Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to run Gentoo for Raspberry Pi 4 in Qemu
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 487

PostPosted: Sun Jan 05, 2020 1:42 pm    Post subject: How to run Gentoo for Raspberry Pi 4 in Qemu Reply with quote

Hi,

I want to emulate the Raspberry PI 4 with Qemu. I created a SD-card according to User:NeddySeagoon/Raspberry Pi4 64 Bit Install. From the SD-card I created a QCOW2 image with qemu-img. I copied the kernel and the dtb-file for the RPI4.
Code:
$ ls -l
total 5934992
-rw-r--r-- 1 samo samo      40697  5. Jan 00:59 bcm2711-rpi-4-b.dtb
-rw-r--r-- 1 samo samo   13392384  5. Jan 00:58 kernel8.img
-rw-r--r-- 1 samo samo 5368709120  5. Jan 00:56 raspberrypi4.img
-rw-r--r-- 1 samo samo 2463105024  5. Jan 01:05 raspberrypi4.qcow
-rwxr--r-- 1 samo samo        266  5. Jan 13:55 start_raspberry.sh

For starting I use the following script:
Code:
$ cat start_raspberry.sh
#!/bin/bash
exec qemu-system-arm \
-kernel ./kernel8.img \
-append "root=/dev/mmcblk0p3 panic=1 rootfstype=ext4 rw" \
-hda ./raspberrypi4.qcow \
-cpu arm1176 -m 256 \
-M versatilepb \
-no-reboot \
-serial stdio \
-net nic -net user \
-dtb ./bcm2711-rpi-4-b.dtb \
$@

But when I run the script, nothing happens:
Code:
$ ./start_raspberry.sh
pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument

What could be wrong?
BR
Back to top
View user's profile Send private message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 487

PostPosted: Sun Jan 05, 2020 1:47 pm    Post subject: Reply with quote

When I do the same with a raspbian image it works.
Code:
$ ls -l
total 3916832
-rw-r--r-- 1 samo samo 2248146944 26. Sep 02:24 2019-09-26-raspbian-buster-lite.img
-rw-r--r-- 1 samo samo 1304625152  5. Jan 14:36 2019-09-26-raspbian-buster-lite.qcow
-rw-r--r-- 1 samo samo  454279954 18. Dez 21:51 2019-09-26-raspbian-buster-lite.zip
-rw-r--r-- 1 samo samo    3814920 18. Dez 21:52 kernel-qemu-4.19.50-buster
-rwxr--r-- 1 samo samo        292  5. Jan 13:55 start_raspberry.sh
-rw-r--r-- 1 samo samo       8067 18. Dez 22:15 versatile-pb.dtb

Code:
$ cat start_raspberry.sh
#!/bin/bash
exec qemu-system-arm \
-kernel ./kernel-qemu-4.19.50-buster \
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" \
-hda ./2019-09-26-raspbian-buster-lite.qcow \
-cpu arm1176 -m 256 \
-M versatilepb \
-no-reboot \
-serial stdio \
-net nic -net user \
-dtb ./versatile-pb.dtb \
$@

Code:
$ ./start_raspberry.sh
pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument
vpb_sic_write: Bad register offset 0x2c
Booting Linux on physical CPU 0x0
Linux version 4.19.50+ (niklas@ubuntu) (gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2)) #1 Tue Nov 26 01:49:16 CET 2019
CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
...
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47163
Location: 56N 3W

PostPosted: Sun Jan 05, 2020 1:52 pm    Post subject: Reply with quote

samo,

You probably cannot a emulate a whole raspberry pi. QEMU will not be able to emulate the hardware.
Your
Code:
-cpu arm1176 -m 256
You need to choose the 64 bit arm cpu. Probably armv8-a

What do you want to achieve?
A QEMU chroot will work.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 487

PostPosted: Sun Jan 05, 2020 2:04 pm    Post subject: Reply with quote

NeddySeagoon,

I want to check if the image boots correctly before I go with the image onto the hardware.

For chroot I also need a running arm64 in qemu, right?

BR
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47163
Location: 56N 3W

PostPosted: Sun Jan 05, 2020 3:04 pm    Post subject: Reply with quote

samo,

Just go with the hardware testing. It will be easier.

You need a static qemu-user for the chroot.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Sakaki
Guru
Guru


Joined: 21 May 2014
Posts: 409

PostPosted: Mon Jan 06, 2020 12:02 am    Post subject: Reply with quote

Hello samo,

just in case you are interested, I have some notes on setting up a QEMU binfmt_misc chroot here.

But this (being a chroot) will not test the ability of your image to boot...
_________________
Regards,

sakaki
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum