summaryrefslogtreecommitdiff
path: root/microkernel/mach/gnumach/building.mdwn
blob: d3fe670a6494455994eb45dc4bab811fa6b036a4 (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
[[!meta copyright="Copyright © 2006, 2007, 2008, 2011, 2013 Free Software
Foundation, Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]

# 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 <http://git.savannah.gnu.org/git/hurd/>),

    $ git clone https://git.savannah.gnu.org/git/hurd/gnumach.git/

... or get the Debian sources, if you're using Debian. (See
[here](http://packages.debian.net/source/unstable/gnumach).)

    $ apt-get source gnumach

## On Debian Systems:

### Preparing for the Build

Building GNU Mach requires the *build-essential* and *fakeroot* packages,
and some additional dependencies specified by the gnumach source 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,

    $ 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:

    # 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,
your favourite flavor of awk (gawk) and GNU make.

First, create the configuration files:

    $ cd gnumach
    $ autoreconf --install

GNU Mach (and the associated headers) need be built in a separate build directory:

    $ mkdir build
    $ cd build

Run configure:

    $ ../configure --prefix=

If building on a 64 bit host system,
you need a number of additional settings to force a 32 bit build:

    $ ../configure --prefix= --host=i686-gnu LD=i686-linux-gnu-ld CC=i686-linux-gnu-gcc

### Installing the Header Files First

In order to build GNU Mach, you will need a working MIG.
Building MIG in turn requires the GNU Mach header files to be already present.
So for bootstrapping MIG, you have to install the Mach headers first,
for example into `~/gnu/include/`:

    $ make DESTDIR=~/gnu install-data

Now you can [[build_MIG|mig/gnu_mig/building]].
Once you are done with that, come back here to finish the Mach build.

### Building and Installing

With MIG present, now build the kernel image:

    $ make gnumach.gz

Optionally run the (tiny) test suite:

    $ make check

It's a good idea to make a backup of the previously installed kernel, in case
you can't boot using the new one. That way, you can restore it after booting
from a rescue media (or mounting the disk image used by your vm).

    # cp /boot/gnumach.gz /boot/gnumach.gz.bak

GNU Mach can now be moved into place, typically `/boot/gnumach.gz`, so that you
can boot your system with the new kernel.

    # cp gnumach.gz /boot