[Build/Dev Blog] Christmas Workstation Build (EFI RAM Disk Fun)

Alright, attempt number three of making this thing user friendly and I think this takes care of the your-device-name-keeps-changing problem.


(Create, check that it’s there, delete, check that it’s gone.)

On initial setup the user will have to use blkmirror set to save a persistent alias into nonvolatile memory that will take the EFI_DEVICE_PATH - the final authority that points to a device - from an existing shell mapping and store it between boots.


<shower thoughts> I bet I could put set + clear in a for(;;) loop and blow up a ‘BIOS’ EEPROM or at least wear out the flash cells in a couple seconds lol

4 Likes

No idea how you structured the program, but using UUID would allow you to point consistently to a device and/or partition as a path.

If you haven’t yet, give it a thought :slight_smile:

Yeah I looked into that too

First thought was “What about using the hard disk UUID?”, but most devices (iSCSI LUNs, PCIe option ROMs, network interfaces, MBR partitions, etc) at the lowest level don’t have a UUID in the same was as a GPT hard disk table/partition.

Second thought was “What about using the raw EFI_DEVICE_PATH as an argument?” but it’s a lot bigger data structure than just a string and while you can go from an EFI_DEVICE_PATH to a string for display purposes, you can’t go back the other direction without already having all the node/instance pointers, etc.

I’m doing alright now but there’s still a lot of stuff I’ve never seen… if there’s an easy way of doing this I’m still open to hearing about it :rofl:

1 Like

Wooooooooooooooooo

Found the devices, found their handles in the EFI table, opened their EFI_BLOCK_IO_PROTOCOLs, and we’re one for(allBlocks){read(), write()} loop away from being done with this piece of shit. At least this part of it.

I think I’ll make a pretty little progress bar for it, because moving like 200GB is gonna be slow :rofl:

5 Likes

infiniband

1 Like

I did a thing. It may not be much but it’s mine lol

Now back to the actual task at hand of making this thing boot from memory.

Transferring raw sectors from one LBA to another appears to be quite fast, too, even on this piece of shit USB stick on USB 2.0.


image

Yup, that was empty before and now it’s the Windows BOOTMGR partition from the test PC.

7 Likes

That’s awesome

1 Like

Admittedly have some cleanup to do still to make sure nothing’s leaking memory/etc, and right now it doesn’t handle transferring from a 512B-sector device to a 4096B-sector device well because the last sector might need zero-padded to fill the leftover space if they don’t align. It just throws the last sector away right now if that happens. Some little things like that to add/fix.

But once that’s polished up I think I’ll put my little cash register web server PC back online, add an Apache license notice to everything, and stick it online for people to be offended by my verbose AF source code lol.

Might just roll this into Devember, not for more of Wendell’s stuff but because it seems like my most interesting thing underway right now

5 Likes

…Every time I propose to put something online, I end up looking into how the open source licensing works and just give up lol.

I’d like to package this whole thing together so it’s the Tianocore EFI shell + GRUB + my own little tools in one bootable ~50MB image that just works™ after setting up a configuration file. And of course they all use some different open source license and I have no idea what notices need to go where so someone doesn’t get butthurt over it.

I’ll figure it out eventually.


Transfer rates to/from the RAM disk (at least from one to another) appear to be insane. So that’s promising lol, I didn’t mess up the block I/O driver horribly like I kinda expected.

2 Likes

You don’t need to figure out what licences each of those use, just reference them in your README file and your licence file.

Parts of this tool rely on software that is covered by their respective licences, including but not limited to, etc etc etc. Should (note: should :stuck_out_tongue: ) keep you covered legally.

HTH!

2 Likes

(Note to self, disable virtual memory in OS to stop from paging RAM to itself.)

Anyone else add little ASCII diagrams in their source code so they know what exactly is going on after not looking at something for a week? :rofl:

1 Like

Nope, I just forget everything like a reasonable person.

1 Like