I'm on this subject for some times now, and I'm stuck. I'll first really simply describe what I did, and "how" it doesn't work.
Running it on QEMU-KVM
I'm using the Kernel delivered inside the "out" folder, which is 4.4. I successfully booted Debian with it on KVM (even if I just had command line instead of graphic display, probably because of Xorg drivers of Debian). It's able to see /dev/vdX disks but cannot see /dev/sdX disks. It has some importance for the KVM parameters about disk mounting (drives parameters are little bit longer)
kvm
-m 2048
-smp 4
-vga std
-kernel kernel-ranchu
-append "console=ttyS0 debug drm.debug=0x0 androidboot.selinux=permissive androidboot.hardware=ranchu"
-serial mon:stdio
-initrd ramdisk.img
-drive format=raw,index=0,if=none,id=system,file=system.img -device virtio-blk-pci,drive=system
-drive format=raw,index=1,if=none,id=userdata,file=userdata.img -device virtio-blk-pci,drive=userdata
-drive format=raw,index=2,if=none,id=cache,file=cache.img -device virtio-blk-pci,drive=cache
-drive format=raw,index=3,if=none,id=vendor,file=vendor.img -device virtio-blk-pci,drive=vendor
(in reality it's a biiiig command line so it's easier to see when I split it).
It makes volumes available this way :
- system beeing /dev/vda
- userdata beeing /dev/vdb
- cache beeing /dev/vdc
- vendor beeing /dev/vdd
It cannot boot fine :
It stops at failing to load the "/sepolicy" file that we are usually able to find at the root of the ramdisk.img : this file is missing and it stops.
With or without the 4 drives it makes no difference, since the file is missing from ramdisk.img, so I guess "mounting" would happen later.
[ 1.163969] init: init first stage started!
[ 1.164537] init: Using Android DT directory /proc/device-tree/firmware/android/
[ 1.165485] init: First stage mount skipped (missing/incompatible fstab in device tree)
[ 1.166509] init: Skipped setting INIT_AVB_VERSION (not in recovery mode)
[ 1.167318] init: Loading SELinux policy
[ 1.167824] selinux: SELinux: Could not open /sepolicy: No such file or directory
[ 1.167824]
[ 1.168978] init: Failed to load monolithic SELinux policy: No such file or directory
[ 1.169934] init: Unable to load SELinux policy
[ 1.170490] init: Reboot start, reason: reboot, rebootTarget: bootloader
[ 1.171292] init[1]: segfault at 14 ip 0000000000565e30 sp 00007ffcfd4651e0 error 4 in init[400000+22a000]
[ 1.172452] init: Reboot ending, jumping to kernel
[ 1.173023] Unregister pv shared memory for cpu 0
[ 1.173024] Unregister pv shared memory for cpu 2
[ 1.173043] Unregister pv shared memory for cpu 3
[ 1.174913] Unregister pv shared memory for cpu 1
[ 1.176075] reboot: Restarting system with command 'bootloader'
[ 1.176804] reboot: machine restart
What I already tried :
- aosp_cf_x86_64_tablet-userdebug - img files and Kernel, same problem
- aosp_cf_x86_64_tv-userdebug - img files and Kernel,same problem
- android-4.19 kernel (x86_64_defconfig with support of /dev/sdX but not /dev/vdX) - works fine with Debian but no change when booting Android
- android-4.19 kernel (x86_64_defconfig edited for adding support of /dev/vdX too) - works fine with Debian but no change when booting Android
Do you know what I'm missing ?
From
https://source.android.com/setup/build/building we can read the following :
AOSP cannot be used from pure source code only and requires additional hardware-related proprietary libraries to run, such as for hardware graphics acceleration. See the sections below for download links and Device binaries for additional resources.My understanding is that of course, for a real world device, specific drivers should probably be added. But for KVM / QEMU too ?
At "lunch" command, hikey and google devices builds are complete and including the missing files, without adding any command.
Also, for Sony devices, some commands are added between repo init and repo sync :
Is something like that mandatory for running on a standard KVM ? Or laptop/device on which every driver is included into the mainline kernel ?
If so, is this a Google/Android thing, or Linaro ? Or something completely custom and unofficial ? (and where to find it)
Thank you in advance ! For now, I'm completely stuck ;)
Julien ROBIN