Difference between revisions of "Build Xinu"

From Embedded Xinu
Jump to navigation Jump to search
m (getreloloe)
(Reverted changes)
Line 1: Line 1:
roeltrocnacn
 
 
The new MIPS port of Embedded XINU has been released.  See the [[Downloads]] tab for more information.
 
The new MIPS port of Embedded XINU has been released.  See the [[Downloads]] tab for more information.
 
A revision of Doug Comer's venerable ''Operating System Design - The XINU Approach'' textbook is in progress.
 
A revision of Doug Comer's venerable ''Operating System Design - The XINU Approach'' textbook is in progress.

Revision as of 04:50, 29 December 2007

The new MIPS port of Embedded XINU has been released. See the Downloads tab for more information. A revision of Doug Comer's venerable Operating System Design - The XINU Approach textbook is in progress.

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 is 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 and 4.2.0 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

Building the XINU image

Once you have downloaded and extracted the xinu tarball, you will see a basic directory structure:

AUTHORS   include/  LICENSE   README  system/  tty/
compile/  lib/      loader/   shell/  test/    uart/

AUTHORS is a brief history of contributors to the XINU operating system in it's varying iterations.

compile/ contains the Makefile and other necesities for building the XINU system once you have a cross-compiler.

include/ contains all the header files used by XINU.

lib/ contains a folder (libxc/) with a Makefile and source for the library, as well as a binary blob which contains the pre-compiled library.

LICENSE is the license under which this project falls.

loader/ contains assembly files and is where the bootloader will begin execution of O/S code.

README is this document.

shell/ contains the source for all shell related functions.

system/ contains the source for all system functions such as the nulluser process (initialize.c) as well as code to set up a C environment (startup.S).

test/ contains a number of testcases (which can be run using the shell command testsuite).

tty/ contains the source for the tty driver.

uart/ contains the source for the uart driver.


By this point it is assumed you have built a cross-compiler (from your host computer's architecture to MIPS), have obtained a supported router and have made the necessary modifications to use the serial port. If you have not it is suggested you visit http://mulug.mscs.mu.edu/xinu/ to understand what you need and why.

Once you have obtained all the required components building the XINU system is a straightforward process. Change into the compile directory and (if needed) update the makeVars file to point to your cross-compiler. Once you have done that you can simply execute make which should leave you with a xinu.boot file in the compile directory.

After creating the xinu.boot image you can hook the router's serial port up to your computer and connect using a serial communications program of your choice (the xinu-console tools available from http://www.mscs.mu.edu/~brylow/xinu/ contain a program called tty-connect which is a basic serial communication program). The settings needed are 8 data bits, no parity bit, and 1 stop bit (8N1) with a speed of 115,200 bps.

Upon connection you can power on the router and immediatly start sending breaks (Control-C) to the device, if your luck holds you will be greated with a CFE prompt. If you are using a DHCP server you can execute ifconfig eth0 -auto to obtain an IP, otherwise your computer can have a static IP in the 192.168.1.[2-255] range. On the host computer initiate a tftp put on the xinu.boot image and on the router type the command boot -elf [host ip]:xinu.boot. If all has gone correctly the router should now be running a XINU image and you will be greeted with a basic shell (xsh$ ).

Within the shell you have some basic commands: exit, gpiostat, help, kill, memstat, led, ps, reset, sleep, uartstat. Each can be described using [command] --help.

For more information check out the Embedded XINU wiki [1].