如何在 mac m1 设备上构建 aosp 6.0 img 并使用该 img 运行模拟器?

问题描述 投票:0回答:1

如何在 mac m1 设备上构建 aosp 6.0 img 并使用该 img 运行模拟器?

总之,我想编译自己的android 6.0镜像,然后使用这个镜像在mac m1上运行模拟器

我就是要学aosp。现在我得到了aosp-6.0.0_r1和aosp-6.0.0_r6源代码。我可以在 intel64 linux 设备上成功构建代码,并获得结果 img 文件。

  • 在 intel64 上,编译结果 imgs 可以由模拟器使用来运行。

我的构建环境是

aosp-6.0.0_r1 的构建结果:

  • 当docker构建成功时,我退出docker。

  • 在 debian 上我的

    aosp.zshrc
    配置是这样的。 “附件
    aosp.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'
    
  • 在intel Debian devide上,我可以运行模拟器并成功构建imgs。

  • 在 Mac m1 上我不能

  • 我的午餐命令:

    lunch aosp_arm-eng

我知道,在Android studio上,我们可以下载android 6模拟器镜像文件。并且图像可以通过模拟器运行成功。

  • **我要模仿它自己构建6.0 imgs,并用我自己的imgs运行模拟器。 **

这是图片下载日志:附件

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.
    

我使用 armeabi-v7a-23_r06 图像运行模拟器,成功。在 Android 设置应用程序上,我得到的构建信息是:

  • 安卓版本:6.0

  • 内部版本号:sdk_phone_armv7-userdebug 6.0 MASTER 3079352 测试密钥.

  • 附件:

    android-download-emulator-imgs-run-result.jpeg

如何找到代码分支

MASTER 3079352
,我不知道。因为aosp源有很多存储库.

  • 图像名称

    armeabi-v7a-23_r06
    我猜aosp分支是
    android-6.0.0_r6

  • 然后我下载代码,午餐命令是:

    lunch sdk_phone_armv7-userdebug

  • build
    在 docker ubuntu 操作系统上成功。

  • 在 debian12 上

    alias emulatorAliasLinux='$AOSP_PATH/prebuilts/android-emulator/linux-x86_64/emulator'

    • 我通过构建结果 imgs 运行模拟器成功,使用 cmd
      emulatorAliasLinux
  • 相同的aosp和构建结果复制到mac m1设备

    • 环境

      alias emulatorAliasMac='$AOSP_PATH/prebuilts/android-emulator/darwin-x86_64/emulator'

    • 执行

      emulatorAliasMac

    • 模拟器只显示Android LOGO,未启动成功。 附件:

      aosp6.0.0_r6_build_imgs_run_on_mac_m1_just_show_logo.png

    • 这是

      emulatorAliasMac
      日志:附件:
      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
      
      

总之,我想编译自己的android 6.0镜像,然后使用这个镜像在mac m1上运行模拟器

总之,我想编译自己的android 6.0镜像,然后使用这个镜像在mac m1上运行模拟器

emulation android-source
1个回答
0
投票

我回来了。 我用mac os写程序,总感觉不错。 所以我不想回到windos,Linux很好,但MacOS更好。

如果你想构建 AOSP 6 并在 MacO 上运行模拟器结果

只需购买一台 intel mac 即可。

© www.soinside.com 2019 - 2024. All rights reserved.