Script to create bootable floppy image using genext2fs and grub without root

090500050805060003040408 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit

For what it's worth, I just wrote a little script that shows how to generate a bootable ext2 floppy using grub and genext2fs without being root.

I wrote this mostly because Thierry Larode and Robert Milan's mkbimage script,

formatting link
requires root privs, and I wanted to show that there is no need for root privs (or 'fakeroot') to make a bootdisk, at least for ext2.

It was fun to write, once the pain stopped. Took me a long time to figure out a few things:

1) you have to enable EXT2 support when building the kernel :-) 2) you have to disable initrd support when building the kernel, or it'll prompt you for a second floppy 3) you have to say root=/dev/fd0 on the kernel commandline instead of root=fd0, which gets misinterpreted as a hexadecimal major/minor device number (!). 4) genext2fs seems to have an off-by-one error; if you ask it to generate a 1440KB image, the resulting disk image doesn't *quite* fit on a floppy: $ dd if=mkb.out of=/dev/fd0 bs=1 dd: writing `/dev/fd0': No space left on device 1474561+0 records in 1474560+0 records out (I guess I'll have a look at that sometime.) The disk booted anyway, so I guess nothing critical is on that last sector.

While writing this, I found the recipes at

formatting link
helpful. Also, reading linux/init/do_mounts.c helped.

- Dan

Reply to
Dan Kegel
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.