Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Ported palacios to Kbuild
[palacios.git] / scripts / toolchain / build-x86_64.sh
1 #!/bin/bash
2
3 # Cross-Compiler Toolchain for ${PLATFORM}
4 #  by Martin Decky <martin@decky.cz>
5 #
6 #  GPL'ed, copyleft
7 #
8
9
10 check_error() {
11     if [ "$1" -ne "0" ]; then
12         echo
13         echo "Script failed: $2"
14         exit
15     fi
16 }
17
18 BINUTILS_VERSION="2.17"
19 GCC_VERSION="4.1.1"
20
21 BINUTILS="binutils-${BINUTILS_VERSION}.tar.gz"
22 GCC_CORE="gcc-core-${GCC_VERSION}.tar.bz2"
23 GCC_CPP="gcc-g++-${GCC_VERSION}.tar.bz2"
24
25 BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/"
26 GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/"
27
28 PLATFORM="x86_64"
29 WORKDIR=`pwd`
30 TARGET="${PLATFORM}-linux-gnu"
31 PREFIX="/opt/toolchain/${PLATFORM}"
32 BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}"
33 GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
34 OBJDIR="${WORKDIR}/gcc-obj"
35
36 echo ">>> Downloading tarballs"
37
38 if [ ! -f "${BINUTILS}" ]; then
39     wget -c "${BINUTILS_SOURCE}${BINUTILS}"
40     check_error $? "Error downloading binutils."
41 fi
42 if [ ! -f "${GCC_CORE}" ]; then
43     wget -c "${GCC_SOURCE}${GCC_CORE}"
44     check_error $? "Error downloading GCC Core."
45 fi
46 if [ ! -f "${GCC_CPP}" ]; then
47     wget -c "${GCC_SOURCE}${GCC_CPP}"
48     check_error $? "Error downloading GCC C++."
49 fi
50
51 echo ">>> Creating destionation directory"
52 if [ ! -d "${PREFIX}" ]; then
53     mkdir -p "${PREFIX}" 
54     test -d "${PREFIX}"
55     check_error $? "Unable to create ${PREFIX}."
56 fi
57
58 echo ">>> Creating GCC work directory"
59 if [ ! -d "${OBJDIR}" ]; then
60     mkdir -p "${OBJDIR}"
61     test -d "${OBJDIR}"
62     check_error $? "Unable to create ${OBJDIR}."
63 fi
64
65 echo ">>> Unpacking tarballs"
66 tar -xvzf "${BINUTILS}"
67 check_error $? "Error unpacking binutils."
68 tar -xvjf "${GCC_CORE}"
69 check_error $? "Error unpacking GCC Core."
70 tar -xvjf "${GCC_CPP}"
71 check_error $? "Error unpacking GCC C++."
72
73 echo ">>> Compiling and installing binutils"
74 cd "${BINUTILSDIR}"
75 check_error $? "Change directory failed."
76 ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls"
77 check_error $? "Error configuring binutils."
78 make all install
79 check_error $? "Error compiling/installing binutils."
80
81 echo ">>> Compiling and installing GCC"
82 cd "${OBJDIR}"
83 check_error $? "Change directory failed."
84 "${GCCDIR}/configure" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c,c++ --disable-multilib --disable-libgcj --without-headers --disable-shared
85 check_error $? "Error configuring GCC."
86 PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
87 check_error $? "Error compiling/installing GCC."
88
89 echo
90 echo ">>> Cross-compiler for ${TARGET} installed."