Reputation: 4233
I've been trying to build and run Android JellyBean on QEMU.
I have a kernel built for my target machine type (ARM Versatile Express - Cortex A15)
I have been trying to build a QEMU image with the output of my Android build but I always end up with errors such as
qemu-system-arm -serial stdio -M vexpress-a15 -m 128m -kernel zImage -append "root=/dev/sda1 earlyprintk" android_jb.img
<3>VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "/" or unknown-block(2,0)
Please append a correct "root=" boot option; here are the available partitions:
<0>Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
This happens if i don't specify the -initrd
option to qemu.
When I do specify the initrd option
qemu-system-arm -serial stdio -M vexpress-a15 -m 128m -kernel zImage -append "root=/dev/sda1 earlyprintk" -initrd ramdisk.img android_jb.img
(generated by the Android build process), I get the following errors
<3>init: cannot find '/system/bin/servicemanager', disabling 'servicemanager'
<3>init: cannot find '/system/bin/vold', disabling 'vold'
<3>init: cannot find '/system/bin/sh', disabling 'setconsole'
<3>init: cannot find '/system/bin/netd', disabling 'netd'
<3>init: cannot find '/system/bin/debuggerd', disabling 'debuggerd'
<3>init: cannot find '/system/bin/rild', disabling 'ril-daemon'
<3>init: cannot find '/system/bin/surfaceflinger', disabling 'surfaceflinger'
<3>init: cannot find '/system/bin/app_process', disabling 'zygote'
<3>init: cannot find '/system/bin/drmserver', disabling 'drm'
<3>init: cannot find '/system/bin/mediaserver', disabling 'media'
<3>init: cannot find '/system/bin/installd', disabling 'installd'
<3>init: cannot find '/system/bin/keystore', disabling 'keystore'
<3>init: cannot find '/system/bin/sh', disabling 'console'
My android_jb.img
contains the contents of android_out/root/*
and android_out/system
Where android_out
is the output of my Android build
(android_out = out/platform/target/project/armboard_v7a)
Upvotes: 1
Views: 2373
Reputation: 4233
I figured out how to do this a few weeks back.
Building Android for VExpress is slightly complicated. Thankfully, the steps are described clearly here.
Following those instructions, once make PRODUCT-armboard_v7a-eng
completes, head over to the output directory.
We now need to create an image that we're going to mount as the SD card on the VExpress board.
For example, I'm going to create a 2GB SD image containing android.
dd if=/dev/zero of=android.img bs=512 count=$((2 * 1024 * 1024 * 1024 / 512))
We now need to create a file system and partition table on this image.
sudo /sbin/losetup /dev/loop0 android.img
# cylinders = size / (16 * 63 * 512)
sudo /sbin/sfdisk --no-reread -D -C 4161 -H 16 -S 63 /dev/loop0 << EOF
0,
;
EOF
sudo /sbin/losetup -d /dev/loop0
# Create the partition
sudo /sbin/losetup -o $((63*512)) /dev/loop0 android.img
sudo /sbin/mkfs.ext2 /dev/loop0
sudo /sbin/losetup -d /dev/loop0
Now that we have the image ready, we copy the android files onto it.
sudo mount -o loop,offset=$((63*512)) android.img /mnt
sudo cp -R <android_out>/target/product/armboard_v7a/root/* /mnt/
sudo cp -R <android_out>/target/product/armboard_v7a/system/* /mnt/system
sudo umount /mnt
Nothing special here.
Use vexpress_defconfig
We can now run qemu
with all the pieces.
qemu-system-arm -kernel zImage -machine vexpress-a9 -cpu cortex-a9 -serial stdio -m 1024 -append 'noinitrd root=/dev/mmcblk0p1 rw mem=1024M console=ttyAMA0,38400n8 rootwait earlyprintk loglevel=8 init=/init' -sd android.img
https://wiki.linaro.org/PeterMaydell/QemuVersatileExpress
http://linux-arm.org/LinuxKernel/LinuxAndroidPlatform
http://www.m5sim.org/BBench-gem5
Upvotes: 1
Reputation: 11
if you are using -initrd
, then it only loads ramdisk which contains only few binaries.
system and other partition is mounted in init.rc, and it seems mount is not happened in your logs.
Upvotes: 1