Booting a redpesk image with Qemu

Launch a x86_64 image

Prerequisites

OVMF

OVMF is a port of Intel’s Tianocore firmware to the qemu virtual machine.

Ubuntu

sudo apt-get install qemu-kvm ovmf

Fedora

sudo dnf install qemu-kvm edk2-ovmf

OpenSUSE

sudo zypper install qemu-edk2 qemu-kvm ovmf

Download the x86_64 image

Create a directory to download the image:

mkdir ~/redpeskimage
cd ~/redpeskimage

Then download the latest redpesk OS image with this command:

wget -r -nd -nc --no-parent -A "redpesk*smack*" 'https://download.redpesk.bzh/redpesk-lts/arz-1.1-update/images/smack/minimal/x86_64/generic/'

See Download Images section for link details.

Control the image integrity

Before doing anything, please control the integrity of the downloaded redpesk image. Example:

sha256sum -c redpesk*.tar.xz.sha256
redpesk*x86_64*.tar.xz: OK

Extract the image

tar xJf redpesk*.tar.xz

Launch the Qemu

# For Ubuntu
OVMF="/usr/share/qemu/OVMF.fd"
# Uncomment/change for Fedora
#OVMF="/usr/share/OVMF/OVMF_CODE.fd"
PORT_SSH=3333

qemu-system-x86_64 \
    -hda "Redpesk-OS.img" \
    -enable-kvm -m 2048 \
    -cpu kvm64 \
    -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt \
    -smp 4 \
    -vga virtio \
    -device virtio-rng-pci \
    -serial mon:stdio \
    -serial null \
    -net nic \
    -net user,hostfwd=tcp::$PORT_SSH-:22 \
    -bios $OVMF

Wait! It is booting…

NOTE: Default root password is root.

Launch a aarch64 image

Prerequisites

Ubuntu

sudo apt-get install libguestfs-tools qemu-system-arm

Fedora

sudo dnf install libguestfs-tools-c qemu-system-arm

OpenSUSE

sudo zypper install libguestfs0 qemu-arm qemu-uefi-aarch64

Download the aarch64 generic image

mkdir ~/redpeskimage
cd ~/redpeskimage

Then download the latest redpesk OS image with this command:

wget -r -nd -nc --no-parent -A "redpesk*smack*" 'https://download.redpesk.bzh/redpesk-lts/arz-1.1-update/images/smack/minimal/aarch64/generic/'

See Download Images section for link details here.

Control the image integrity

Before doing anything, please control the integrity of the downloaded redpesk image. Example:

sha256sum -c redpesk*.tar.xz.sha256
redpesk*aarch64*.tar.xz: OK

Extract the image

tar xJf redpesk*.tar.xz

Extract the kernel for the image

Use virt-builder to extract kernel of the downloaded image. Example :

$ sudo virt-builder --get-kernel Redpesk-OS.img
download: /boot/vmlinuz-5.10.18-2203.rpdarz.aarch64 -> ./vmlinuz-5.10.18-2203.rpdarz.aarch64
download: /boot/initramfs-5.10.18-2203.rpdarz.aarch64.img -> ./initramfs-5.10.18-2203.rpdarz.aarch64.img

Launch the Qemu

KERNEL_IMAGE=$(ls vmlinuz-*.aarch64)
INITRAMFS_IMAGE=$(ls initramfs-*.aarch64.img)
PORT_SSH=3333

qemu-system-aarch64 \
        -hda "Redpesk-OS.img" \
        -kernel $KERNEL_IMAGE \
        -initrd $INITRAMFS_IMAGE \
        -machine accel=tcg,type=virt \
        -m 2048 \
        -cpu cortex-a57 \
        -smp 4 \
        -append 'console=ttyAMA0,115200 root=LABEL=rootfs security=smack' \
        -net nic -net user,hostfwd=tcp::$PORT_SSH-:22 \
        -display none \
        -nographic \
        -snapshot

Wait! It is booting…

NOTE: Default root password is root.

NOTE: Key sequence to exit qemu in terminal mode is : CTRL-A and then X

Connect to the qemu over SSH

PORT_SSH=3333
ssh -p $PORT_SSH root@localhost

Installing a package

See this section for installing and starting helloworld-binding: Application deployment