android-9.0.0_r34 / aosp_x86_64-eng builds missing files, like /sepolicy - can't boot

1,033 views
Skip to first unread message

julien....@gmail.com

unread,
Mar 18, 2019, 10:28:34 AM3/18/19
to Android Building
Hi everybody,

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.

Building the most "generic" or "mainline" Android as possible (android-9.0.0_r34 / aosp_x86_64-eng) :
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 :
  1. system beeing /dev/vda
  2. userdata beeing /dev/vdb
  3. cache beeing /dev/vdc
  4. 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

julien....@gmail.com

unread,
Mar 18, 2019, 1:29:34 PM3/18/19
to Android Building
While re-playing with official emulator - and taking a look at Android 10 by the way ;) I noticed that the ramdisk.img of the emulator does't contain /sepolicy file, and it looks like Emulator still succeeds to get it booting : so the missing files that makes QEMU-KVM to fail is not really missing, it can be avoided and work fine ?

It tends to indicates that the standard generic build android-9.0.0_r34 / aosp_x86_64-eng is probably fine and can be booted in some way. But how...

By running the emulator by command line, and adding a magic parameter, I got information about the way the Kernel and the others things are loaded by the emulator

./emulator -avd Eve_API_Q -show-kernel

For example :

[    0.000000] Kernel command line: nopti qemu=1 no_timer_check androidboot.hardware=ranchu androidboot.serialno=EMULATOR28X0X23X0 clocksource=pit no-kvmclock console=ttyS0,38400 android.qemud=1 android.checkjni=1 qemu.gles=1 qemu.encrypt=1 qemu.opengles.version=131072 cma=288M@0-4G qemu.wifi=1 mac80211_hwsim.channels=2 androidboot.android_dt_dir=/proc/device-tree/firmware/android/ skip_initramfs rootwait ro init=/init loop.max_part=7 dm="1 vroot none ro 1,0 5156696 verity 1 PARTUUID=1F043BE6-7A8C-43B6-8531-70B6C93CBBDC PARTUUID=1F043BE6-7A8C-43B6-8531-70B6C93CBBDC 4096 4096 644587 644587 sha1 926f02610018cd908ac13bfe96c403b304344292 02da5c0c5c30a948ae740375556f4bf37fc8a052 1 ignore_zero_blocks" androidboot.veritymode=enforcing androidboot.verifiedbootstate=orange root=/dev/dm-0 ramoops.mem_address=0xff018000 ramoops.mem_size=0x10000 memmap=0x10000$0xff018000 qemu.dalvik.vm.heapsize=384m mac80211_hwsim.mac_prefix=5554

But it's really tough. I'll continue to check all that I can, but if some of you know how to do, or already done a "standard generic Android build" that works fine on standard supported hardware, and know what is mandatory to get it starting fine, you're welcome !
Reply all
Reply to author
Forward
0 new messages