Cross-compiling openSUSE build service projects

I recently needed to debug one of my OBS projects that was failing on the ARM architecture. Unfortunately, my only ARM computer (a Raspberry Pi) was of a too-old architecture to run the OBS toolset directly – the Raspberry was armv6l, and I needed armv7l.

After poking around a lot to figure out how to run OBS as a cross compiler, I eventually had success. These are my notes, which refer to doing this on an OpenSUSE Tumbleweed system on a 64 bit Intel CPU.

1. Install the emulator

zypper install qemu
zypper install build-initvm-x86-64

2. Enable binfmt support for ARM (allows the running of ARM executable on x86_64 CPUs)

cat >/etc/binfmt.d/arm.conf <<EOF

3. restart the binfmt service

systemctl restart systemd-binfmt

4. run osc build using:

osc build --alternative-project=openSUSE:Factory:ARM standard armv7l ecolab.spec

This will fail, because it can’t run the ARM executables.

5. copy the qemu-arm-binfmt executable into the build root

cp /usr/bin/qemu-arm-binfmt /var/tmp/build-root/standard-armv7l/usr/bin

6. rerun the osc build command above. It will complain that the built root is corrupt. Do not clean the build root, but just type continue.

Did you like this? Share it:
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply