Skip to content

Instantly share code, notes, and snippets.

@shutingrz
Created December 15, 2022 20:56
Show Gist options
  • Save shutingrz/0bae8647cdfb9ff669e3269d96ac1281 to your computer and use it in GitHub Desktop.
Save shutingrz/0bae8647cdfb9ff669e3269d96ac1281 to your computer and use it in GitHub Desktop.
build busybox binaries
#!/bin/sh
#ARCHS=${ARCHS:-"aarch64-linux-gnu mipsel-linux-gnu"}
ARCHS=${ARCHS:-"arm-linux-gnueabi arm-linux-gnueabihf powerpc64le-linux-gnu aarch64-linux-gnu mipsel-linux-gnu"}
set -e
busybox_version='busybox-1.35.0'
busybox_archive="${busybox_version}.tar.bz2"
busybox_url="https://busybox.net/downloads/${busybox_archive}"
if [ ! -f ./${busybox_archive} ]; then
curl -O ${busybox_url}
fi
for arch in ${ARCHS}; do
mkdir -p "work/${arch}"
mkdir -p "build"
cp ${busybox_archive} work/${arch}
tar jvxf work/${arch}/${busybox_archive} -C work/${arch}/
docker run -v $(pwd)/work/${arch}/${busybox_version}:/workdir -e QEMU_LD_PREFIX=/usr/${arch}/ -e CROSS_TRIPLE=${arch} multiarch/crossbuild "/bin/sh" "-c" "make defconfig;make CONFIG_STATIC=y"
if [ "$?" -eq "0" ]; then
cp work/${arch}/${busybox_version}/busybox build/busybox-${arch}
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment