When developing for architectures that are not mainstream, developers often have challenges to get access to current systems that allow to work on a specific software. Especially when asking to fix an issue that shows up only on big endian hardware, the answer I repeatedly get is, that it’s hard to get access to an appropriate machine.
I just recently saw reports that told that the qemu project made substantial progress with supporting more current Mainframe hardware. Thus I thought, how hard could it be to create a virtual machine that allows to develop for s390x on local workstation hardware.
It turned out to be much easier than I thought. First, I did a standard install of tumbleweed for s390x, which went quite easy. But then I remembered that also the OBS supports emulators, and specifically qemu to run virtual machines.
I got myself a recent version of qemu-s390 from the Virtualization project:
osc repourls Virtualization ... su cd /etc/zypp/repos.d && \ wget https://download.opensuse.org/repositories/Virtualization/openSUSE_Leap_15.1/Virtualization.repo zypper install --allow-vendor-change qemu-s390 exit
After this, we are almost done. The next part is to checkout some package from OBS and try to build it:
mkdir ~/obs && cd $_ osc co openSUSE:Factory:zSystems cmsfs cd openSUSE:Factory:zSystems/cmsfs
Now, you can run the build locally with the ‘osc’ command. You will have to specify the amount of memory you want to give to the resulting virtual machine, in my case here, it is 8GByte:
osc build --vm-type qemu --vm-memory=8192 standard s390x
Building locally is nice, but how about working on that software? That is where the fun begins. Typically you would be able to do a chroot to a local directory when building in a chroot environment. So, lets just do some beginner error and run osc with the chroot command:
osc chroot --vm-type qemu --vm-memory=8192 standard s390x
To my big surprise, that command did not complain. I just opened up a second terminal, and found that in the background some processes were heavily working, and after a while, I was actually placed into a shell.
To double check, I ran ‘cat /proc/cpuinfo’ and yes, I am placed into a s390x virtual machine!
Putting things together: All you have to do, to have a running s390x virtual machine crafted for some specific package with all latest updates is:
- Get the package source from OBS
- Run osc chroot
I think that is really great functionality. Thanks to the excellent OBS team that made this work out of the box without much hassle. Great Job!!!