annotate host-tools.sh @ 254:e005f4279b36

Tell bash not to cache paths, missing error check, commented out busybox build.
author Rob Landley <rob@landley.net>
date Tue, 01 Jan 2008 03:12:59 -0600
parents 8b0d2080707c
children 754717ecf40b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
177
6b4844b708b9 dash->bash.
Rob Landley <rob@landley.net>
parents: 134
diff changeset
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
e005f4279b36 Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
19 #if [ ! -f "$(which busybox)" ]
e005f4279b36 Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
20 #then
e005f4279b36 Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
21 # setupfor busybox &&
e005f4279b36 Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
22 # make defconfig &&
e005f4279b36 Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
23 # make &&
e005f4279b36 Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
24 # cp busybox "${HOSTTOOLS}" &&
e005f4279b36 Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
25 # for i in $(sed 's@.*/@@' busybox.links)
e005f4279b36 Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
26 # do
e005f4279b36 Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
27 # ln -s busybox "${HOSTTOOLS}"/$i
e005f4279b36 Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
28 # done
e005f4279b36 Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
29 # rm "${HOSTTOOLS}"/{ar,find}
e005f4279b36 Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
30 #fi
e005f4279b36 Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
31
99
fd6d26721acf Minor tweak, move toybox build to the start.
Rob Landley <rob@landley.net>
parents: 96
diff changeset
32 # Build 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
33 if [ ! -f "$(which 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
34 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
35 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
36 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
37 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
38 make instlist &&
222
8b0d2080707c Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents: 215
diff changeset
39 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
40 cd .. &&
8b0d2080707c Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents: 215
diff changeset
41 $CLEANUP toybox
99
fd6d26721acf Minor tweak, move toybox build to the start.
Rob Landley <rob@landley.net>
parents: 96
diff changeset
42
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
43 [ $? -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
44 fi
93
153ba1a0b427 Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff changeset
45
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
46 # 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
47 # 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
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 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
50 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
51 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
52 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
53 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
54 CONFIG_HOSTFS=y
215
fed22f98962e Update UML build config to work with 2.6.23.
Rob Landley <rob@landley.net>
parents: 182
diff changeset
55 CONFIG_LBD=y
fed22f98962e Update UML build config to work with 2.6.23.
Rob Landley <rob@landley.net>
parents: 182
diff changeset
56 CONFIG_BLK_DEV=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_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
58 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
59 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
60 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
61 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
62 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
63 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
64 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
65 cd .. &&
222
8b0d2080707c Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents: 215
diff changeset
66 $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
67
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 [ $? -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
69 fi
93
153ba1a0b427 Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff changeset
70
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
71 # 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
72 #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
73 #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
74 #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
75 #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
76 #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
77 #$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
78 #
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 #[ $? -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
80
134
da91da84e7de We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents: 120
diff changeset
81 # 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
82 # 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
83 # 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
84
134
da91da84e7de We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents: 120
diff changeset
85 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
86 [ -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
87
134
da91da84e7de We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents: 120
diff changeset
88 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
89 then
da91da84e7de We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents: 120
diff changeset
90 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
91 fi
93
153ba1a0b427 Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff changeset
92
134
da91da84e7de We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents: 120
diff changeset
93 # 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
94 # ./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
95 # make &&
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 install &&
da91da84e7de We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents: 120
diff changeset
97 # cd .. &&
da91da84e7de We can't reliably build qemu because who knows what toolchains the host
Rob Landley <rob@landley.net>
parents: 120
diff changeset
98 # $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
99
93
153ba1a0b427 Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff changeset
100 echo -e "\e[32mHost tools build complete.\e[0m"