Android 源码启动虚拟机经验

export PATH=$PATH:/home/nwpushuai/Sources/Google/Android/Google/aosp/out/host/linux-x86/bin
export ANDROID_PRODUCT_OUT=/home/nwpushuai/Sources/Google/Android/Google/aosp/out/target/product/generic
export ANDROID_SWT=/home/nwpushuai/Sources/Google/Android/Google/aosp/out/host/linux-x86/framework
export ANDROID_BUILD_TOP=/home/nwpushuai/Sources/Google/Android/Google/aosp
再执行
emulator -system system.img -data userdata.img -ramdisk ramdisk.img

emulator -kernel /Volumes/android/android-source/prebuilts/qemu-kernel/arm/kernel-qemu-armv7 -system system.img -data userdata.img -ramdisk ramdisk.img

问题:emulator: WARNING: system partition size adjusted to match image file (550 MB > 200 MB)
解决方案:emulator -partition-size 6020 -kernel ~/Sources/Google/Android/Google/android-9.0.0_r35/prebuilts/qemu-kernel/x86_64/4.4/kernel-qemu2 -system system.img -data userdata.img -ramdisk ramdisk.img

问题:不显示UI
解决方案:emulator -show-kernel -no-window

问题:
emulator: ERROR: New emulator backend requires minimum kernel version 3.10+ (currently got lower)
Please make sure you've got updated system images and do not force the specific kernel image together with the engine version

解决:emulator -kernel ./prebuilts/qemu-kernel/3.10版本以上的 -system system.img -data userdata.img -ramdisk ramdisk.img

https://blog.csdn.net/qq_25564621/article/details/80253983

https://www.brobwind.com/archives/799

[   10.950765] init: Wait for partitions returned after 10001ms
[   10.953434] init: bool android::init::FirstStageMount::InitRequiredDevices(): partition(s) not found after polling timeout: system, vendor
[   10.956988] init: Failed to mount required partitions early ...

# PDK does not use ext4 image, but it is added here to prevent build break.
TARGET_USERIMAGES_USE_EXT4 := true
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 6291456000
BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true

你可能感兴趣的:(Android代码经验)