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

How to setup a hurd in bochs



Hi,

here is an explanation of how to get the hurd running in bochs (using
the debian packages of bochs), from a snapshot tarball. Feel free to
comment and tell me how much better I could have done it.

1. Creating a disk image
(can be done as normal user)
Use bximage, choose a hd, say of 900Mb, named for example
/hurd/hurd.img. Write down the disk geometry (cylinders, etc...)
somewhere, they will be needed. And bximage gives also the line to put
in the .bochsrc to have that file recognized as a disk.

2. Making a partition table
(can be done as normal user)
Run /sbin/fdisk, get into expert mode (x) to set the disk geometry
correctly (in the 900Mb case: only 'c' then 1828). Return into normal
mode (r), and create a single linux-type primary partition. Save and
quit (w).

3. Making a filesystem
(you need to be root to do that)
#losetup /dev/loop0 /hurd/hurd.img -o 32256
(that magical offset value is bytes/sector times
sectors/cylinder, and gives access to the partition we created, keeping
the partition table safe)
#mkfs.ext2 -o hurd /dev/loop0

4. Unpacking the tarball
(I'm assuming you do that after the losetup)
(you need to be root to do that)
#mount -o loop /dev/loop0 /mnt
#cd /mnt
#tar --same-owner -xjpvf ~user/gnu-20030126.tar.bz2
(assumes a bzip2-ed tarball in the user homedir)

5. Preparing a nice grub menu
#mkdir boot/grub
#cp /boot/grub/*stage* boot/grub
(it seems the files in the tarball don't work... maybe my mistake)
#vi boot/grub/menu.lst
This is what I did put in that file: (of course, put single lines on
single lines, beware!!)

default         0
timeout         5
color cyan/blue white/blue

title GNU
root (hd0,0)
kernel /boot/gnumach.gz root=device:hd0s1
module /hurd/ext2fs.static \
--multiboot-command-line=${kernel-command-line} \
--host-priv-port=${host-port} \
--device-master-port=${device-port} \
--exec-server-task=${exec-task} -T typed \
${root} $(task-create) $(task-resume)
module /lib/ld.so.1 /hurd/exec $(exec-task=task-create)
boot

title GNU(single)
root (hd0,0)
kernel /boot/gnumach.gz root=device:hd0s1
module /hurd/ext2fs.static  --readonly \
--multiboot-command-line=${kernel-command-line} \
--host-priv-port=${host-port} \
--device-master-port=${device-port} \
--exec-server-task=${exec-task} -T typed \
${root} $(task-create) $(task-resume)
module /lib/ld.so.1 /hurd/exec $(exec-task=task-create)
boot

6. Preparing bochs
No, the image is ready, we can let it go:
#cd /root
#umount /mnt
#losetup -d /dev/loop0
I'm assuming you have a grub floppy somewhere. In .bochsrc, you need to
set it up as the floppy, and /hurd/hurd.img as the disk (you remember
that line bximage gave?). Set that floppy as boot device.
Run bochs. If all is well, you should get a grub prompt:
> root (hd0)
> install /boot/grub/stage1 d (hd0) /boot/grub/stage2 p
/boot/grub/menu.lst /boot/grub/menu.lst
(well, I don't understand the full line, but that's what worked)

7. Booting the hurd
Now, stop the simulation, set the disk as the boot device, and launch
bochs. You should get a nice grub menu, and choosing the GNU(single)
entry should put you on track. You will get VGA notices, but if you ask
to continue, they don't seem to hurt: it is just mach that does some
poking around during the detection phase.

Hope this helps,

Snark on #hurd and #hurdfr



Reply to: