V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
oLUCKo
V2EX  ›  Android

如何将 AOSP 编译的 img 应用到 Mac m1 平台的模拟器上

  •  
  •   oLUCKo · 245 天前 · 6271 次点击
    这是一个创建于 245 天前的主题,其中的信息可能已经有所发展或是发生改变。

    How to build aosp 6.0 img and run emulator with the img on mac m1 device? https://stackoverflow.com/q/78250170/7707781

    我有两台设备 Intel64 Debian M1 Mac 我可以在 Debian 成功编译和运行 AOSP6.0 , lunch 各个目标都可以成功 .

    我注意到 AndroidStudio 可以下载并成功运行 android 6.0 模拟器 , 所以我觉的我只是没有找到正确的操作路径 .

    我希望能将编译好的 img 们 在 mac m1 设备上运行 . 但是我总是碰到 黑屏 或者 只显示 logo .

    有人可以分享相关经验吗 ? 可以带价联系 .

    7 条回复    2024-03-31 16:21:53 +08:00
    Shatyuka
        1
    Shatyuka  
       245 天前 via iPhone
    编译的时候去掉 32 位支持
    oLUCKo
        2
    oLUCKo  
    OP
       245 天前
    可以展开说说吗
    我的编译指令是 `lunch sdk_phone_armv7-userdebug`
    oLUCKo
        3
    oLUCKo  
    OP
       245 天前
    @Shatyuka
    可以展开说说吗
    我的编译指令是 `lunch sdk_phone_armv7-userdebug`
    oLUCKo
        4
    oLUCKo  
    OP
       245 天前
    dankai
        5
    dankai  
       245 天前
    改成 armv8a 的
    oLUCKo
        6
    oLUCKo  
    OP
       245 天前
    @dankai
    是说 `lunch sdk_phone_armv8a-userdebug` 吗
    我创建了一个 arm64-v8a 的模拟器 , 设备信息中的 builder number 是 sdk_phone_arm64-userdebug
    所以说我改用 `lunch sdk_phone_arm64-userdebug` 是吧
    oLUCKo
        7
    oLUCKo  
    OP
       244 天前
    @dankai

    lunch 是 : lunch sdk_phone_arm64-userdebug


    我尝试了两种方式

    1. 黑屏无法启动 --> 将生成的 cache.img / ramdisk.img / system.img / userdata.img 放到 android_sdk/system-images/android-23/default/arm64-v8a 目录下 , 通过使用 sdk 中的模拟器启动 emulator . 现象是 黑屏无法启动

    2. 黑屏无法启动 --> 使用 AOSP 中的 emulator 执行文件 指定 img 路径 , 第二中方式的指令和日志如下 :

    模拟器启动用的这个执行文件, 日志转储可以忽略 , 以下是实际的日志内容 , 模拟器的实际表现就是 黑屏 . 没有任何其他了

    $AOSP_PATH/prebuilts/android-emulator/darwin-x86_64/emulator64-arm -verbose 2>&1 | tee a /Volumes/MacOs_disk/AOSP/android-6.0.0_r6.tmp/emulator.log/6.emulator.just.aosp.content.arm64.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/arm64/kernel-qemu
    emulator: Auto-detect: Kernel image requires new 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: Target arch = 'arm64'
    Content of hardware configuration file:
    hw.cpu.arch = arm
    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/arm64/kernel-qemu
    kernel.parameters = androidboot.hardware=goldfish android.checkjni=1
    kernel.newDeviceNaming = yes
    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: ttyGF
    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-wUTFrp
    emulator: nand_add_dev: system,size=0x60000000,file=/tmp/android-tom/emulator-wUTFrp,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=ttyGF0 android.qemud=ttyGF1 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: can't connect to ADB server: Socket is not connected (errno = 57)
    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
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2594 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 18ms · UTC 06:27 · PVG 14:27 · LAX 22:27 · JFK 01:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.