How to build aosp 6.0 img and run emulator with the img on mac m1 device ?
In a word, I want to compile my own android 6.0 image and then use this image to run the emulator on mac m1
I'm what to learn aosp . Now i got aosp-6.0.0_r1 and aosp-6.0.0_r6 source code . I can build the code success , and got the result img files , on intel64 linux device .
- on intel64 devide the build result imgs can be use by emulator to run .
My build enviroment is
Debian12
The build result of aosp-6.0.0_r1 :
when on docker build success , i exit docker .
on debian my
aosp.zshrcconfig is this . "attachmentsaosp.zshrc.sh"-
# AOSP source path evn export AOSP_ROOT=/Volumes/Beyourself/AOSP export AOSP_5=$AOSP_ROOT/android-5.0.1_r1 export AOSP_5_OUT=$AOSP_ROOT/android-5.0.1_r1.tmp export AOSP_6=$AOSP_ROOT/android-6.0.0_r1 export AOSP_6_OUT=$AOSP_ROOT/android-6.0.0_r1.tmp export AOSP_6_R6=$AOSP_ROOT/android-6.0.0_r6 export AOSP_6_R6_OUT=$AOSP_ROOT/android-6.0.0_r6.tmp # export AOSP_PATH=$AOSP_6 # export AOSP_OUT=$AOSP_6_OUT #export AOSP_PATH=$AOSP_6_R6 #export AOSP_OUT=$AOSP_6_R6_OUT # alias source-aosp-build-envsetup.sh='source $AOSP_PATH/build/envsetup.sh' alias repoAlias='python3 $AOSP_ROOT/bin/repo' function source-aosp-build-envsetup() { # AOSP build cache setting : https://source.android.com/source/initializing?hl=zh-cn#optimizing-a-build-environment curPath=$(pwd) if [ "$curPath" = "$AOSP_PATH" ]; then echo -e "\n You are on AOSP path: $AOSP_PATH " echo "Config build cache. " export USE_CCACHE=1 export CCACHE_DIR=$AOSP_OUT/build_ccache prebuilts/misc/linux-x86/ccache/ccache -M 100G fi echo -e "\n>>>> source $AOSP_PATH/build/envsetup.sh" source $AOSP_PATH/build/envsetup.sh } # When config the build result env config , # just emulatorAliasXxx we can run the result emulator with we build imgs . export ANDROID_PRODUCT_OUT=$AOSP_OUT/build_out/target/product/generic export OUT=$ANDROID_PRODUCT_OUT export ANDROID_BUILD_TOP=$AOSP_PATH alias emulatorAliasMac='$AOSP_PATH/prebuilts/android-emulator/darwin-x86_64/emulator' alias emulatorAliasLinux='$AOSP_PATH/prebuilts/android-emulator/linux-x86_64/emulator' On intel Debian devide , i can run emulator with build out imgs success .
On Mac m1 i can't
My lunch cmd :
lunch aosp_arm-eng
I know , on Android studio , we can download android 6 emulator image files . And the images can run success by emulator .
- **I what to imitate it to build 6.0 imgs by my self , and run emulator with my self imgs . **
This is the images download log : attachments android-studio-download-android6-imgs.log
-
Preparing "Install ARM 64 v8a System Image API 23 (revision 7)". Downloading https://dl.google.com/android/repository/sys-img/android/arm64-v8a-23_r07.zip "Install ARM 64 v8a System Image API 23 (revision 7)" ready. Preparing "Install Intel x86 Atom System Image API 23 (revision 10)". Downloading https://dl.google.com/android/repository/sys-img/android/x86-23_r10.zip "Install Intel x86 Atom System Image API 23 (revision 10)" ready. Preparing "Install ARM EABI v7a System Image API 23 (revision 6)". Downloading https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-23_r06.zip "Install ARM EABI v7a System Image API 23 (revision 6)" ready. Preparing "Install Intel x86_64 Atom System Image API 23 (revision 10)". Downloading https://dl.google.com/android/repository/sys-img/android/x86_64-23_r10.zip "Install Intel x86_64 Atom System Image API 23 (revision 10)" ready. Installing ARM 64 v8a System Image in /Volumes/Beyourself/dev_tools/dev_kit/android_sdk/system-images/android-23/default/arm64-v8a "Install ARM 64 v8a System Image API 23 (revision 7)" complete. "Install ARM 64 v8a System Image API 23 (revision 7)" finished. Installing Intel x86 Atom System Image in /Volumes/Beyourself/dev_tools/dev_kit/android_sdk/system-images/android-23/default/x86 "Install Intel x86 Atom System Image API 23 (revision 10)" complete. "Install Intel x86 Atom System Image API 23 (revision 10)" finished. Installing ARM EABI v7a System Image in /Volumes/Beyourself/dev_tools/dev_kit/android_sdk/system-images/android-23/default/armeabi-v7a "Install ARM EABI v7a System Image API 23 (revision 6)" complete. "Install ARM EABI v7a System Image API 23 (revision 6)" finished. Installing Intel x86_64 Atom System Image in /Volumes/Beyourself/dev_tools/dev_kit/android_sdk/system-images/android-23/default/x86_64 "Install Intel x86_64 Atom System Image API 23 (revision 10)" complete. "Install Intel x86_64 Atom System Image API 23 (revision 10)" finished.
I run emulator with armeabi-v7a-23_r06 images , success . On android setting app i got build info is :
Android version : 6.0
Build number : sdk_phone_armv7-userdebug 6.0 MASTER 3079352 test-key .
attachments:
android-download-emulator-imgs-run-result.jpeg
How to find the code branch MASTER 3079352 , I don't know . Because aosp source are many repository .
The images name
armeabi-v7a-23_r06i guess the aosp branch isandroid-6.0.0_r6Then i download the code and lunch cmd is :
lunch sdk_phone_armv7-userdebugbuildsuccess on docker ubuntu os .on debian12
alias emulatorAliasLinux='$AOSP_PATH/prebuilts/android-emulator/linux-x86_64/emulator'- I run emulator success by the build result imgs , use cmd
emulatorAliasLinux
- I run emulator success by the build result imgs , use cmd
the same aosp and build result copy to mac m1 device
env
alias emulatorAliasMac='$AOSP_PATH/prebuilts/android-emulator/darwin-x86_64/emulator'execute
emulatorAliasMacthe emulator just show Android LOGO , not start success . attachments:
aosp6.0.0_r6_build_imgs_run_on_mac_m1_just_show_logo.pngthis is
emulatorAliasMaclog : attachments :4.emulator.just.aosp.content.log-
emulator: found Android build root: /Volumes/MacOs_disk/AOSP/android-6.0.0_r6 emulator: found Android build out: /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic emulator: Read property file at /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/system/build.prop emulator: Cannot find boot properties file: /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/boot.prop emulator: Found target API sdkVersion: 23 emulator: virtual device has no config file - no problem emulator: using core hw config path: /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/hardware-qemu.ini emulator: found skin-specific hardware.ini: /Volumes/MacOs_disk/AOSP/android-6.0.0_r6/development/tools/emulator/skins/HVGA/hardware.ini emulator: autoconfig: -skin HVGA emulator: autoconfig: -skindir /Volumes/MacOs_disk/AOSP/android-6.0.0_r6/development/tools/emulator/skins emulator: found skin-specific hardware.ini: /Volumes/MacOs_disk/AOSP/android-6.0.0_r6/development/tools/emulator/skins/HVGA/hardware.ini emulator: keyset loaded from: /Users/tom/.android/default.keyset emulator: trying to load skin file '/Volumes/MacOs_disk/AOSP/android-6.0.0_r6/development/tools/emulator/skins/HVGA/layout' emulator: skin network speed: 'full' emulator: skin network delay: 'none' emulator: autoconfig: -kernel /Volumes/MacOs_disk/AOSP/android-6.0.0_r6/prebuilts/qemu-kernel/arm/kernel-qemu-armv7 emulator: Auto-detect: Kernel image requires legacy device naming scheme. emulator: Auto-detect: Kernel does not support YAFFS2 partitions. emulator: autoconfig: -ramdisk /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/ramdisk.img emulator: autoconfig: -sysdir /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic emulator: Using initial system image: /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/system.img emulator: WARNING: system partition size adjusted to match image file (1536 MB > 200 MB) emulator: autoconfig: -data /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/userdata-qemu.img emulator: autoconfig: -initdata /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/userdata.img emulator: WARNING: data partition size adjusted to match image file (550 MB > 200 MB) emulator: autoconfig: -cache /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/cache.img emulator: Physical RAM size: 512MB emulator: GPU emulation is disabled emulator: WARNING: CPU acceleration only works with x86/x86_64 system images. emulator: Auto-config: -qemu -cpu cortex-a8 Content of hardware configuration file: hw.cpu.arch = arm hw.cpu.model = cortex-a8 hw.ramSize = 512 hw.screen = touch hw.mainKeys = yes hw.trackBall = yes hw.keyboard = no hw.keyboard.lid = no hw.keyboard.charmap = qwerty2 hw.dPad = yes hw.gsmModem = yes hw.gps = yes hw.battery = yes hw.accelerometer = yes hw.audioInput = yes hw.audioOutput = yes hw.sdCard = yes disk.cachePartition = yes disk.cachePartition.path = /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/cache.img disk.cachePartition.size = 66m hw.lcd.width = 320 hw.lcd.height = 480 hw.lcd.depth = 16 hw.lcd.density = 160 hw.lcd.backlight = yes hw.gpu.enabled = no hw.initialOrientation = portrait hw.camera.back = emulated hw.camera.front = none vm.heapSize = 48 hw.sensors.proximity = yes hw.sensors.magnetic_field = yes hw.sensors.orientation = yes hw.sensors.temperature = yes hw.useext4 = yes kernel.path = /Volumes/MacOs_disk/AOSP/android-6.0.0_r6/prebuilts/qemu-kernel/arm/kernel-qemu-armv7 kernel.parameters = androidboot.hardware=goldfish android.checkjni=1 kernel.newDeviceNaming = no kernel.supportsYaffs2 = no disk.ramdisk.path = /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/ramdisk.img disk.systemPartition.initPath = /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/system.img disk.systemPartition.size = 1536m disk.dataPartition.path = /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/userdata-qemu.img disk.dataPartition.size = 550m avd.name = <build> . QEMU options list: emulator: argv[00] = "/Volumes/MacOs_disk/AOSP/android-6.0.0_r6/prebuilts/android-emulator/darwin-x86_64/emulator64-arm" emulator: argv[01] = "-android-hw" emulator: argv[02] = "/Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/hardware-qemu.ini" Concatenated QEMU options: /Volumes/MacOs_disk/AOSP/android-6.0.0_r6/prebuilts/android-emulator/darwin-x86_64/emulator64-arm -android-hw /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/hardware-qemu.ini emulator: registered 'boot-properties' qemud service emulator: Using kernel serial device prefix: ttyS emulator: Ramdisk image contains fstab.goldfish file emulator: Found format of system partition: 'ext4' emulator: Found format of userdata partition: 'ext4' emulator: Found format of cache partition: 'ext4' emulator: system partition format: ext4 emulator: Mapping 'system' partition image to /tmp/android-tom/emulator-kBISGe emulator: nand_add_dev: system,size=0x60000000,file=/tmp/android-tom/emulator-kBISGe,initfile=/Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/system.img,pagesize=512,extrasize=0 emulator: userdata partition format: ext4 emulator: nand_add_dev: userdata,size=0x22600000,file=/Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/userdata-qemu.img,pagesize=512,extrasize=0 emulator: cache partition format: ext4 emulator: nand_add_dev: cache,size=0x4200000,file=/Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/build_out/target/product/generic/cache.img,pagesize=512,extrasize=0 emulator: registered 'boot-properties' qemud service emulator: Adding boot property: 'dalvik.vm.heapsize' = '48m' emulator: Adding boot property: 'ro.config.low_ram' = 'true' emulator: Adding boot property: 'qemu.sf.lcd_density' = '160' emulator: Adding boot property: 'qemu.hw.mainkeys' = '1' emulator: Adding boot property: 'qemu.sf.fake_camera' = 'back' emulator: Kernel parameters: qemu.gles=0 qemu=1 console=ttyS0 android.qemud=ttyS1 androidboot.hardware=goldfish android.checkjni=1 ndns=1 emulator: autoconfig: -scale 1 emulator: Forcing ro.adb.qemud to "0". emulator: control console listening on port 5554, ADB on port 5555 emulator: sent '0012host:emulator:5555' to ADB server emulator: setting up http proxy: server=127.0.0.1 port=8889 emulator: android_hw_fingerprint_init: fingerprint qemud listen service initialized emulator: ping program: /Volumes/MacOs_disk/AOSP/android-6.0.0_r6/prebuilts/android-emulator/darwin-x86_64/ddms goldfish_fb_get_pixel_format:170: display surface,pixel format: bits/pixel: 16 bytes/pixel: 2 depth: 16 red: bits=5 mask=0xf800 shift=11 max=0x1f green: bits=6 mask=0x7e0 shift=5 max=0x3f blue: bits=5 mask=0x1f shift=0 max=0x1f alpha: bits=0 mask=0x0 shift=0 max=0x0 emulator: ### WARNING: /etc/localtime does not point to /usr/share/zoneinfo/, can't determine zoneinfo timezone name emulator: _hwFingerprint_connect: connect finger print listen is called emulator: got message from guest system fingerprint HAL emulator: User configuration saved to /Users/tom/.android/emulator-user.ini
In a word, I want to compile my own android 6.0 image and then use this image to run the emulator on mac m1
In a word, I want to compile my own android 6.0 image and then use this image to run the emulator on mac m1

