Android as DomU

Hi,

We are trying to run Android as DomU. Xen version is 4.8
when we run xl create -c /etc/xen/androidguest.cfg seeing below crashes

[ 1.910945] usbcore: registered new interface driver usbhid
[ 1.910993] usbhid: USB HID core driver
[ 1.911270] ashmem: initialized
[ 1.911500] nanohub: loaded; ret=0
[ 1.918110] IFO:<624:VENC_DRV_ModInit>enter VENC_DRV_ModInit()
[ 1.918110]
[ 1.919009] IFO:<538:VENC_DRV_Probe>VENC_DRV_Probe, omxvenc prepare to probe.
[ 1.919009]
[ 1.919098] Unhandled fault: ttbr address size fault (0x96000000) at 0xffffff800807d0a4
[ 1.919150] Internal error: : 96000000 [#1] PREEMPT SMP
[ 1.919178] Modules linked in:
[ 1.919216] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.113-07887-geb8dbd1 #3
[ 1.919246] Hardware name: XENVM-4.8 (DT)
[ 1.919270] task: ffffffc01a898080 task.stack: ffffffc01a8d4000
[ 1.919313] PC is at VENC_DRV_Probe+0xa0/0x408
[ 1.919341] LR is at VENC_DRV_Probe+0x9c/0x408
[ 1.919367] pc : [] lr : [] pstate: 60400045
[ 1.919397] sp : ffffffc01a8d7b60
[ 1.919417] x29: ffffffc01a8d7b60 x28: 0000000000000000
[ 1.919457] x27: ffffff80093ce910 x26: ffffff80092e0470
[ 1.919495] x25: ffffff80094ef548 x24: 0000000000000000
[ 1.919534] x23: ffffff8009204000 x22: 0000000000000000
[ 1.919571] x21: ffffff8008f1b000 x20: ffffff800963b000
[ 1.919609] x19: ffffff800963b498 x18: 0000000000000007
[ 1.919646] x17: 000000000000000e x16: 0000000000000020
[ 1.919684] x15: 0000000000000019 x14: ffffffffffffffff
[ 1.919722] x13: 0000000000000054 x12: 0000000000000000
[ 1.919760] x11: 000000000000000a x10: ffffff800807e000
[ 1.919797] x9 : 0000000000000000 x8 : ffffff800940d470
[ 1.919835] x7 : 0000000000000000 x6 : 0000000000000000
[ 1.919872] x5 : 000000001bffe200 x4 : ffffff800807e000
[ 1.919910] x3 : 00e8000000000f07 x2 : ffffff800807dfff
[ 1.919948] x1 : 0040000000000001 x0 : ffffff800807d0a4
[ 1.919988]
[ 1.919988] SP: 0xffffffc01a8d7ae0:
[ 1.920014] 7ae0 00000000 00000000 09204000 ffffff80 00000000 00000000 094ef548 ffffff80
[ 1.920110] 7b00 092e0470 ffffff80 093ce910 ffffff80 00000000 00000000 1a8d7b60 ffffffc0
[ 1.920212] 7b20 08aa6f44 ffffff80 1a8d7b60 ffffffc0 08aa6f48 ffffff80 60400045 00000000
[ 1.920308] 7b40 094ef888 ffffff80 00000004 00000000 ffffffff ffffffff 08aa6f44 ffffff80
[ 2.087487] 7b60 1a8d7be0 ffffffc0 087680f8 ffffff80 094ef558 ffffff80 094ef558 ffffff80
[ 2.087529] 7b80 094ef860 ffffff80 00000000 00000000 094ef888 ffffff80 00000000 00000000
[ 2.087565] 7ba0 0935b568 ffffff80 092e0470 ffffff80 093ce910 ffffff80 00000000 00000000
[ 2.087600] 7bc0 1a8d7be0 ffffffc0 087680dc ffffff80 094ef558 ffffff80 094ef558 ffffff80
[ 2.087643]
[ 2.087643] X29: 0xffffffc01a8d7ae0:
[ 2.087655] 7ae0 00000000 00000000 09204000 ffffff80 00000000 00000000 094ef548 ffffff80
[ 2.087691] 7b00 092e0470 ffffff80 093ce910 ffffff80 00000000 00000000 1a8d7b60 ffffffc0
[ 2.087727] 7b20 08aa6f44 ffffff80 1a8d7b60 ffffffc0 08aa6f48 ffffff80 60400045 00000000
[ 2.087763] 7b40 094ef888 ffffff80 00000004 00000000 ffffffff ffffffff 08aa6f44 ffffff80
[ 2.087797] 7b60 1a8d7be0 ffffffc0 087680f8 ffffff80 094ef558 ffffff80 094ef558 ffffff80
[ 2.087831] 7b80 094ef860 ffffff80 00000000 00000000 094ef888 ffffff80 00000000 00000000
[ 2.087867] 7ba0 0935b568 ffffff80 092e0470 ffffff80 093ce910 ffffff80 00000000 00000000
[ 2.087902] 7bc0 1a8d7be0 ffffffc0 087680dc ffffff80 094ef558 ffffff80 094ef558 ffffff80
[ 2.087937]
[ 2.087946] Process swapper/0 (pid: 1, stack limit = 0xffffffc01a8d4000)
[ 2.087960] Stack: (0xffffffc01a8d7b60 to 0xffffffc01a8d8000)
[ 2.087977] 7b60: ffffffc01a8d7be0 ffffff80087680f8 ffffff80094ef558 ffffff80094ef558
[ 2.087991] 7b80: ffffff80094ef860 0000000000000000 ffffff80094ef888 0000000000000000
[ 2.088007] 7ba0: ffffff800935b568 ffffff80092e0470 ffffff80093ce910 0000000000000000
[ 2.088022] 7bc0: ffffffc01a8d7be0 ffffff80087680dc ffffff80094ef558 ffffff80094ef558
[ 2.088037] 7be0: ffffffc01a8d7c10 ffffff8008765e80 ffffff80094ef558 ffffff800962f000
[ 2.088053] 7c00: 0000000000000000 ffffff800962f000 ffffffc01a8d7c50 ffffff8008765fdc
[ 2.088067] 7c20: ffffff80094ef558 ffffff80094ef888 ffffff80094ef5b cat /mnt/etc/f8 0000000000000000
[ 2.088083] 7c40: ffffff80094b3000 ffffff800935b600 ffffffc01a8d7c80 ffffff80087639cc
[ 2.088098] 7c60: 0000000000000000 ffffff80094ef888 ffffff8008765f20 ffffff8008df78dc
[ 2.088113] 7c80: ffffffc01a8d7cd0 ffffff80087656b8 ffffff80094ef888 ffffffc01988e600
[ 2.088128] 7ca0: ffffff80094b40e8 ffffff8008df0938 ffffffc01988e670 0000000000000000
[ 2.088143] 7cc0: ffffffc01a9ac6a8 ffffffc01988e768 ffffffc01a8d7cf0 ffffff80087652e4
[ 2.088158] 7ce0: ffffff80094ef888 ffffff80094ef888 ffffffc01a8d7d30 ffffff8008766cf0
[ 2.088173] 7d00: ffffff80094ef888 0000000000000000 ffffff8009204b18 ffffff8008f1b6c0
[ 2.088189] 7d20: ffffff80094ef548 ffffff8008f1b6c0 ffffffc01a8d7d50 ffffff8008768028
[ 2.088204] 7d40: ffffff80094ef860 ffffff8008f1b6a8 ffffffc01a8d7d80 ffffff800933a144
[ 2.088218] 7d60: 0000000000000000 ffffff800933a108 ffffff800963b450 0000000000000000
[ 2.088233] 7d80: ffffffc01a8d7dc0 ffffff8008083cd4 ffffffc01a898080 ffffff800933a094
[ 2.088248] 7da0: 0000000000000000 0000000000000006 ffffff8009554000 0000000000000000
[ 2.088263] 7dc0: ffffffc01a8d7e30 ffffff80092e0da0 0000000000000182 ffffff8009554000
[ 2.088278] 7de0: ffffff80092c9fc8 0000000000000006 ffffffc01a8d7e00 ffffff800912da80
[ 2.088294] 7e00: ffffff80094314a0 ffffff800912d258 0000000600000006 0000000000000000
[ 2.088308] 7e20: 0000000000000000 ffffff80092c9fc8 ffffffc01a8d7e90 ffffff8008df1058
[ 2.088323] 7e40: ffffff8008df1040 0000000000000000 0000000000000000 0000000000000000
[ 2.287300] 7e60: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 2.287317] 7e80: 0000000000000000 ffffff8008083aa4 0000000000000000 ffffff8008083ab0
[ 2.287331] 7ea0: ffffff8008df1040 0000000000000000 0000000000000000 0000000000000000
[ 2.287348] 7ec0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 2.287363] 7ee0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 2.287378] 7f00: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 2.287393] 7f20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 2.287408] 7f40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 2.287422] 7f60: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 2.287438] 7f80: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 2.287454] 7fa0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 2.287470] 7fc0: 0000000000000000 0000000000000005 0000000000000000 0000000000000000
[ 2.287484] 7fe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 2.287499] Call trace:
[ 2.287509] Exception stack(0xffffffc01a8d7990 to 0xffffffc01a8d7ac0)
[ 2.287521] 7980: ffffff800963b498 0000007fffffffff
[ 2.287538] 79a0: 0000000041662000 ffffff8008aa6f48 0000000000000007 ffffff8000000000
[ 2.287553] 79c0: ffffff800807d0a4 ffffff800810d2c4 0000000000000001 ffffff8008df78dc
[ 2.287569] 79e0: ffffff8008258718 ffffff800960be98 ffffff8008aa6f44 ffffffbeffffffff
[ 2.287585] 7a00: ffffffc01a8d7a30 ffffff8008df78dc ffffff800960be98 ffffffc01a36d800
[ 2.287600] 7a20: 0000000000000001 ffffffc01a36d800 ffffff800807d0a4 0040000000000001
[ 2.287615] 7a40: ffffff800807dfff 00e8000000000f07 ffffff800807e000 000000001bffe200
[ 2.287630] 7a60: 0000000000000000 0000000000000000 ffffff800940d470 0000000000000000
[ 2.287645] 7a80: ffffff800807e000 000000000000000a 0000000000000000 0000000000000054
[ 2.287660] 7aa0: ffffffffffffffff 0000000000000019 0000000000000020 000000000000000e
[ 2.287683] [] VENC_DRV_Probe+0xa0/0x408
[ 2.287700] [] platform_drv_probe+0x58/0xd0
[ 2.287715] [] driver_probe_device+0x220/0x2c0
[ 2.287728] [] __driver_attach+0xbc/0xc0
[ 2.287742] [] bus_for_each_dev+0x6c/0xac
[ 2.287754] [] driver_attach+0x2c/0x34
[ 2.287766] [] bus_add_driver+0x1cc/0x230
[ 2.287778] [] driver_register+0x7c/0x114
[ 2.287789] [] __platform_driver_register+0x60/0x6c
[ 2.287806] [] VENC_DRV_ModInit+0xb0/0x140
[ 2.287823] [] do_one_initcall+0x44/0x134
[ 2.287838] [] kernel_init_freeable+0x1b0/0x250
[ 2.287855] [] kernel_init+0x18/0x140
[ 2.287866] [] ret_from_fork+0x10/0x20
[ 2.287881] Code: d2800081 f2bd1400 97d7f283 b40018c0 (b9400013)
[ 2.288998] —[ end trace 2b3516bea66e789d ]—
[ 2.289036] Kernel panic - not syncing: Fatal exception
[ 2.289053] Kernel Offset: disabled
[ 2.289065] Memory Limit: none
[ 2.289083] Rebooting in 5 seconds…

