From 5a7d886c273b4c675ba62c299032744a57a8e170 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Thu, 9 Mar 2006 02:47:48 +0000 Subject: none --- Distrib/HurdOnQEMU.mdwn | 85 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 63 insertions(+), 22 deletions(-) diff --git a/Distrib/HurdOnQEMU.mdwn b/Distrib/HurdOnQEMU.mdwn index 377e26f2..920bb970 100644 --- a/Distrib/HurdOnQEMU.mdwn +++ b/Distrib/HurdOnQEMU.mdwn @@ -1,43 +1,84 @@ -## Hurd on QEMU +# Hurd on QEMU -I will assume you have already installed [[QEMU]]. +## What is Needed -You will need the [debian grub boot disk package](ftp://ftp.debian.org/debian/pool/main/g/grub/grub-disk_0.95+cvs20040624-17_all.deb) for the floppy.img . The floppy boot image is called grub-0.95-i386-pc.ext2fs.gz and you can [[Gunzip]] this and rename it to floppy.img if you like. +1. First thing is to install [[QEMU]]. +2. [Debian grub boot disk package](ftp://ftp.debian.org/debian/pool/main/g/grub/) for the floppy disk image needed for booting. The floppy boot image is called `grub-*-i386-pc.ext2fs.gz` and you will need to decompress this. I have renamed mine to `floppy.img`. +3. You will need a [Debian/Hurd installation CD](http://www.debian.org/ports/hurd/hurd-cd). I suggest using K9 as K10 seems to have some issues. -First off use `qemu-img` to create a disk image. I set mine to 2 gigabytes. +## Installing Debian/Hurd with QEMU - # qemu-img create hd0.img 2G +First off you will need to create a disk image using `qemu-img`. I have set mine to 2 gigabytes, although you should be able to get away with less. -Now you will need a cdrom image or an install CD. I will use Debian/Hurd K9 in this example. I use a floppy image with [[GRUB]] on it to boot the system after I'm done installing. The first time you run it you'll want to use `-boot d` to boot off the cdrom. + $ qemu-img create hd0.img 2G - # qemu -hda hd0.img -cdrom debian-K9-hurd-i386-CD1.iso -fda floppy.img -boot d +Next you will want to start up QEMU and begin the installation process. The first time you run it you will want to use the `-boot d` option to boot off the cdrom. -Now at his point do the regular install using `hd0` as your harddrive. Partition it and install the base system. Instead of rebooting, just stop QEMU (it'll keep booting off the cdrom). + $ qemu -hda hd0.img -cdrom debian-K9-hurd-i386-CD1.iso -fda floppy.img -boot d -**Important:** Current versions of gnumach will not boot in QEMU unless you use QEMU's `-isa` command line option (`-M isapc` for QEMU 0.8). A patch to fix this is in the works. +Now at his point do the regular install using `hd0` as your harddrive. Partition it and install the base system. Once you have finished installing the base system select the reboot option as this will ensure the disk is properly un-mounted. When the Debian CD menu comes up again simply close QEMU. -Now run your image with floppy booting and finish the install (`./native-install` .. etc) +Now run your image with floppy booting and finish the install (`./native-install` .. etc). - # qemu -isa -hda hd0.img -cdrom debian-K9-hurd-i386-CD1.iso -fda floppy.img -boot a +**Important:** Notice the `-M isapc` option. This is needed for the version of gnumach that comes with K9 (or K10). Once you get your system running you can update to the latest version of gnumach which does not have this restriction. -So far I haven't been able to get networking going, it seems as if gnumach is not finding the ethernet device, although I haven't really looked into it that far. +**Important:** If you are running an older version of QEMU (less than 0.8) then you will need to use the `-isa` option instead of `-M isapc`. -### Mounting disk image + $ qemu -hda hd0.img -cdrom debian-K9-hurd-i386-CD1.iso -fda floppy.img -boot a -M isapc -If you want to mount your disk image, you'll either have to use mount or a program called [[Lomount]] to do this. If you are going to use mount, you will need to know the correct offset. +## Mounting Disk Image on Host - # mount -o loop,offset=OFFSET hd0.img /mnt/diskimage +You may wish to mount your disk image on your host system to transfer files. To do this you will first need to find the offset of the partition you wish to mount. --- [[Main/AndrewResch]] - 23 Feb 2005 + # fdisk -ul hd0.img -Readers may be interested in [[Hurd/QemuImageForL4]] too. +Now take the number of sectors for the beginning of the partition and multiply it by the sector size. My partition starts at sector 63 and I have a sector size of 512 therefor my offset is 32256. --- [[Main/OgnyanKulev]] - 23 Feb 2005 + # mount -o loop,offset=32256 hd0.img /mnt/diskimage -To find the offset, you can run (from your host OS): +## Networking in QEMU - $ fdisk -ul hd0.img +### What is Needed -and multiply sectors by the # of bytes given +1. Your Linux kernel will need 802.1d Ethernet Bridging support and TUN/TAP device driver support. +2. You will need to install [bridge-utils](http://bridge.sourceforge.net). --- [[Main/EldonKoyle]] - 25 Aug 2005 +### Setting Up the Host Bridge + +You need to setup a bridge on the host first. This assumes `eth0` is down. I have modified my hosts network startup scripts to automatically setup a bridge, you may want to do this also. + + # brctl addbr br0 + # ifconfig eth0 0.0.0.0 promisc up + # brctl addif br0 eth0 + +At this point you will need to setup `br0` as you would normally `eth0` (`dhcpcd br0` for example). + +### The qemu-ifup Script + +This script gets called when QEMU starts and will attach the tun device to the bridge. QEMU will look for this file at `/etc/qemu-ifup` and that is where I keep mine. + + #!/bin/sh + sudo ifconfig $1 0.0.0.0 promisc up + sudo brctl addif br0 $1 + +### Setting up the Network in the Hurd + +Now it is time to start-up your QEMU Hurd system and get networking going in there. + +**Important:** Remember you may need to use the `-M isapc` or `-isa` flag if using an older version of the gnumach package. + + $ qemu -hda hd0.img -cdrom debian-K9-hurd-i386-CD1.iso -fda floppy.img -boot a -net nic -net tap + +Once you have logged in as `root` run the `pfinet` translator with values that apply to your network. Think of your QEMU client as another computer in your network. + + # settrans -fgap /servers/socket/2 /hurd/pfinet -i eth0 -a xxx.xxx.xxx.xxx -g xxx.xxx.xxx.xxx -m xxx.xxx.xxx.xxx + +That should do it! Do not forget to edit/update `/etc/resolv.conf` to get DNS working. + +## Related Links + +These are links that users of [[HurdOnQEMU]] may find helpful. + +[[DebianAfterInstall]] - good source of information pertaining to your system after installation. + +[[Hurd/QemuImageForL4]] - a QEMU image for the Hurd/L4 project. -- cgit v1.2.3