summaryrefslogtreecommitdiff
path: root/README.CrossCompiling
blob: 67b59574df1dcdba616a96db37db38b39dfdb4a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
Intro
-----

You can compile AbaOS from a 32-bit host or chroot (e.g. Arch32 chroot).
But you have to be extremly careful nothing from the host creeps into
the binaries.

You can also create a cross-compilation environment. Not, we don't need
a full fledged chain, linker and 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

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 ..

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

Links
-----

https://ftp.gnu.org/gnu/binutils/
http://wiki.osdev.org/Target_Triplet
http://wiki.osdev.org/GCC_Cross-Compiler