Difference between revisions of "Build Xinu"

From Embedded Xinu
Jump to navigation Jump to search
(New page: == Cross-Compiler == In order to compile Embedded MIPS kernels on a workstation that is not itself a MIPS processor, it is necessary to build and install an appropriate [http://en.wikipedi...)
 
Line 1: Line 1:
 +
{{Update}}
 
== Cross-Compiler ==
 
== Cross-Compiler ==
 
In order to compile Embedded MIPS kernels on a workstation that is not itself
 
In order to compile Embedded MIPS kernels on a workstation that is not itself
Line 49: Line 50:
  
 
   /usr/local/project/mipsel-dev/bin/mipsel-gcc
 
   /usr/local/project/mipsel-dev/bin/mipsel-gcc
 +
 +
----
 +
 +
One of  the biggest hurdles for compiling on one computer and sending the binary to a second computer is the architecture type.  For our purposes we are developing on a powerpc architecture and sending the compiled binary to a mips processor.  This is done through the use of a crosscompiler, our powerpc to mips crosscompiler is located in:
 +
/usr/local/project/EmbeddedOS/crosscompiler
 +
 +
All compiling programs are prefixed with <tt>mipsel-linux-uclibc-</tt> to differentiate the crosscompiler from the local system's compiling programs.  A simple recommendation is to add the crosscompiler directory to your path.  This can be done by typing:
 +
export PATH=$PATH:/usr/local/project/EmbeddedOS/crosscompiler
 +
Alternativly, this can be added to your <tt>.profile</tt> or <tt>.bashrc</tt> (or whatever script loads when you use a terminal...).
 +
 +
All the standard GNU Compiler Collection programs should exists (most importantly gcc and objdump are there).

Revision as of 20:56, 11 July 2007

Clockimportant.png This article or section needs to be updated.
Parts of this article or section have been identified as no longer being up to date.
Please update the article to reflect recent changes, and remove this template when finished.

Cross-Compiler

In order to compile Embedded MIPS kernels on a workstation that is not itself a MIPS processor, it is necessary to build and install an appropriate cross compiler. There are many ways to accomplish this; for reference, we list the specific versions and steps we used for our installation.

As always, one should be wary of installing unfamilar software as the root user of the system. All of the steps below have been carried out as a lesser-privileged user with write access to the necessary directories.

First, we downloaded, compiled, and installed the appropriate binary utilities. We downloaded binutils version 2.17, untarred the source code, and and ran the following commands:

  ./configure  --prefix=/usr/local/project/mipsel-dev --target=mipsel
  make
  make install

We have chosen the path "/usr/local/project/mipsel-dev" to host our cross-compiler installation. Whatever path it used here must be reflected in the XINU build configuration file, "compile/makeVars" when you arrive at that step.

We are not building a true, full-blown UNIX cross-compiler here, and do not need a proper installation of the platform-specific C libraries; XINU has its own small libraries that compile with the kernel. However, the GCC compilation will want to see appropriate library headers, so we cheat here by linking the platform-specific include directory to the host machine's include directory.

  mkdir -p /usr/local/project/mipsel-dev/mipsel/usr
  ln -s /usr/include /usr/local/project/mipsel-dev/mipsel/usr/include

Second, we downloaded, patched, compiled and installed the GNU C Compiler. We downloaded GCC version 3.4.6. We applied a short patch to correct some kind of obscure fixproto error. We added the newly compiled binutils into the shell path (/usr/local/project/mipsel-dev/bin) for the gcc compilation to find them. This is also known to work with GCC version 4.1.2 unpatched, using this script to get around installing a bunch of platform-specific UNIX libraries.

  ./configure  --prefix=/usr/local/project/mipsel-dev --target=mipsel --with-sysroot=/usr/local/project/mipsel-dev/mipsel/ --enable-languages=c
  make
  make install

If all has gone well, you should now have a gcc cross-compiler from your host's native architecture to little-endian MIPS:

  /usr/local/project/mipsel-dev/bin/mipsel-gcc

One of the biggest hurdles for compiling on one computer and sending the binary to a second computer is the architecture type. For our purposes we are developing on a powerpc architecture and sending the compiled binary to a mips processor. This is done through the use of a crosscompiler, our powerpc to mips crosscompiler is located in:

/usr/local/project/EmbeddedOS/crosscompiler

All compiling programs are prefixed with mipsel-linux-uclibc- to differentiate the crosscompiler from the local system's compiling programs. A simple recommendation is to add the crosscompiler directory to your path. This can be done by typing:

export PATH=$PATH:/usr/local/project/EmbeddedOS/crosscompiler

Alternativly, this can be added to your .profile or .bashrc (or whatever script loads when you use a terminal...).

All the standard GNU Compiler Collection programs should exists (most importantly gcc and objdump are there).