booting FAT12 revisited
Posted: Tue Mar 02, 2021 12:16 am
As part of my typical thrashing about, I've decided to revisit my older Verbum handrolled boot loader, which I'd left in an incomplete state while trying to re-write it to boot as a FAT12 system (rather than the raw sectors I'd previously booted from). Aside from the significant trimming of print scaffolding I'd had in the earlier version, and the general issue of trying to read the FAT and directory data in the cramped confines of the boot sector, the matter that I've run into is that I've been trying to figure out a way to either hand-craft or generate the FAT12 data without using an existing tool such as mkfs.msdos.
I am unsure if this is really a sensible approach however, as it would presumably be a lot more practical to simply create the image file, mount it, add the second stage and kernel files to the mounted file, then overwrite the boot sector. I get the feeling that I am self-sabotaging again, that this is a sign that I am taking the hardest road with the expectation that I will give up before too long.
OK, aside from that, I am curious as to the best way to read the FAT and directory entries to find the files. I've been going over Alexfru's BootProg code, but I am not certain that I understand it as well as I would like. Alex's code seems to work by reading the first 12 sectors into memory wholesale, finding the directory entry for the kernel by name, and loading it from there. I'll probably follow suit, but I am wondering if there are any other methods which would work as well.
This probably seems like a fool's errand, seeing how I've argued myself against rolling one's own bootloader (and for good reason), but I have the sense that I've left this particular exercise fester and now I want to get it behind me once and for all for my own sake. I think I'll learn some things I've missed in all the years I've been daydreaming and puttering without actually doing much of anything.
Sorry if I've rambled on a bit here, but I'm a bit frazzled for a number of reasons and probably shouldn't be posting right now, but there it is.
I am unsure if this is really a sensible approach however, as it would presumably be a lot more practical to simply create the image file, mount it, add the second stage and kernel files to the mounted file, then overwrite the boot sector. I get the feeling that I am self-sabotaging again, that this is a sign that I am taking the hardest road with the expectation that I will give up before too long.
OK, aside from that, I am curious as to the best way to read the FAT and directory entries to find the files. I've been going over Alexfru's BootProg code, but I am not certain that I understand it as well as I would like. Alex's code seems to work by reading the first 12 sectors into memory wholesale, finding the directory entry for the kernel by name, and loading it from there. I'll probably follow suit, but I am wondering if there are any other methods which would work as well.
This probably seems like a fool's errand, seeing how I've argued myself against rolling one's own bootloader (and for good reason), but I have the sense that I've left this particular exercise fester and now I want to get it behind me once and for all for my own sake. I think I'll learn some things I've missed in all the years I've been daydreaming and puttering without actually doing much of anything.
Sorry if I've rambled on a bit here, but I'm a bit frazzled for a number of reasons and probably shouldn't be posting right now, but there it is.