Skip to content

Commit

Permalink
Implement #240 Fix aarch/arm64 Architecture Issues
Browse files Browse the repository at this point in the history
  • Loading branch information
guysoft committed Feb 22, 2025
1 parent 15370fe commit c2296ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/build
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ set -x

define(){ IFS='\n' read -r -d '' ${1} || true; }

# Source in dist config to seed generate_board_config.py
# but will then be overwritten ${CUSTOM_PI_OS_PATH}/config for
# 'final' configuration
source ${DIST_PATH}/config

define SCRIPT <<'EOF'
BUILD_SCRIPT_PATH=$(dirname $(realpath -s $BASH_SOURCE))
export EXTRA_BOARD_CONFIG=$(mktemp)
Expand Down
6 changes: 4 additions & 2 deletions src/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ function chroot_correct_qemu() {
chmod 755 common.sh

# Set up QEMU if needed
if [[ "$host_arch" != "armv7l" ]] || [[ "$host_arch" != "aarch64" ]]; then
if [[ "$host_arch" != "armv7l" ]] && [[ "$host_arch" != "aarch64" ]]; then
if [[ "$target_arch" == "armv7l" ]] || [[ "$target_arch" == "armhf" ]]; then
if grep -q gentoo /etc/os-release; then
ROOT="$(realpath .)" emerge --usepkgonly --oneshot --nodeps qemu
Expand All @@ -630,6 +630,8 @@ function chroot_correct_qemu() {
cp "$(which qemu-aarch64-static)" usr/bin/qemu-aarch64-static
fi
fi
elif [[ ( "$target_arch" == "armv7l" || "$target_arch" == "armhf" ) && "$host_arch" != "armv7l" ]]; then
cp "$(which qemu-aarch64-static)" usr/bin/qemu-aarch64-static
fi

# Execute chroot with appropriate QEMU setup
Expand All @@ -655,7 +657,7 @@ function chroot_correct_qemu() {
echo "Unknown arch, building on: $host_arch image: $target_arch"
return 1
fi
elif { [[ "$target_arch" == "armv7l" ]] || [[ "$target_arch" == "armhf" ]]; } && [[ "$host_arch" != "armv7l" ]]; then
elif [[ ( "$target_arch" == "armv7l" || "$target_arch" == "armhf" ) && "$host_arch" != "armv7l" ]]; then
echo "Building on aarch64/arm64 device a armv7l system, using qemu-arm-static"
chroot . usr/bin/qemu-arm-static /bin/bash /chroot_script
else
Expand Down

0 comments on commit c2296ef

Please sign in to comment.