Loading
uclibc-ng: specify architecture in `make defconfig`
This ensures the correct architecture is picked up in the `.config` file.
For instance, specifying `ARCH=arm` will correctly set TARGET_ARCH=arm
and TARGET_arm=y.
This commit has been tested to successfully produce toolchains for:
* mipsel-unknown-linux-uclibc (ben-nanonote)
* mips-unknown-linux-uclibc
* armv7a-unknown-linux-uclibceabihf
* armv7a-unknown-linux-uclibceabi
Specifically, the following script has been used to test the toolchains:
#!/usr/bin/env bash
set -euo pipefail
function test_toolchain() {
TRIPLE="$1"
shift
EXPRESSION="$1"
shift
QEMU_ARCH="$1"
shift
echo "Testing $TRIPLE" > /dev/stderr
BUILT_PACKAGE=$(nix-build -E "$EXPRESSION")
nix-shell -p "$BUILT_PACKAGE" -p qemu --run '
set -euo pipefail
echo "#include <stdio.h>" > program.c
echo "int main() { puts(\"Hello!\"); }" >> program.c
'"$TRIPLE"'-gcc program.c -o program -static
for TO_GREP in '"$(printf "'%s' " "$@")"'; do
readelf -h program | grep -F "$TO_GREP"
done
qemu-'"$QEMU_ARCH"' ./program
'
}
function test_triple() {
TRIPLE="$1"
shift
QEMU_ARCH="$1"
shift
test_toolchain "$TRIPLE" '(import ./. { crossSystem = { config = "'"$TRIPLE"'"; }; }).stdenv.cc' "$QEMU_ARCH" "$@"
}
function test_cross() {
TRIPLE="$1"
shift
CROSS="$1"
shift
QEMU_ARCH="$1"
shift
test_toolchain "$TRIPLE" '(import ./. {}).pkgsCross.'"$CROSS"'.stdenv.cc' "$QEMU_ARCH" "$@"
}
test_cross "mipsel-unknown-linux-uclibc" "ben-nanonote" "mipsel" "little endian"
test_triple "mips-unknown-linux-uclibc" "mips" "big endian"
test_triple "armv7a-unknown-linux-uclibceabihf" "arm" "little endian" "EABI" "hard-float ABI"
test_triple "armv7a-unknown-linux-uclibceabi" "arm" "little endian" "EABI" "soft-float ABI"