Mercurial > hg > aboriginal
annotate host-tools.sh @ 276:b3054103cdd7
Have busybox clean up after itself, and zap old host tool symlinks when rerun.
author | Rob Landley <rob@landley.net> |
---|---|
date | Wed, 30 Jan 2008 21:37:21 -0600 |
parents | c61e7e0ef234 |
children | ffef8c1fe240 |
rev | line source |
---|---|
177 | 1 #!/bin/bash |
93
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 # Get lots of predefined environment variables and shell functions. |
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 |
254
e005f4279b36
Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
5 # Tell bash not to memorize the path to anything, so toybox utilities get |
e005f4279b36
Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
6 # used immediately even if a different executable was found last $PATH lookup. |
e005f4279b36
Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
7 set +h |
e005f4279b36
Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
8 |
93
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 echo -e "\e[0m" |
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 echo "=== Building host tools" |
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 |
96
137ba51ee993
Delete output directories on re-run, teach build to log and build multiple
Rob Landley <rob@landley.net>
parents:
95
diff
changeset
|
12 NO_ARCH=1 |
93
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 source include.sh |
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 |
99
fd6d26721acf
Minor tweak, move toybox build to the start.
Rob Landley <rob@landley.net>
parents:
96
diff
changeset
|
15 mkdir -p "${HOSTTOOLS}" || dienow |
96
137ba51ee993
Delete output directories on re-run, teach build to log and build multiple
Rob Landley <rob@landley.net>
parents:
95
diff
changeset
|
16 |
254
e005f4279b36
Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
17 # Build busybox |
259
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
18 if [ -z "$(which busybox)" ] |
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
19 then |
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
20 setupfor busybox && |
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
21 cp "${SOURCES}/config-busybox" .config && |
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
22 yes "" | make oldconfig && |
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
23 make && |
276
b3054103cdd7
Have busybox clean up after itself, and zap old host tool symlinks when rerun.
Rob Landley <rob@landley.net>
parents:
271
diff
changeset
|
24 cp busybox "${HOSTTOOLS}" |
b3054103cdd7
Have busybox clean up after itself, and zap old host tool symlinks when rerun.
Rob Landley <rob@landley.net>
parents:
271
diff
changeset
|
25 |
b3054103cdd7
Have busybox clean up after itself, and zap old host tool symlinks when rerun.
Rob Landley <rob@landley.net>
parents:
271
diff
changeset
|
26 [ $? -ne 0 ] && dienow |
b3054103cdd7
Have busybox clean up after itself, and zap old host tool symlinks when rerun.
Rob Landley <rob@landley.net>
parents:
271
diff
changeset
|
27 |
259
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
28 for i in $(sed 's@.*/@@' busybox.links) |
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
29 do |
276
b3054103cdd7
Have busybox clean up after itself, and zap old host tool symlinks when rerun.
Rob Landley <rob@landley.net>
parents:
271
diff
changeset
|
30 ln -s busybox "${HOSTTOOLS}"/$i || dienow |
259
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
31 done |
276
b3054103cdd7
Have busybox clean up after itself, and zap old host tool symlinks when rerun.
Rob Landley <rob@landley.net>
parents:
271
diff
changeset
|
32 cd .. && |
b3054103cdd7
Have busybox clean up after itself, and zap old host tool symlinks when rerun.
Rob Landley <rob@landley.net>
parents:
271
diff
changeset
|
33 $CLEANUP busybox |
b3054103cdd7
Have busybox clean up after itself, and zap old host tool symlinks when rerun.
Rob Landley <rob@landley.net>
parents:
271
diff
changeset
|
34 |
b3054103cdd7
Have busybox clean up after itself, and zap old host tool symlinks when rerun.
Rob Landley <rob@landley.net>
parents:
271
diff
changeset
|
35 [ $? -ne 0 ] && dienow |
259
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
36 fi |
254
e005f4279b36
Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
37 |
99
fd6d26721acf
Minor tweak, move toybox build to the start.
Rob Landley <rob@landley.net>
parents:
96
diff
changeset
|
38 # Build toybox |
259
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
39 if [ -z "$(which toybox)" ] |
120
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
40 then |
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
41 setupfor toybox && |
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
42 make defconfig && |
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
43 make && |
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
44 make instlist && |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
215
diff
changeset
|
45 make install_flat PREFIX="${HOSTTOOLS}" && |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
215
diff
changeset
|
46 cd .. && |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
215
diff
changeset
|
47 $CLEANUP toybox |
99
fd6d26721acf
Minor tweak, move toybox build to the start.
Rob Landley <rob@landley.net>
parents:
96
diff
changeset
|
48 |
120
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
49 [ $? -ne 0 ] && dienow |
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
50 fi |
93
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
51 |
108
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
52 # As a temporary measure, build User Mode Linux and use _that_ to package |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
53 # the ext2 image to boot qemu with. |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
54 |
120
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
55 if [ -z "$(which linux)" ] |
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
56 then |
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
57 setupfor linux && |
254
e005f4279b36
Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
58 cat > mini.conf << EOF && |
108
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
59 CONFIG_BINFMT_ELF=y |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
60 CONFIG_HOSTFS=y |
215
fed22f98962e
Update UML build config to work with 2.6.23.
Rob Landley <rob@landley.net>
parents:
182
diff
changeset
|
61 CONFIG_LBD=y |
fed22f98962e
Update UML build config to work with 2.6.23.
Rob Landley <rob@landley.net>
parents:
182
diff
changeset
|
62 CONFIG_BLK_DEV=y |
fed22f98962e
Update UML build config to work with 2.6.23.
Rob Landley <rob@landley.net>
parents:
182
diff
changeset
|
63 CONFIG_BLK_DEV_LOOP=y |
108
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
64 CONFIG_STDERR_CONSOLE=y |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
65 CONFIG_UNIX98_PTYS=y |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
66 CONFIG_EXT2_FS=y |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
67 EOF |
120
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
68 make ARCH=um allnoconfig KCONFIG_ALLCONFIG=mini.conf && |
276
b3054103cdd7
Have busybox clean up after itself, and zap old host tool symlinks when rerun.
Rob Landley <rob@landley.net>
parents:
271
diff
changeset
|
69 make -j "$CPUS" ARCH=um && |
120
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
70 cp linux "${HOSTTOOLS}" && |
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
71 cd .. && |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
215
diff
changeset
|
72 $CLEANUP linux |
93
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
73 |
120
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
74 [ $? -ne 0 ] && dienow |
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
75 fi |
93
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
76 |
108
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
77 # Build squashfs |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
78 #setupfor squashfs |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
79 #cd squashfs-tools && |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
80 #make && |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
81 #cp mksquashfs unsquashfs "${HOSTTOOLS}" && |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
82 #cd .. && |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
83 #$CLEANUP squashfs* |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
84 # |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
85 #[ $? -ne 0 ] && dienow |
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
86 |
134
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
87 # we can't reliably build qemu because who knows what gcc version the host |
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
88 # has? so until qemu is fixed to build with an arbitrary c compiler, |
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
89 # just test for its' existence and warn. |
93
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
90 |
134
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
91 temp="qemu-${qemu_test}" |
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
92 [ -z "$qemu_test" ] && temp=qemu |
93
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
93 |
134
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
94 if [ -z "$(which $temp)" ] |
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
95 then |
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
96 echo "***************** warning: $temp not found. *******************" |
95
027e15c1cfec
Only build qemu if it's not already installed. (Revisit this when 0.9.0 comes
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
97 fi |
93
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
98 |
134
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
99 # setupfor qemu && |
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
100 # ./configure --disable-gcc-check --disable-gfx-check --prefix="${CROSS}" && |
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
101 # make && |
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
102 # make install && |
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
103 # cd .. && |
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
104 # $CLEANUP qemu-* |
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
105 |
271
c61e7e0ef234
host-tools needs bzip2 to create tarballs.
Rob Landley <rob@landley.net>
parents:
265
diff
changeset
|
106 for i in ar as bzip2 cc cp find gcc install ld make nm od sort |
262
b2e353ae7566
Have host-tools populate build/host with 1) toybox, 2) all the remaining
Rob Landley <rob@landley.net>
parents:
259
diff
changeset
|
107 do |
276
b3054103cdd7
Have busybox clean up after itself, and zap old host tool symlinks when rerun.
Rob Landley <rob@landley.net>
parents:
271
diff
changeset
|
108 rm -f "${HOSTTOOLS}/$i" |
b3054103cdd7
Have busybox clean up after itself, and zap old host tool symlinks when rerun.
Rob Landley <rob@landley.net>
parents:
271
diff
changeset
|
109 ln -sf `which $i` "${HOSTTOOLS}/$i" || dienow |
262
b2e353ae7566
Have host-tools populate build/host with 1) toybox, 2) all the remaining
Rob Landley <rob@landley.net>
parents:
259
diff
changeset
|
110 done |
b2e353ae7566
Have host-tools populate build/host with 1) toybox, 2) all the remaining
Rob Landley <rob@landley.net>
parents:
259
diff
changeset
|
111 |
93
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
112 echo -e "\e[32mHost tools build complete.\e[0m" |