diff options
author | Thomas Schwinge <tschwinge@gnu.org> | 2007-09-04 21:23:29 +0200 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gnu.org> | 2007-09-04 21:23:29 +0200 |
commit | d93deae15ee91a9b04989777fda563f2ccd5410f (patch) | |
tree | 9221a69f97cf10e42f96f21765ed7f32de424cfb /unsorted/BuildingTheHurd.mdwn | |
parent | 4011bbadc0c3a646f241ec226611deee2e1a07dd (diff) |
Shuffle another bunch of files, related to `Distrib/' and `GNU/'.
Diffstat (limited to 'unsorted/BuildingTheHurd.mdwn')
-rw-r--r-- | unsorted/BuildingTheHurd.mdwn | 251 |
1 files changed, 251 insertions, 0 deletions
diff --git a/unsorted/BuildingTheHurd.mdwn b/unsorted/BuildingTheHurd.mdwn new file mode 100644 index 00000000..fb412eae --- /dev/null +++ b/unsorted/BuildingTheHurd.mdwn @@ -0,0 +1,251 @@ +## <a name="Table_of_Contents"> Table of Contents </a> + +%TOC% + +Created from the original by [Jon Portnoy](http://cvs.gentoo.org/~avenj/), <http://cvs.gentoo.org/~avenj/doc/xcompile-en.html> + +## <a name="Introduction"> Introduction </a> + +For a Linux to Hurd cross-compiler you need these versions (I tried newer versions of gcc but they won't compile) + +* [binutils-2.13.90.0.16](http://ftp.gnu.org/gnu/binutils/) + +* egcs-core-1.2.2 <- a very old version of gcc, but it is very stable, you will need it for compiling the gnumach headers and the mig kernel + +* [gcc-core-2.95.2](http://ftp.gnu.org/gnu/gcc/) <- for compiling hurd + +* [glibc-2.2.5](http://ftp.gnu.org/gnu/glibc/) + +* [gnumach-1.3](http://ftp.gnu.org/gnu/gnumach/gnumach-1.3.tar.gz) + +* [mig-1.3](http://ftp.gnu.org/gnu/mig/mig-1.3.tar.gz) + +* [hurd](http://www.gnu.org/software/hurd/download.html) + +## <a name="Building"> Building </a> + +### <a name="The_directory_structure"> The directory structure </a> + +It is easier to compile the whole sources in an extra directory: + +* `build/binutils` <- the unpacked binutils sources + +* `build/binutils.build` + +* `build/egcs` <- the unpacked egcs sources + +* `build/egcs.build` + +* `build/gcc` <- the unpacked gcc sources + +* `build/gcc.build` + +* `build/glibc` <- the unpacked glibc sources + +* `build/glibc.build` + +* `build/gnumach` <- the unpacked gnumach kernel sources + +* `build/gnumach.build` + +* `build/mig` <- the unpacked mig kernel sources + +* `build/mig.build` + +* `build/hurd` <- the unpacked hurd kernel sources + +* `build/hurd.build` + +### <a name="Exporting_the_CFLAGS_tt_and_PATH"> Exporting the `CFLAGS` and `PATH` </a> + +`/usr/local` is where the sources we compile will be installed. If you want to choose another directory you have to change the path to the bin directory and too you have to change the `--prefix` path to the directory you want. + + $ export CFLAGS="-march=i686 -O2 -fomit-frame-pointer" + $ export PATH=/usr/local/bin:$PATH + +**_All commands that are prefixed by `#` must be run as root with `CFLAGS` and `PATH` exported._** + +### <a name="Cross_binutils"> Cross binutils </a> + + $ cd binutils.build + $ ../binutils/configure --prefix=/usr/local --target=i686-pc-gnu + $ make + $ make check + # make install + $ cd .. + +### <a name="Cross_egcs"> Cross egcs </a> + +When the `/usr/local/bin` directory do not exist before you will now have to export the `PATH` again because after installing binutils you will have it. + + $ cd egcs.build + $ ../egcs/configure --prefix=/usr/local --target=i686-pc-gnu \ + --with-gnu-as --with-gnu-ld + $ make -k + # make -k install + $ ln -s /usr/local/i686-pc-gnu \ + /usr/local/lib/gcc-lib/i686-pc-gnu/egcs-2.91.66/i686-pc-gnu + $ cd .. + +### <a name="GNUmach_Headers"> GNUmach Headers </a> + + $ cd gnumach.build + $ ../gnumach/configure --build=i686-pc-linux-gnu --host=i686-pc-gnu + # make -k install-headers prefix=/usr/local/i686-pc-gnu + $ cd .. + +### <a name="Mig"> Mig </a> + +Mig is the Mach Interface Generator - needed by Mach and the Hurd to create C code from their IDL files. Mig is what helps us do RPC without ever knowing much about it. + + $ cd mig.build + $ ../mig/configure --target=i686-pc-gnu --host=i686-pc-linux-gnu \ + --prefix=/usr/local + $ make + # make install + $ cd .. + +### <a name="Gnumach_Headers_inclusive_Mig"> Gnumach Headers inclusive Mig </a> + +When you first compile the GNUmach headers Mig won't be mentioned (it wasn't installed actually) and this causes some errors when compiling the GNUmach headers but you need them to compile mig. (I don't know if you have to do this but i think it is the better way) + + $ cd gnumach.build + $ rm -r * (deletes every file and directory in this directory) + $ ../gnumach/configure --build=i686-pc-linux-gnu --host=i686-pc-gnu + # make -k install-headers prefix=/usr/local/i686-pc-gnu + $ cd .. + +### <a name="Cross_GCC"> Cross GCC </a> + +For the coexistence of EGCS and GCC you have to move the `/usr/local/bin/i686-pc-gnu-gcc` to the `/usr/local/bin` directory in `i686-pc-gnu-egcs`. So you can choose wich compiler you want use: with the `CC` environment variable set to `i686-pc-gnu-egcs` you can use EGCS without this command you use GCC. + + # mv /usr/local/bin/i686-pc-gnu-gcc \ + /usr/local/bin/i686-pc-gnu-egcs + + $ cd gcc.build + $ ../gcc/configure --prefix=/usr/local --target=i686-pc-gnu \ + --with-gnu-as --with-gnu-ld + $ make -k compile the glibc-headers) + # make -k install + $ cd .. + + # ln -s /usr/local/i686-pc-gnu/ \ + /usr/local/lib/gcc-lib/i686-pc-gnu/2.95.2/i686-pc-gnu + +You need `make -k` because otherwise it will fail but with `-k` you will have everything you need. + +### <a name="Hurd_Headers"> Hurd Headers </a> + + $ cd hurd.build + $ ../hurd/configure --build=i686-pc-linux-gnu -�host=i686-pc-gnu \ + -�prefix=/usr/local/i686-pc-gnu --disable-profile + # make install-headers no_deps=t + $ cd .. + +### <a name="Cross_GLibC"> Cross GLibC </a> + +For having glibc compiled with the cross-gcc and not with your original gcc you have to export another `PATH`. The normal user who configures and compiles and also root has to export this `PATH`. + + $ export PATH=/usr/local/bin:/usr/local/i686-pc-gnu/bin:$PATH + $ cd glibc.build + $ ../glibc/configure --without-cvs --enable-add-ons=crypt \ + --disable-profile --build=i686-pc-linux-gnu \ + --host=i686-pc-gnu --prefix=/usr/local/i686-pc-gnu + +AS ROOT WITH EXPORTED CFLAGS: + + # export PATH=/usr/local/bin:/usr/local/i686-pc-gnu/bin:$PATH + # make -k install-headers install_root=/usr/local/i686-pc-gnu + # cp ../glibc/include/features.h \ + /usr/local/i686-pc-gnu/include/features.h + # touch /usr/local/i686-pc-gnu/include/gnu/stubs.h + $ cd .. + +### <a name="Building_Cross_egcs"> Building Cross egcs </a> + + # mv /usr/local/bin/i686-pc-gnu-gcc \ + /usr/local/bin/i686-pc-gnu-foo (for protecting gcc) + # mv /usr/local/bin/i686-pc-gnu-egcs \ + /usr/local/bin/i686-pc-gnu-gcc + $ cd egcs.build + $ make + # make install (as root, export CFLAGS and the NEW PATH) + $ cd .. + # mv /usr/local/bin/i686-pc-gnu-gcc \ + /usr/local/bin/i686-pc-gnu-egcs + # mv /usr/local/bin/i686-pc-gnu-foo \ + /usr/local/bin/i686-pc-gnu-gcc + +### <a name="Building_Cross_GCC"> Building Cross GCC </a> + + $ cd gcc.build + $ make + # make install + $ cd .. + +Remember to export `CFLAGS` and the new `PATH` + +### <a name="Building_Cross_GLibC"> Building Cross GLibC </a> + + $ cd glibc.build + $ make + # make install root_install=/usr/local/i686-pc-gnu + +Remember to export `CFLAGS` and the new `PATH` + +For solving a glibc bug you have to link the `/usr/local/i686-pc-gnu/include/libc.so.0.2` with the `/usr/local/i686-pc-gnu/lib/libc.so` ever when you (re)install glibc. + + # ln -sf /usr/local/i686-pc-gnu/lib/libc.so.0.2 \ + /usr/local/i686-pc-gnu/lib/libc.so + +### <a name="Install_the_GNUmach_kernel_somew"> Install the GNUmach kernel somewhere </a> + + $ rm -r gnumach.build + $ mkdir gnumach.build + $ cd gnumach.build + +You will need more than the `-�target` and `-�host` variables to build the GNUmach kernel. You have to enable some kernel features with the `--enable` command to have your kernel working properly. To have a quick view of what you need you can view the `gnumach/i386/README-Drivers` (I do not know how old it is, so maybe there are more options available but i haven't searched for more). + +My configure command: + + $ ../gnumach/configure --build=i686-pc-linux-gnu \ + --host=i686-pc-gnu �-enable-lpr \ + --enable-floppy --enable-ide \ + --enable-aic7xxx �-enable-rtl8139 + # ln -s /usr/local/i686-pc-gnu/include \ + /where/you/want/to/install/the/kernel/include + # ln -s /usr/locali686-pc-gnu/lib \ + /where/you/want/to/install/the/kernel/lib + $ make + # make install-kernel \ + prefix=/where/you/want/to/install/the/kernel (as root ...) + +### <a name="Hurd_Servers"> Hurd Servers </a> + + $ rm -r hurd.build + $ mkdir hurd.build + $ cd hurd.build + $ nano -w/vi (or what editor you ever use) ../hurd/Makeconf + +You have to comment out the `CFLAGS` in this file or delete the `-std=gnu99` and the `-O3`. + + $ ../hurd/configure �build=i686-pc-linux-gnu \ + --host=i686-pc-gnu \ + -�prefix=/where/you/want/to/install/the/kernel \ + --disable-profile + $ make -k + # make -k install prefix=/where/you/want/to/install/the/kernel + +You have to use `-k` because when you don't use it the compilation will brake with an error. I tried different installations of gcc and glibc and too i used different versions of hurd but i cannot solve this prob so maybe it is hurd related. + +So there is no warranty that the hurd kernel you compiled will work. I will try it and then update this guide. + +---- + +## <a name="Document_History"> Document History </a> + +Created from the original, <http://cvs.gentoo.org/~avenj/doc/xcompile-en.html>, by [Jon Portnoy](http://cvs.gentoo.org/~avenj/) + +I would recommend not using EGCS, but instead using the GCC cross compiler. See [[Hurd/BuildingHurd]] and [[Mach/BuildingOskitMach]] for more information on building the GNU OS components. <br />-- [[Main/JoachimNilsson]] - 13 Apr 2003 + +Text formatting. <br />-- [[Main/OgnyanKulev]] - 13 Apr 2003 |