Skip to content

Instantly share code, notes, and snippets.

@brianpow
Created June 9, 2019 16:42
Show Gist options
  • Save brianpow/8b32813fdce87153a787cd30cf8ff7d8 to your computer and use it in GitHub Desktop.
Save brianpow/8b32813fdce87153a787cd30cf8ff7d8 to your computer and use it in GitHub Desktop.
Put this file in the busybox source folder and run, then it will make all variants of busybox for ARM and MIPS architecture. (A few variants cannot be built)
build()
{
if [ ! -f $1-$i ] ; then
echo Building $1-$i...
make clean > /dev/null
time make CROSS_COMPILE="$CROSS_COMPILE" CFLAGS+="$_CFLAGS" CXXFLAGS+="$_CXXFLAGS"
mv $1 $1-$i
else
echo Skipping $1-$i since the output file already exists
fi
}
if [ "$#" -gt 0 ]; then
CROSS_COMPILE=arm-linux-gnueabi-
for i in armv4t armv5t armv5te armv6 armv6j armv6k armv6kz armv6t2 armv6z armv6zk armv7 armv7-a armv7ve armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8.5-a armv7-r armv8-r armv6-m armv6s-m armv7-m armv7e-m armv8-m.base armv8-m.main; do
_CFLAGS=" -march=$i -static"
_CXXFLAGS=" -march=$i -static"
build $1
done
CROSS_COMPILE=mips-linux-gnu-
for i in mips1 mips2 mips3 mips4 mips32 mips32r2 mips64 mips64r2; do
_CFLAGS=" -march=$i -static"
_CXXFLAGS=" -march=$i -static"
[ "$i" = "mips1" ] && _CFLAGS+=" -mfp32"
build $1
done
else
echo Usage $0 [output-prefix]
echo Example: $0 busybox
echo Result: the output file will be busybox-armv4t, busybox-armv5t...
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment