How to emulate the Librem5 ARM architecture? Why is there no ARM virtual machine?

Is it possible? I’m trying to check whether an app built with the Quasar Framework/Electron.js would run on it and how well it runs performance-wise as far as possible.

I think it needs another virtual machine which could be run with qemu-system-arm without the devkit even under non-arm x86 GNU/Linux hardware - is that correct?
It looks like the virtual machines from here for non-devkit hardware are all x86-64 ones.

1 Like

That is correct. Your best bet is to run the devkit version. It should work, if it doesn’t, you should be able to add a kernel parameter to output to the virtual serial device and have qemu attach that to an ncurses out. That would let you see the bootup messages and get basic functionality for debugging display and driver issues. You could also use it in a chroot if it’s just to test particular ARM software.

2 Likes

I tried sudo qemu-system-arm -machine sabrelite -drive file=./devkit.img,format=raw -display gtk -m 2G
and sudo qemu-system-arm -machine virt -drive file=./devkit.img,format=raw -display gtk -m 2G and with qcow2 after converting the .img to .qcow2. But it only starts qemu with a black screen that waits for input and says:

QEMU 3.1.0 monitor - type ‘help’ for more information
(qemu)

The same shows when using -display curses and excluding the -display parameter. When using -vga virtio it says:

qemu-system-arm: Virtio VGA not available

Supported machines are listed here. Specifying the CPU with -cpu cortex-m4 didn’t help.

Do I need to compile Linux for ARM as described here or are there signed images somewhere that I could use?

For chroot here is a guide on how to run x86 on arm so maybe the opposite is possible too.

m4 is MCU (not CPU) and I think you need aarch64, not arm.
Try raspi2 for the start but L5 initialisation vector is a bit complex due to this m4 core and dram initialisation, so not sure what’s done by bootloader and what by actual image.

chroot is trivial. Get a copy of qemu-arm-static compiled for the host system (x86 or x86_64). Don’t know what package it is on debian, gentoo it uses the static-user USE flag. Name might vary slightly. Copy it to $CHROOT/usr/bin/qemu-arm-static then run

 echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register

Which tells the kernel to use the linked program as the interpreter for files matching the specified format. You can then chroot into $CHROOT and it should just work.