Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qemu-arm-static isn't needed when already on an arm64 box #228

Closed
wants to merge 1 commit into from

Conversation

jxmx
Copy link
Contributor

@jxmx jxmx commented Aug 14, 2024

When building a Pi image, if you're already on an arm64/aarch64 system, there's no need to try to install/use qemu-arm-static binary for the build.

@guysoft
Copy link
Owner

guysoft commented Aug 18, 2024

It is needed if you want to build from amd64. Unless I missed something then you need this in that case.

@jxmx
Copy link
Contributor Author

jxmx commented Aug 18, 2024

I will have to test this again. I was building an arm64 image on an arm64 system and kept hitting that and the script failed.

@guysoft
Copy link
Owner

guysoft commented Aug 18, 2024

Ok if it fails then I wonder why - I am building on an arm64 arm64 images and it does not fail.
It might be that if you install qemu-user-static on your arm machine it would build with the current code. There might be an optimization in place though if its using qemu.

@jxmx
Copy link
Contributor Author

jxmx commented Aug 18, 2024

Yeah I will do more testing. I specifically don’t want to use qemu-arm-static because this is being built in a per-minute VPS builder. Dropping the unneeded emulator cuts the assembly by 2/3 or more.

@guysoft
Copy link
Owner

guysoft commented Nov 7, 2024

Any update on this?

@jxmx
Copy link
Contributor Author

jxmx commented Nov 8, 2024

I am still using the patch and it continues to work and be accurate. I'm building the Pi images on an arm64 Amazon instance where the system type is aarch64/armv8 and not armhf/armv7hf. The use of qemu-arm-static is entirely unnecessary for that.

@jxmx
Copy link
Contributor Author

jxmx commented Nov 29, 2024

I have re-confirmed that this patch is still necessary if you are already on an aarch64 system with the right stuff installed:

# uname -a
Linux ip-172-31-15-100 6.1.0-23-cloud-arm64 #1 SMP Debian 6.1.99-1 (2024-07-15) aarch64 GNU/Linux

In the code:

++ uname -m
+ '[' aarch64 '!=' armv7l ']'
+ '[' armhf == armv7l ']'
+ '[' armhf == armhf ']'
+ grep -q gentoo /etc/os-release
++ which qemu-arm-static
+ cp usr/bin/qemu-arm-static
cp: missing destination file operand after 'usr/bin/qemu-arm-static'
Try 'cp --help' for more information.
++++ echo_red 'build failed, unmounting image...'

All of the tests in the code lead to the system still trying to use qemu-arm-static to build an aarch64 system even though it already is an aarch64 system and doesn't need qemu. This is seen later in the code here:

if [ "$(uname -m)" != "armv7l" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "arm64" ] ; then
    ... bunch of stuff omitted ...
else
    echo "Building on ARM device a armv7l/aarch64/arm64 system, not using qemu"
    chroot . /bin/bash /chroot_script
fi

@jxmx
Copy link
Contributor Author

jxmx commented Dec 1, 2024

Replacing this is a better fix contained in #240

@jxmx jxmx closed this Dec 1, 2024
@jxmx jxmx deleted the no_qemu_already_on_arm branch December 1, 2024 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants