summaryrefslogtreecommitdiff
path: root/Hurd/QemuImageForL4.mdwn
blob: c77a2f25598582bb6ce3e560e3d0ebf0dcd84619 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
This page is initially taken from <http://perso.ens-lyon.fr/alexandre.buisse/hurd/qemu-howto> with the following signature:

> 04-02-2005 Alexandre Buisse
>
> Send any comments or ameliorations to <Nattfodd@gmailNOSPAM.com>

This is a howto on how to get a working image of Hurd/L4 with qemu, on ia32 arch.

You will need the following :

* automake 1.7 (or greater)
* autoconf 2.53 (or greater)
* grub
* the CVS version of hurd-l4, which you can retrieve from the savannah server: `export CVS_RSH=ssh && cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/hurd co hurd-l4`
* two flavours of Pistachio, the L4 kernel, which can be found at <http://www.l4ka.org/projects/pistachio/download.php>. Take the demodisk for ia32 (`pistachio-ia32-0.4-demodisk.bin.bz2`), we'll checkout the CVS later (the 0.4 tarball isn't recent enough).

We will begin with the hurd itself (these steps are taken from the `README`).

    $ cd hurd-l4
    $ autoreconf -f -i -s

You shouldn't have any warnings with this autoreconf. If that is not the case, it probably hasn't used the good version of automake or autoconf. For instance, on Gentoo Linux, you must set WANT\_AUTOCONF to 2.5 and WANT\_AUTOMAKE to 1.7.

    $ ./configure --enable-maintainer-mode --prefix=/l4
    $ make
    $ make install
    $ mkdir /l4/boot
    $ install -s laden/laden /l4/boot
    $ install -s wortel/wortel /l4/boot
    $ install -s physmem/physmem /l4/boot
    $ install -s task/task /l4/boot
    $ install -s deva/deva /l4/boot
    $ install -s ruth/ruth /l4/boot

Now we'll prepare the Pistachio kernel :

    $ cd ..
    $ cvs -d:pserver:guest@cvs.l4ka.org:/public-cvs login

When asked for a password, answer `guest`

    $ cvs -z3 -d:pserver:guest@cvs.l4ka.org:/public-cvs co pistachio
    $ cd pistachio

We must apply some patchs for it to work properly with The Hurd. They are located in `hurd-l4/README`:

    $ patch -p1 < ../hurd-l4/README

We will first compile sigma0 (and some other tools) :

    $ cd user
    $ autoreconf -f -i -s
    $ mkdir BUILDDIR
    $ cd BUILDDIR

We need to change the linkbase of sigma0 :

    $ ../configure --with-s0-linkbase=0x40000 --prefix=/l4
    $ make
    $ make install

And now the kernel itself :

    $ cd ../../kernel

You can use any builddir as long as the directory doesn't yet exist.

    $ make BUILDDIR=/tmp/pistachio-build
    $ cd /tmp/pistachio-build
    $ vi Makeconf.local

You should modify the first three lines to :

    ARCH=ia32
    CPU=i586
    PLATFORM=pc99

now run:

    $ make menuconfig

Set the options as they fit you but for qemu to work, you must have the following hardware :

    IA32        Basic Architecture
    Pentium1    Processor Type

You can now:

    $ make

You should obtain a file named ia32-kernel into your build directory.

    $ cp ia32-kernel /l4/boot
    $ cp /l4/libexec/l4/sigma0 /l4/boot

We now have to modify a little bit the demodisk to use the kernel and servers we just obtained :

    $ mkdir qemu
    $ mkdir qemu/image
    $ cd qemu
    $ cp ~/pistachio-ia32-0.4-demodisk.bin.bz2 .
    $ bunzip2 pistachio-ia32-0.4-demodisk.bin.bz2
    $ mount -o loop pistachio-ia32-0.4-demodisk.bin image
    $ cd image/boot
    $ cp /l4/boot/* .
    $ cd grub
    $ vi menu.lst

Your should edit `menu.lst` to make it look like :

    title  GNU Hurd on L4
    kernel /boot/laden -D -o serial,uart1,speed=9600
    module /boot/ia32-kernel
    module /boot/sigma0
    module /boot/wortel -D -o serial,uart1,speed=9600
    module /boot/physmem
    module /boot/task
    module /boot/deva
    module /boot/task
    module /boot/ruth

The two -D are intended for debug, you can delete them if you want. It is possible that filenames are limited to 8 characters, check your image/boot directory for ia32-kernel. If it has been renamed into ia32-ker, modify the according line in menu.lst

When you start qemu, you will have two windows : the shell from which you launched it and a VGA window. You can interact with L4 in both windows (switching with the `config/console` command in the debugger). You can choose to have wortel and laden output to the serial device (the shell), which is default behaviour, or to VGA (change `-o serial,urt1,speed=9600` by `-o vga` in your menu.lst).

The image is now ready :

    $ cd ../../../
    $ umount image

We can launch qemu:

    $ qemu -dummy-net  -serial stdio -fda pistachio-ia32-0.4-demodisk.bin -boot a

Congratulations, you just booted Hurd/L4 ! To start the Kernel Debugger, press `ESC`. To switch the KDB mode from character (I find it unusable) to command line, type

    > c
    /conf> m

-- [[Main/OgnyanKulev]] - 05 Feb 2005

I didn't bother to licence it as it is so small, but consider it is under some sort of creative commons that allows redistribution and modification. <br /> -- Alexandre Buisse &lt; <nattfodd@gmailNOSPAM.com> &gt;

-- [[Main/JoachimNilsson]] - 05 Feb 2005

Comments from Marcus Brinkmann:

> Thanks a lot for that. Some comments:
>
>     $ ../configure --with-s0-linkbase=0x40000 --prefix=/l4
>
> I'd recommend to explain how to use `--without-com0` here (or whatever it is called, don't remember) to choose VGA output, or how to configure the serial port. If you use vga, no `-o` option to laden and wortel should be used so you get all output on vga (but of course you can also mix it, whatever you want).
>
> Serial 1 is currently going to be used for remote debugging of userland apps.
>
> QEMU supports up to four serial ports, I use: `-serial stdio` and `-serial pty` and then I get the debugging output and kernel debugger in the terminal I started qemu in, and can use the pty for remote debugging with gdb (the latter doesn't work yet).
>
> Next:
>
>     You should modify the first three lines to :
>      ARCH=ia32
>      CPU=i586
>      PLATFORM=pc99
>
> I never did that. I did change the menu item Processor Type to Pentium1 though. Maybe it has the same effect (and then your document would be a bit redundant here).
>
> Somebody should at some point document all those menu options, some are quite useful for debugging!
>
> Thanks, Marcus

-- [[Main/OgnyanKulev]] - 05 Feb 2005

I've been doing this sort of thing (See also `info grub` for making bootable eltorito grub cd ISOs):

    $ cd /usr/src/controlled/qemu-images
    $ ls -R l4
    ls -R l4
    l4:
    boot  deva  ia32-kernel  laden   physmem  sigma0  task  wortel

    l4/boot:
    grub

    l4/boot/grub:
    menu.lst  stage2_eltorito

    $ cd /usr/src/controlled/qemu-images # dir above "l4" dir.
    $ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \
      -boot-load-size 4 -boot-info-table \
      -o /usr/src/controlled/qemu-images/l4.iso l4

    $ qemu -boot d -cdrom /usr/src/controlled/qemu-images/l4.iso

-- [[Main/DerekDavies]] - 07 Feb 2005