Files
docker-easyconnect/build-scripts/get-echost-names.sh
Hagb f533949090 Support non-amd64 deb package of EasyConnect
Since non-amd64 deb packages of EasyConnect are proved to exist
(https://github.com/Hagb/docker-easyconnect/issues/25#issuecomment-1233369467),
the deb package should not be assume to be amd64 and architecture
specific code should be rewritten:

- Add EC_HOST build argument to tell Dockerfile the architecture of
  EasyConnect package
- Whether to install cross toolchain and qemu-user and which package
  should be install, is determined by EC_HOST and the local architecture
  now, more specifically by build-scripts/get-echost-names.sh (no longer
  hard-code amd64 cross toolchain)
- fake-hwaddr.so should follow the architecture of the EC deb, so
  fake-hwaddr/Makefile uses CC envirnoment variable instead of
  hard-coded x86_64-linux-gnu-gcc as c compiler now
- qemu_args is removed now. It was used to pass LD_PRELOAD to foreign
  binaries under qemu-user, but now we pass LD_PRELOAD to the qemu
  wrapper and wrapper will pass the LD_PRELOAD to the simulated
  binaries
2022-09-24 08:52:32 +08:00

38 lines
892 B
Bash

#!/bin/sh
if [ -z "$EC_HOST" -o "$(dpkg --print-architecture)" = "$EC_HOST" ]; then
ecgccpkg=build-essential
ecprefix=
ec_cc=gcc
is_echost_foreign=
is_echost_foreign() { false; }
else
case "$EC_HOST" in
i386 )
ecqemu=qemu-i386
ecgccpkg=crossbuild-essential-i386
ecprefix=i386-linux-gnu ;;
amd64 )
ecqemu=qemu-x86_64
ecgccpkg=crossbuild-essential-amd64
ecprefix=x86_64-linux-gnu ;;
armhf )
ecqemu=qemu-arm
ecgccpkg=crossbuild-essential-armhf
ecprefix=arm-linux-gnueabihf ;;
arm64 )
ecqemu=qemu-aarch64
ecgccpkg=crossbuild-essential-arm64
ecprefix=aarch64-linux-gnu ;;
mips64el )
ecqemu=qemu-mips64el
ecgccpkg=crossbuild-essential-mips64el
ecprefix=mips64el-linux-gnuabi64 ;;
* )
echo "Unsupported platform ${EC_HOST}" >&2
false ;;
esac &&
ec_cc=${ecprefix}-gcc &&
is_echost_foreign=1 &&
is_echost_foreign() { true; }
fi