Reputation: 148
I am trying to set up an Arch image and use qemu in order to cross-compile some stuff before I load the image onto the Pi. I thought the easiest way to do it would be to qemu the latest starter image, prepare it with whatever I needed, and then dd it onto the Pi when I was done.
I downloaded the Arch image from http://downloads.raspberrypi.org/arch_latest, and wanted to run it under Qemu similar to http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/.
I tried many variations on the qemu command line they gave
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1" -hda 2013-05-25-wheezy-raspbian.img
substituting the archlinux-hf-2013-07-22.img. But this eventually led to "Kernel panic - not syncing: No init found. Try passing init= option to kernel"
I'm sure this means the kernel-qemu I downloaded won't work with the Arch image, but I'm not sure the right way to fix the issue.
Edit:
Even the latest Raspbian image kernel panics when I use the command line above with it. Which I guess shouldn't have surprised me, since it's most likely an old kernel.
So I guess my real question is, how can I use whatever kernel is included in the image, rather than having to build my own kernel?
Upvotes: 7
Views: 6932
Reputation: 3891
In 2013-05-25-wheezy-raspbian.img
You can use same kernel for both image.
Here you have to comment ld.so.preload
which will load some shared-library,which will unable login. so kernel panic.
Note:-"root=/dev/sda2 panic=1" pass this parameter only.
You can comment it by doing below.
sudo kpartx -av 2013-05-25-wheezy-raspbian.img
mkdir tmp
sudo mount /dev/mapper/loop0p2 tmp/
cd tmp/etc
sudo vi ld.so.preload
/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
comment
#/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
umount /dev/mapper/loop0p2
kpartx -d 2013-05-25-wheezy-raspbian.img
Then run qemu
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1" -hda 2013-05-25-wheezy-raspbian.img
this will perfectly boot without any trouble
Upvotes: 3
Reputation: 3891
In case archlinux-hf-2013-07-22.img Here there 3 partion are made. you can check by using
fdisk -l archlinux-hf-2013-07-22.img
rootfs is in sd5 i.e 5th partion.
So pass this parameter "root=/dev/sda5 panic=1"
, it will boot perfectly.
Upvotes: 7