Hi again,Here is the AOSP 10 on ARM64 QEMU version of the procedure I follow. Andoid5.10 arm64 kernel build included, like for x86_64.Appart from using "vdb" and "vdc" into fstab instead of sdb and sdc, andremoving some "rild.rc" file, the approach is the same. With someadditionnal information at the endrepo init -u https://android.googlesource.com/platform/manifest -bandroid-10.0.0_r47repo syncsource build/envsetup.shlunchm -j $(nproc)# out/target/product/generic_arm64/system.img# out/target/product/generic_arm64/vendor.imgCreate and ext4 format the partition image files:qemu-img create rootfs.img 5Gqemu-img create userdata.img 1Gqemu-img create cache.img 500Mlosetup /dev/loop0 rootfs.imglosetup /dev/loop1 userdata.imglosetup /dev/loop2 cache.imgmkfs -t ext4 /dev/loop0mkfs -t ext4 /dev/loop1mkfs -t ext4 /dev/loop2losetup -d /dev/loop1losetup -d /dev/loop2*Mouting the rootfs partition *mount -t ext4 /dev/loop0 /where/you/wantcp -a [system.img mount point] [rootfs/mount/point]The content of system.img may be copied inside a folder which is named likethe mount point. Move everything 1 folder above.cp -a [vendor.img mount point] [rootfs/mount/point]If the name of the "vendor.img" mount point is "vendor", everything shouldnow be inside the "/vendor" folder of the rootfs. If not, you have to moveit to /vendor folderDelete these files:/vendor/lib/hw/camera.ranchu.so/vendor/lib/hw64/camera.ranchu.so/vendor/lib/hw/camera.ranchu.jpeg.so/vendor/lib/hw64/camera.ranchu.jpeg.so/vendor/lib/hw/vendor/lib/hw/gralloc.ranchu/vendor/lib/hw64/gralloc.ranchu/vendor/lib/hw/hwcomposer.ranchu/vendor/lib/hw64/hwcomposer.ranchu/vendor/lib/hw/vulkan.ranchu.so/vendor/lib/hw64/vulkan.ranchu.so/vendor/etc/init/rild.rcChange /vendor/etc/fstab.ranchu, those 2 lines should be enough:/dev/block/vdb /data ext4noatime,nosuid,nodev,nomblk_io_submit,errors=panicwait,check,quota,reservedsize=128M,first_stage_mount/dev/block/vdc /cache ext4noatime,nosuid,nodev,nomblk_io_submit,errors=panicwait,check,quota,reservedsize=128M,first_stage_mountChange /vendor/etc/init/hw/init.ranchu.rc by changing this line:setprop ro.hardware.egl emulationtosetprop ro.hardware.egl swiftshader*Manufacturing an up to date 5.10 ARM64 Android kernel:*/!\ From configs/android-5.10/android-recommended.config, if you want touse a mouse, remove the following line : # CONFIG_INPUT_MOUSE is not setgit clone https://android.googlesource.com/kernel/common -b android12-5.10Start from copying "arch/arm64/configs/defconfig" file to the root of thekernel tree, name it ".config", and append to it:CONFIG_NETFILTER_ADVANCED=yContent of configs/android-5.10/android-base.configContent of configs/android-5.10/android-recommended.configContent of configs/android-5.10/android-recommended-arm64.configmake ARCH=arm64 menuconfig, exit, save: yes.By looking with some tools, some of the things included intox86_64_defconfig, android-base.config, android-recommended.config are notincluded into the resulting ".config".It works anyway, but it would be nice to know why theese option aren'tenabling.Still missing from arm64/configs/defconfigCONFIG_SYSVIPC=yCONFIG_ACPI_APEI_PCIEAER=yCONFIG_KSM=yCONFIG_IP6_NF_NAT=mCONFIG_IP6_NF_TARGET_MASQUERADE=mCONFIG_LEGACY_PTY_COUNT=16CONFIG_POWER_AVS=yCONFIG_BACKLIGHT_GENERIC=mCONFIG_QCOM_IOMMU=yCONFIG_NFS_FS=yCONFIG_NFS_V4=yCONFIG_NFS_V4_1=yCONFIG_NFS_V4_2=yCONFIG_ROOT_NFS=yStill missing from android-base.config:CONFIG_TRACE_GPU_MEM=yStill missing from android-recommended.config:CONFIG_BACKLIGHT_LCD_SUPPORT=yCONFIG_REFCOUNT_FULL=yCONFIG_SDCARD_FS=yNow, some options that are still disabled, but should be enabled accordingto android-base-conditional.xml:CONFIG_ARMV8_DEPRECATED=yCONFIG_CP15_BARRIER_EMULATION=yCONFIG_SETEND_EMULATION=yCONFIG_SHADOW_CALL_STACK=yCONFIG_SWP_EMULATION=yCONFIG_BPF_JIT_ALWAYS_ON=yCONFIG_KFENCE=yCONFIG_USERFAULTFD=yCONFIG_AIO and CONFIG_ANDROID_BINDERFS options (from android-base.config)are causing early reboot without explanations. Would be nice to know why,to keep them enabled and have something running... Until so, disable themby adding at the end of .config:# CONFIG_AIO is not set# CONFIG_ANDROID_BINDERFS is not setAdding VirtIO things:CONFIG_VIRTIO=yCONFIG_VIRTIO_PCI=yCONFIG_VIRTIO_PCI_LEGACY=yCONFIG_VIRTIO_BALLOON=yCONFIG_VIRTIO_INPUT=yCONFIG_VIRTIO_MMIO=yCONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=yCONFIG_VIRTIO_DMA_SHARED_BUFFER=yCONFIG_BLK_MQ_VIRTIO=yCONFIG_MEMORY_BALLOON=yCONFIG_BALLOON_COMPACTION=yCONFIG_PAGE_REPORTING=yCONFIG_DRM_GEM_SHMEM_HELPER=yCONFIG_DRM_VIRTIO_GPU=ymake ARCH=arm64 menuconfig, exit, save: yes.make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j $(nproc)make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-INSTALL_MOD_PATH=/home/user/Desktop/ INSTALL_MOD_STRIP=1 modules_install*"Installing" the kernel:*Place the the arch/arm64/boot/Image.gz file at the same place as therootfs.img, userdata.img and cache.img filesPlace the content of /home/user/Desktop/lib/modules/5.10.37+/ into/vendor/lib/modules/*Unmount rootfs.img*umount /its/mount/pointlosetup -d /dev/loop0*Ready to go:*>From an x86_64 computer:qemu-system-aarch64 -M virt -cpu cortex-a72 -accel tcg,thread=multi-smp 4 -m 2048 -kernel Image.gz -monitor none -parallel none -append"root=/dev/vda rootfstype=ext4 ro init=/init selinux=1 checkreqprot=1androidboot.selinux=permissive console=ttyAMA0 androidboot.hardware=ranchuloglevel=8" -serial mon:stdio -vga std -device ramfb -device nec-usb-xhci-device usb-kbd -device usb-mouse -bios/usr/share/qemu-efi-aarch64/QEMU_EFI.fd -drive format=raw,file=rootfs.img-drive format=raw,file=userdata.img -drive format=raw,file=cache.imgIf you are lucky enough to have an arm64 machine with KVM available on it,and enough RAM, into the above command line, remplace:qemu-system-aarch64 -M virt -cpu cortex-a72 -accel tcg,thread=multi-smp 4 -m 2048bykvm -M virt -cpu host -accel kvm -smp 4 -m 2048In summary, from an arm64 computer :kvm -M virt -cpu host -accel kvm -smp 4 -m 2048 -kernel Image.gz-monitor none -parallel none -append "root=/dev/vda rootfstype=ext4 roinit=/init selinux=1 checkreqprot=1 androidboot.selinux=permissiveconsole=ttyAMA0 androidboot.hardware=ranchu loglevel=8" -serial mon:stdio-vga std -device ramfb -device nec-usb-xhci -device usb-kbd -deviceusb-mouse -bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd -driveformat=raw,file=rootfs.img -drive format=raw,file=userdata.img -driveformat=raw,file=cache.img*Bits of additionnal information:*Having ARM64 AOSP running on QEMU from x86_64, even with "-acceltcg,thread=multi" which makes things much better, you still need to wait 30seconds before having "android" boot logo (on an AMD 3700X) and 350 seconds(almost 6 minutes) on first boot before having the android main screen withicons and all stuff (2 minutes at the following boots).There are some repeated messages about camera 2.4 stuff and radio@1.0. Youmay remove the/vendor/etc/init/android.hardware.camera.provi...@2.4-service.rc, butmessages about "android.hardware.camera.provider@2.4" will still appear, soyou may remove the associated entries (camera and radio) from/vendor/manifext.xml. Then no more messages about it.In case of need to debug, you may type "logcat" in the console: this giveway too much informations but you may spot information on what you arelooking for, or few lines above some service crashing (sometimes somemessages contains usefull information to tell you why it is going to crashjust after). Into the "userdata.img" partition you may also find"/tombstones" folder, containing crash logs of services.In order to cleanly poweroff your emulated system you can type "reboot -p"so that the "userdata.img" is kept as clean as possible.----You received this message because you are subscribed to the "Android Building"mailing list.To post to this group, send email to android-...@googlegroups.comTo unsubscribe from this group, send email toFor more options, visit this group at---You received this message because you are subscribed to the Google Groups"Android Building" group.To unsubscribe from this group and stop receiving emails from it, send an emailTo view this discussion on the web visit
Hi Felix,
I took a look again into all my stuff to double check, using the described list of commands* (using Debian 11 x86_64 computer, but was also working on Debian 10) I obtained both "system.img" and "vendor.img" into the output folder.
Commands*:
source build/envsetup.sh
lunch aosp_arm64-eng
m -j $(nproc)
Attached here is a tutorial I made myself about AOSP 11 (arm64) on QEMU: for now it works but not perfectly (only works using and arm64 KVM, unstable, but starting, and allowing to browse the main screen, menus, settings... looks like instability is related to swiftshader, according "tombstones" files - Janne Karhunen messages from few days ago may drive to something interesting to replace swiftshader by something more efficient on qemu!). In case you need to compare your results, here is a link about my today attempts following the attached tutorial: https://pix-server-sorel.luoss.fr/Manual/Android/qemu-kvm-aarch64-android-11.0.0_r38/
There is a kernel (today's 5.10.43
version), its .config file, and prepared filesystem images to
boot android 11.0.0_r38 on arm64 qemu-kvm (using a RPi4 for
example, at least, that's what I used, 8GB model to have plenty
of RAM, but 4GB may be enough). Into the "build-output"
sub-folder you'll find the "system.img" and "vendor.img" that
landed into my "out/target/product/generic_arm64/" folder
(before and after I used "simg2img" command to convert them into
standard ext4 partitions images).
Good luck !
Julien