Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
Lyra

Titan BIOS - HTTP booting

Recommended Posts

This is a small (obviously) custom BIOS, the chief feature of which is booting over HTTP. This is quite handy when writing a custom operating system as the edit process there tends to be a bit tedious moving hard drives and files around and such.

 

With this, you can do something like:

  1. Install the BIOS to an EEPROM, and set the EEPROM data to something like "http://localhost/init.lua"
  2. Run an HTTP server on your local machine, and point it at your files
  3. Configure OpenComputers to permit making HTTP requests to 127.0.0.1 (disclaimer: this is a very bad idea in multiplayer)
  4. Boot your testing computer directly from the files you're editing

It can also boot off of any available disks (with OpenOS compatibility and "short" disk addresses), present a pleasant editable menu, print out useful error messages when things break, and behave in general like a proper bootloader. There is room at the top to hardcode a list of boot targets, if that's more convenient than EEPROM data for some reason, and disable the menu if you don't want that. It is in total a little bit over 3kb so there's still a little room for extras. (Network booting and a Lua shell would be interesting.)

 

It may or may not be good with memory depending on exactly how closures work in OpenComputer's Lua implementation, not really sure. Memory usage seems to be difficult or impossible to measure properly.

 

Installation goes something like this, from a working computer:

$ wget http://... titanbios.lua
$ flash -q titanbios.lua "Titan BIOS"
$ lua
> component.eeprom.setData("http://localhost:8000/init.lua")

Download here. No guarantees: it appears to work so far, but there's probably a bug or two left.

 

So I guess that's sort of useful, maybe, to some people? Oh well.

 

And here's a picture of a bootloader, because those are exciting:

 

t3TnihF.png

Link to post
Share on other sites

Awesome script! Any idea how difficult it would be to make this connect to another OpenComputers device instead of a real server (via wireless card)? I've got a horrible/amazing plan to make a drone boot from an NFS server (and possibly even run a full OpenOS install), but I haven't had time to delve into the wireless communication protocol yet.

Link to post
Share on other sites

Very nice idea. I haven't tested it yet but there is the line

local probe = not #targets

which is probably not working as expected: probe is always false because #targets always returns a number.

 

Support for OpenComputers networks would be very nice indeed. Maybe there are already some file hosting protocols/programs for OpenComputers out there. (e.g. available via https://github.com/OpenPrograms)

Link to post
Share on other sites

I'm sure it's possible- after I posted this I was pointed toward some Lua minifiers that net an extra 1-2kb of space or so, which should be enough to implement some kind of network boot. Unfortunately modems are by default limited to only 8kb of data per packet- and while you could make the case that 8kb is enough to implement a more capable second stage, this wouldn't be very satisfying, as ideally this BIOS is the only thing you need to start the whole system. So now the challenge is to figure out how to implement a packetized network boot with proper resend/ack in less than 2kb of minified code. Definitely has to be dirt simple. (Furthermore there should be as little sending required as possible- for a drone I think you want to conserve power, which means not using the wireless card any more than necessary.)

And I still want to see if I can pack a Lua shell in here somewhere.

The "not #targets" thing is indeed quite broken; evidently I didn't bother to test it. I'm not a huge fan of Lua so I'm still unfamiliar with its boolean semantics (and I definitely prefer languages with more flexible definitions of truthiness).

I'm not quite done with this thing, so I'll see what I can come up with. I have some vague ambitions of writing an OS to go with it and this makes an excellent bootloader.

Link to post
Share on other sites

This is really great. So basically you use this eeprom, and just stick an OS disk in the computer. Is there a way to not just load the bootloader via eeprom, but then in turn have the bootloader see the http daemon's files for like OpenOS? So use the HTTP server as a read only FS for auto installing the OS with just an eeprom and disk drive on the computer end? This would be pretty amazing. 

 

The next obvious step would be incorporate an NFS somehow so you don't even need the disk drives in OpenComputers anymore. Perhaps more of just a "NFS" card or block. So you could just use the eeprom, and that's it. 

Link to post
Share on other sites

yeh... I'm telling you to forget the configs

set up a virtual FS in HFS, and copy the IP-URL it gives you for your server. (setup is noobishly easy)

you'll have to modify the titan-bios localhost URL with that IP-URL you just copied.

once you've done that, titan-bios should boot off your HFS-server.

I've played around with stuff like that and am even writing NetBiOS (you won't find anything about it)

basically, think of OpenOS loaded from the bios over the internet.

(I'm working on removing a butt-load of files to reduce net-load)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.