#!/bin/sh
#
# From:
#   https://canonical-subiquity.readthedocs-hosted.com/en/latest/howto/autoinstall-quickstart-s390x.html
#   https://cdimage.ubuntu.com/ubuntu/releases/24.10/release/netboot/s390x/
#
# Download files:
#   https://cdimage.ubuntu.com/releases/oracular/release/ubuntu-24.10-live-server-s390x.iso
#   https://cdimage.ubuntu.com/ubuntu/releases/24.10/release/netboot/s390x/linux.ubuntu
#   https://cdimage.ubuntu.com/ubuntu/releases/24.10/release/netboot/s390x/initrd.ubuntu
#
# Create disk:
#   qemu-img create -f qcow2 rootfs.qcow 16G
#

qemu-system-s390x \
    -nographic \
    -machine s390-ccw-virtio \
    -cpu max,zpci=on \
    -m 2G \
    -smp 4 \
    -drive file=rootfs.qcow \
    -cdrom ubuntu-24.10-live-server-s390x.iso \
    -device virtio-net-ccw,netdev=net \
    -netdev user,id=net,hostfwd=tcp::2222-:22 \
    -kernel linux.ubuntu \
    -initrd initrd.ubuntu \
    -append "ip=dhcp"
