Page 1 of 1

How could I boot a floppy from grub installed on hdd?

Posted: Sun May 09, 2010 9:56 am
by TylerH
I had an idea, instead of going through all the trouble to make a bootable Grub CD/floppy, why not just install Grub(w/ some minimal Linux) to the HDD of a VM and add the floppy drive to the Grub menu? How could I add the floppy drive to the menu, or is it possible?

note: When I say Grub, I'm talking about Grub2.

Re: How could I boot a floppy from grub installed on hdd?

Posted: Sun May 09, 2010 7:20 pm
by NickJohnson
I don't know how that would be simpler - then you have to have a floppy and a hard drive attached to the VM, not to mention an unneeded copy of Linux (which is completely unnecessary for GRUB btw). It's definitely possible though: just use fd0 as the boot device in menu.lst the same way you would in the floppy.

Re: How could I boot a floppy from grub installed on hdd?

Posted: Sun May 09, 2010 8:46 pm
by TylerH
Floppies are easier because they can be faked, I want to have Grub load the whole floppy(really just a binary image of my kernel), but do it as if it were a kernel as opposed to chainloading. The part I don't know how to do is have Grub load the whole floppy, but as if it were a kernel(that means not restoring BIOs loaded environment). I've tried kernel (fd0)+[I've tried 1-4 here] and I keep getting "Invalid or unsupported executable format", what exactly does it want? I've got the grub header in the binary formatted image(at the very beginning actually). Does it need to be formated to a specific executable format, or is binary okay?

Linux is just the means of installing(without all the trouble of creating an install CD) and manipulating Grub's configuration until I get it exactly the way I want it.

The way this is easier is that I can compile and run the VM and not have to do anything else to debug. How else can I get loaded by Grub in an efficient way(efficient as in I can compile and debug with few steps)? I guess part of my problem is being too stubborn to leave Fasm's IDE. I've even configured Linux to open .asm files with Wine and configured Wine's registry to open .asm files with Fasm's IDE :D.

Re: How could I boot a floppy from grub installed on hdd?

Posted: Mon May 10, 2010 10:25 am
by Selenic
A couple of things: first, it shouldn't be too difficult to put your kernel into a FAT12 floppy image (which you can find with GRUB pre-installed somewhere on the wiki). If you can't find something to do that for you, you could use it to gain some experience of writing filesystem drivers where they won't break anything seriously :wink:
TylerAnon wrote:I've tried kernel (fd0)+[I've tried 1-4 here] and I keep getting "Invalid or unsupported executable format", what exactly does it want?
I think the reason is that you're not giving it a base. The standard solution is to have 'root (fd0)' on a separate line, then 'kernel off+size' as another line, though I don't know whether that's completely necessary.