42_KFS/documentation/installation.md

1.7 KiB

INSTALLATION

Cross compile the compile

WHY ??

Why cross compile the gcc ?

We must cross compile gcc cause our kernel is developped for i386 cpu but your current cpu is probally not an i386 so we need to create an i386 compiler

HOW ?

THE DOCUMENTATION

export PREFIX="$HOME/opt/cross"
export TARGET=i386-elf
export PATH="$PREFIX/bin:$PATH"
mkdir $HOME/src
cd $HOME/src
tar xf [your binutils archive]
tar xf [your gcc archive]
tar xf [your gdb archive]
  • (protips use -j [nb core])
  • Compile binutils
cd $HOME/src
mkdir build-binutils

cd build-binutils
../binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
make
make install
  • Compile gdb
cd $HOME/src
mkdir build-gdb

cd build-gdb
../gdb.x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-werror
make all-gdb
make install-gdb
make
make install
  • Compile gcc
cd $HOME/src

# The $PREFIX/bin dir _must_ be in the PATH. We did that above.
which -- $TARGET-as || echo $TARGET-as is not in the PATH

mkdir build-gcc
cd build-gcc
../gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc

Compile and the start the kernel

make run