Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notes for native-emulation on Arch Linux #118

Open
jchidley opened this issue Nov 11, 2020 · 5 comments
Open

Notes for native-emulation on Arch Linux #118

jchidley opened this issue Nov 11, 2020 · 5 comments

Comments

@jchidley
Copy link

jchidley commented Nov 11, 2020

Thanks for doing this. I had to make some adjustments to get the native emulation to work on Arch Linux.

For Arch, packages qemu and qemu-arch-extra are required.

After unzipping the Raspbian download to a img file, I needed to use fdisk -u sectors -l ../Downloads/2020-08-20-raspios-buster-armhf-lite.img to work out the correct options to setup a loop device. This showed that the first partition's Start (in sectors) was 8192 and Sectors was 524288. So the offset in bytes will be 8192 * 512 and the sizelimit 524288 * 512

losetup -f --show -P --offset $((8192 * 512)) --sizelimit $((524288 * 512))  ../Downloads/2020-08-20-raspios-buster-armhf-lite.img

Because qemu-system-aarch64 kept complaining that the image was in the raw format, and I couldn't work how to specify the format for the -sd option, I converted the raspbian image from a raw format to the qcow2 one using

qemu-img convert -f raw -O qcow2 ../Downloads/2020-08-20-raspios-buster-armhf-lite.img rpi.qcow2

Finally, my modified command to start the image was:

qemu-system-aarch64 -M raspi3 -append "rw earlyprintk loglevel=8 console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootdelay=1" -dtb ./bcm2710-rpi-3-b-plus.dtb -sd rpi.qcow2 -kernel kernel8.img -m 1G -smp 4 -serial stdio -usb -device usb-mouse -device usb-kbd
@dhruvvyas90
Copy link
Owner

@jchidley : Thank you !! That's very useful info. Would you like to create a wiki post on how to emulate rpi-arch / do you mind if I add the posted info in a wiki post ?

@jchidley
Copy link
Author

You have my permission to reuse what I wrote in this issue, above. If I were you, I would test the commands to be sure that a syntax error hasn’t crept in. I am glad that you found it helpful.

@dhruvvyas90
Copy link
Owner

Thank you !! I will double check the instructions before publishing it under wiki.

@k1ba-meow
Copy link

k1ba-meow commented Jan 31, 2023

I was able to use the raw image directly without the limitation by replacing -sd filename.img with -drive file=filename.img,format=raw,index=0,media=disk, however the newer raspi images start directly to raspi-config (which opens in the graphical output window) and while QEMU captured input devices, I was unable to navigate it. I tried all available options for -serial with or without the console boot option in -append , tried omitting the usb options or replacing them with -usb -usbdevice keyboard -usbdevice mouse, to no success. Any ideas on that?

@k1ba-meow
Copy link

Update: I tried to boot the 2022-09-22-bullseye-arm64 image, in my above comment the lite version, now I also tried the regular version with GUI and again, QEMU captures input devices but no input is recognized on the pi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants