# Building [[GNU_Mach|gnumach]] from Source If you want to build the [[GNU_Mach|gnumach]] kernel yourself instead of just using a pre-built binary, follow these instructions. The unpacked source tree is around 20 MiB, and the build tree (with all drivers enabled) is around 50 MiB. ## Getting the Source Code You can either use the git repository (see ), $ git clone git.savannah.gnu.org:/srv/git/hurd/gnumach.git ... or Debian sources, if you're using Debian. (See [here](http://packages.debian.net/source/unstable/gnumach).) $ apt-get source gnumach Please see the Debian [[running/debian/FAQ]] before using `apt-get source`. ## On Debian Systems: ### Preparing for the Build Building GNU Mach requires the *build-essential* and *fakeroot* packages, their dependencies and additional packages that are specified by the source gnumach package: # apt-get install build-essential fakeroot # apt-get build-dep gnumach ### Building and Installing ... Debian `.deb` files Change into the directory with the downloaded / unpacked GNU Mach sources, e.g. $ cd gnumach-XXXXXXXX Start the build process with $ dpkg-buildpackage -us -uc -b -rfakeroot [[GNU_Mach|gnumach]] is now building. To use the new kernel, you must install the resulting `.deb` package which is located one directory above the build directory and has a similar name as the build directory, e.g. # dpkg -i ../gnumach_XXXXXXXX-X_hurd-i386.deb You can now reboot your computer and enjoy the new kernel. ## On non-Debian Systems: ### Preparing for the Build Building GNU Mach requires a C compiler, a static 32 bit standard C library and your favourite flavor of awk (gawk) and GNU make. ### Installing the Header Files First In order to build GNU Mach, you must build and install MIG, which requires that you install the GNU Mach header files: First, you have to create the configuartion files: $ cd gnumach $ autoreconf --install GNU Mach and its headers should be built in a subdirectory: $ mkdir gnumach-build $ cd gnumach-build Find the path to your GNU Mach sources (`..`) and configure it: $ ../configure --prefix= Use the --host flag on 64 bit systems: $ ../configure --prefix= --host=i686-unknown-linux-gnu Install the header files into e.g. `~/gnu/include/`: $ make DESTDIR=~/gnu install-data ### Building and Installing Building GNU Mach requires you to have the Mach Interface Generator installed. See [[building_MIG|mig/gnu_mig/building]] about how to do that, then come back here. GNU Mach should be built in a subdirectory create it if you have not already. $ mkdir gnumach-build $ cd gnumach-build If you previously ran ../configure for installing the header files, you may run into a bug when you configure and run make below. If that is the case, run "rm -rf *" in the _build_ directory, and reconfigure. $ cd gnumach-build $ rm -rf * Find the path to your GNU Mach sources (`..`) and configure it: $ ../configure If you are building on a 64 bit system, do the following instead: $ CPP='gcc -m32 -E -x c -undef -ansi' CC='gcc -m32' LD='ld -melf_i386' $ ../configure --host=i686-unknown-linux-gnu Build the kernel image: $ make gnumach.gz Optionally run the (tiny) test suite: $ make check You can then install and use `gnumach.gz`. [TODO]