Prex Home > Document Index > Prex Build Guide

Prex Build Guide

Version 1.4.0, 2007/12/26

Table of Contents


Getting Source

You can download the source files at the download page.
Some binary files may be available there.

Compiling Prex

Step 1. Prepare Toolchain

The following packages are required to compile Prex.
  • GCC 2.95 or later (~4.2)
  • GNU Binutils
  • GNU Make
GCC and Binutils should be built appropriately for your target architecture if you cross-compile Prex.

Step 2. Unpack Sources

Unpack the sources and move to top level directory of the source tree.
$ cd /usr/src
$ tar zxvf prex-X.X.X.tar.gz
$ cd prex-X.X.X

Step 3. Configure

Setup target architecture and platform. The following sample shows the setting for i386-pc target.
$ ./configure --target=i386-pc

Step 4. Make

Run make.
$ make

(Tips)

If you want to run 'make' in the subdirectory, you have to set the SRCDIR as follow.
$ export SRCDIR=/usr/src/prex-X.X.X

Compiling on Windows

Cygwin is required to build Prex on Windows environment.

Please note that we can not use the default gcc version included in Cygwin. This is because the pre-compiled gcc in Cygwin is built to generate a native Windows binary (PE format). Since Prex supports only ELF file format, you have to prepare the toolchain for i386-elf with the following steps. (Target Platform is i386-pc here.)

Step 1. Install Cygwin

You can find the latest Cygwin setup program at this site. Download setup.exe and run it. During Cygwin installation, you have to select at least the following packages in addition to the default selection.
  • make
  • binutils
  • gcc-core
  • flex
  • perl
Note: These tools are not required to build Prex itself. They are required to build "binutils and gcc".

Step 2. Unpack Archives

You have to download and unpack the following files.
$ cd /usr/src
$ tar zxvf binitils-2.15.tar.gz
$ tar zxvf gcc-core-3.4.3.tar.gz

Step 3. Build Binutils

Configure and build binutils.

$ mkdir binutils-2.15-i386-elf
$ cd binutils-2.15-i386-elf
$ ../binutils-2.15/configure --prefix=/usr/local/i386 --target=i386-elf --disable-nls
$ make
$ make install

You must set the path to this binutils before compiling gcc.

$ export PATH=/usr/local/i386/bin:$PATH
$ cd /usr/src

Step 4. Build gcc

$ mkdir gcc-3.4.3-i386-elf
$ cd gcc-3.4.3-i386-elf
$ ../gcc-3.4.3/configure --prefix=/usr/local/i386 --target=i386-elf \
 --with-gnu-as --with-gnu-ld --disable-nls --enable-languages=c --without-headers \
 --without-libs --disable-libssp
$ make LANGUAGES="c"
$ make LANGUAGES="c" install
$ cd /usr/src

Step 5. Configure Prex and make

$ cd prex-X.X.X
$ ./configure --target=i386-pc
$ make

Customizing OS Boot Image

If you compile the Prex source with "make" command, the OS boot image is created as "prexos" in the root directory. The file "prexos" must exist in root directory of the Prex disk. You can test your own Prex image by replacing the "prexos" in the floppy image. The file "prexos" includes the following files.

  • Boot loader
  • Kernel module
  • Driver module
  • Boot task(s)

The boot task is a special task which is loaded by kernel directly at boot time. You can specify your own boot task(s) in "BOOTTASKS=" option in files.conf placed in "/conf/etc" directory.