Prex Home > Document Index > Prex Build Guide

Prex Build Guide

Version 1.3.0, 2007/06/20

Table of Contents


Getting Source

You can download the source files at the download page.
And, some binary files may be available there.

Compiling Prex

Step 1. Prepare Toolchain

The following packages are required for compiling 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 about 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 PREX_SRC as follow.
$ export PREX_SRC=/usr/src/prex-X.X.X

Compiling on Win32 with Cygwin

Target Platform: i386-pc

The gcc on Cygwin generates PE files as Win32 program. However, Prex supports only ELF file format. So, you have to prepare the toolchain for i386-elf with the following steps.

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 required to build binutils/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. Setup

Set the prefix of the build tools before compiling Prex.
$ export CROSS_COMPILE=i386-elf-

Customizing OS Boot Image

If you compile the Prex source with "make" command, the OS boot image is created as "prexos" in "/img" 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 "TASK=" option in Makefile placed in "/img" directory.