BASE_ARCH=aarch64 is Ignored
Something in the last month or so is making the value set of BASE_ARCH skew from what is set in the configuration. Given the following config:
export DIST_NAME=AllStarLink3
export DIST_VERSION=3.0.14
# rpi-imager json generator settings
export RPI_IMAGER_NAME="${DIST_NAME}"
export RPI_IMAGER_DESCRIPTION="ASL3"
export RPI_IMAGER_WEBSITE="https://allstarlink.org"
export RPI_IMAGER_ICON="https://raw.githubusercontent.com/guysoft/CustomPiOS/devel/media/rpi-imager-CustomPiOS.png"
export MODULES="base(network,pkgupgrade,asl3)"
# Base configuration
export BASE_ARCH=aarch64
export BASE_IMAGE_ENLARGEROOT=512
export BASE_DISTRO=raspios64
export BASE_BOARD=raspberrypiarm64
export BASE_ADD_USER=no
# PKGUPGRADE
export PKGUPGRADE_DISTUPGRADE=y
export PKGUPGRADE_DISTUPGRADE_METHOD=dist-upgrade
export ASL3_REPO_LVL="main"
I would expect BASE_ARCH=aarch64 to be fixed. However when the code gets to the selection of qemu-arm-static in src/custompios the value is being reset to BASE_ARCH=armhf and I'm not entirely sure where:
+ echo BASE_ARCH=armhf
BASE_ARCH=armhf
++ uname -m
+ '[' aarch64 '!=' armv7l ']'
++ uname -m
+ '[' aarch64 '!=' aarch64 ']'
+ [[ armhf == \a\r\m\v\7\l ]]
+ [[ armhf == \a\r\m\h\f ]]
++ uname -m
+ [[ aarch64 != \a\r\m\v\7\l ]]
++ which qemu-aarch64-static
+ cp usr/bin/qemu-aarch64-static
cp: missing destination file operand after 'usr/bin/qemu-aarch64-static'
Try 'cp --help' for more information.
++++ echo_red 'build failed, unmounting image...'
Note that I've added some debugging and changes to custompios to try to figure out what's happening. By the time the build process gets here, BASE_ARCH is being change from aarch64 to armhf.
I should additionally point out that the script is properly downloading the arm64 image:
Downloading latest Raspbian image from https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2024-11-19/2024-11-19-raspios-bookworm-arm64-lite.img.xz
However, I finally figured out that this is erroneously sneaking into the configuration via extra_board_config:
# cat asl3/src/workspace/extra_board_config
export BASE_ARCH="armhf"
Looks like this is being set somewhere in src/custompios_core/generate_board_config.py or one of the other modules. I'm not entirely sure where since BASE_BOARD=raspberrypiarm64 should result in the correct configuration if I read the images.yml file correctly.
Tracking this down further, it appears that generate_board_config.py is getting called in build before the configuration file is being read in:
++ export EXTRA_BOARD_CONFIG=/tmp/tmp.8JwPSXLnpI
++ EXTRA_BOARD_CONFIG=/tmp/tmp.8JwPSXLnpI
++ /home/admin/asl3-pi-image/CustomPiOS/src/custompios_core/generate_board_config.py /tmp/tmp.8JwPSXLnpI
++ echo 'Temp source file: /tmp/tmp.8JwPSXLnpI'
Temp source file: /tmp/tmp.8JwPSXLnpI
++ source /home/admin/asl3-pi-image/CustomPiOS/src/common.sh
++ install_cleanup_trap
++ set -e
++ trap cleanup SIGINT SIGTERM
++++ realpath -s /home/admin/asl3-pi-image/CustomPiOS/src/build
+++ dirname /home/admin/asl3-pi-image/CustomPiOS/src/build
++ CUSTOM_OS_PATH=/home/admin/asl3-pi-image/CustomPiOS/src
++ source /home/admin/asl3-pi-image/CustomPiOS/src/config '' /tmp/tmp.8JwPSXLnpI
The file being created in /tmp will always contain export BASE_ARCH="armhf" because the environment variables set by the particular build's config file is not sourced and loaded before calling generate_board_config.py. And then the output of generate_board_config.py seems to always override the config setting.