Mercurial > hg > aboriginal
annotate host-tools.sh @ 259:754717ecf40b
Have host tools build all the busybox tools which A) the build actually
uses), B) which aren't supplied by toybox, C) which aren't too broken to use.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 24 Jan 2008 03:48:19 -0600 |
parents | e005f4279b36 |
children | b2e353ae7566 |
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 |
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
|
15 #rm -rf "${HOSTTOOLS}" |
99
fd6d26721acf
Minor tweak, move toybox build to the start.
Rob Landley <rob@landley.net>
parents:
96
diff
changeset
|
16 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
|
17 |
254
e005f4279b36
Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
18 # 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
|
19 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
|
20 then |
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
21 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
|
22 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
|
23 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
|
24 make && |
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
25 cp busybox "${HOSTTOOLS}" && |
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
26 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
|
27 do |
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
28 ln -s busybox "${HOSTTOOLS}"/$i |
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
29 done |
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
30 rm "${HOSTTOOLS}"/{ar,find} |
754717ecf40b
Have host tools build all the busybox tools which A) the build actually
Rob Landley <rob@landley.net>
parents:
254
diff
changeset
|
31 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
|
32 |
99
fd6d26721acf
Minor tweak, move toybox build to the start.
Rob Landley <rob@landley.net>
parents:
96
diff
changeset
|
33 # 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
|
34 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
|
35 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
|
36 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
|
37 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
|
38 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
|
39 make instlist && |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
215
diff
changeset
|
40 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
|
41 cd .. && |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
215
diff
changeset
|
42 $CLEANUP toybox |
99
fd6d26721acf
Minor tweak, move toybox build to the start.
Rob Landley <rob@landley.net>
parents:
96
diff
changeset
|
43 |
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
|
44 [ $? -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
|
45 fi |
93
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
46 |
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
|
47 # 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
|
48 # 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
|
49 |
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
|
50 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
|
51 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
|
52 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
|
53 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
|
54 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
|
55 CONFIG_HOSTFS=y |
215
fed22f98962e
Update UML build config to work with 2.6.23.
Rob Landley <rob@landley.net>
parents:
182
diff
changeset
|
56 CONFIG_LBD=y |
fed22f98962e
Update UML build config to work with 2.6.23.
Rob Landley <rob@landley.net>
parents:
182
diff
changeset
|
57 CONFIG_BLK_DEV=y |
fed22f98962e
Update UML build config to work with 2.6.23.
Rob Landley <rob@landley.net>
parents:
182
diff
changeset
|
58 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
|
59 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
|
60 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
|
61 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
|
62 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
|
63 make ARCH=um allnoconfig KCONFIG_ALLCONFIG=mini.conf && |
182
fc827ab6166f
Autodetect number of processors and feed appropriate -j to make.
Rob Landley <rob@landley.net>
parents:
177
diff
changeset
|
64 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
|
65 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
|
66 cd .. && |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
215
diff
changeset
|
67 $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
|
68 |
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
|
69 [ $? -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
|
70 fi |
93
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
71 |
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
|
72 # 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
|
73 #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
|
74 #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
|
75 #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
|
76 #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
|
77 #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
|
78 #$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
|
79 # |
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 #[ $? -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
|
81 |
134
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
82 # 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
|
83 # 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
|
84 # 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
|
85 |
134
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
86 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
|
87 [ -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
|
88 |
134
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
89 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
|
90 then |
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
91 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
|
92 fi |
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 # 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
|
95 # ./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
|
96 # make && |
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
97 # 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
|
98 # cd .. && |
da91da84e7de
We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
99 # $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
|
100 |
93
153ba1a0b427
Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
101 echo -e "\e[32mHost tools build complete.\e[0m" |