content of androidguest.cfg is as follows:
kernel = “/boot/AImage.gz”
memory = 512
vcpus = 1
name=“Androidguest”
#vif = [ ‘’ ]
#dhcp = “dhcp”
disk = [’/xen/android/system.raw.img,raw,xvda1,w’,’/xen/android/cache.raw.img,raw,xvda2,w’,’/xen/android/vendor.raw.img,raw,xvda3,w’,’/xen/android/user.raw.img,raw,xvda4,w’]
extra = “earlyprintk=xenboot console=hvc0 root=/dev/xvda1 debug ro init=/bin/sh”

Added below entries in fstab.hikey960, which is part of vendor.img
/dev/xvda1 / ext4 defaults 1 1
/dev/xvda2 none ext4 defaults 0 0
/dev/xvda3 none ext4 defaults 0 0
/dev/xvda4 none ext4 defaults 0 0
#none /dev/pts devpts gid=5,mode=620 0 0
#none /dev/shm tmpfs defaults 0 0

Please let me know what is wrong.

It looks like the device tree you have passed to the domU kernel has told the kernel that a video encoder present. domU kernels will require a different device tree compared to dom0 or not-hypervised kernels.

Thanks Daniel.

In the kernel we have disabled the Encoder and decoder modules and boot proceeded bit ahead.
Now we are facing below issue.
[ 3.022764] EXT4-fs (xvda3): couldn’t mount as ext3 due to feature incompatibilities
[ 3.023071] EXT4-fs (xvda3): couldn’t mount as ext2 due to feature incompatibilities
[ 3.227364] EXT4-fs (xvda3): recovery complete
[ 3.227419] EXT4-fs (xvda3): mounted filesystem with ordered data mode. Opts: (null)
[ 3.227534] VFS: Mounted root (ext4 filesystem) on device 202:3.
[ 3.228104] Freeing unused kernel memory: 1152K
[ 3.229517] Kernel panic - not syncing: Requested init /bin/sh failed (error -2).
[ 3.229554] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.113-07887-geb8dbd1-dirty #2
[ 3.229574] Hardware name: XENVM-4.8 (DT)
[ 3.229588] Call trace:
[ 3.229616] [] dump_backtrace+0x0/0x264
[ 3.229636] [] show_stack+0x20/0x28
[ 3.229656] [] dump_stack+0xa8/0xe0
[ 3.229673] [] panic+0x140/0x298
[ 3.229693] [] kernel_init+0xe4/0x140
[ 3.229708] [] ret_from_fork+0x10/0x20
[ 3.229728] Kernel Offset: disabled
[ 3.229742] Memory Limit: none
[ 3.229762] Rebooting in 5 seconds.

