On Sat, 24 Aug 2024 at 17:12, Mario Marietto <marietto2...@gmail.com> wrote: > I want to emulate Android 14 by KonstaKang using qemu-system-aarch64 and as > model virt on Ubuntu 24.04 x64 bit installed on my PC (Intel I9 + RTX 2080 > ti).
So first up, this is as far as I know "uncharted territory" in that I'm not aware of anybody who's booted full Android on any (upstream) QEMU board model. (If there's anybody on-list who *has* done this, please speak up!) It would be interesting to see if it can be done, but it is I suspect unlikely to work "out of the box", especially more complex stuff like accelerated graphics. You'll want to be prepared to fiddle around, diagnose boot-failures, maybe rebuild the kernel, etc. > I've chosen the parameters to boot it,according with the files provided by > that version of Android,that you can find here : > > https://konstakang.com/devices/rpi4/AOSP14/ > > This is the command issued with the parameters embedded : I don't have any solid ideas, but: > qemu-system-aarch64 \ > -m 2048 \ > -cpu cortex-a72 \ > -M virt,gic-version=2 \ ^^ this says to QEMU "boot the 'virt' board"... > -drive > if=pflash,format=raw,file=/usr/local/share/qemu/edk2-aarch64-code.fd \ > -drive if=pflash,format=raw,file=/usr/local/share/qemu/edk2-arm-vars.fd \ > -kernel > /mnt/zroot2/zroot2/OS/Linux/lineage-21.0-20240618-UNOFFICIAL-KonstaKANG-rpi4-atv/boot/Image > \ > -append 'console=ttyAMA0,38400 keep_bootcon earlycon=pl011,0x9000000 > androidboot.hardware=ranchu root=/dev/vdd1' \ ^^^ but this looks like it's saying to the kernel (or perhaps to Android later boot) "you're booting on the 'ranchu' board". Is this image supposed to work on "virt" ? > -drive > file=/mnt/zroot2/zroot2/OS/Linux/lineage-21.0-20240618-UNOFFICIAL-KonstaKANG-rpi4-atv/lineage-21.0-20240618-UNOFFICIAL-KonstaKANG-rpi4-atv.img,format=raw,index=0,media=disk > \ > -device virtio-gpu-pci \ > -device qemu-xhci \ > -device usb-kbd \ > -device usb-mouse \ > -netdev user,id=mynet \ > -device virtio-net-pci,netdev=mynet \ > -serial stdio \ > -no-reboot \ > -d guest_errors \ > -smp cores=4 \ > -device qemu-xhci,id=xhci,addr=0x5 \ > -device usb-mouse,bus=xhci.0 \ > -device usb-kbd,bus=xhci.0 > > Where did I found the kernel "Image" ? here : > > https://dlupload.com/filedetail/377203177 > > This is the boot log : > > EFI stub: Booting Linux Kernel... > EFI stub: EFI_RNG_PROTOCOL unavailable > EFI stub: Generating empty DTB > EFI stub: Exiting boot services... > [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083] > [ 0.000000] Linux version 6.6.36-g01aac93821d2-v8 (kleaf@build-host) > (Android (11368308, +pgo, +bolt, +lto, +mlgo, based on r510928) clang version > 18.0.0 (https://android.googlesource.com/toolchain/llvm-project > 477610d4d0d988e69dbc3fae4fe86bff3f07f2b5), LLD 18.0.0) #1 SMP PREEMPT Tue Jul > 2 09:02:32 UTC 2024 > [ 0.000000] KASLR disabled due to lack of seed > [ 0.000000] printk: debug: skip boot console de-registration. > [ 0.000000] earlycon: pl11 at MMIO 0x0000000009000000 (options '') > [ 0.000000] printk: bootconsole [pl11] enabled > [ 0.000000] efi: EFI v2.7 by EDK II > [ 0.000000] efi: SMBIOS 3.0=0xbfed0000 MEMATTR=0xbd0a0018 ACPI > 2.0=0xbc6f0018 MEMRESERVE=0xbcb43f18 > [ 0.000000] Zone ranges: > [ 0.000000] DMA [mem 0x0000000040000000-0x00000000bfffffff] > [ 0.000000] DMA32 empty > [ 0.000000] Normal empty > [ 0.000000] Movable zone start for each node > [ 0.000000] NoSplit zone start for each node > [ 0.000000] NoMerge zone start for each node > [ 0.000000] Early memory node ranges > [ 0.000000] node 0: [mem 0x0000000040000000-0x00000000bc76ffff] > [ 0.000000] node 0: [mem 0x00000000bc770000-0x00000000bcb3ffff] > [ 0.000000] node 0: [mem 0x00000000bcb40000-0x00000000bfe1ffff] > [ 0.000000] node 0: [mem 0x00000000bfe20000-0x00000000bfeaffff] > [ 0.000000] node 0: [mem 0x00000000bfeb0000-0x00000000bfebffff] > [ 0.000000] node 0: [mem 0x00000000bfec0000-0x00000000bffdffff] > [ 0.000000] node 0: [mem 0x00000000bffe0000-0x00000000bfffffff] > [ 0.000000] Initmem setup node 0 [mem > 0x0000000040000000-0x00000000bfffffff] > [ 0.000000] cma: Reserved 8 MiB at 0x00000000bbc00000 on node -1 > [ 0.000000] Failed to find device node for boot cpu > [ 0.000000] missing boot CPU MPIDR, not enabling secondaries These error messages hint at a problem where the kernel is using the device tree (which UEFI has said it's providing as "empty") rather than the ACPI tables. > [ 0.000000] percpu: Embedded 31 pages/cpu s87016 r8192 d31768 u126976 > [ 0.000000] Detected PIPT I-cache on CPU0 > [ 0.000000] CPU features: detected: Spectre-v2 > [ 0.000000] CPU features: detected: Spectre-v3a > [ 0.000000] CPU features: detected: Spectre-v4 > [ 0.000000] CPU features: detected: Spectre-BHB > [ 0.000000] CPU features: detected: ARM erratum 1742098 > [ 0.000000] CPU features: detected: ARM errata 1165522, 1319367, or 1530923 > [ 0.000000] alternatives: applying boot alternatives > [ 0.000000] Kernel command line: console=ttyAMA0,38400 keep_bootcon > earlycon=pl011,0x9000000 androidboot.hardware=ranchu root=/dev/vdd1 > androidboot.serialno=10000000abcd1234 androidboot.btmacaddr=11:22:33:44:55:66 > [ 0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 > bytes, linear) > [ 0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 > bytes, linear) > [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 516096 > [ 0.000000] mem auto-init: stack:all(zero), heap alloc:off, heap free:off > [ 0.000000] Memory: 2008408K/2097152K available (19328K kernel code, 2374K > rwdata, 7612K rodata, 1792K init, 1192K bss, 80552K reserved, 8192K > cma-reserved) > [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 > [ 0.000000] ftrace: allocating 56269 entries in 220 pages > [ 0.000000] ftrace: allocated 220 pages with 5 groups > [ 0.000000] trace event string verifier disabled > [ 0.000000] rcu: Preemptible hierarchical RCU implementation. > [ 0.000000] rcu: RCU event tracing is enabled. > [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=1. > [ 0.000000] Trampoline variant of Tasks RCU enabled. > [ 0.000000] Rude variant of Tasks RCU enabled. > [ 0.000000] Tracing variant of Tasks RCU enabled. > [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 > jiffies. > [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1 > [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 > [ 0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention. > [ 0.000000] timer_probe: no matching timers found This one is also vaguely suggestive of a similar issue. Is the kernel expecting to be booted via UEFI ? Or does it insist on a device tree? If the latter, try not using UEFI. More generally, if the kernel wasn't built to run on the "virt" board you may find it is missing device drivers that the virt board needs. You'll find the .config file for the kernel helpful in diagnosing this, and you might need to rebuild your own kernel. -- PMM