Denys Vlasenko | 12efcf3 | 2015-10-05 09:04:04 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | umount /mnt # optional |
| 4 | |
| 5 | test -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 Vlasenko | e6b5787 | 2015-10-05 12:43:04 +0200 | [diff] [blame] | 18 | |
Denys Vlasenko | 12efcf3 | 2015-10-05 09:04:04 +0200 | [diff] [blame] | 19 | make defconfig |
| 20 | # Want static build |
| 21 | sed 's/^.*CONFIG_STATIC.*$/CONFIG_STATIC=y/' -i .config |
Denys Vlasenko | 12efcf3 | 2015-10-05 09:04:04 +0200 | [diff] [blame] | 22 | bzip2 </dev/null >/dev/null || { |
Denys Vlasenko | e6b5787 | 2015-10-05 12:43:04 +0200 | [diff] [blame] | 23 | # Drats, newer Aboriginal Linux has no bzip2 |
Denys Vlasenko | 12efcf3 | 2015-10-05 09:04:04 +0200 | [diff] [blame] | 24 | sed 's/^.*CONFIG_FEATURE_COMPRESS_USAGE.*$/# CONFIG_FEATURE_COMPRESS_USAGE is not set/' -i .config |
| 25 | } |
Denys Vlasenko | e6b5787 | 2015-10-05 12:43:04 +0200 | [diff] [blame] | 26 | 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 Vlasenko | 12efcf3 | 2015-10-05 09:04:04 +0200 | [diff] [blame] | 31 | # These won't build because of toolchain/libc breakage: |
Denys Vlasenko | bddbeb8 | 2017-01-02 13:48:06 +0100 | [diff] [blame] | 32 | sed 's/^.*CONFIG_FEATURE_SYNC_FANCY.*$/# CONFIG_FEATURE_SYNC_FANCY is not set/' -i .config # no syncfs() on armv4l, sparc |
Denys Vlasenko | 12efcf3 | 2015-10-05 09:04:04 +0200 | [diff] [blame] | 33 | 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 Vlasenko | e6b5787 | 2015-10-05 12:43:04 +0200 | [diff] [blame] | 36 | |
Denys Vlasenko | 12efcf3 | 2015-10-05 09:04:04 +0200 | [diff] [blame] | 37 | make #V=1 || sh |
Denys Vlasenko | bddbeb8 | 2017-01-02 13:48:06 +0100 | [diff] [blame] | 38 | test -f busybox || exit 1 |
Denys Vlasenko | 12efcf3 | 2015-10-05 09:04:04 +0200 | [diff] [blame] | 39 | 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 Vlasenko | a779c6d | 2015-10-05 12:34:24 +0200 | [diff] [blame] | 44 | od -v -tx1 <busybox |
Denys Vlasenko | 12efcf3 | 2015-10-05 09:04:04 +0200 | [diff] [blame] | 45 | fi |
| 46 | #test "x$FTP_PORT" = x || |
| 47 | # ftpput -P "$FTP_PORT" "$FTP_SERVER" strace |
| 48 | ) 2>&1 | tee build.log |
| 49 | mount -o remount,ro /home |
| 50 | sync |
| 51 | sleep 1 |