Bochs/bochs/docs-html/hurd.html

257 lines
7.0 KiB
HTML
Raw Normal View History

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Author" CONTENT="Bruno Bonfils">
<TITLE>Bochs and the GNU/Hurd</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#ececec" LINK="#3333cc" VLINK="#666666">
<center>
<h1>How to use bochs to run the Hurd</h1>
<font size=2>by Bruno Bonfils, &lt;asyd@debian-fr.org&gt;</font>
</center>
<h2><li> Introduction</h2>
<p>
Since I don't have enough computers to dedicate a box to the Hurd, I'm trying
to do my own harddrive image disk. I thougt there was
some documentation about how to do that. But since I didn't find
anything and I decided to write a small doc. I hope this document will be
useful for some people who wants to try the Hurd.
</p>
<li> The testing box
<p>
Debian (Sid) GNU/Linux 2.4.19
</p>
<pre>
ii bochs 1.4.1.no.elpin IA-32 (x86) PC emulator
ii bochs-x 1.4.1.no.elpin Bochs binary with X interface.
ii grub 0.92+cvs200209 GRand Unified Bootloader
ii gcc-i386-gnu 1.7-8 Cheap cross-compiler for GNU/Hurd.
ii mig-i386-gnu 1.2-1 The GNU distribution of the Mach 3.0 interface
</pre>
<p>If you don't have time and if you trust me, you can download here
[1] my own image file. <b>(You don't need to run native-install)</b><p>
<h2><li> Creating the image</h2>
<p>
<i>In this example, I use a 112 MB image disk, but I think you
can use any size without some problem.</i>
</p>
<p>
Use createdisk command like this :
<pre>
# createdisk hurd.img 112
Disk Geometry:
C: 227
H: 16
S: 63
Total size: 117153792 bytes
</pre>
</p
<p>
Note on a paper or on your memory the disk geometry. Then, use the
losetup command to create a loopback on the whole disk.
</p>
<pre>
# losetup /dev/loop1 hurd.img
</pre>
<p>
Now, call fdisk on /dev/loop1. Go into expert mode, and modify the
disk geometry using the c, h, s commands. Return in normal mode, and
create an unique primary partition which uses the whole disk. Then,
detach the /dev/loop1 using :
<pre># losetup -d /dev/loop1</pre>
</p>
<h2><li> Installing GNU/Hurd</h2>
<li> Attach the partition
<p> First of all, you need to create a filesystem on the disk. Use the
command losetup and -o &lt;offset&gt; option to attach /dev/loop1 on the first
partition of an image disk. Offset is computed like this :
offset = sector * block_size (512)
<pre># losetup -o 32256 /dev/loop1 hurd.img</pre></p>
<li> Preparing the filesystem
<p>According to The Hurd Installation Guide [2], use mke2fs to create a
filesystem.</p>
<pre># mke2fs -o hurd /dev/loop1</pre>
Just mount /dev/loop1 like a typical dev.
<pre># mount /dev/loop1 /mnt/gnu</pre>
<li> Finish the installation
<p>Download a GNU/Hurd archive as indicated in the Hurd Installation Guide, and decompress it in /mnt/gnu.</p>
<pre>
# cd /mnt/gnu
# tar --same-owner -xvzpf ~/gnu-latest.tar.gz
</pre>
<h2><li> Bochs Configuration</h2>
<p>
Copy default configuration (/usr/share/doc/bochs/examples/bochsrc.gz on debian)
on your home directory and edit it with your favorite editor (GNU Emacs, i hope ;).
</p>
<p>For my image file I have the following configuration :
<pre>
romimage: file=/usr/share/bochs/BIOS-bochs-latest, address=0xf0000
megs: 128
vgaromimage: /usr/share/vgabios/vgabios.bin
floppya: 1_44=/dev/fd0, status=ejected
diskc: file="/home/asyd/travail/hurd/hurd.img", cyl=227, heads=16, spt=63 # edit me
cdromd: dev=/dev/cdrom, status=inserted
boot: c
log: /dev/stdout
panic: action=ask
error: action=report
info: action=report
debug: action=ignore
vga_update_interval: 300000
keyboard_serial_delay: 250
keyboard_paste_delay: 100000
floppy_command_delay: 500
ips: 1000000
mouse: enabled=0
private_colormap: enabled=0
fullscreen: enabled=0
screenmode: name="sample"
ne2k: ioaddr=0x280, irq=9, mac=fe:fd:00:00:00:01, ethmod=tap, ethdev=tap0
keyboard_mapping: enabled=0, map=
keyboard_type: xt
i440fxsupport: enabled=0
</pre>
note most of them are actually in the default Debian example file. If you use
these lines, don't forget to read the Networking section.
</p>
<h2><li> Note on GNU Mach</h2>
<p><i>
Remember that the Hurd is not an OS, it's just a collection of libraries
and programs, so we can't actually boot the Hurd. We boot GNU Mach, and
then launch the base servers.
</i></p>
<p>
The default GNU Mach which is provided by the default GNU/Hurd archive
contains some modules / drivers which are not needed in bochs
environment. If you use it, you'll probably have some kernel panic
while booting. Don't be afraid and just say alwayscont.
</p>
<p><i>
Note: in my archive, I use a recompiled GNU Mach which contains only the
drivers which are needed (--enable-floppy --enable-ide --enable-kmsg
--enable-ne2000). If you want more informations on how to compile your own
GNU Mach, just send me a mail and I'll add the section in this
document.
</i></p>
<h2><li> Final Step</h2>
<p>
Create a grub floppy disk or use my floppy image [3]. Adapt your bochsrc
file according to your choice. If you want install Grub on the image disk,
remember to copy stage1, stage2 Grub's files into /mnt/gnu/boot/grub.
</p>
<p>Launch bochs - as root if you want networking (using sudo for example).</p>
<i>If you have stage1 and stage2 file, you can install Grub on the MBR.</i>
<pre>
&lt;grub&gt; root (hd0,0)
&lt;grub&gt; setup (hd0)
</pre>
<p>Finally, booting GNU mach</p>
<pre>
&lt;grub&gt; root (hd0,0)
&lt;grub&gt; kernel /boot/gnumach.gz root=hd0s1
&lt;grub&gt; module /boot/serverboot.gz
&lt;grub&gt; boot
</pre>
Now, you can read the official Hurd Installation Guide [2].
<h2><li> Networking</h2>
<p>
You can try to test networking between the GNU/Linux (host OS) and the GNU/Hurd.
First of all, please read [4], I currently have the *same* problem.
</p>
<p>
Verify your kernel configuration, you need to have :
<pre>
CONFIG_NETLINK_DEV=m
CONFIG_ETHERTAP=m
</pre>
(or y instead or m). Check if /dev/tap0 file exist, else create it
with
<pre>
# mknod /dev/tap0 c 36 16
</pre>
and run this command on the guest os :
<pre>
# ifconfig tap0 192.168.100.1 netmask 255.255.255.0
</pre>
Use ip 196.168.100.10 on the GNU/Hurd and you can ping 192.168.100.1
</p>
<h2><li> Links</h2>
<li> [1] <a href="http://plouc.net/~asyd/hurd/hurd.img.gz">My own
harddisk Image File (~20Mo)</a>
<li> [2] <a
href="http://web.walfield.org/papers/hurd-installation-guide/english/hurd-install-guide.html">Hurd
Installation guide</a>
<li> [3] Grub Floppy image : <font color="#FF0000">coming soon</font>
<li> [4] <a href="http://www.geocrawler.com/archives/3/11758/2002/3/350/8049674/">new ethertap interface for linux, by Bryce Denney</a>
<h2><li> Thanks</h2>
<li> Mmenal
<li> #hurdfr, #hurd, #bochs channels (Freenode network)
<li> All people who help me everyday on IRC
<hr SIZE=1>
<center>
Copyright (c) <a href="mailto:asyd@debian-fr.org">Bruno Bonfils</a><br>
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation.
<br>
Last modified : Sat, 31 Aug 2002 22:54:50 +0200
</center>
</body>
</html>