Here is an more precise/checked guide to AOSP 10 (aosp_x86_64-eng) on QEMU, kernel build and detailed configuration steps included (5.10, let's be up to date!)
repo init -u https://android.googlesource.com/platform/manifest -b android-10.0.0_r47 repo sync source build/envsetup.sh lunch aosp_x86_64-eng m -j $(nproc) The interesting files are : # out/target/product/generic_x86_64/system.img # out/target/product/generic_x86_64/vendor.img Create (and ext4 format) the partition image files that we will use with QEMU: qemu-img create rootfs.img 5G qemu-img create userdata.img 1G qemu-img create cache.img 500M losetup /dev/loop0 rootfs.img losetup /dev/loop1 userdata.img losetup /dev/loop2 cache.img mkfs -t ext4 /dev/loop0 mkfs -t ext4 /dev/loop1 mkfs -t ext4 /dev/loop2 losetup -d /dev/loop1 losetup -d /dev/loop2 Mouting the rootfs partition mount -t ext4 /dev/loop0 /where/you/want *Placing and changing the right files :* cp -a [system.img mount point] [rootfs/mount/point] The content of system.img may be copied inside a folder which is named like the mount point. Move everything 1 folder back. cp -a [vendor.img mount point] [rootfs/mount/point] If the name of the "vendor.img" mount point is "vendor", everything should now be inside the "/vendor" folder of the rootfs mount point. If not, you have to move it to the /vendor folder Delete : /vendor/lib64/hw/camera.ranchu.so /vendor/lib/hw/camera.ranchu.so /vendor/lib64/hw/camera.ranchu.jpeg.so /vendor/lib/hw/camera.ranchu.jpeg.so /vendor/lib64/hw/gralloc.ranchu.so /vendor/lib/hw/gralloc.ranchu.so /vendor/lib64/hw/hwcomposer.ranchu.so /vendor/lib/hw/hwcomposer.ranchu.so /vendor/lib64/hw/vulkan.ranchu.so /vendor/lib/hw/vulkan.ranchu.so Change /vendor/etc/fstab.ranchu, those 2 lines should be enough: /dev/block/sdb /data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,quota,reservedsize=128M,first_stage_mount /dev/block/sdc /cache ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,quota,reservedsize=128M,first_stage_mount Change /vendor/etc/init/hw/init.ranchu.rc by changing this line: setprop ro.hardware.egl emulation to setprop ro.hardware.egl swiftshader *Manufacturing an up to date 5.10 Android kernel:* git clone https://android.googlesource.com/kernel/configs /!\ From configs/android-5.10/android-recommended.config, if you want to use a mouse, remove the following line : # CONFIG_INPUT_MOUSE is not set git clone https://android.googlesource.com/kernel/common -b android12-5.10 Start from copying "arch/x86/configs/x86_64_defconfig" file to the root of the kernel tree, name it ".config", and append to it: CONFIG_NETFILTER_ADVANCED=y Content of configs/android-5.10/android-base.config Content of configs/android-5.10/android-recommended.config Content of configs/android-5.10/android-recommended-x86.config make menuconfig, exit, save: yes. By looking with some tools, some of the things included into x86_64_defconfig, android-base.config, android-recommended.config are not included into the resulting ".config". It works anyway, but it would be nice to know why theese option aren't enabling. Still missing from x86_64_defconfig CONFIG_SYSVIPC=y CONFIG_PREEMPT_VOLUNTARY=y CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_NF_CONNTRACK_SIP=y CONFIG_NFS_FS=y CONFIG_NFS_V3_ACL=y CONFIG_NFS_V4=y CONFIG_ROOT_NFS=y Still missing from android-base.config: CONFIG_INET_DIAG_DESTROY=y CONFIG_INET_UDP_DIAG=y CONFIG_TRACE_GPU_MEM=y Still missing from android-recommended.config: CONFIG_BACKLIGHT_LCD_SUPPORT=y CONFIG_ENABLE_DEFAULT_TRACERS=y CONFIG_REFCOUNT_FULL=y CONFIG_SDCARD_FS=y Now, 3 options that are still disabled, but should be enabled according to android-base-conditional.xml: CONFIG_KFENCE=y CONFIG_USERFAULTFD=y CONFIG_BPF_JIT_ALWAYS_ON=y CONFIG_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 them by adding at the end of .config: # CONFIG_AIO is not set # CONFIG_ANDROID_BINDERFS is not set Adding VirtIO things: CONFIG_VIRTIO=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_PCI_LEGACY=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_INPUT=y CONFIG_VIRTIO_MMIO=y CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y CONFIG_VIRTIO_DMA_SHARED_BUFFER=y CONFIG_BLK_MQ_VIRTIO=y CONFIG_MEMORY_BALLOON=y CONFIG_BALLOON_COMPACTION=y CONFIG_PAGE_REPORTING=y CONFIG_DRM_GEM_SHMEM_HELPER=y CONFIG_DRM_VIRTIO_GPU=y Above options are enough if you use "-vga virtio" option into QEMU/KVM command line. If wanting to use "-vga std" instead, in order to have the display initializing itself, I had to add: CONFIG_DRM_BOCHS=y CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE=y make menuconfig, exit, save: yes. make -j $(nproc) make INSTALL_MOD_PATH=/home/user/Desktop/ INSTALL_MOD_STRIP=1 modules_install *Take the resulting kernel files:* Take the arch/x86/boot/bzImage file Place the content of /home/user/Desktop/lib/modules/5.10.37+/ into /vendor/lib/modules/ *Unmount rootfs.img:* umount /its/mount/point losetup -d /dev/loop0 *Ready to go: *from where the "rootfs.img", "userdata.img" and "cache.img", and "bzImage" files are located, type: kvm -m 4096 -smp 4 -kernel bzImage -append "root=/dev/sda rootfstype=ext4 ro init=/init selinux=1 checkreqprot=1 androidboot.selinux=permissive console=ttyS0 androidboot.hardware=ranchu loglevel=8" -serial mon:stdio -drive format=raw,file=rootfs.img -drive format=raw,file=userdata.img -drive format=raw,file=cache.img -vga virtio Here with Debian 11 it worked all fine. With the right kernel options, -vga std works fine too. There is a little color glitch about RGB being shown as BGR (or BGR shown as RGB, not sure ^^), probably one line about graphic stack / swiftshader things somewhere (but I don't know where). I'll now go back to arm64, then AOSP 11. Having QEMU running these AOSP versions is based on almost the same approach but needs more things to tweak, so I'll detail it properly after I get them working again -- -- You received this message because you are subscribed to the "Android Building" mailing list. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-building?hl=en --- 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 email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/8310d1dd-5d21-41f7-b6e4-8f66f0be4a61n%40googlegroups.com.
