-
Notifications
You must be signed in to change notification settings - Fork 1
/
toolchain.sh
executable file
·66 lines (56 loc) · 1.44 KB
/
toolchain.sh
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
#!/bin/sh
# The following is (probably) needed to create the toochain
# * GCC
# * G++
# * GNU Make
# * GNU Bison
# * Flex
# * GNU GMP
# * GNU MPFR
# * GNU MPC
# * Texinfo
# * git
# * xorriso
export PREFIX="$(pwd)/toolchain"
export TARGET=i686-elf
export BINUTILS=binutils-2.27
export GCC=gcc-4.9.4
mkdir -p toolchain
cd toolchain
# BINUTILS
wget http://ftpmirror.gnu.org/binutils/$BINUTILS.tar.gz
tar xzf $BINUTILS.tar.gz
mkdir -p build-binutils
cd build-binutils
../$BINUTILS/configure --target=$TARGET --prefix=$PREFIX --with-sysroot \
--disable-nls --disable-werror
make && make install
cd ..
# Test
export PATH=$PREFIX/bin:$PATH
which -- $TARGET-as || echo $TARGET-as is not in the PATH
# GCC
wget ftp://ftp.gnu.org/gnu/gcc/$GCC/$GCC.tar.gz
tar xzf $GCC.tar.gz
mkdir -p build-gcc
cd build-gcc
../$GCC/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
cd ..
# OBJCONV
git clone https://github.com/vertis/objconv.git
cd objconv
g++ -o objconv -O2 src/*.cpp
cp objconv $PREFIX/$TARGET/bin
cd ..
# GRUB
git clone git://git.savannah.gnu.org/grub.git
cd grub
./autogen.sh
mkdir - ../build-grub
cd ../build-grub
../grub/configure --disable-werror TARGET_CC=$TARGET-gcc TARGET_OBJCOPY=$TARGET-objcopy TARGET_STRIP=$TARGET-strip TARGET_NM=$TARGET-nm TARGET_RANLIB=$TARGET-ranlib --target=$TARGET --prefix=$PREFIX
make && make install