Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to emulate Ubuntu Core for Raspberry Pi 3 using QEMU?

I am trying to emulate Ubuntu Core for Raspberry Pi 3 using QEMU but it does not work.

I found tutorials about emulating Raspbian using QEMU and tried to apply them to Ubuntu Core:

  • RASPBERRY PI ON QEMU
  • Using QEMU to emulate a Raspberry Pi

I could not find the right kernel so I used Raspbian Kernel. It did not work. Then I Mounted Ubuntu Core Image and extracted the kernel.img it also did not work.

I start qemu with this command

qemu-system-arm -kernel ./kernel.img \
-cpu arm1176 \
-m 256 \
-M versatilepb \
-no-reboot \
-serial stdio \
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" \
-drive "file=pi3.img,index=0,media=disk,format=raw" \
-redir tcp:2222::22 

QEMU starts but does not load Ubuntu Core.

Does somebody emulated Ubuntu Core(for Raspberry Pi 3) with QEMU?

like image 942
Rustam Isaev Avatar asked Nov 07 '22 09:11

Rustam Isaev


1 Answers

This bit: "-M versatilepb" says "please emulate a VersatilePB development board". (That's a several decades old ARM evaluation board.) "-cpu arm1176" asks for an "arm1176" CPU, which is the ARMv6 CPU that's in the raspberry pi 1. Most userspace code intended for the raspi2 or raspi3 will not run on that (they use a newer ARMv7 CPU). Basically you're trying to use a command line from a tutorial for running a versatilepb kernel on a versatilepb model in order to run raspi 1 userspace images and filesystems. It won't work for raspi2 or raspi3 userspace code.

(Current upstream QEMU does now have a model of a raspi3; I suspect it is not yet complete enough to be able to boot the Ubuntu image, though.)

like image 80
Peter Maydell Avatar answered Dec 01 '22 15:12

Peter Maydell