How to build s390x emulator (tcg) on Ubuntu 16.04:
- Download qemu's source code using apt:
$ apt source qemu
- Install all build requirements according to [1]:
$ sudo mk-build-deps -i -r qemu
- Install s390x cross compiler:
$ sudo apt install -y gcc-5-multilib-s390x-linux-gnu
- Change debian/rules to always build s390x bootloader via cross-compiler, by applying the provided patch:
$ cd qemu-2.5+dfsg
$ patch -p1 < ~/qemu-s390x-debian-rules.patch
- Build according to [1], this will take some time:
$ fakeroot debian/rules binary
...
- Install resulting qemu-system-s390x package:
$ sudo apt install ../qemu-system-s390x_2.5+dfsg-5ubuntu10.14_amd64.deb
- Use virt-manager[2] to setup the host, don't use CDROMs as they are not supported. Rather, download and use latest debian's installer kernel and initrd:
$ wget -c http://ftp.debian.org/debian/dists/stable/main/installer-s390x/current/images/generic/kernel.debian \
http://ftp.debian.org/debian/dists/stable/main/installer-s390x/current/images/generic/initrd.debian
- Use above as initrd and kernel on 'Boot Options' tab under 'Direct kernel boot'. Installation only possible via console.