source: chumby/toolchain.sh @ 49

Revision 49, 2.6 KB checked in by sgk, 10 years ago (diff)

Toolchainをリビルドするスクリプト。

  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3DST="/usr/local/chumby"
4
5SDK="arm-linux-v4.1.2b.tar.gz"
6SDKSUM="9d63bec835d8ced1f22ae9001b0debfb"
7SDKURL="http://files.chumby.com/toolchain/arm-linux-v4.1.2b.tar.gz"
8
9BINUTILS="binutils-2.18.tar.bz2"
10BINUTILSSUM="9d22ee4dafa3a194457caf4706f9cf01"
11BINUTILSURL="http://core.ring.gr.jp/pub/GNU/binutils/binutils-2.18.tar.bz2"
12BINUTILSDIR="binutils-2.18"
13
14GCC="gcc-4.1.2.tar.bz2"
15GCCSUM="a4a3eb15c96030906d8494959eeda23c"
16GCCURL="http://core.ring.gr.jp/pub/GNU/gcc/gcc-4.1.2/gcc-4.1.2.tar.bz2"
17GCCDIR="gcc-4.1.2"
18#GCC="gcc-4.2.3.tar.bz2"
19#GCCSUM="ef2a4d9991b3644115456ea05b2b8163"
20#GCCURL="http://core.ring.gr.jp/pub/GNU/gcc/gcc-4.2.3/gcc-4.2.3.tar.bz2"
21#GCCDIR="gcc-4.2.3"
22
23if [ ! -d toolchain ]; then
24  mkdir toolchain
25fi
26cd toolchain
27
28download()
29{
30  echo "Checking \"$1\"..."
31  [ -f "$1" ] && [ `md5sum "$1" | awk '{print $1}'` != "$2" ] && rm -f "$1"
32  if [ ! -f "$1" ]; then
33    wget -O "$1" "$3"
34    if [ `md5sum "$1" | awk '{print $1}'` != "$2" ]; then
35      echo $1: checksum error
36      exit 1
37    fi
38  fi
39}
40
41download $SDK $SDKSUM $SDKURL
42download $BINUTILS $BINUTILSSUM $BINUTILSURL
43download $GCC $GCCSUM $GCCURL
44
45#
46#
47#
48
49SYSROOT="$DST/sysroot"
50
51echo "Extracting SDK..."
52rm -rf sdk
53mkdir sdk
54(
55  cd sdk
56  tar xzf "../$SDK"
57)
58
59echo "Collecting sysroot files..."
60echo "SUDOing to mkdir \"$DST\"; supply password if asked."
61sudo mkdir -p "$DST"
62sudo chown "`whoami`" "$DST"
63rm -rf "$SYSROOT"
64mkdir -p "$SYSROOT"
65
66cp -aT sdk/usr/arm-linux/lib "$SYSROOT/lib"
67mkdir "$SYSROOT/usr"
68cp -aT sdk/usr/arm-linux/include "$SYSROOT/usr/include"
69cp -aT sdk/usr/arm-linux/sys-include/asm-arm "$SYSROOT/usr/include/asm"
70cp -aT sdk/usr/arm-linux/sys-include/linux "$SYSROOT/usr/include/linux"
71cp -aT sdk/usr/arm-linux/sys-include/mtd "$SYSROOT/usr/include/mtd"
72cp -aT sdk/usr/arm-linux/sys-include/sound "$SYSROOT/usr/include/sound"
73ln -s .. "$SYSROOT/usr/arm-linux"
74ln -s ../lib "$SYSROOT/usr/lib"
75
76
77#
78#
79#
80
81echo "Extracting binutils..."
82rm -rf "$BINUTILSDIR"
83tar xjf "$BINUTILS"
84rm -rf binutils
85mkdir binutils
86(
87  cd binutils
88  echo "Configuring binutils..."
89  "../$BINUTILSDIR/configure" --prefix="$DST" --target=arm-linux --with-sysroot="$SYSROOT" 2>&1 > configure.log
90  echo "Building binutils..."
91  make 2>&1 > make.log
92  echo "Installing binutils..."
93  make install 2>&1 > install.log
94)
95
96echo "Extracting GCC..."
97rm -rf "$GCCDIR"
98tar xjf "$GCC"
99rm -rf gcc
100mkdir gcc
101(
102  cd gcc
103  echo "Configuring GCC..."
104  "../$GCCDIR/configure" --prefix="$DST" --target=arm-linux --enable-languages=c,c++ --with-sysroot="$SYSROOT" 2>&1 > configure.log
105  echo "Building GCC..."
106  make 2>&1 > make.log
107  echo "Installing GCC..."
108  make install 2>&1 > install.log
109)
Note: See TracBrowser for help on using the repository browser.