summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-08-24 11:00:03 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-08-24 11:00:03 +0200
commitbbbf85901d1ada1b7b186b076f1604d9a144c246 (patch)
treefeafa936013300990b2b6318610ecbba906d5098 /doc
parent1c609474a99cb71d9d1c5852faf5be5845ef7477 (diff)
downloadabaos-bbbf85901d1ada1b7b186b076f1604d9a144c246.tar.gz
abaos-bbbf85901d1ada1b7b186b076f1604d9a144c246.tar.bz2
moved cross compilation docu to doc dir
Diffstat (limited to 'doc')
-rw-r--r--doc/README.CrossCompiling174
1 files changed, 174 insertions, 0 deletions
diff --git a/doc/README.CrossCompiling b/doc/README.CrossCompiling
new file mode 100644
index 0000000..74f31ce
--- /dev/null
+++ b/doc/README.CrossCompiling
@@ -0,0 +1,174 @@
+Intro
+-----
+
+You can compile AbaOS from a 32-bit host or chroot (e.g. Arch32 chroot).
+But you have to be extremly careful that nothing ceeps into the kernel
+from the host system.
+
+You can also create a cross-compilation environment. Now, we don't need
+a full fledged chain, linker and C compiler is enough. AbaOs has a small
+integrated C library which is sufficient to build the kernel.
+
+gcc
+---
+
+mkdir -p $HOME/cross-compilers/gcc
+cd $HOME/cross-compilers/gcc
+wget https://ftp.gnu.org/gnu/binutils/binutils-2.28.tar.gz
+tar xf binutils-2.28.tar.gz
+mkdir binutils-build
+cd binutils-build
+../binutils-2.28/configure --target=i486-elf --prefix=$HOME/cross-compilers --disable-nls -v
+make all
+make check
+make install
+cd ..
+
+wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.lz
+tar xf gmp-6.1.2.tar.lz
+mkdir gmp-build
+cd gmp-build
+../gmp-6.1.2/configure --build=i486-elf --host=i486-elf --prefix=$HOME/cross-compilers
+make all
+make check
+make install
+cd ..
+
+wget http://www.mpfr.org/mpfr-current/mpfr-3.1.5.tar.gz
+tar xf mpfr-3.1.5.tar.gz
+mkdir mpfr-build
+cd mpfr-build
+../mpfr-3.1.5/configure --build=i486-elf --host=i486-elf --prefix=$HOME/cross-compilers \
+ --with-gmp=$HOME/cross-compilers
+make all
+make check
+make install
+cd ..
+
+wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
+tar xf mpc-1.0.3.tar.gz
+mkdir mpc-build
+cd mpc-build
+../mpc-1.0.3/configure --host=i486-elf --target=i486-elf \
+ --prefix=$HOME/cross-compilers \
+ --with-gmp=$HOME/cross-compilers \
+ --with-mpfr=$HOME/cross-compilers
+make all
+make check
+make install
+cd ..
+
+wget ftp://ftp.mpi-sb.mpg.de/pub/gnu/mirror/gcc.gnu.org/pub/gcc/releases/gcc-7.1.0/gcc-7.1.0.tar.gz
+tar zxf gcc-7.1.0.tar.gz
+mkdir gcc-build
+cd gcc-build
+../gcc-7.1.0/configure --target=i486-elf --prefix=$HOME/cross-compilers \
+ --with-gnu-as --with-gnu-ld \
+ --disable-nls --enable-languages=c --disable-libgcj --without-headers \
+ --with-gmp=$HOME/cross-compilers \
+ --with-mpfr=$HOME/cross-compilers \
+ --with-mpc=$HOME/cross-compilers
+make all-gcc
+make all-target-libgcc
+make install-gcc
+make install-target-libgcc
+
+Compile abaos and libc tests with:
+
+setenv PATH "${PATH}:$HOME/cross-compilers"
+make clean all CC=i486-elf-gcc LD=i486-elf-ld
+
+
+tcc
+---
+
+mkdir -p $HOME/cross-compilers/tcc
+cd $HOME/cross-compilers/tcc
+wget https://ftp.gnu.org/gnu/binutils/binutils-2.28.tar.gz
+tar xf binutils-2.28.tar.gz
+mkdir binutils-build
+cd binutils-build
+../binutils-2.28/configure --target=i486-elf --prefix=$HOME/cross-compilers --disable-nls -v
+make all
+make check
+make install
+cd ..
+
+mkdir -p $HOME/cross-compilers/tcc
+cd $HOME/cross-compilers/tcc
+git clone git://repo.or.cz/tinycc.git
+cd tinycc
+./configure --cpu=i386 --enable-cross --prefix=$HOME/cross-compilers
+make
+cd ..
+
+Compile abaos and libc tests with:
+
+setenv PATH "${PATH}:$HOME/cross-compilers"
+make clean all CC=i386-tcc LD=i486-elf-ld
+
+pcc
+---
+
+mkdir -p $HOME/cross-compilers/pcc
+cd $HOME/cross-compilers/pcc
+wget https://ftp.gnu.org/gnu/binutils/binutils-2.28.tar.gz
+tar xf binutils-2.28.tar.gz
+mkdir binutils-build
+cd binutils-build
+../binutils-2.28/configure --target=i486-unknown-linux-gnu --prefix=$HOME/cross-compilers --disable-nls -v
+make all
+make check
+make install
+cd ..
+
+mkdir -p $HOME/cross-compilers/pcc
+cvs -d :pserver:anonymous@pcc.ludd.ltu.se:/cvsroot co pcc-libs
+mkdir pcc-libs-build
+cd pcc-libs-build
+../pcc-libs/configure --target=i486-unknown-linux-gnu --prefix=$HOME/cross-compilers
+make
+make install
+cd ..
+
+cvs -d :pserver:anonymous@pcc.ludd.ltu.se:/cvsroot co pcc
+mkdir pcc-build
+cd pcc-build
+../pcc/configure --target=i486-unknown-linux-gnu --prefix=$HOME/cross-compilers
+make
+make install
+
+Compile abaos and libc tests with:
+
+setenv PATH "${PATH}:$HOME/cross-compilers"
+make clean all CC=i486-unknown-linux-gnu-pcc LD=i486-unknown-linux-gnu-ld
+
+clang
+-----
+
+Clang is easy, usually it already supports common targets. Just
+for the kernel we need a i486 linker from binutils:
+
+mkdir -p $HOME/cross-compilers/pcc
+cd $HOME/cross-compilers/pcc
+wget https://ftp.gnu.org/gnu/binutils/binutils-2.28.tar.gz
+tar xf binutils-2.28.tar.gz
+mkdir binutils-build
+cd binutils-build
+../binutils-2.28/configure --target=i486-unknown-linux-gnu --prefix=$HOME/cross-compilers --disable-nls -v
+make all
+make check
+make install
+cd ..
+
+Compile abaos and libc tests with:
+
+setenv PATH "${PATH}:$HOME/cross-compilers"
+make clean all run-qemu CC='clang -target i386-pc-none-abi' LD=i486-unknown-linux-gnu-ld
+
+Links
+-----
+
+https://ftp.gnu.org/gnu/binutils/
+http://wiki.osdev.org/Target_Triplet
+http://wiki.osdev.org/GCC_Cross-Compiler