Closed naturaverl closed 1 month ago
first time pi-gen user here
Sorry it didn't all go as smoothly as it should've. I'm not familiar with Macs at all, so I'm not sure I'll be of much help here.
Do you need to build armhf images or arm64 images? If you don't need armhf images, you could try building from the 'arm64' branch and see if you have better luck.
Otherwise, do M1 macs support arm32 instructions natively or only aarch64? If it's only aarch64, then there's not much of a chance that this will work.
Arm macs do not support arm32/armv7l/armv8l/armhf.
(Neither does the RPI5 unless it is booted into 4k page mode...)
running into the same issue. I don't quite understand why the setarch linux32
is needed here?
32-bit arm isn't like 32-bit x86_64. x86_64 processors support i686 instructions by default. 64-bit arm (aarch64/arm64) is different from 32-bit arm (armhf/armv7l/armv8l/etc...).
Only some 64-bit arm processors support both 32-bit arm and 64-bit arm instructions simultaneously, and even then only in certain modes.
Desktop arm macs are aarch64 only, and have never supported 32-bit arm. (iOS devices stopped supporting 32-bit arm years ago.)
Building the 32-bit arm rpi distribution requires running certain 32-bit arm apps during the build, so you need support for that architecture (armhf/armv7l/armv8l). In linux, you can emulate missing architecture support with some kernel-level emulation referred to as binfmt, as mentioned at https://github.com/RPi-Distro/pi-gen/tree/master#binfmt_misc . Generally, on top of having that support, when you try to run 32-bit software in linux on top of a 64-bit kernel, you can have that architecture switch supported by prefixing commands with the linux32
command.
macOS doesn't have that ability.
But maybe you can get around these issues by using some form of binfmt that might work on macs?
Does running this first as part of the build process help at all?
docker pull tonistiigi/binfmt
docker run --privileged --rm tonistiigi/binfmt --uninstall qemu-*
docker run --privileged --rm tonistiigi/binfmt --install all
To elaborate a bit on why setarch linux32 is used at all. Some applications use uname -m
to determine the host machine architecture. When running a 64bit kernel, that gives you:
$ uname -m
aarch64
That can lead to incorrect assumptions when building a 32bit image. When you wrap that with setarch linux32, you get:
$ setarch linux32 uname -m
armv8l
However, in this case it sounds like setarch isn't the issue. You're just building on a machine that doesn't support the 32bit arm instructions.
Thanks guys, things are clarified for me now!
I believe build.sh should be a bit clearer now if there are architecture or page size incompatibilities and README.md mentions the requirement of using different branches.
Hi, first time pi-gen user here. I'm on a M1 mac, trying to use pi-gen to build a standard image (nothing's been added in by me, yet)
I'm trying to follow the README to learn how to use pi-gen, and understand that I can use Docker for pi-gen to have a debian environment to run from. On my Mac mini M1 system, I've simply cloned from pi-gen master branch, am using the build-docker.sh script, and the simplest of uses is failing for me. [EDIT] I've checked out the arm64 branch and that works better for me. The README didn't specifically mention needing to run the arm64 branch if your host is arm64.