[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to make a boot disk (part I)



> took me quite a while to figure out, so here is a step by step manual how to
> build a _boot_ disk.
> 
> $ mke2fs -N 32 -o hurd /dev/fd0

Don't forget that you can always use an image file on your hard disk
instead of using the floppy device directly.  Then splat the image file to
the floppy with dd, or the image is ready to be compressed and uploaded
without needing to insert a scratch floppy as part of the build process.

First create an image file:
	dd if=/dev/zero bs=1440k count=1 of=/tmp/floppy-image
For mke2fs, with the -F flag you can just have it operate on the plain file
rather than a device.

Then, you need to mount the filesystem from the image file.
On the Hurd, this Just Works:
	settrans -a /floppy /hurd/ext2fs /tmp/floppy-image

On Linux, you need to use a `loopback device':
	losetup /dev/loop0 /tmp/floppy-image
	mount /dev/loop0 /floppy

After populating the filesystem, sync and then unmount with:
Hurd:
	settrans -ag /floppy
Linux:
	umount /floppy
	losetup -d /dev/loop0

> $ mkdir /floppy/boot/grub
> $ cp /usr/share/grub/i386-pc/stage1 /floppy/boot/grub

Note that if you are tight on space, you don't need to put stage1 in the
filesystem, just leave it in the boot sector and install from there.

> Then reboot and boot from this floppy. Insert your Hurd boot floppy again,
> and enter at the Grub prompt:

Or use /sbin/grub.  It should probably get a new option for "virtual
devices" so you could indicate an image file directly instead of fd0.

> install= (fd0)/boot/grub/stage1 (fd0) (fd0)/boot/grub/stage2 0x8000 p
> 
> (I know this by heart already :)

Or:
	install= (fd0)+1 (fd0) (fd0)/boot/grub/stage2 0x8000 p


Reply to: