To build working armv7l binaries natively, I set march, mfpu and mfloat-abi CFLAGS specific for the device. Otherwise they can't run, illegal instruction.
Binaries in generated/, kconfig/ and root/airlock/toybox/ are dynamically linked by default, so to bootstrap a musl root with a downloaded musl toolchain from a glibc host without its own toolchain, I append -static to both CFLAGS and full compiler path in HOSTCC.
From a8da293686dc539cf6dd9fa6b1f0dfba52fd8513 Mon Sep 17 00:00:00 2001 From: Denys Nykula <[email protected]> Date: Tue, 26 Sep 2019 22:58:23 +0300 Subject: [PATCH] Pass cflags and hostcc in mkroot. To build working armv7l binaries natively, I set march, mfpu and mfloat-abi CFLAGS specific for the device. Otherwise they can't run, illegal instruction. Binaries in generated/, kconfig/ and root/airlock/toybox/ are dynamically linked by default, so to bootstrap a musl root with a downloaded musl toolchain from a glibc host without its own toolchain, I append -static to both CFLAGS and full compiler path in HOSTCC. --- scripts/mkroot.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/mkroot.sh b/scripts/mkroot.sh index fcc4274..182fcfd 100755 --- a/scripts/mkroot.sh +++ b/scripts/mkroot.sh @@ -3,7 +3,8 @@ # Clear environment variables by restarting script w/bare minimum passed through [ -z "$NOCLEAR" ] && exec env -i NOCLEAR=1 HOME="$HOME" PATH="$PATH" LINUX="$LINUX" \ - CROSS_COMPILE="$CROSS_COMPILE" CROSS_SHORT="$CROSS_SHORT" "$0" "$@" + CROSS_COMPILE="$CROSS_COMPILE" CROSS_SHORT="$CROSS_SHORT" \ + CFLAGS="$CFLAGS" HOSTCC="$HOSTCC" "$0" "$@" # assign command line NAME=VALUE args to env vars while [ $# -ne 0 ] @@ -52,7 +53,7 @@ then echo === Create airlock dir PREFIX="$AIRLOCK" KCONFIG_CONFIG="$TOP"/.airlock CROSS_COMPILE= \ - make clean defconfig toybox install_airlock && + CFLAGS="$CFLAGS" make clean defconfig toybox install_airlock && rm "$TOP"/.airlock || exit 1 fi export PATH="$CROSS_PATH:$AIRLOCK" -- 2.23.0
_______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
