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

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

-N sets the number of inodes.

If we don't use -N option, the inodes use up too much space and the files
won't fit. Of course, if you make the value too small, you won't be able to
write all files you want. Anyway, 24 was enough to fit all files, but I want
to store some more grub stage 1.5 files, so we try 32. If this is not
enough, try higher values. If it is too much, lower it.

$ mount /dev/fd0 /floppy   # or settrans /floppy /hurd/ext2fs /dev/fd0
$ mkdir /floppy/boot
$ cp /boot/gnumach.gz /boot/serverboot.gz /floppy/boot/
$ cat > /floppy/boot/servers.boot
# GNU Mach boot script for Debian GNU/Hurd.  Each line specifies a
# file for serverboot to load (the first word), and actions to be done
# with it.

# First, the bootstrap filesystem.  It needs several ports as arguments,
# as well as the user flags from the boot loader.
/hurd/ext2fs.static.gz --bootflags=${boot-args} --host-priv-port=${host-port} --device-master-port=${device-port} --exec-server-task=${exec-task} -Tbunzip2:device ${root-device} $(task-create) $(prompt-task-resume)

# Now the exec server; to load the dynamically-linked exec server
# program, we have serverboot in fact load and run ld.so, which in
# turn loads and runs /hurd/exec.  This task is created, and its task
# port saved in ${exec-task} to be passed to the fs above, but it is
# left suspended; the fs will resume the exec task once it is ready.
/lib/ld.so.1.gz /hurd/exec $(exec-task=task-create)

 -Tbunzip2:device says we use a compressed root file system on another
 disk. We wait for this disk to be inserted before loading it via
 $(prompt-task-resume) instead $(task-resume).

$ mkdir /floppy/hurd /floppy/lib
$ gzip -9c /hurd/ext2fs.static > /floppy/hurd/ext2fs.static.gz
$ gzip -9c /lib/ld.so.1 > /floppy/lib/ld.so.1.gz

Make sure you actually compress the Hurd ld.so.1, and not the Linux one!

$ mkdir /floppy/boot/grub
$ cp /usr/share/grub/i386-pc/stage1 /floppy/boot/grub
$ cp /usr/share/grub/i386-pc/stage2 /floppy/boot/grub
$ cat > /floppy/boot/grub/menu.lst
# This is the amount grub waits before booting the default entry
timeout= 10

# Tell which entry to boot by default.  Note that this is origin zero
# from the beginning of the file.  
default= 0

# Note that to GRUB, all hard disks are `hd' and all floppy disks are `fd'.
# To Mach, SCSI disks are `sd' and IDE type disks are `hd'.  Use
# GRUB names in the `root' command and prefixing filenames.  Use a 
# Mach name as the `root' arg for the kernel, and whenever running the Hurd.

# Entry 0:
title= Floppy
root= (fd0)
kernel= /boot/gnumach.gz root=fd0
module= /boot/serverboot.gz

The boot disk is almost ready now, but it isn't bootable.

$ umount /floppy  # or settrans /mnt

Insert a new, empty floppy, then:

dd if=/usr/share/grub/i386-pc/stage1 of=/dev/fd0 bs=512 count=1
dd if=/usr/share/grub/i386-pc/stage2 of=/dev/fd0 bs=512 seek=1

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

install= (fd0)/boot/grub/stage1 (fd0) (fd0)/boot/grub/stage2 0x8000 p

(I know this by heart already :)

Voila. Your Hurd boot disk is ready now.

The trick is of course what to do on the _root_ disk. Create an empty loop
file system of approx 6 MB:

$ dd if=/dev/zero of=/tmp/root.fs bs=1024k count=6
$ mke2fs -o hurd /tmp/root.fs
$ mount -o loop /tmp/root.fs /gnu

Now put "stuff" in /gnu. servers, libs, binaries. Don't forget "touch
/servers/exec", or it won't boot at all (I think). You can put about 4 MB
stuff into it (uncompressed). Then:

$ umount /floppy
$ bzip2 -9 /tmp/root.fs
$ dd if=/tmp/root.fs.bz2 of=/dev/fd0 bs=512

And then insert the root disk when the boot disk asks for it.

Let me know what you put into the root disk to get a working system.
There will be a way to minimalize the C library and the Hurd libs, so we can
fit a bit more than the above 4 MB. But for now, I would like to now how to
get a working system at all. So try to find out what is essential and let me

Of course I will soon put up a boot disk on the net. Hold your breath.


`Rhubarb is no Egyptian god.' Debian http://www.debian.org  Check Key server 
Marcus Brinkmann              GNU    http://www.gnu.org    for public PGP Key 
Marcus.Brinkmann@ruhr-uni-bochum.de                        PGP Key ID 36E7CD09

Reply to: