<html>

<title>Compiling GnuMach</title>

<body>

<h2>Compiling a custom Gnumach :</h2>

<p>
This is another recipe that tries to explain the steps needed to compile 
a custom gnumach. The reasons why you should need to recompile gnumach are
various; for example you may want to have the latest CVS gnumach. In my case
the reason was that in my machine gnumach didn't boot, and I decided to
compile a debugging-enabled gnumach ( and my debugging-enabled kernel
just booted without problems : luckily, I didn't need any debug ).
</p>

<p>
These are the steps for compiling and booting a custom gnumach : 
</p>

<ol>

<li>

<p>
I suppose that you are cross-compiling gnumach from linux; 
you will need a hurd crosscompiler and mig. Installing both in 
Debian GNU/Linux is almost trivial. Just type as root :
</p><p>
<samp># apt-get install gcc-i386-gnu mig-i386-gnu</samp>
</p><p>
TODO : what happens in case I don't use Debian ?
</p>

</li><li>

<p>
Get the sources of gnumach; use CVS as explained in the 
<a href="http://www.gnu.org/software/hurd/gnumach-download.html">gnumach source page</a>, that is :
</p><p>

<samp>$ cvs -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/hurd login</samp><br/>
<br/>
( when prompted for the password just press enter ) and :&nbsp;<br/>
<br>
<samp>$ cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/hurd co gnumach</samp>

</p><p>
If you also want to have the Hurd and Mig sources, just change "<samp>co gnumach</samp>" by
"<samp>co hurd</samp>" or "<samp>co mig</samp>". There are also tarballs with gnumach sources
( follow the 
<a href="http://www.gnu.org/software/hurd/gnumach-download.html">gnumach link</a>
again ).
<p>

</li><li>

<p>
Go to to the gnumach directory in where CVS has put the gnumach sources, and inside
it make a directory named build and jump into it :
</p><p>
<samp>$ cd gnumach</samp><br/>
<samp>$ mkdir build</samp><br/>
<samp>$ cd build</samp>
</p>

</li><li>

<p>
Set the enviroment so that the default compiler is set to i386-gnu-gcc. 
For example :
</p><p>
<samp>$ export PATH=/usr/i386-gnu/bin:$PATH</samp>
</p>

</li><li>

<p>
Configure and Compile gnumach ; for a review of compilation options see 
<a href="http://www.gnu.org/software/hurd/gnumach-doc/mach_2.html#SEC8">the gnumach reference manual</a> :
</p><p>
<samp>$ ../configure i386-pc-gnu --enable-floppy --enable-ide --enable-kdb --enable-lpr --enable-kmsg
--enable-rtl8139</samp><br/>
<samp>$ make</samp>
</p><p>
this would generate a kernel image called kernel.
</p>

</li><li>

<p>
The kernel must be copied to the hurd's boot directory; if your hurd partition is mounted in
/gnu, then :
</p><p>
<samp># cp kernel /gnu/boot/kernel</samp>
</p><p>
of course feel free to rename the kernel as you wish.
</p>

</li><li>

<p>
Before rebooting and testing your new kernel, make the neccessary changes in the grub's menu.lst.
For example, in my machine those changes looks like this :
</p><p>
<samp>
title Debian GNU/Hurd - gnumach dbg<br/>
root (hd0,10)<br/>
kernel /boot/kernel root=/dev/hd0s11<br/>
module /boot/serverboot.gz<br/>
<br/>
title Debian GNU/Hurd - gnumach default<br/> 
root (hd0,10)<br/>
kernel /boot/gnumach.gz root=/dev/hd0s11<br/>
module /boot/serverboot.gz<br/>
</samp>
</p>

</li><li>

<p>
Now it's time to reboot the machine and boot hurd with the new gnumach kernel. Enjoy it!
</p>

</li>

<ol>

</body>
</html>