If init parameter is removed from the command line, getting below issue. what should be the value for init?
[ 2.385063] Starting init: /etc/init exists but couldn’t execute it (error -13)
[ 2.386060] Kernel panic - not syncing: No working init found. Try passing init= option to kernel.
[ 2.386107] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.113-07887-geb8dbd1-dirty #2
[ 2.386126] Hardware name: XENVM-4.8 (DT)
[ 2.386141] Call trace:
[ 2.386165] [] dump_backtrace+0x0/0x264
[ 2.386181] [] show_stack+0x20/0x28
[ 2.386200] [] dump_stack+0xa8/0xe0
[ 2.386220] [] panic+0x140/0x298
[ 2.386241] [] kernel_init+0x130/0x140
[ 2.386258] [] ret_from_fork+0x10/0x20

Does Android even use init=? I thought the true root filesystem for Android came from the initramfs.

I think the root cause is that you don’t provide correct fstab to Android.
I success to get Android DomU booting, below is parts of dts for Android DomU
passthrough {
compatible = “simple-bus”;
ranges;
#address-cells = <2>;
#size-cells = <2>;

    firmware {
        android {
            compatible = "android,firmware";
            fstab {
                compatible = "android,fstab";
                system {
                    compatible = "android,system";
                    dev = "/dev/block/xvda1";
                    type = "ext4";
                    mnt_flags = "ro" ;
                    fsmgr_flags = "wait";
                    status = "ok";
                };
                vendor {
                    compatible = "android,vendor";
                    dev = "/dev/block/xvda2";
                    type = "ext4";
                    mnt_flags = "ro" ;
                    fsmgr_flags = "wait";
                    status = "ok";
                };
            };
        };
    };
};

And don’t forget to modify DomU config file:

kernel = ‘./android_Image’
device_tree = “./android_hi3660-hikey960.dtb”
ramdisk = ‘./android_ramdisk.img’
extra = 'andoidboot.hardware=hikey960 androidboot.android_dt_dir=/proc/device-tree/passthrough/firmware/android/ console=hv0 ’
disk = [
‘file:./android_system.raw.img,xvda1,w’,
‘file:./android_vendor.raw.img,xvda2,w’,
]

1 Like