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

Lyra

Members
  • Content Count

    3
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by Lyra

  1. 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.

  2. You're in the BIOS- there is no sleep function. You've clearly already figured out that you can't just require() the os module, because that's provided by OpenOS, which you don't have here.

     

    The OpenOS implementation of os.sleep is here. Notice that it just polls events until it reaches the timeout. You could do that yourself, but now you have to figure out what you're going to do with all the events you get, since there doesn't seem to be a way to pause execution with computer.pullSignal without actually receiving events.

  3. 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

×
×
  • Create New...

Important Information

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