diff options
author | Joachim Nilsson <joachim@gnufans.org> | 2003-04-13 11:16:00 +0000 |
---|---|---|
committer | Joachim Nilsson <joachim@gnufans.org> | 2003-04-13 11:16:00 +0000 |
commit | 03fb584c2f1355909ff44d381db152fb3a0c103f (patch) | |
tree | 49bc6236d0d7bef11d91f30bb845b62e063922f2 /Distrib | |
parent | 519701b3d7011b82af2c0bf0dd384f0fe90db396 (diff) |
none
Diffstat (limited to 'Distrib')
-rw-r--r-- | Distrib/BuildingTheHurd.mdwn | 283 |
1 files changed, 283 insertions, 0 deletions
diff --git a/Distrib/BuildingTheHurd.mdwn b/Distrib/BuildingTheHurd.mdwn new file mode 100644 index 00000000..80b8a01a --- /dev/null +++ b/Distrib/BuildingTheHurd.mdwn @@ -0,0 +1,283 @@ +<table align="center" width="75%"> + <tr> + <td align="center" colspan="2"><nop><h2><a name="HowTo_setup_a_Hurd_cross_compile"> <nop>HowTo setup a Hurd cross-compiler in Linux </nop></a></h2></nop></td> + </tr> + <tr> + <td><nop><h2><a name="Table_of_Contents"> Table of Contents </a></h2> %TOC% </nop></td> + <td valign="top"> + <p> Created from the original by <a href="http://cvs.gentoo.org/~avenj/" target="_top">Jon Portnoy</a>, <a href="http://cvs.gentoo.org/~avenj/doc/xcompile-en.html" target="_top">http://cvs.gentoo.org/~avenj/doc/xcompile-en.html</a></p> + <p><nop></nop></p> + <h2><a name="Introduction"> Introduction </a></h2> + <p> For a Linux to Hurd cross-compiler you need these versions (I tried newer versions of gcc but they won't compile) </p> + <p> + </p> + <ul> + <li><a href="http://ftp.gnu.org/gnu/binutils/" target="_top">binutils-2.13.90.0.16</a></li> + </ul> + <p> + </p> + <ul> + <li> egcs-core-1.2.2 &lt;- a very old version of gcc, but it is very stable, you will need it for compiling the gnumach headers and the mig kernel </li> + </ul> + <p> + </p> + <ul> + <li><a href="http://ftp.gnu.org/gnu/gcc/" target="_top">gcc-core-2.95.2</a> &lt;- for compiling hurd </li> + </ul> + <p> + </p> + <ul> + <li><a href="http://ftp.gnu.org/gnu/glibc/" target="_top">glibc-2.2.5</a></li> + </ul> + <p> + </p> + <ul> + <li><a href="http://ftp.gnu.org/gnu/gnumach/gnumach-1.3.tar.gz" target="_top">gnumach-1.3</a></li> + </ul> + <p> + </p> + <ul> + <li><a href="http://ftp.gnu.org/gnu/mig/mig-1.3.tar.gz" target="_top">mig-1.3</a></li> + </ul> + <p> + </p> + <ul> + <li><a href="http://www.gnu.org/software/hurd/download.html" target="_top">hurd</a></li> + </ul> + <p> + </p> + </td> + </tr> +</table> + +## <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_CFLAG_and_PATH"> </a> Exporting the CFLAG and PATH + +`/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 + +### <a name="Cross_binutils"> Cross binutils </a> + +cd binutils.build ../binutils/configure --prefix=/usr/local --target=i686-pc-gnu make make check + +make install (as root, and don't forget to export the CFLAGS and the PATH) + +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 (as root, don't forget to export CFLAGS and PATH) + 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"> </a> GNUmach Headers + + cd gnumach.build + ../gnumach/configure --build=i686-pc-linux-gnu --host=i686-pc-gnu + make -k install-headers prefix=/usr/local/i686-pc-gnu (as root ...) + 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 (as root ...) + 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 do nt 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 (as root ...) + cd .. + +### <a name="Cross_GCC"> </a> Cross GCC + +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) + sudo 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 (as root ...) + 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"> </a> Building Cross GCC + + cd gcc.build + + make + + sudo make install + + cd .. + +Remember to export CFLAGS and the new PATH + +### <a name="Building_Cross_GLibC"> Building Cross GLibC </a> + + cd glibc.build + + make + + sudo 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"> </a> Install the GNUmach kernel somewhere + + 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 edit 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 -03. + + ../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 |