annotate mini-native.sh @ 50:5aeba79b8f5f

Remove qemu build (it's in cross-compiler.sh now), move uClibc build right after kernel build, fix busybox build to cross-compile dynamically, guard gcc/binutils build with --short, bonk gcc source with sed to make fixinc.sh go away, remove cruft at the end.
author Rob Landley <rob@landley.net>
date Tue, 19 Dec 2006 01:13:11 -0500
parents eeddef87a747
children f96f7a24642a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 #!/bin/sh
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 # Get lots of predefined environment variables and shell functions.
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
4
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 source include.sh
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
6 TOOLS="${NATIVE}/tools"
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
7 mkdir -p "${TOOLS}/bin" || dienow
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
8
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
9 # Purple. And why not?
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
10 echo -e "\e[35m"
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
11
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 [ $? -ne 0 ] && dienow
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
13
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
14 # Build and install Linux kernel.
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
15
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
16 setupfor linux
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
17 # Install Linux kernel headers (for use by uClibc).
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 make headers_install ARCH="${KARCH}" INSTALL_HDR_PATH="${TOOLS}" &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
19 # build bootable kernel for target
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
20 mv "${WORK}/config-linux" .config &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
21 (yes "" | make ARCH="${KARCH}" oldconfig) &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
22 make ARCH="${KARCH}" CROSS_COMPILE="${ARCH}-" &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
23 cp "${KERNEL_PATH}" "${NATIVE}/zImage-${ARCH}" &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
24 cd .. &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
25 $CLEANUP linux-*
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
26
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
27 [ $? -ne 0 ] && dienow
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
28
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
29 # Build and install uClibc. (We could just copy the one from the compiler
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
30 # toolchain, but this is cleaner.)
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
31
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
32 setupfor uClibc
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
33 cp "${WORK}"/config-uClibc .config &&
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
34 (yes "" | make CROSS="${ARCH}-" oldconfig) > /dev/null &&
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
35 make CROSS="${ARCH}-" KERNEL_HEADERS="${TOOLS}/include" \
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
36 RUNTIME_PREFIX="${TOOLS}/" DEVEL_PREFIX="${TOOLS}/" \
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
37 all install_runtime install_dev install_utils &&
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
38 cd .. &&
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
39 $CLEANUP uClibc*
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
40
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
41 [ $? -ne 0 ] && dienow
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
42
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
43 # Build and install busybox
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
44
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
45 setupfor busybox
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
46 make defconfig &&
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
47 make CROSS="${ARCH}-" &&
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
48 cp busybox "${TOOLS}/bin"
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
49 [ $? -ne 0 ] && dienow
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
50 for i in $(sed 's@.*/@@' busybox.links)
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
51 do
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
52 ln -s busybox "${TOOLS}/bin/$i" || dienow
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
53 done
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
54 cd .. &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
55 $CLEANUP busybox
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
56
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
57 [ $? -ne 0 ] && dienow
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
58
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
59 if [ -z "${BUILD_SHORT}" ]
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
60 then
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
61
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
62 # Build and install native binutils
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
63
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
64 setupfor binutils build-binutils
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
65 CC="${ARCH}"-gcc AR="${ARCH}"-ar "${CURSRC}/configure" --prefix="${TOOLS}" \
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
66 --build="${CROSS_HOST}" --host=${CROSS_TARGET} --target=${CROSS_TARGET} \
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
67 --disable-nls --disable-shared --disable-multilib $BINUTILS_FLAGS &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
68 make configure-host &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
69 make &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
70 make install &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
71 cd .. &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
72 mkdir -p "${TOOLS}/include" &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
73 cp binutils-*/include/libiberty.h "${TOOLS}/include" &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
74 $CLEANUP binutils-* build-binutils
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
75
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
76 [ $? -ne 0 ] && dienow
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
77
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
78 # Build and install native gcc, with c++ support this time.
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
79
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
80 setupfor gcc-core build-gcc gcc-
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
81 echo -n "Adding c++" &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
82 (tar xvjCf "${WORK}" "${LINKDIR}/gcc-g++.tar.bz2" || dienow ) | dotprogress &&
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
83 # GCC tries to "help out in the kitchen" by screwing up the linux include
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
84 # files. Cut out those bits with sed and throw them away.
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
85 sed -i 's@\./fixinc\.sh@-c true@' "${CURSRC}/gcc/Makefile.in" &&
46
eeddef87a747 Still doesn't work, but doesn't work better.
Rob Landley <rob@landley.net>
parents: 44
diff changeset
86 # GCC has some deep assumptions about the name of the cross-compiler it should
eeddef87a747 Still doesn't work, but doesn't work better.
Rob Landley <rob@landley.net>
parents: 44
diff changeset
87 # be using. These assumptions are wrong, and lots of redundant corrections
eeddef87a747 Still doesn't work, but doesn't work better.
Rob Landley <rob@landley.net>
parents: 44
diff changeset
88 # are required to make it stop.
eeddef87a747 Still doesn't work, but doesn't work better.
Rob Landley <rob@landley.net>
parents: 44
diff changeset
89 CC="${ARCH}-gcc" GCC_FOR_TARGET="${ARCH}-gcc" CC_FOR_TARGET="${ARCH}-gcc" \
eeddef87a747 Still doesn't work, but doesn't work better.
Rob Landley <rob@landley.net>
parents: 44
diff changeset
90 AR="${ARCH}-ar" AR_FOR_TARGET="${ARCH}-ar" AS="${ARCH}-ar" LD="${ARCH}-ld" \
eeddef87a747 Still doesn't work, but doesn't work better.
Rob Landley <rob@landley.net>
parents: 44
diff changeset
91 NM="${ARCH}-nm" NM_FOR_TARGET="${ARCH}-nm" \
eeddef87a747 Still doesn't work, but doesn't work better.
Rob Landley <rob@landley.net>
parents: 44
diff changeset
92 "${CURSRC}/configure" \
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
93 --prefix="${TOOLS}" --disable-multilib \
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
94 --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --target="${CROSS_TARGET}" \
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
95 --enable-long-long --enable-c99 --enable-shared --enable-threads=posix \
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
96 --enable-__cxa_atexit --disable-nls --enable-languages=c,c++ \
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
97 --disable-libstdcxx-pch &&
46
eeddef87a747 Still doesn't work, but doesn't work better.
Rob Landley <rob@landley.net>
parents: 44
diff changeset
98 make all-gcc &&
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
99 make install-gcc &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
100 ln -s gcc "${TOOLS}/bin/cc" &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
101 cd .. &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
102 $CLEANUP gcc-* build-gcc
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
103
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
104 [ $? -ne 0 ] && dienow
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
105
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
106 # Move the gcc internal libraries and headers somewhere sane.
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
107
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
108 mkdir -p "${TOOLS}"/gcc &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
109 mv "${TOOLS}"/lib/gcc/*/*/include "${TOOLS}"/gcc/include &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
110 mv "${TOOLS}"/lib/gcc/*/* "${TOOLS}"/gcc/lib &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
111 $CLEANUP "${TOOLS}"/{lib/gcc,gcc/lib/install-tools} &&
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
112
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
113 # Build and install gcc wrapper script.
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
114
44
41e82517e123 Helps to check in something that isn't _obviously_ broken. :)
Rob Landley <rob@landley.net>
parents: 43
diff changeset
115 mv "${TOOLS}/bin/${ARCH}-gcc" "${TOOLS}/bin/gcc-unwrapped" &&
41e82517e123 Helps to check in something that isn't _obviously_ broken. :)
Rob Landley <rob@landley.net>
parents: 43
diff changeset
116 gcc "${TOP}"/sources/toys/gcc-uClibc.c -Os -s -o "${TOOLS}/bin/${ARCH}-gcc"
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
117
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
118 [ $? -ne 0 ] && dienow
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
119
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
120 fi
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
121
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
122 # Packaging goes here
43
6d16887ec084 Intermediate snapshot. Doesn't work yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
123
50
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
124 # Color back to normal
5aeba79b8f5f Remove qemu build (it's in cross-compiler.sh now), move uClibc build right
Rob Landley <rob@landley.net>
parents: 46
diff changeset
125 echo -e "\e[0m"