annotate cross-compiler.sh @ 301:309b574a5059

Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a package build breaks its source isn't deleted), and comment host-tools.sh more.
author Rob Landley <rob@landley.net>
date Thu, 21 Feb 2008 04:47:54 -0600
parents 87df194d555d
children 7f529baf0b57
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
175
6fd189c18c1c Three things: 1) dash->bash, 2) install cross-ldd and cross-readelf,
Rob Landley <rob@landley.net>
parents: 147
diff changeset
1 #!/bin/bash
1
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
2
34
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents: 33
diff changeset
3 # Get lots of predefined environment variables and shell functions.
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
4
34
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents: 33
diff changeset
5 source include.sh
1
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
6
96
137ba51ee993 Delete output directories on re-run, teach build to log and build multiple
Rob Landley <rob@landley.net>
parents: 93
diff changeset
7 rm -rf "${CROSS}"
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 39
diff changeset
8 mkdir -p "${CROSS}" || dienow
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 39
diff changeset
9
47
edaa86240321 Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents: 41
diff changeset
10 # Orange
edaa86240321 Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents: 41
diff changeset
11 echo -e "\e[33m"
edaa86240321 Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents: 41
diff changeset
12
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
13 # 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
14
250
cef5bbd777fa Make sure error return from setupfor is noticed.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
15 setupfor binutils build-binutils &&
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
16 "${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
17 --target=${CROSS_TARGET} --with-lib-path=lib --disable-nls \
59
18c065749b79 Add i686 and x86_64 config files. (Might or might not work, dunno.)
Rob Landley <rob@landley.net>
parents: 48
diff changeset
18 --disable-shared --disable-multilib --program-prefix="${ARCH}-" \
18c065749b79 Add i686 and x86_64 config files. (Might or might not work, dunno.)
Rob Landley <rob@landley.net>
parents: 48
diff changeset
19 $BINUTILS_FLAGS &&
293
cdd26f8acc35 Update to gcc 4.1.2->4.2.2. Still doesn't fix the internal compiler error
Rob Landley <rob@landley.net>
parents: 287
diff changeset
20 make -j $CPUS configure-host &&
182
fc827ab6166f Autodetect number of processors and feed appropriate -j to make.
Rob Landley <rob@landley.net>
parents: 175
diff changeset
21 make -j $CPUS &&
293
cdd26f8acc35 Update to gcc 4.1.2->4.2.2. Still doesn't fix the internal compiler error
Rob Landley <rob@landley.net>
parents: 287
diff changeset
22 make -j $CPUS install &&
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
23 cd .. &&
33
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
24 mkdir -p "${CROSS}/include" &&
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 294
diff changeset
25 cp binutils/include/libiberty.h "${CROSS}/include"
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
26
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 294
diff changeset
27 cleanup binutils build-binutils
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
28
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
29 # 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
30
250
cef5bbd777fa Make sure error return from setupfor is noticed.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
31 setupfor gcc-core build-gcc &&
59
18c065749b79 Add i686 and x86_64 config files. (Might or might not work, dunno.)
Rob Landley <rob@landley.net>
parents: 48
diff changeset
32 AR_FOR_TARGET="${ARCH}-ar" "${CURSRC}/configure" $GCC_FLAGS \
18c065749b79 Add i686 and x86_64 config files. (Might or might not work, dunno.)
Rob Landley <rob@landley.net>
parents: 48
diff changeset
33 --prefix="${CROSS}" --host=${CROSS_HOST} --target=${CROSS_TARGET} \
18c065749b79 Add i686 and x86_64 config files. (Might or might not work, dunno.)
Rob Landley <rob@landley.net>
parents: 48
diff changeset
34 --enable-languages=c --disable-threads --disable-multilib \
120
c91ceb05bc1c Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents: 112
diff changeset
35 --disable-nls --disable-shared --program-prefix="${ARCH}-" &&
183
d2a27709d3b6 Fixup the -j stuff to actually work. (typo in gcc, and uClibc can't use it.)
Rob Landley <rob@landley.net>
parents: 182
diff changeset
36 make -j $CPUS all-gcc &&
293
cdd26f8acc35 Update to gcc 4.1.2->4.2.2. Still doesn't fix the internal compiler error
Rob Landley <rob@landley.net>
parents: 287
diff changeset
37 make -j $CPUS install-gcc &&
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
38 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
39
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 39
diff changeset
40 echo Fixup toolchain... &&
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 39
diff changeset
41
136
8c3d95f52237 Some tweaks to make toolchain debugging easier.
Rob Landley <rob@landley.net>
parents: 131
diff changeset
42 # Write this out as a script snippet for debugging purposes.
8c3d95f52237 Some tweaks to make toolchain debugging easier.
Rob Landley <rob@landley.net>
parents: 131
diff changeset
43
8c3d95f52237 Some tweaks to make toolchain debugging easier.
Rob Landley <rob@landley.net>
parents: 131
diff changeset
44 cat > fixup-toolchain.sh << EOF &&
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
45 # 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
46
21
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
47 mkdir -p "${CROSS}"/gcc &&
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
48 mv "${CROSS}"/lib/gcc/*/*/include "${CROSS}"/gcc/include &&
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
49 mv "${CROSS}"/lib/gcc/*/* "${CROSS}"/gcc/lib &&
257
d37e39370d39 Fix cross compiler toolchain to be properly relocatable on x86-64 host.
Rob Landley <rob@landley.net>
parents: 250
diff changeset
50 ln -s ${CROSS_TARGET} ${CROSS}/tools &&
d37e39370d39 Fix cross compiler toolchain to be properly relocatable on x86-64 host.
Rob Landley <rob@landley.net>
parents: 250
diff changeset
51 ln -sf ../../../../tools/bin/ld ${CROSS}/libexec/gcc/*/*/collect2 &&
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 294
diff changeset
52 rm -rf "${CROSS}"/{lib/gcc,gcc/lib/install-tools} &&
21
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
53
61
eb42ad9e8f81 Shuffle comments around.
Rob Landley <rob@landley.net>
parents: 59
diff changeset
54 # Build and install gcc wrapper script.
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 39
diff changeset
55
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 39
diff changeset
56 cd "${CROSS}"/bin &&
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 39
diff changeset
57 mv "${ARCH}-gcc" gcc-unwrapped &&
110
62f6268ff61b Build uClibc's readelf and ldd by hand to work around inadequate cross-compile
Rob Landley <rob@landley.net>
parents: 96
diff changeset
58 $CC -Os -s "${TOP}"/sources/toys/gcc-uClibc.c -o "${ARCH}-gcc"
136
8c3d95f52237 Some tweaks to make toolchain debugging easier.
Rob Landley <rob@landley.net>
parents: 131
diff changeset
59 EOF
8c3d95f52237 Some tweaks to make toolchain debugging easier.
Rob Landley <rob@landley.net>
parents: 131
diff changeset
60
8c3d95f52237 Some tweaks to make toolchain debugging easier.
Rob Landley <rob@landley.net>
parents: 131
diff changeset
61 # Run toolchain fixup and cleanup
8c3d95f52237 Some tweaks to make toolchain debugging easier.
Rob Landley <rob@landley.net>
parents: 131
diff changeset
62
8c3d95f52237 Some tweaks to make toolchain debugging easier.
Rob Landley <rob@landley.net>
parents: 131
diff changeset
63 chmod +x fixup-toolchain.sh &&
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 294
diff changeset
64 ./fixup-toolchain.sh
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
65
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 294
diff changeset
66 cleanup "${CURSRC}" build-gcc
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
67
283
8b70223188d8 Set up symlinks for distcc to use.
Rob Landley <rob@landley.net>
parents: 257
diff changeset
68 # Set up symlinks for distcc
8b70223188d8 Set up symlinks for distcc to use.
Rob Landley <rob@landley.net>
parents: 257
diff changeset
69
8b70223188d8 Set up symlinks for distcc to use.
Rob Landley <rob@landley.net>
parents: 257
diff changeset
70 mkdir -p "${CROSS}/distcc" &&
287
75033cdf4c1c Fix to make the distcc symlinks correctly.
Rob Landley <rob@landley.net>
parents: 283
diff changeset
71 ln -s ../bin/gcc-unwrapped "${CROSS}/distcc/cc" &&
75033cdf4c1c Fix to make the distcc symlinks correctly.
Rob Landley <rob@landley.net>
parents: 283
diff changeset
72 ln -s ../bin/gcc-unwrapped "${CROSS}/distcc/gcc"
283
8b70223188d8 Set up symlinks for distcc to use.
Rob Landley <rob@landley.net>
parents: 257
diff changeset
73
8b70223188d8 Set up symlinks for distcc to use.
Rob Landley <rob@landley.net>
parents: 257
diff changeset
74 [ $? -ne 0 ] && dienow
8b70223188d8 Set up symlinks for distcc to use.
Rob Landley <rob@landley.net>
parents: 257
diff changeset
75
85
7c874da5505c Switch config-linux to miniconfig-linux. Adjust the build and config scripts,
Rob Landley <rob@landley.net>
parents: 83
diff changeset
76 # Install kernel headers.
33
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
77
250
cef5bbd777fa Make sure error return from setupfor is noticed.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
78 setupfor linux &&
33
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
79 # Install Linux kernel headers (for use by uClibc).
182
fc827ab6166f Autodetect number of processors and feed appropriate -j to make.
Rob Landley <rob@landley.net>
parents: 175
diff changeset
80 make -j $CPUS headers_install ARCH="${KARCH}" INSTALL_HDR_PATH="${CROSS}" &&
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 294
diff changeset
81 cd ..
33
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
82
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 294
diff changeset
83 cleanup linux
33
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
84
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
85 # 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
86
250
cef5bbd777fa Make sure error return from setupfor is noticed.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
87 setupfor uClibc &&
147
711eb6884b54 uClibc uses CROSS for different things than we do, so blank it when not
Rob Landley <rob@landley.net>
parents: 144
diff changeset
88 make CROSS= allnoconfig KCONFIG_ALLCONFIG="${WORK}"/miniconfig-uClibc &&
183
d2a27709d3b6 Fixup the -j stuff to actually work. (typo in gcc, and uClibc can't use it.)
Rob Landley <rob@landley.net>
parents: 182
diff changeset
89 # Can't use -j here, build is unstable.
66
57f77c25b39d Hit uClibc build with a large rock so it stops inserting hardwired paths in
Rob Landley <rob@landley.net>
parents: 61
diff changeset
90 make CROSS="${ARCH}-" KERNEL_HEADERS="${CROSS}/include" PREFIX="${CROSS}/" \
183
d2a27709d3b6 Fixup the -j stuff to actually work. (typo in gcc, and uClibc can't use it.)
Rob Landley <rob@landley.net>
parents: 182
diff changeset
91 RUNTIME_PREFIX=/ DEVEL_PREFIX=/ all install_runtime install_dev &&
110
62f6268ff61b Build uClibc's readelf and ldd by hand to work around inadequate cross-compile
Rob Landley <rob@landley.net>
parents: 96
diff changeset
92 # "make utils" in uClibc is broken for cross compiling. Either it creates a
62f6268ff61b Build uClibc's readelf and ldd by hand to work around inadequate cross-compile
Rob Landley <rob@landley.net>
parents: 96
diff changeset
93 # target binary (which you can't run on the host), or it tries to link the
62f6268ff61b Build uClibc's readelf and ldd by hand to work around inadequate cross-compile
Rob Landley <rob@landley.net>
parents: 96
diff changeset
94 # host binary against the target library, and use the target compiler flags
62f6268ff61b Build uClibc's readelf and ldd by hand to work around inadequate cross-compile
Rob Landley <rob@landley.net>
parents: 96
diff changeset
95 # (neither of which is going to produce a working host binary). The solution
62f6268ff61b Build uClibc's readelf and ldd by hand to work around inadequate cross-compile
Rob Landley <rob@landley.net>
parents: 96
diff changeset
96 # is to bypass the broken build entirely, and do it by hand.
147
711eb6884b54 uClibc uses CROSS for different things than we do, so blank it when not
Rob Landley <rob@landley.net>
parents: 144
diff changeset
97 make CROSS= distclean &&
711eb6884b54 uClibc uses CROSS for different things than we do, so blank it when not
Rob Landley <rob@landley.net>
parents: 144
diff changeset
98 make CROSS= allnoconfig &&
120
c91ceb05bc1c Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents: 112
diff changeset
99 make CROSS= headers KERNEL_HEADERS=/usr/include &&
175
6fd189c18c1c Three things: 1) dash->bash, 2) install cross-ldd and cross-readelf,
Rob Landley <rob@landley.net>
parents: 147
diff changeset
100 $CC -Os -s -I include utils/readelf.c -o "${CROSS}/bin/${ARCH}-readelf" &&
6fd189c18c1c Three things: 1) dash->bash, 2) install cross-ldd and cross-readelf,
Rob Landley <rob@landley.net>
parents: 147
diff changeset
101 $CC -Os -s -I ldso/include utils/ldd.c -o "${CROSS}/bin/${ARCH}-ldd" &&
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 294
diff changeset
102 cd ..
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
103
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 294
diff changeset
104 cleanup uClibc
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
105
38
297bb57cf74c Apparently "" around EOF also disables variable substitution, not just ''.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
106 cat > "${CROSS}"/README << EOF &&
33
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
107 Cross compiler for $ARCH
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
108 From http://landley.net/code/firmware
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
109
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 39
diff changeset
110 To use: Add the "bin" directory to your \$PATH, and use "$ARCH-gcc" as
33
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
111 your compiler.
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
112
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
113 The syntax used to build the Linux kernel is:
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
114
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 39
diff changeset
115 make ARCH=${KARCH} CROSS_COMPILE=${ARCH}-
33
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
116
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
117 EOF
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
118
48
0f77e2472d27 Strip binaries.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
119 # Strip everything
0f77e2472d27 Strip binaries.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
120
0f77e2472d27 Strip binaries.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
121 cd "$CROSS"
0f77e2472d27 Strip binaries.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
122 for i in `find bin -type f` `find "$CROSS_TARGET" -type f`
0f77e2472d27 Strip binaries.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
123 do
0f77e2472d27 Strip binaries.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
124 strip "$i" 2> /dev/null
0f77e2472d27 Strip binaries.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
125 done
0f77e2472d27 Strip binaries.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
126 #for i in `find lib -type f` `find gcc/lib -type f`
0f77e2472d27 Strip binaries.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
127 #do
0f77e2472d27 Strip binaries.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
128 # "${ARCH}-strip" "$i" 2> /dev/null
0f77e2472d27 Strip binaries.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
129 #done
0f77e2472d27 Strip binaries.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
130
75
38e7e0cc3b9f Build mksquashfs in the non-short cross-compiler, and use it at the end of
Rob Landley <rob@landley.net>
parents: 66
diff changeset
131 echo -n creating "build/cross-compiler-${ARCH}".tar.bz2 &&
38e7e0cc3b9f Build mksquashfs in the non-short cross-compiler, and use it at the end of
Rob Landley <rob@landley.net>
parents: 66
diff changeset
132 cd "${BUILD}"
38e7e0cc3b9f Build mksquashfs in the non-short cross-compiler, and use it at the end of
Rob Landley <rob@landley.net>
parents: 66
diff changeset
133 { tar cjvf "cross-compiler-${ARCH}".tar.bz2 cross-compiler-"${ARCH}" || dienow
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 39
diff changeset
134 } | dotprogress
33
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
135
bf2e771f4ba5 Update build script. Now uses a config file (usage: ./build.sh arch), and
Rob Landley <rob@landley.net>
parents: 27
diff changeset
136 [ $? -ne 0 ] && dienow
39
c12b04caa0c1 Apparently, the exit value of a successful build is 1 because [ $? -ne 0 ]
Rob Landley <rob@landley.net>
parents: 38
diff changeset
137
93
153ba1a0b427 Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents: 88
diff changeset
138 # A quick hello world program to test the cross-compiler out.
153ba1a0b427 Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents: 88
diff changeset
139 # Build hello.c dynamic, then static, to verify header/library paths.
153ba1a0b427 Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents: 88
diff changeset
140
175
6fd189c18c1c Three things: 1) dash->bash, 2) install cross-ldd and cross-readelf,
Rob Landley <rob@landley.net>
parents: 147
diff changeset
141 echo "Sanity test: building Hello World."
6fd189c18c1c Three things: 1) dash->bash, 2) install cross-ldd and cross-readelf,
Rob Landley <rob@landley.net>
parents: 147
diff changeset
142
93
153ba1a0b427 Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents: 88
diff changeset
143 "${ARCH}-gcc" -Os "${SOURCES}/toys/hello.c" -o "$WORK"/hello &&
153ba1a0b427 Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents: 88
diff changeset
144 "${ARCH}-gcc" -Os -static "${SOURCES}/toys/hello.c" -o "$WORK"/hello &&
144
8c7bcb36dcf5 Fix typo in path name.
Rob Landley <rob@landley.net>
parents: 143
diff changeset
145 if which qemu-"${QEMU_TEST}" > /dev/null
143
17d06149802e Only run the sanity check on the toolchain if the appropriate qemu is installed.
Rob Landley <rob@landley.net>
parents: 136
diff changeset
146 then
17d06149802e Only run the sanity check on the toolchain if the appropriate qemu is installed.
Rob Landley <rob@landley.net>
parents: 136
diff changeset
147 [ x"$(qemu-"${QEMU_TEST}" "${WORK}"/hello)" == x"Hello world!" ] &&
17d06149802e Only run the sanity check on the toolchain if the appropriate qemu is installed.
Rob Landley <rob@landley.net>
parents: 136
diff changeset
148 echo Cross-toolchain seems to work.
17d06149802e Only run the sanity check on the toolchain if the appropriate qemu is installed.
Rob Landley <rob@landley.net>
parents: 136
diff changeset
149 fi
93
153ba1a0b427 Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents: 88
diff changeset
150
153ba1a0b427 Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents: 88
diff changeset
151 [ $? -ne 0 ] && dienow
153ba1a0b427 Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents: 88
diff changeset
152
47
edaa86240321 Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents: 41
diff changeset
153 echo -e "\e[32mCross compiler toolchain build complete.\e[0m"