I have the general goal to write my own boot manager, or to be able to use an existing boot manager which can:
1.) overwrite a particular entry in MBR's partition table with a new entry, that is read from a list that I supply. I have done that using debug.exe successfully. Ranish PM can do that, but is limited to 32 entries.
2.) enumerate all entries in an extended partition table and change the partition type eg from FAT32 to hidden FAT or to unformatted, or even delete the selected partition. At the moment, gdisk.exe can do that in batch mode.
With GRUB, my initial goal is to find out what it can do and to experiment with it. I would like to have a floppy disk that I could use on an old laptop or on a virtual machine. So far my efforts were failures. I have done something like:
command /c copy /b stage1 + stage2 grub.flp
then write grub.flp to floppy using rawwrite. Result: BIOS POST messages on screen as normal, then screen goes black, then error message displayed at the top of screen: "Error!". I patched my grub.flp like this:
command /c copy /b grub.flp + bytes.f6 grub.ima
where bytes.f6 is a file that consits entirely of hex value F6. It's size was so that the resulting grub.ima was 1,747,560 bytes in size. Then again rawwrite grub.ima to floppy. Result: BIOS POST messages on screen as normal, then screen goes black, then error message displayed at the top of screen: "Error!"
I was expecting to get a GRUB menu with the ability to manually add/edit new entries. I have found GRUB4DOS and am able to see a menu with edit options. Unfortunately GRUB4DOS lacks documentation, but if I understand the article Experience of Using Grub For DOS
correctly, knowing how to use GRUB will help.