annotate host-tools.sh @ 514:8d2b9cd1a52e

build-all-target.sh needs toybox netcat to pass data into/out of qemu, so host-tools.sh should install that too.
author Rob Landley <rob@landley.net>
date Tue, 02 Dec 2008 02:09:11 -0600
parents 909a4921273d
children f07d714321fe
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
389
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 368
diff changeset
5 # Tell bash not to cache the $PATH to anything, so busybox/toybox utilities
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 368
diff changeset
6 # get used immediately even if a different executable was found last lookup.
254
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
96
137ba51ee993 Delete output directories on re-run, teach build to log and build multiple
Rob Landley <rob@landley.net>
parents: 95
diff changeset
9 NO_ARCH=1
503
e98ed40c55ef Move include.sh to sources/include.sh. End user doesn't call it directly, shouldn't be at top level.
Rob Landley <rob@landley.net>
parents: 501
diff changeset
10 source sources/include.sh
93
153ba1a0b427 Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff changeset
11
485
b0438691e9e1 Move color selection into ./config. (The default colors don't look great on a white background.)
Rob Landley <rob@landley.net>
parents: 453
diff changeset
12 echo -e "$HOST_COLOR"
b0438691e9e1 Move color selection into ./config. (The default colors don't look great on a white background.)
Rob Landley <rob@landley.net>
parents: 453
diff changeset
13 echo "=== Building host tools"
b0438691e9e1 Move color selection into ./config. (The default colors don't look great on a white background.)
Rob Landley <rob@landley.net>
parents: 453
diff changeset
14
389
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 368
diff changeset
15 export LC_ALL=C
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 368
diff changeset
16
99
fd6d26721acf Minor tweak, move toybox build to the start.
Rob Landley <rob@landley.net>
parents: 96
diff changeset
17 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
18
352
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
19 # If we want to record the host command lines, so we know exactly what commands
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
20 # the build uses.
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
21
355
f6e1d29086c1 Mmove package-mini-native.sh back to using oneit, and always build toybox
Rob Landley <rob@landley.net>
parents: 352
diff changeset
22 if [ ! -z "$RECORD_COMMANDS" ] && [ ! -f "$BUILD/wrapdir/wrappy" ]
352
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
23 then
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
24 echo setup wrapdir
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
25
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
26 # Build the wrapper and install it into build/wrapdir/wrappy
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
27 rm -rf "$BUILD/wrapdir"
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
28 mkdir "$BUILD/wrapdir" &&
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
29 $CC -Os "$SOURCES/toys/wrappy.c" -o "$BUILD/wrapdir/wrappy" || dienow
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
30
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
31 # Loop through each $PATH element and create a symlink to the wrapper with
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
32 # that name.
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
33
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
34 for i in $(echo $PATH | sed 's/:/ /g')
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
35 do
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
36 for j in $(ls $i)
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
37 do
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
38 ln -s wrappy "$BUILD/wrapdir/$j"
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
39 done
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
40 done
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
41
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
42 # Adjust things to use wrapper directory
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 281
diff changeset
43
352
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
44 export WRAPPY_REALPATH="$PATH"
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
45 PATH="$BUILD/wrapdir"
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
46
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
47 # If we're not recording the host command lines, then populate a directory
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
48 # with host versions of all the command line utilities we're going to install
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
49 # into mini-native. When we're done, PATH can be set to include just this
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
50 # directory and nothing else.
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
51
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
52 # This serves three purposes:
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
53 #
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
54 # 1) Enumerate exactly what we need to build the system, so we can make sure
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
55 # mini-native has everything it needs to rebuild us. If anything is missing
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
56 # from this list, the resulting mini-native probably won't have it either,
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
57 # so it's nice to know as early as possible that we actually needed it.
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
58 #
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
59 # 2) Quick smoke test that the versions of the tools we're using can compile
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
60 # everything from source correctly, and thus mini-native should be able to
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
61 # rebuild from source using those same tools.
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
62 #
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
63 # 3) Reduce variation from distro to distro. The build always uses the
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
64 # same command line utilities no matter where we're running, because we
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
65 # provide our own.
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
66
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
67 else
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 281
diff changeset
68
352
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
69 # Start by creating symlinks to the host toolchain, since we need to use
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
70 # that to build anything else. We build a cross compiler, and a native
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
71 # compiler for the target, but we don't build a host toolchain. We use the
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
72 # one that's already there.
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
73
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
74 for i in ar as nm cc gcc make ld
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
75 do
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
76 [ ! -f "${HOSTTOOLS}/$i" ] && (ln -s `which $i` "${HOSTTOOLS}/$i" || dienow)
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
77 done
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
78
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
79 # Build toybox
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
80
514
8d2b9cd1a52e build-all-target.sh needs toybox netcat to pass data into/out of qemu, so host-tools.sh should install that too.
Rob Landley <rob@landley.net>
parents: 508
diff changeset
81 if [ ! -f "${HOSTTOOLS}/toybox" ]
352
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
82 then
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
83 setupfor toybox &&
514
8d2b9cd1a52e build-all-target.sh needs toybox netcat to pass data into/out of qemu, so host-tools.sh should install that too.
Rob Landley <rob@landley.net>
parents: 508
diff changeset
84 make defconfig &&
8d2b9cd1a52e build-all-target.sh needs toybox netcat to pass data into/out of qemu, so host-tools.sh should install that too.
Rob Landley <rob@landley.net>
parents: 508
diff changeset
85 make || dienow
389
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 368
diff changeset
86 if [ -z "$USE_TOYBOX" ]
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 368
diff changeset
87 then
514
8d2b9cd1a52e build-all-target.sh needs toybox netcat to pass data into/out of qemu, so host-tools.sh should install that too.
Rob Landley <rob@landley.net>
parents: 508
diff changeset
88 mv toybox "$HOSTTOOLS" &&
8d2b9cd1a52e build-all-target.sh needs toybox netcat to pass data into/out of qemu, so host-tools.sh should install that too.
Rob Landley <rob@landley.net>
parents: 508
diff changeset
89 ln -s toybox "$HOSTTOOLS"/patch &&
8d2b9cd1a52e build-all-target.sh needs toybox netcat to pass data into/out of qemu, so host-tools.sh should install that too.
Rob Landley <rob@landley.net>
parents: 508
diff changeset
90 ln -s toybox "$HOSTTOOLS"/netcat || dienow
389
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 368
diff changeset
91 else
514
8d2b9cd1a52e build-all-target.sh needs toybox netcat to pass data into/out of qemu, so host-tools.sh should install that too.
Rob Landley <rob@landley.net>
parents: 508
diff changeset
92 make install_flat PREFIX="${HOSTTOOLS}" || dienow
389
becb1084a427 Add USE_TOYBOX option (enabled by default), to use toybox commands where
Rob Landley <rob@landley.net>
parents: 368
diff changeset
93 fi
514
8d2b9cd1a52e build-all-target.sh needs toybox netcat to pass data into/out of qemu, so host-tools.sh should install that too.
Rob Landley <rob@landley.net>
parents: 508
diff changeset
94 cd ..
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 281
diff changeset
95
352
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
96 cleanup toybox
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
97 fi
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
98
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
99 # Build busybox
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
100
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
101 # Yes this is an old version of busybox. (It's the last version I released
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
102 # as busybox maintainer.) We're gradually replacing busybox with toybox, one
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
103 # command at a time.
311
a791ca629d9c Upgrade to toybox-0.0.5 and linux-2.6.25-rc7. Remove use of perl in the kernel
Rob Landley <rob@landley.net>
parents: 301
diff changeset
104
352
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
105 if [ ! -f "${HOSTTOOLS}/busybox" ]
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
106 then
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
107 setupfor busybox &&
453
61a26b8092bf Busybox defconfig has become useless, so switch busybox to build via allyesconfig minus symbols to be disabled.
Rob Landley <rob@landley.net>
parents: 413
diff changeset
108 make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" &&
358
9829e6cc8637 Update busybox from 1.2.2 to 1.11.0. Toybox i still used for oneit and patch,
Rob Landley <rob@landley.net>
parents: 355
diff changeset
109 make -j $CPUS &&
9829e6cc8637 Update busybox from 1.2.2 to 1.11.0. Toybox i still used for oneit and patch,
Rob Landley <rob@landley.net>
parents: 355
diff changeset
110 make busybox.links &&
352
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
111 cp busybox "${HOSTTOOLS}"
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
112
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
113 [ $? -ne 0 ] && dienow
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
114
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
115 for i in $(sed 's@.*/@@' busybox.links)
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
116 do
358
9829e6cc8637 Update busybox from 1.2.2 to 1.11.0. Toybox i still used for oneit and patch,
Rob Landley <rob@landley.net>
parents: 355
diff changeset
117 ln -s busybox "${HOSTTOOLS}"/$i # || dienow
352
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
118 done
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
119 cd ..
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
120
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
121 cleanup busybox
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
122 fi
311
a791ca629d9c Upgrade to toybox-0.0.5 and linux-2.6.25-rc7. Remove use of perl in the kernel
Rob Landley <rob@landley.net>
parents: 301
diff changeset
123 fi
a791ca629d9c Upgrade to toybox-0.0.5 and linux-2.6.25-rc7. Remove use of perl in the kernel
Rob Landley <rob@landley.net>
parents: 301
diff changeset
124
254
e005f4279b36 Tell bash not to cache paths, missing error check, commented out busybox build.
Rob Landley <rob@landley.net>
parents: 222
diff changeset
125
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 281
diff changeset
126 # This is optionally used by mini-native to accelerate native builds when
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 281
diff changeset
127 # running under qemu. It's not used to build mini-native, or to build
311
a791ca629d9c Upgrade to toybox-0.0.5 and linux-2.6.25-rc7. Remove use of perl in the kernel
Rob Landley <rob@landley.net>
parents: 301
diff changeset
128 # the cross compiler, but it needs to be on the host system in order to
a791ca629d9c Upgrade to toybox-0.0.5 and linux-2.6.25-rc7. Remove use of perl in the kernel
Rob Landley <rob@landley.net>
parents: 301
diff changeset
129 # use the distcc acceleration trick.
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 281
diff changeset
130
318
b3cf2e4b74f0 Patch from Andre Ruiz to fix host-tools rebuild check. (If busybox is already
Rob Landley <rob@landley.net>
parents: 311
diff changeset
131 # Build distcc (if it's not in $PATH)
488
2a028ba323bb If distccd is installed on the host, link it into build/host so we don't rebuild it on a second host-tools.sh run with the trimmed $PATH.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
132 if [ ! -f "${HOSTTOOLS}"/distccd ]
277
ffef8c1fe240 Build distcc on host if it's not already installed.
Rob Landley <rob@landley.net>
parents: 276
diff changeset
133 then
488
2a028ba323bb If distccd is installed on the host, link it into build/host so we don't rebuild it on a second host-tools.sh run with the trimmed $PATH.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
134 if [ -z "$(which distccd)" ]
2a028ba323bb If distccd is installed on the host, link it into build/host so we don't rebuild it on a second host-tools.sh run with the trimmed $PATH.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
135 then
2a028ba323bb If distccd is installed on the host, link it into build/host so we don't rebuild it on a second host-tools.sh run with the trimmed $PATH.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
136 setupfor distcc &&
2a028ba323bb If distccd is installed on the host, link it into build/host so we don't rebuild it on a second host-tools.sh run with the trimmed $PATH.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
137 ./configure --with-included-popt &&
2a028ba323bb If distccd is installed on the host, link it into build/host so we don't rebuild it on a second host-tools.sh run with the trimmed $PATH.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
138 make -j "$CPUS" &&
2a028ba323bb If distccd is installed on the host, link it into build/host so we don't rebuild it on a second host-tools.sh run with the trimmed $PATH.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
139 cp distcc distccd "${HOSTTOOLS}" &&
2a028ba323bb If distccd is installed on the host, link it into build/host so we don't rebuild it on a second host-tools.sh run with the trimmed $PATH.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
140 cd ..
277
ffef8c1fe240 Build distcc on host if it's not already installed.
Rob Landley <rob@landley.net>
parents: 276
diff changeset
141
488
2a028ba323bb If distccd is installed on the host, link it into build/host so we don't rebuild it on a second host-tools.sh run with the trimmed $PATH.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
142 cleanup distcc
2a028ba323bb If distccd is installed on the host, link it into build/host so we don't rebuild it on a second host-tools.sh run with the trimmed $PATH.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
143 else
2a028ba323bb If distccd is installed on the host, link it into build/host so we don't rebuild it on a second host-tools.sh run with the trimmed $PATH.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
144 ln -s "$(which distccd)" "${HOSTTOOLS}"/distccd
2a028ba323bb If distccd is installed on the host, link it into build/host so we don't rebuild it on a second host-tools.sh run with the trimmed $PATH.
Rob Landley <rob@landley.net>
parents: 485
diff changeset
145 fi
277
ffef8c1fe240 Build distcc on host if it's not already installed.
Rob Landley <rob@landley.net>
parents: 276
diff changeset
146 fi
ffef8c1fe240 Build distcc on host if it's not already installed.
Rob Landley <rob@landley.net>
parents: 276
diff changeset
147
508
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 505
diff changeset
148 # If the host system hasn't got genext2fs, build it. We use it to build the
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 505
diff changeset
149 # ext2 image to boot qemu with in package-mini-native.sh.
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 505
diff changeset
150
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 505
diff changeset
151 if [ -z "$(which genext2fs)" ]
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 505
diff changeset
152 then
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 505
diff changeset
153 setupfor genext2fs &&
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 505
diff changeset
154 ./configure &&
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 505
diff changeset
155 make -j $CPUS &&
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 505
diff changeset
156 cp genext2fs "${HOSTTOOLS}" &&
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 505
diff changeset
157 cd ..
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 505
diff changeset
158
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 505
diff changeset
159 cleanup genext2fs
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 505
diff changeset
160 fi
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 505
diff changeset
161
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 281
diff changeset
162 # Everything after here is stuff we _could_ build, but currently don't.
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 281
diff changeset
163
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
164 # 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
165 #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
166 #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
167 #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
168 #cp mksquashfs unsquashfs "${HOSTTOOLS}" &&
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 281
diff changeset
169 #cd ..
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
170 #
301
309b574a5059 Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents: 281
diff changeset
171 #cleanup squashfs
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
172
352
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
173 if [ ! -z "$RECORD_COMMANDS" ]
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
174 then
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
175 # Add the host tools we just built to wrapdir
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
176 for j in $(ls "$HOSTTOOLS")
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
177 do
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
178 ln -s wrappy "$BUILD/wrapdir/$j"
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
179 done
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
180 fi
1782b77fae15 Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents: 340
diff changeset
181
93
153ba1a0b427 Break out the qemu build (and squashfs) into something easy to comment out,
Rob Landley <rob@landley.net>
parents:
diff changeset
182 echo -e "\e[32mHost tools build complete.\e[0m"