Mercurial > hg > aboriginal
annotate build.sh @ 18:eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
world program. There's probably a typo here somewhere, but the basics are
there.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 04 Dec 2006 20:30:51 -0500 |
parents | 1202bdb44025 |
children | c4e1bd04035d |
rev | line source |
---|---|
1
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
1 #!/bin/sh |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
2 |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
3 # Memo: How should I pass this in? |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
4 |
15
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
5 ARCH=armv4l |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
6 CLEANUP=echo #rm -rf |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
7 |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
8 if [ $ARCH == armv4l ] |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
9 then |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
10 KARCH=arm |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
11 # GCC_FLAGS="--with-float=soft" |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
12 fi |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
13 |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
14 if [ $ARCH = armv5l ] |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
15 then |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
16 KARCH=arm |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
17 GCC_FLAGS="--with-float=soft --without-fp --with-cpu=xscale" |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
18 # --target=armv5l-linux |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
19 fi |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
20 |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
21 if [ $ARCH == x86_64 ] |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
22 then |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
23 KARCH=$ARCH |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
24 GCC_FLAGS="-m64" |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
25 fi |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
26 |
1
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
27 function dienow() |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
28 { |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
29 echo "Exiting due to errors" |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
30 exit 1 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
31 } |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
32 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
33 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
34 function dotprogress() |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
35 { |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
36 x=0 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
37 while read i |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
38 do |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
39 x=$[$x + 1] |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
40 if [[ "$x" -eq 25 ]] |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
41 then |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
42 x=0 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
43 echo -n . |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
44 fi |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
45 done |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
46 echo |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
47 } |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
48 |
8
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
49 # Extract package $1, use work directory $2 (or $1 if no $2), use source |
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
50 # directory $3 (or $1 if no $3) |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
51 |
1
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
52 function setupfor() |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
53 { |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
54 echo "=== Building $1" |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
55 echo -n "Extracting" |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
56 cd "${WORK}" && |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
57 { tar xvjf "${SOURCES}/${STAGE}/$1".tar.bz2 || dienow |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
58 } | dotprogress |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
59 if [ -z "$2" ] |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
60 then |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
61 cd "$1"* || dienow |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
62 else |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
63 mkdir "$2" |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
64 cd "$2" || dienow |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
65 fi |
8
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
66 export CURSRC="$1" |
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
67 [ ! -z "$3" ] && CURSRC="$3" |
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
68 export CURSRC=`echo "${WORK}/${CURSRC}"*` |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
69 [ ! -d "${CURSRC}" ] && dienow |
1
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
70 } |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
71 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
72 # Setup |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
73 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
74 umask 022 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
75 unset CFLAGS CXXFLAGS |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
76 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
77 # Find/create directories |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
78 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
79 TOP=`pwd` |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
80 export SOURCES="${TOP}/sources" |
8
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
81 export CROSS="${TOP}/build/cross-compiler/" |
1
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
82 export WORK="${TOP}/build/temp" |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
83 mkdir -p "${CROSS}" "${WORK}" |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
84 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
85 [ $? -ne 0 ] && dienow |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
86 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
87 # For bash: check the $PATH for new executables added after startup. |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
88 set +h |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
89 # Put the cross compiler in the path |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
90 export PATH=${CROSS}/bin:/bin:/usr/bin |
1
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
91 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
92 # Which platform are we building for? |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
93 |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
94 export CROSS_HOST=i686-pc-linux-gnu |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
95 export CROSS_TARGET=${ARCH}-unknown-linux-gnu |
1
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
96 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
97 export STAGE=build-cross |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
98 |
18
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
99 # Install the linux kernel headers. |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
100 |
9
6cd344d090de
Switch in make headers_install, fix the uclibc cleanup stage to actually work,
Rob Landley <rob@landley.net>
parents:
8
diff
changeset
|
101 setupfor linux |
15
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
102 make headers_install ARCH="${KARCH}" INSTALL_HDR_PATH="${CROSS}" |
1
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
103 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
104 [ $? -ne 0 ] && dienow |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
105 |
18
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
106 # Build and install binutils |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
107 |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
108 setupfor binutils build-binutils |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
109 "${CURSRC}/configure" --prefix="${CROSS}" --host=${CROSS_HOST} \ |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
110 --target=${CROSS_TARGET} --with-lib-path=lib --disable-nls \ |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
111 --disable-shared --enable-64-bit-bfd --disable-multilib && |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
112 make configure-host && |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
113 make && |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
114 make install && |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
115 cd .. && |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
116 cp binutils-*/include/libiberty.h "${CROSS}/include" && |
15
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
117 $CLEANUP binutils-* build-binutils |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
118 |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
119 [ $? -ne 0 ] && dienow |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
120 |
18
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
121 # Build and install gcc |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
122 |
8
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
123 setupfor gcc-core build-gcc gcc- |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
124 "${CURSRC}/configure" --prefix="${CROSS}" --host=${CROSS_HOST} \ |
15
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
125 --target=${CROSS_TARGET} \ |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
126 --disable-multilib --disable-nls --disable-shared $GCC_FLAGS \ |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
127 --disable-threads --enable-languages=c |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
128 #--with-local-prefix="${CROSS}" \ |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
129 # --enable-languages=c,c++ --enable-__cxa_atexit --enable-c99 \ |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
130 # --enable-long-long --enable-threads=posix && |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
131 make all-gcc && |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
132 make install-gcc && |
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
133 cd .. && |
18
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
134 |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
135 # Move the gcc internal libraries and headers somewhere sane. |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
136 |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
137 mkdir -p "${CROSS}"gcc && |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
138 mv "${CROSS}"lib/gcc/*/*/include "${CROSS}"gcc/include && |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
139 mv "${CROSS}"lib/gcc/*/* "${CROSS}"gcc/lib && |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
140 $CLEANUP "${CURSRC}" build-gcc "${CROSS}"lib/gcc "${CROSS}"gcc/lib/install-tools |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
141 |
8
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
142 [ $? -ne 0 ] && dienow |
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
143 |
18
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
144 # Build and install uClibc |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
145 |
8
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
146 setupfor uClibc |
15
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
147 make TARGET_ARCH=${KARCH} CROSS=${CROSS_TARGET}- defconfig && |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
148 make TARGET_ARCH=${KARCH} CROSS=${CROSS_TARGET}- KERNEL_SOURCE="${CROSS}" && |
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
149 make TARGET_ARCH=${KARCH} CROSS=${CROSS_TARGET}- utils && |
8
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
150 # The kernel headers are already installed, but uClibc's install will try to |
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
151 # be "helpful" and copy them over themselves, at which point hilarity ensues. |
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
152 # Make it not do that. |
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
153 rm include/{asm,asm-generic,linux} && |
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
154 make RUNTIME_PREFIX="${CROSS}" DEVEL_PREFIX="${CROSS}" \ |
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
155 install_runtime install_dev && |
0068264ad65a
Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents:
3
diff
changeset
|
156 cd .. && |
15
11b76d1cc1cd
Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents:
9
diff
changeset
|
157 $CLEANUP uClibc-* |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
158 |
18
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
159 [ $? -ne 0 ] && dienow |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
160 |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
161 # Build and install gcc wrapper script. |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
162 |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
163 mkdir -p "${CROSS}"gcc |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
164 mv "${CROSS}"lib/gcc/*/*/include "${CROSS}"gcc/include |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
165 mv "${CROSS}"lib/gcc/*/* "${CROSS}"gcc/lib |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
166 $CLEANUP -rf "${CROSS}"lib/gcc "${CROSS}"gcc/lib/install-tools |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
167 GCCNAME="$(echo "${CROSS}"bin/*-gcc)" && |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
168 mv "$GCCNAME" "${CROSS}"bin/gcc-unwrapped && |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
169 gcc sources/toys/gcc-uClibc.c -Os -s -o "$GCCNAME" && |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
170 |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
171 # A quick hello world program to test the cross-compiler out. |
17
1202bdb44025
Build for the wrapper script. (Which still doesn't work right.)
Rob Landley <rob@landley.net>
parents:
15
diff
changeset
|
172 |
18
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
173 cat > "$WORK"/hello.c << 'EOF' && |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
174 #include <stdio.h> |
17
1202bdb44025
Build for the wrapper script. (Which still doesn't work right.)
Rob Landley <rob@landley.net>
parents:
15
diff
changeset
|
175 |
18
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
176 int main(int argc, char *argv[]) |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
177 { |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
178 printf("Hello world!\n"); |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
179 return 0; |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
180 } |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
181 EOF |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
182 |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
183 # Build something dynamic, then static, to verify header/library paths. |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
184 |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
185 "$GCCNAME" -Os "$WORK"/hello.c -o "$WORK"/hello && |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
186 "$GCCNAME" -Os -static "$WORK"/hello.c -o "$WORK"/hello |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
187 [ x`qemu-${KARCH} hello` == x"Hello world!" ] && |
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
188 echo Cross-toolchain seems to work. |
17
1202bdb44025
Build for the wrapper script. (Which still doesn't work right.)
Rob Landley <rob@landley.net>
parents:
15
diff
changeset
|
189 |
3
1b721a51e9c6
Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents:
1
diff
changeset
|
190 [ $? -ne 0 ] && dienow |
18
eaf7a8d5e697
Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents:
17
diff
changeset
|
191 |