AOSP构建在自定义设备-emulator上

时间:2018-03-26 13:42:06

标签: android android-emulator android-source

我正在学习AOSP构建系统,特别是如何添加新设备 我在默认的full-eng配置上构建android-6.0.1_r46 Marshmallo并在模拟器上运行它。它运作正常。

但是当我尝试在/ tree / my_company / my_product /之类的源代码树中添加我的自定义设备而不是成功构建并在模拟器上运行时 - 模拟器只是挂起黑屏。根本没有加载。

我如何让模拟器工作? 我的makefile如下所示..

Android.mk

ifneq ($(filter my_product, $(TARGET_DEVICE)),)

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

include $(call all-makefiles-under,$(LOCAL_PATH))

endif

AndroidProducts.mk

PRODUCT_MAKEFILES := \
 $(LOCAL_DIR)/aosp_my_product.mk 

vendorsetup.sh

add_lunch_combo aosp_my_product-eng

aosp_my_product.mk

#$(call inherit-product, device/generic/mini-emulator-armv7-a-neon/mini_emulator_common.mk) //copied to device.mk

$(call inherit-product, device/my_company/my_product/device.mk)

#Overrides

PRODUCT_NAME := aosp_my_product
PRODUCT_DEVICE :=my_product
PRODUCT_MODEL := Customized Android
PRODUCT_MANUFACTURER :=my_company
PRODUCT_BRAND :=Android

PRODUCT_LOCALES := en_US 
PRODUCT_PACKAGE_OVERLAYS := device/my_company/my_product/overlay
PRODUCT_CHARACTERISTICS := nosdcard

device.mk

 PRODUCT_NAME :=aosp_my_product
    PRODUCT_DEVICE :=my_product
    PRODUCT_MODEL := Customized Android
    PRODUCT_MANUFACTURER := my_company
    PRODUCT_BRAND := Android

    LOCAL_KERNEL := prebuilts/qemu-kernel/arm/kernel-qemu-armv7
    PRODUCT_COPY_FILES += \
    $(LOCAL_KERNEL):kernel

# common stuffs across mini_emulators

PRODUCT_PACKAGES += \
    audio.primary.goldfish \
    camera.goldfish \
    gps.goldfish \
    gralloc.goldfish \
    lights.goldfish \
    power.goldfish \
    sensors.goldfish \
    vibrator.goldfish \
    qemu-props \
    qemud \
    libGLES_android \
    libGLESv1_CM_emulation \
    lib_renderControl_enc \
    libEGL_emulation \
    libGLESv2_enc \
    libOpenglSystemCommon \
    libGLESv2_emulation \
    libGLESv1_enc \
    rild


PRODUCT_COPY_FILES += \
    device/generic/mini-emulator-armv7-a-neon/init.mini-emulator.rc:root/init.goldfish.rc \
    device/generic/goldfish/init.goldfish.sh:system/etc/init.goldfish.sh \
    device/generic/goldfish/ueventd.goldfish.rc:root/ueventd.goldfish.rc \
    device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
    frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \
    frameworks/native/data/etc/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml \
    frameworks/av/media/libeffects/data/audio_effects.conf:system/etc/audio_effects.conf \
    hardware/libhardware_legacy/audio/audio_policy.conf:system/etc/audio_policy.conf \
    device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml \
    frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:system/etc/media_codecs_google_audio.xml \
    frameworks/av/media/libstagefright/data/media_codecs_google_telephony.xml:system/etc/media_codecs_google_telephony.xml \
    frameworks/av/media/libstagefright/data/media_codecs_google_video.xml:system/etc/media_codecs_google_video.xml \
    device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml \
    device/generic/goldfish/fstab.goldfish:root/fstab.goldfish

BoardConfig.mk

# config.mk
#
# Product-specific compile-time definitions.
#
# The generic product target doesn't have any hardware-specific pieces.


TARGET_NO_BOOTLOADER := true
TARGET_NO_KERNEL := true
TARGET_ARCH := arm

TARGET_ARCH_VARIANT := armv7-a
TARGET_CPU_VARIANT := generic
TARGET_CPU_ABI := armeabi-v7a
TARGET_CPU_ABI2 := armeabi

