blob: c9e1a37e564d84841b0ce072d8e885eb731bd9ed [file] [log] [blame]
Denys Vlasenko12efcf32015-10-05 09:04:04 +02001#!/bin/sh
2
3umount /mnt # optional
4
5test -x "bin/busybox-$HOST" && {
6 echo "Found bin/busybox-$HOST, using it"
7 cp -a "bin/busybox-$HOST" bin/busybox
8 bin/busybox --install -s bin/
9 # Supply missing stuff (e.g. bzip2):
10 PATH="$PATH:$PWD/bin"
11 # Override known-buggy host binaries:
12 cp -af bin/od `which od`
13}
14
15(
16 #set -e -x
17 cd busybox
Denys Vlasenkoe6b57872015-10-05 12:43:04 +020018
Denys Vlasenko12efcf32015-10-05 09:04:04 +020019 make defconfig
20 # Want static build
21 sed 's/^.*CONFIG_STATIC.*$/CONFIG_STATIC=y/' -i .config
Denys Vlasenko12efcf32015-10-05 09:04:04 +020022 bzip2 </dev/null >/dev/null || {
Denys Vlasenkoe6b57872015-10-05 12:43:04 +020023 # Drats, newer Aboriginal Linux has no bzip2
Denys Vlasenko12efcf32015-10-05 09:04:04 +020024 sed 's/^.*CONFIG_FEATURE_COMPRESS_USAGE.*$/# CONFIG_FEATURE_COMPRESS_USAGE is not set/' -i .config
25 }
Denys Vlasenkoe6b57872015-10-05 12:43:04 +020026 test x"`uname -m`" = x"mips" && {
27 # Without this, I get MIPS-I binary instead of MIPS32.
28 # No idea what's the difference, but my router wants MIPS32.
29 sed 's/^.*CONFIG_EXTRA_CFLAGS.*$/CONFIG_EXTRA_CFLAGS="-mips32"/' -i .config
30 }
Denys Vlasenko12efcf32015-10-05 09:04:04 +020031 # These won't build because of toolchain/libc breakage:
Denys Vlasenkobddbeb82017-01-02 13:48:06 +010032 sed 's/^.*CONFIG_FEATURE_SYNC_FANCY.*$/# CONFIG_FEATURE_SYNC_FANCY is not set/' -i .config # no syncfs() on armv4l, sparc
Denys Vlasenko12efcf32015-10-05 09:04:04 +020033 sed 's/^.*CONFIG_FEATURE_WTMP.*$/# CONFIG_FEATURE_WTMP is not set/' -i .config
34 sed 's/^.*CONFIG_FEATURE_UTMP.*$/# CONFIG_FEATURE_UTMP is not set/' -i .config
35 sed 's/^.*CONFIG_FEATURE_INETD_RPC.*$/# CONFIG_FEATURE_INETD_RPC is not set/' -i .config
Denys Vlasenkoe6b57872015-10-05 12:43:04 +020036
Denys Vlasenko12efcf32015-10-05 09:04:04 +020037 make #V=1 || sh
Denys Vlasenkobddbeb82017-01-02 13:48:06 +010038 test -f busybox || exit 1
Denys Vlasenko12efcf32015-10-05 09:04:04 +020039 size busybox
40 ./busybox || echo "Exit code: $?"
41 if uuencode TEST </dev/null >/dev/null && bzip2 </dev/null >/dev/null; then
42 bzip2 <busybox | uuencode busybox.bz2
43 else
Denys Vlasenkoa779c6d2015-10-05 12:34:24 +020044 od -v -tx1 <busybox
Denys Vlasenko12efcf32015-10-05 09:04:04 +020045 fi
46 #test "x$FTP_PORT" = x ||
47 # ftpput -P "$FTP_PORT" "$FTP_SERVER" strace
48) 2>&1 | tee build.log
49mount -o remount,ro /home
50sync
51sleep 1