Boot Ubuntu Server Image for rock pi 4b in QEMU

Hi, How can I boot the kernel in the image using qemu-aarch64 and mount the rootfs to update it?

sudo apt-get install binfmt-support qemu-user-static
sudo mount rootfs.ext4 /mnt
sudo chroot /mnt
1 Like

Yes,we can do that. But in some cases I wanted to check if the image is build correctly then how can I do that.

We can flash and check it, but if we were some how able to emulate the machine then we can check image faster and our image creation cycles can be fast.

@sutarganesh
wouldnt it be faster and easier to check it with simply having 2nd/test rock device?

I would assume that you would like to chroot into the image with QEMU for ability to update repository, packages, … or adding changes.

However, using QEMU will not ensure you that the image runs also properly on rockpi device, to be sure, best it to test it then directly on a rockpi device, you can take a cheaper version with 1/2GB, it will do the same and is cheaper then time wasted.

As you do have SSH and your rock can boot with emmc, meaning that you can keep SD card inside and when you need to test your image, simply flash it with dd (can be done over SSH). That would be how I would probably automate that process, as I would add additional test scripts to it and when I want to finish my testing, simply change extlinux config to boot from whatever device it did before.

check image faster and our image creation cycles can be fast

You can use network file system and test on real hardware. Use nfs as rootfs, and mount your boot partition on /boot. You can test new kernel and applications in this way.