define-alpine/qemu.sh
2022-06-18 12:05:18 -03:00

17 lines
494 B
Bash
Executable file

#!/bin/sh
if test "$NOGRAPHIC" = true; then
append="console=ttyS0"
qemuappend="-nographic"
fi
qemu-img create -f qcow2 tmp.qcow2 1G
mkfs.ext4 tmp.qcow2
sudo chown root:$(id -u) -R boot/ && sudo chmod g+rw -R boot/
qemu-system-x86_64 -enable-kvm -m 2048 \
-drive file=image.squashfs,media=disk \
-drive file=tmp.qcow2,media=disk \
-kernel boot/vmlinuz-virt -initrd boot/initramfs-virt \
-append "root=/dev/sda rootfstype=squashfs modules=ext4 init=/sbin/runit-init $append" $qemuappend