SMALLER_FONT_FOOTPRINT := true
MINIMAL_FONT_FOOTPRINT := true
# Some framework code requires this to enable BT
BOARD_HAVE_BLUETOOTH := true
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/generic/common/bluetooth

BOARD_USES_GENERIC_AUDIO := true

USE_CAMERA_STUB := true

BUILD_EMULATOR_OPENGL := true
USE_OPENGL_RENDERER := true

BOARD_USE_LEGACY_UI := true
VSYNC_EVENT_PHASE_OFFSET_NS := 0

TARGET_USERIMAGES_USE_EXT4 := true



BOARD_BOOTIMAGE_PARTITION_SIZE := 576716800
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 576716800
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

BOARD_SEPOLICY_DIRS += build/target/board/generic/

#ifndef PDK_FUSION_PLATFORM_ZIP
#ifeq ($(HOST_OS),linux)
# WITH_DEXPREOPT := true
#endif
#endif # PDK_FUSION_PLATFORM_ZIP

out / target / product / my_product $ ls

android-info.txt  hardware-qemu.ini         symbols
cache             installed-files.txt       system
cache.img         kernel                    system.img
clean_steps.mk    obj                       userdata.img
data              previous_build_config.mk  userdata-qemu.img
dex_bootjars      ramdisk.img
gen               root

adb设备显示 emulator-5554离线

[cmd]〜/ aosp $ emulator& [1] 17183

