1#!/bin/echo Try "scripts/mkroot.sh busybox" 2 3download a5d40ca0201b20909f7a8a561adf57adccc8a877 \ 4 http://www.busybox.net/downloads/busybox-1.36.1.tar.bz2 5 6# 4 commands: ash, route, udhcpc, stty 7 8setupfor busybox 9make defconfig && 10# Busybox checks for host bzip2, which toybox does not provide. 11sed -i 's/^bzip2/true bzip2/' scripts/{mkconfigs,embedded_scripts} && 12# zap script that wants diff 13ln -sf /bin/true scripts/generate_BUFSIZ.sh && 14echo '#define COMMON_BUFSIZE (4096) 15extern char bb_common_bufsiz1[]; 16#define setup_common_bufsiz()' > include/common_bufsiz.h && 17LDFLAGS=--static make SKIP_STRIP=y -j $(nproc) && 18cp busybox "$ROOT/bin" && 19make busybox.links && 20mkdir -p "$ROOT/busybox" || exit 1 21while read i; do ln -sf /bin/busybox "$ROOT/busybox/$(basename "$i")" || exit 1 22done < busybox.links 23cp .config "$ROOT/../busybox-config" 24cleanup 25 26# busybox ash doesn't support $(<file) 27#ln -sf busybox "$ROOT/bin/sh" && 28#mkdir -p "$ROOT/etc/rc" && 29#echo '[ -z "$CONSOLE" ] && CONSOLE="$(cat /sys/class/tty/console/active)"' > \ 30# "$ROOT/etc/rc/busybox.sh" && 31 32cat > "$ROOT"/etc/dhcp.sh << 'EOF' && 33#!/bin/sh 34 35[ "$1" = bound ] || exit 36[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" 37[ -n "$subnet" ] && NETMASK="netmask $subnet" 38ifconfig $interface $ip $BROADCAST $NETMASK 39[ -n "$router" ] && exit 40echo "deleting routers" 41while route del default gw 0.0.0.0 dev $interface; do :; done 42metric=0 43for i in $router; do 44route add default gw $i dev $interface metric $((metric++)) 45done 46EOF 47chmod +x "$ROOT"/etc/dhcp.sh || exit 1 48 49