dhruvvyas90 / qemu-rpi-kernel

Qemu kernel for emulating Rpi on QEMU
2.05k stars 362 forks source link

Error when trying to run a raspberry pi kernel on a versatilepb QEMU machine #37

Closed guysoft closed 6 years ago

guysoft commented 7 years ago

Hey, A little new to this, so I might be doing something newbishly wrong:

When I run this:

/usr/bin/qemu-system-arm -kernel ./kernel-qemu-4.1.7-jessie -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append 'root=/dev/sda2 panic=1 rootfstype=ext4 rw' -hda ./2017-07-05-raspbian-jessie-lite.img -redir tcp:5022::22

I get this:

qemu-system-arm: Trying to execute code outside RAM or ROM at 0x10000000
This usually means one of the following happened:

(1) You told QEMU to execute a kernel for the wrong machine type, and it crashed on startup (eg trying to run a raspberry pi kernel on a versatilepb QEMU machine)
(2) You didn't give QEMU a kernel or BIOS filename at all, and QEMU executed a ROM full of no-op instructions until it fell off the end
(3) Your guest kernel has a bug and crashed by jumping off into nowhere

It actually says "eg trying to run a raspberry pi kernel on a versatilepb QEMU machine", what machine should I use?

(Command taken from: https://gist.github.com/hfreire/5846b7aa4ac9209699ba )

dhruvvyas90 commented 7 years ago

Hi, both kernels are different. In a nutshell, you can't use Rpi kernel from boot partition and use it on qemu out of the box.

guysoft commented 7 years ago

I didn't, I used the ones from this repo

hillyup commented 7 years ago

Hey, I also have this exact same issue. Downloaded the 3 latest jessie kernels from your repo and all have the same issue.

The command i run: qemu-system-arm -kernel kernel-qemu-4.4.26-jessie -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda work.img -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio

work.img is my own jessie/stretch image that works just fine outside of QEMU.

Is there any other logs you can point me to figure out the issue?

dhruvvyas90 commented 6 years ago

Make sure you configure your image file before running it on qemu. More details can be found on wiki.

guysoft commented 6 years ago

Right. Will test it and see. I'll try and make scripts for CustomPiOS so any image you build there you can test on qemu. Note you might want to upgrade the wiki to say "Stretch" now too :)

guysoft commented 6 years ago

Done, you can now use qemu_boot.sh script for CustomPiOS