[cmd]〜/ aosp $ emulator -verbose

    emulator:Found ANDROID_PRODUCT_OUT: /home/azahar/aosp/out/target/product/my_product
    emulator:Found build target architecture: arm
    emulator:Looking for ranchu emulator backed for arm CPU
    emulator:Probing program: ./emulator64-ranchu-arm
    emulator:Probing program: ./emulator-ranchu-arm
    emulator:Probing path for: emulator64-ranchu-arm
    emulator:Probing path for: emulator-ranchu-arm
    emulator:Looking for emulator-arm to emulate 'arm' CPU
    emulator:Probing program: ./emulator64-arm
    emulator:Probing program: ./emulator-arm
    emulator:Probing path for: emulator64-arm
    emulator:Found target-specific emulator binary: /home/azahar/aosp/prebuilts/android-emulator/linux-x86_64/emulator64-arm
    emulator:GPU emulation is disabled
    emulator: found Android build root: /home/azahar/aosp
    emulator: found Android build out:  /home/azahar/aosp/out/target/product/my_product
    emulator: Read property file at /home/azahar/aosp/out/target/product/my_product/system/build.prop
    emulator: Cannot find boot properties file: /home/azahar/aosp/out/target/product/my_product/boot.prop

    emulator: Found target API sdkVersion: 23

    emulator: virtual device has no config file - no problem
    emulator: using core hw config path: /home/azahar/aosp/out/target/product/my_product/hardware-qemu.ini
    emulator: found skin-specific hardware.ini: /home/azahar/aosp/development/tools/emulator/skins/HVGA/hardware.ini
    emulator: autoconfig: -skin HVGA
    emulator: autoconfig: -skindir /home/azahar/aosp/development/tools/emulator/skins
    emulator: found skin-specific hardware.ini: /home/azahar/aosp/development/tools/emulator/skins/HVGA/hardware.ini
    emulator: keyset loaded from: /home/azahar/.android/default.keyset
    emulator: trying to load skin file '/home/azahar/aosp/development/tools/emulator/skins/HVGA/layout'
    emulator: skin network speed: 'full'
    emulator: skin network delay: 'none'
    emulator: autoconfig: -kernel /home/azahar/aosp/out/target/product/my_product/kernel
    emulator: Auto-detect: Kernel image requires legacy device naming scheme.
    emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
    emulator: autoconfig: -ramdisk /home/azahar/aosp/out/target/product/my_product/ramdisk.img
    emulator: autoconfig: -sysdir /home/azahar/aosp/out/target/product/my_product
    emulator: Using initial system image: /home/azahar/aosp/out/target/product/my_product/system.img
    emulator: WARNING: system partition size adjusted to match image file (550 MB > 200 MB)

    emulator: autoconfig: -data /home/azahar/aosp/out/target/product/my_product/userdata-qemu.img
    emulator: autoconfig: -initdata /home/azahar/aosp/out/target/product/my_product/userdata.img
    emulator: WARNING: data partition size adjusted to match image file (550 MB > 200 MB)

    emulator: autoconfig: -cache /home/azahar/aosp/out/target/product/my_product/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 = /home/azahar/aosp/out/target/product/my_product/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 = /home/azahar/aosp/out/target/product/my_product/kernel
      kernel.parameters =  androidboot.hardware=goldfish android.checkjni=1
      kernel.newDeviceNaming = no
      kernel.supportsYaffs2 = no
      disk.ramdisk.path = /home/azahar/aosp/out/target/product/my_product/ramdisk.img
      disk.systemPartition.initPath = /home/azahar/aosp/out/target/product/my_product/system.img
      disk.systemPartition.size = 550m
      disk.dataPartition.path = /home/azahar/aosp/out/target/product/my_product/userdata-qemu.img
      disk.dataPartition.size = 550m
      avd.name = <build>
    .
    QEMU options list:
    emulator: argv[00] = "/home/azahar/aosp/prebuilts/android-emulator/linux-x86_64/emulator64-arm"
    emulator: argv[01] = "-android-hw"
    emulator: argv[02] = "/tmp/android-azahar/emulator-lsvyCj"
    Concatenated QEMU options:
     /home/azahar/aosp/prebuilts/android-emulator/linux-x86_64/emulator64-arm -android-hw /tmp/android-azahar/emulator-lsvyCj
    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-azahar/emulator-AvYGsQ
    emulator: nand_add_dev: system,size=0x22600000,file=/tmp/android-azahar/emulator-AvYGsQ,initfile=/home/azahar/aosp/out/target/product/my_product/system.img,pagesize=512,extrasize=0
    emulator: userdata partition format: ext4
    WARNING: userdata image already in use, changes will not persist!
    emulator: Mapping 'userdata' partition image to /tmp/android-azahar/emulator-YcBfzc
    emulator: Creating empty userdata partition image at: /tmp/android-azahar/emulator-YcBfzc
    Creating filesystem with parameters:
        Size: 576716800
        Block size: 4096
        Blocks per group: 32768
        Inodes per group: 7040
        Inode size: 256
        Journal blocks: 2200
        Label: 
        Blocks: 140800
        Block groups: 5
        Reserved block group size: 39
    Created filesystem with 11/35200 inodes and 4536/140800 blocks
    emulator: nand_add_dev: userdata,size=0x22600000,file=/tmp/android-azahar/emulator-YcBfzc,pagesize=512,extrasize=0
    emulator: cache partition format: ext4
    WARNING: cache image already in use, changes will not persist!
    emulator: Mapping 'cache' partition image to /tmp/android-azahar/emulator-wM4p7H
    emulator: Creating empty cache partition image at: /tmp/android-azahar/emulator-wM4p7H
    Creating filesystem with parameters:
        Size: 69206016
        Block size: 4096
        Blocks per group: 32768
        Inodes per group: 4224
        Inode size: 256
        Journal blocks: 1024
        Label: 
        Blocks: 16896
        Block groups: 1
        Reserved block group size: 7
    Created filesystem with 11/4224 inodes and 1302/16896 blocks
    emulator: nand_add_dev: cache,size=0x4200000,file=/tmp/android-azahar/emulator-wM4p7H,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 5556, ADB on port 5557
    emulator: sent '0012host:emulator:5557' to ADB server
    emulator: android_hw_fingerprint_init: fingerprint qemud listen service initialized

    emulator: ping program: /home/azahar/aosp/prebuilts/android-emulator/linux-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

1 个答案:

答案 0 :(得分:0)

您正在为无法在qemu上仿真的手臂设备而构建。 您可以尝试为任何现有的设备(例如珊瑚或梅林)构建并检查其是否为它们启动。但可能不会。