DEV Community

Russell Standish
Russell Standish

Posted on • Originally published at hpcoders.com.au on

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
:arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:
\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff
:/usr/bin/qemu-arm-binfmt:P
:armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2
8:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\x
ff:/usr/bin/qemu-armeb-binfmt:P
EOF

  1. restart the binfmt service

systemctl restart systemd-binfmt

  1. 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.

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


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

  1. 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.

Top comments (0)