Skip to content

Run in Standalone Mode

This guide covers running a ToloMEO image on QEMU x86-64 in standalone mode, without the devcontainer build environment.

Prerequisites

  • QEMU installed with qemu-system-x86_64 available
  • A completed image build; see Build the ToloMEO Reference Image
  • Device credentials at certs/agent.env, flashed onto the QEMU disk
  • The disk tools sfdisk, mkfs.ext4 and mksquashfs on the host that provisions the disk (the devcontainer provides them)

Prepare Artifacts

Copy the following files from the artifacts directory to your working directory:

artifacts/tolomeo-qemux86-64
└── image-prod
    └── 1.0.0
        ├── bzImage
        ├── image-prod-tolomeo-qemux86-64.rootfs.ext4.gz
        ├── image-prod-tolomeo-qemux86-64.rootfs.qemuboot.conf
        └── ...

You need: bzImage and image-prod-tolomeo-qemux86-64.rootfs.ext4.gz.

Extract the root filesystem:

gunzip image-prod-tolomeo-qemux86-64.rootfs.ext4.gz

Prepare the Working Directory

Your working directory should contain the following before launching QEMU:

.
├── bzImage
├── image-prod-tolomeo-qemux86-64.rootfs.ext4
├── qemu-disk.img                               # provisioned disk with certificates
└── shared/                                     # local directory for shared mount

Provision the disk from a meta-tolomeo checkout, with the working directory as the target. The script creates qemu-disk.img and flashes certs/agent.env onto its certs partition, without root or a loop device. It also creates the shared/ directory:

meta-tolomeo-qemu/scripts/provision-qemu-disk.sh <working-directory> certs/agent.env

Run QEMU

Launch the VM with the following command:

qemu-system-x86_64 \
  -kernel bzImage \
  -append 'root=/dev/vda rw mem=1024M ip=dhcp console=ttyS0 console=ttyS1 oprofile.timer=1 tsc=reliable no_timer_check rcupdate.rcu_expedited=1 swiotlb=0 ' \
  -drive file=image-prod-tolomeo-qemux86-64.rootfs.ext4,if=virtio,format=raw \
  -drive file=qemu-disk.img,if=virtio,format=raw,id=qemu-disk \
  -virtfs local,path=shared,mount_tag=shared,security_model=mapped-xattr \
  -device virtio-net-pci,netdev=net0,mac=52:54:00:12:35:02 \
  -netdev user,id=net0,hostfwd=tcp:127.0.0.1:2222-:22,hostfwd=tcp:127.0.0.1:2323-:23 \
  -object rng-random,filename=/dev/urandom,id=rng0 \
  -device virtio-rng-pci,rng=rng0 \
  -cpu IvyBridge -machine q35,i8042=off \
  -smp 4 -m 1024 \
  -usb -device usb-tablet -usb -device usb-kbd \
  -serial mon:stdio -serial null -nographic

KVM acceleration

Add -enable-kvm for better performance. This may require sudo depending on your system configuration.

Connect via SSH

Once the VM has booted, connect as admin:

ssh -p 2222 admin@127.0.0.1

See also