Mercurial > hg > aboriginal
comparison root-filesystem.sh @ 713:9282f84b31a1
Add NATIVE_TOOLCHAIN=only, to build _just_ the native toolchain (sae set of packages as the cross compiler, only --enable-shared and with uClibc++).
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 10 Apr 2009 03:32:41 -0500 |
parents | 20ba34b54140 |
children | db04bd3c11e0 |
comparison
equal
deleted
inserted
replaced
712:9d766670154a | 713:9282f84b31a1 |
---|---|
31 mkdir -p "$TOOLS/$i" || dienow | 31 mkdir -p "$TOOLS/$i" || dienow |
32 ln -s "usr/$i" "${NATIVE_ROOT}/$i" || dienow | 32 ln -s "usr/$i" "${NATIVE_ROOT}/$i" || dienow |
33 done | 33 done |
34 fi | 34 fi |
35 | 35 |
36 # Copy qemu setup script and so on. | |
37 | |
38 cp -r "${SOURCES}/native/." "${TOOLS}/" && | |
39 cp "$SRCDIR"/MANIFEST "${TOOLS}/src" || dienow | |
40 | |
41 if [ -z "${NATIVE_TOOLSDIR}" ] | |
42 then | |
43 sed -i -e 's@/tools/@/usr/@g' "${TOOLS}/sbin/init.sh" || dienow | |
44 fi | |
45 | |
46 # Install Linux kernel headers. | 36 # Install Linux kernel headers. |
47 | 37 |
48 setupfor linux | 38 setupfor linux |
49 # Install Linux kernel headers (for use by uClibc). | 39 # Install Linux kernel headers (for use by uClibc). |
50 make headers_install -j "$CPUS" ARCH="${KARCH}" INSTALL_HDR_PATH="${TOOLS}" && | 40 make headers_install -j "$CPUS" ARCH="${KARCH}" INSTALL_HDR_PATH="${TOOLS}" && |
57 # Build and install uClibc. (We could just copy the one from the compiler | 47 # Build and install uClibc. (We could just copy the one from the compiler |
58 # toolchain, but this is cleaner.) | 48 # toolchain, but this is cleaner.) |
59 | 49 |
60 setupfor uClibc | 50 setupfor uClibc |
61 make CROSS="${ARCH}-" KCONFIG_ALLCONFIG="$(getconfig uClibc)" allnoconfig && | 51 make CROSS="${ARCH}-" KCONFIG_ALLCONFIG="$(getconfig uClibc)" allnoconfig && |
62 cp .config "${TOOLS}"/src/config-uClibc || dienow | 52 cp .config "${WORK}"/config-uClibc || dienow |
63 | 53 |
64 # Alas, if we feed install and install_utils to make at the same time with | 54 # Alas, if we feed install and install_utils to make at the same time with |
65 # -j > 1, it dies. Not SMP safe. | 55 # -j > 1, it dies. Not SMP safe. |
66 for i in install install_utils | 56 for i in install install_utils |
67 do | 57 do |
71 UCLIBC_LDSO_NAME=ld-uClibc -j $CPUS $i || dienow | 61 UCLIBC_LDSO_NAME=ld-uClibc -j $CPUS $i || dienow |
72 done | 62 done |
73 cd .. | 63 cd .. |
74 | 64 |
75 cleanup uClibc | 65 cleanup uClibc |
76 | |
77 # Build and install toybox | |
78 | |
79 setupfor toybox | |
80 make defconfig && | |
81 if [ -z "$USE_TOYBOX" ] | |
82 then | |
83 make CROSS="${ARCH}-" && | |
84 cp toybox "$TOOLS/bin" && | |
85 ln -s toybox "$TOOLS/bin/patch" && | |
86 ln -s toybox "$TOOLS/bin/oneit" && | |
87 ln -s toybox "$TOOLS/bin/netcat" && | |
88 cd .. | |
89 else | |
90 make install_flat PREFIX="${TOOLS}"/bin CROSS="${ARCH}-" && | |
91 rm "${TOOLS}"/bin/sh && # Bash won't install if this exists. | |
92 cd .. | |
93 fi | |
94 | |
95 cleanup toybox | |
96 | |
97 # Build and install busybox | |
98 | |
99 setupfor busybox | |
100 make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" && | |
101 make -j $CPUS CROSS_COMPILE="${ARCH}-" $VERBOSITY && | |
102 make busybox.links && | |
103 cp busybox "${TOOLS}/bin" | |
104 | |
105 [ $? -ne 0 ] && dienow | |
106 | |
107 for i in $(sed 's@.*/@@' busybox.links) | |
108 do | |
109 ln -s busybox "${TOOLS}/bin/$i" # || dienow | |
110 done | |
111 cd .. | |
112 | |
113 cleanup busybox | |
114 | 66 |
115 if [ "$NATIVE_TOOLCHAIN" == "none" ] | 67 if [ "$NATIVE_TOOLCHAIN" == "none" ] |
116 then | 68 then |
117 # If we're not installing a compiler, delete the headers, static libs, | 69 # If we're not installing a compiler, delete the headers, static libs, |
118 # and example source code. | 70 # and example source code. |
229 ln -s libuClibc++.a "${TOOLS}"/lib/libstdc++.a && | 181 ln -s libuClibc++.a "${TOOLS}"/lib/libstdc++.a && |
230 cd .. | 182 cd .. |
231 | 183 |
232 cleanup uClibc++ | 184 cleanup uClibc++ |
233 | 185 |
186 fi # End of NATIVE_TOOLCHAIN build | |
187 | |
188 if [ "$NATIVE_TOOLCHAIN" != "only" ] | |
189 then | |
190 | |
191 # Copy qemu setup script and so on. | |
192 | |
193 cp -r "${SOURCES}/native/." "${TOOLS}/" && | |
194 cp "$SRCDIR"/MANIFEST "${TOOLS}/src" && | |
195 cp "${WORK}/config-uClibc" "${TOOLS}/src/config-uClibc" || dienow | |
196 | |
197 if [ -z "${NATIVE_TOOLSDIR}" ] | |
198 then | |
199 sed -i -e 's@/tools/@/usr/@g' "${TOOLS}/sbin/init.sh" || dienow | |
200 fi | |
201 | |
202 # Build and install toybox | |
203 | |
204 setupfor toybox | |
205 make defconfig && | |
206 if [ -z "$USE_TOYBOX" ] | |
207 then | |
208 make CROSS="${ARCH}-" && | |
209 cp toybox "$TOOLS/bin" && | |
210 ln -s toybox "$TOOLS/bin/patch" && | |
211 ln -s toybox "$TOOLS/bin/oneit" && | |
212 ln -s toybox "$TOOLS/bin/netcat" && | |
213 cd .. | |
214 else | |
215 make install_flat PREFIX="${TOOLS}"/bin CROSS="${ARCH}-" && | |
216 cd .. | |
217 fi | |
218 | |
219 cleanup toybox | |
220 | |
221 # Build and install busybox | |
222 | |
223 setupfor busybox | |
224 make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" && | |
225 cp .config "${TOOLS}"/src/config-busybox && | |
226 make -j $CPUS CROSS_COMPILE="${ARCH}-" $VERBOSITY && | |
227 make busybox.links && | |
228 cp busybox "${TOOLS}/bin" | |
229 | |
230 [ $? -ne 0 ] && dienow | |
231 | |
232 for i in $(sed 's@.*/@@' busybox.links) | |
233 do | |
234 # Allowed to fail. | |
235 ln -s busybox "${TOOLS}/bin/$i" 2>/dev/null | |
236 done | |
237 cd .. | |
238 | |
239 cleanup busybox | |
240 | |
234 # Build and install make | 241 # Build and install make |
235 | 242 |
236 setupfor make | 243 setupfor make |
237 CC="${ARCH}-gcc" ./configure --prefix="${TOOLS}" --build="${CROSS_HOST}" \ | 244 CC="${ARCH}-gcc" ./configure --prefix="${TOOLS}" --build="${CROSS_HOST}" \ |
238 --host="${CROSS_TARGET}" && | 245 --host="${CROSS_TARGET}" && |
240 make -j $CPUS install && | 247 make -j $CPUS install && |
241 cd .. | 248 cd .. |
242 | 249 |
243 cleanup make | 250 cleanup make |
244 | 251 |
245 # Remove the busybox /bin/sh link so the bash install doesn't get upset. | 252 # Build and install bash. (Yes, this is an old version. It's intentional.) |
246 | |
247 rm "$TOOLS"/bin/sh | |
248 | |
249 # Build and install bash. (Yes, this is an old version. I prefer it.) | |
250 # I plan to replace it with toysh anyway. | |
251 | 253 |
252 setupfor bash | 254 setupfor bash |
255 # Remove existing /bin/sh link (busybox) so the bash install doesn't get upset. | |
256 #rm "$TOOLS"/bin/sh | |
253 # wire around some tests ./configure can't run when cross-compiling. | 257 # wire around some tests ./configure can't run when cross-compiling. |
254 cat > config.cache << EOF && | 258 cat > config.cache << EOF && |
255 ac_cv_func_setvbuf_reversed=no | 259 ac_cv_func_setvbuf_reversed=no |
256 bash_cv_sys_named_pipes=yes | 260 bash_cv_sys_named_pipes=yes |
257 bash_cv_have_mbstate_t=yes | 261 bash_cv_have_mbstate_t=yes |
262 --without-bash-malloc --disable-readline && | 266 --without-bash-malloc --disable-readline && |
263 # note: doesn't work with -j | 267 # note: doesn't work with -j |
264 make && | 268 make && |
265 make install && | 269 make install && |
266 # Make bash the default shell. | 270 # Make bash the default shell. |
267 ln -s bash "${TOOLS}/bin/sh" && | 271 ln -sf bash "${TOOLS}/bin/sh" && |
268 cd .. | 272 cd .. |
269 | 273 |
270 cleanup bash | 274 cleanup bash |
271 | 275 |
272 setupfor distcc | 276 setupfor distcc |
285 cleanup distcc | 289 cleanup distcc |
286 | 290 |
287 # Put statically and dynamically linked hello world programs on there for | 291 # Put statically and dynamically linked hello world programs on there for |
288 # test purposes. | 292 # test purposes. |
289 | 293 |
290 "${ARCH}-gcc" "${SOURCES}/toys/hello.c" -Os -s -o "${TOOLS}/bin/hello-dynamic" && | 294 "${ARCH}-gcc" "${SOURCES}/toys/hello.c" -Os -s -o "${TOOLS}/bin/hello-dynamic" && |
291 "${ARCH}-gcc" "${SOURCES}/toys/hello.c" -Os -s -static -o "${TOOLS}/bin/hello-static" | 295 "${ARCH}-gcc" "${SOURCES}/toys/hello.c" -Os -s -static -o "${TOOLS}/bin/hello-static" |
292 | 296 |
293 [ $? -ne 0 ] && dienow | 297 [ $? -ne 0 ] && dienow |
294 | 298 |
299 fi # End of NATIVE_TOOLCHAIN != only | |
300 | |
295 # Delete some unneeded files | 301 # Delete some unneeded files |
296 | 302 |
297 rm -rf "${TOOLS}"/{info,man,libexec/gcc/*/*/install-tools} | 303 rm -rf "${TOOLS}"/{info,man,libexec/gcc/*/*/install-tools} |
298 | |
299 # End of NATIVE_TOOLCHAIN | |
300 | |
301 fi | |
302 | 304 |
303 # Clean up and package the result | 305 # Clean up and package the result |
304 | 306 |
305 "${ARCH}-strip" "${TOOLS}"/{bin/*,sbin/*,libexec/gcc/*/*/*} | 307 "${ARCH}-strip" "${TOOLS}"/{bin/*,sbin/*,libexec/gcc/*/*/*} |
306 "${ARCH}-strip" --strip-unneeded "${TOOLS}"/lib/*.so | 308 "${ARCH}-strip" --strip-unneeded "${TOOLS}"/lib/*.so |
307 | 309 |
308 create_stage_tarball root-filesystem | 310 create_stage_tarball root-filesystem |
309 | 311 |
310 if [ ! -z "$NATIVE_RETROFIT_CXX" ] | |
311 then | |
312 [ -z "$NATIVE_TOOLSDIR" ] && SUBDIR=usr || SUBDIR=tools | |
313 | |
314 (cd "${BUILD}/root-filesystem-$ARCH"/$SUBDIR && | |
315 tar c c++ lib/*c++* lib/libgcc_s.so* || dienow) | | |
316 (tar xC "${BUILD}/cross-compiler-$ARCH" || dienow) | |
317 | |
318 create_stage_tarball cross-compiler | |
319 fi | |
320 | |
321 # Color back to normal | 312 # Color back to normal |
322 echo -e "\e[0mBuild complete" | 313 echo -e "\e[0mBuild complete" |