第十五期 在AOSP上建立一个新产品《手机就是开发板》
来源:互联网 发布:淘宝使用他人图片 编辑:程序博客网 时间:2024/05/21 11:18
这一期我们来做一个实践,在AOSP上建立一个新产品,编译出镜像文件在模拟器emulator上运行。
在实验前我们先整理一下思路,分析一下编译流程必要的定制文件。首先是执行./build/envsetup.sh会扫描device各子目录下的vendorsetup.sh,然后执行lunch时会扫描device各子目录中的AndroidProducts.mk文件;如果lunch中选择的TARGET_PRODUCT与某个AndroidProducts.mk文件指向的PRODUCT_MAKEFILES文件中的PRODUCT_NAME相同,则引用那个AndroidProducts.mk文件指向的PRODUCT_MAKEFILES文件,并引用这个文件中对应的PRODUCT_DEVICE变量,并赋值为TARGET_DEVICE;执行make时会在刚才的目录下搜索并加载AndroidBoard.mk和BoardConfig.mk还有system.prop文件。
综上所述,我们需要6个文件,分别是:
1. vendorsetup.sh
2. AndroidProducts.mk
3. myproduct.mk
4. AndroidBoard.mk
5. BoardConfig.mk
6. system.prop
这里我们说明一下建立的新产品的几个定义:
vendor ---- test
product ---- myproduct
device ---- phdemo
这三个要素的关系和区别只要在实践中才能体会出来。
@vendorsetup.sh
add_lunch_combo myproduct-eng
@AndoridProduct.mk
PRODUCT_MAKEFILES := \$(LOCAL_DIR)/myproduct.mk
@myproduct.mk
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)$(call inherit-product, $(SRC_TARGET_DIR)/board/generic/device.mk)include $(SRC_TARGET_DIR)/product/emulator.mk# OverridesPRODUCT_NAME := myproductPRODUCT_DEVICE := phdemoPRODUCT_BRAND := Android_phdemoPRODUCT_MODEL := phdemo AOSP on ARM Emulator
@AndroidBoard.mk
LOCAL_PATH := $(call my-dir)
@BoardConfig.mk
# config.mk## Product-specific compile-time definitions.## The generic product target doesn't have any hardware-specific pieces.TARGET_NO_BOOTLOADER := trueTARGET_NO_KERNEL := trueTARGET_ARCH := arm# Note: we build the platform images for ARMv7-A _without_ NEON.## Technically, the emulator supports ARMv7-A _and_ NEON instructions, but# emulated NEON code paths typically ends up 2x slower than the normal C code# it is supposed to replace (unlike on real devices where it is 2x to 3x# faster).## What this means is that the platform image will not use NEON code paths# that are slower to emulate. On the other hand, it is possible to emulate# application code generated with the NDK that uses NEON in the emulator.#TARGET_ARCH_VARIANT := armv7-aTARGET_CPU_VARIANT := genericTARGET_CPU_ABI := armeabi-v7aTARGET_CPU_ABI2 := armeabiHAVE_HTC_AUDIO_DRIVER := trueBOARD_USES_GENERIC_AUDIO := true# no hardware cameraUSE_CAMERA_STUB := true# Enable dex-preoptimization to speed up the first boot sequence# of an SDK AVD. Note that this operation only works on Linux for nowifeq ($(HOST_OS),linux)ifeq ($(WITH_DEXPREOPT),)WITH_DEXPREOPT := trueendifendif# Build OpenGLES emulation guest and host librariesBUILD_EMULATOR_OPENGL := true# Build and enable the OpenGL ES View renderer. When running on the emulator,# the GLES renderer disables itself if host GL acceleration isn't available.USE_OPENGL_RENDERER := true# Set the phase offset of the system's vsync event relative to the hardware# vsync. The system's vsync event drives Choreographer and SurfaceFlinger's# rendering. This value is the number of nanoseconds after the hardware vsync# that the system vsync event will occur.## This phase offset allows adjustment of the minimum latency from application# wake-up (by Choregographer) time to the time at which the resulting window# image is displayed. This value may be either positive (after the HW vsync)# or negative (before the HW vsync). Setting it to 0 will result in a# minimum latency of two vsync periods because the app and SurfaceFlinger# will run just after the HW vsync. Setting it to a positive number will# result in the minimum latency being:## (2 * VSYNC_PERIOD - (vsyncPhaseOffsetNs % VSYNC_PERIOD))## Note that reducing this latency makes it more likely for the applications# to not have their window content image ready in time. When this happens# the latency will end up being an additional vsync period, and animations# will hiccup. Therefore, this latency should be tuned somewhat# conservatively (or at least with awareness of the trade-off being made).VSYNC_EVENT_PHASE_OFFSET_NS := 0TARGET_USERIMAGES_USE_EXT4 := trueBOARD_SYSTEMIMAGE_PARTITION_SIZE := 1610612736BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4BOARD_FLASH_BLOCK_SIZE := 512TARGET_USERIMAGES_SPARSE_EXT_DISABLED := trueBOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicyifeq ($(TARGET_PRODUCT),sdk)# include an expanded selection of fonts for the SDK.EXTENDED_FONT_FOOTPRINT := trueendif
@system.prop
## system.prop for generic sdk#rild.libpath=/system/lib/libreference-ril.sorild.libargs=-d /dev/ttyS0
这些文件的排列如下:
然后执行lunch,选择刚才添加的myproduct-eng
然后执行 make ,编译完成后就可以使用emulator进行模拟运行。
运行后通过 About phone--> Build number 就可以看到我们的定制信息。
0 0
- 第十五期 在AOSP上建立一个新产品《手机就是开发板》
- 第十四期 AOSP 编译系统分析《手机就是开发板》
- 第二期 AOSP 环境搭建、下载和编译 《手机就是开发板》
- 第十三期 AOSP 编译环境初始化过程分析《手机就是开发板》
- 第一期 前言 《手机就是开发板》
- 第五期 基于模拟器上的实践和学习规划 《手机就是开发板》
- 第二十期 在Android中修改GPS定位数据的完整方案《手机就是开发板》
- 第十二期 Android ROM结构分析《手机就是开发板》
- 第十八期 Android GPS原理分析《手机就是开发板》
- 第十五期 MIPS汇编U-Boot从start.S开始《路由器就是开发板》
- 第四期 Android Studio 开发环境搭建 《手机就是开发板》
- 第三期 Android Kernel 下载和编译 《手机就是开发板》
- 第六期 基于模拟器的Helloworld 内核驱动 《手机就是开发板》
- 第七期 基于模拟器的Helloworld 可执行程序 《手机就是开发板》
- 第八期 基于模拟器的Helloworld HAL接口 《手机就是开发板》
- 第九期 基于模拟器的Helloworld JNI方法 《手机就是开发板》
- 第十期 基于模拟器的Helloworld Framework接口 《手机就是开发板》
- 第十六期 CyanogenMod 小米3W刷机《手机就是开发板》
- LeetCode-二分查找面试题目总结
- 文字验证码怎么在提交是判断 这里给出了验证码(做过的帮忙看下)
- SpringMVC与Activiti网页流程设计器整合(一)
- Python GUI之Tkinter概述
- Android Bound Services 简单使用
- 第十五期 在AOSP上建立一个新产品《手机就是开发板》
- 使用Android-PullToRefresh报错
- 如何显示当月的所有日期
- 有没有类似淘宝app的例子
- 在Pocket Pc 2003的Form1中放一个DataGrid控件,通过下面的方法连接到数据表,为什么不显示表中的数据呢?
- 一个表单提交纠错引起的问题,session在上级页面继承
- Python 将一个正整数分解质因数
- 求助,动态网页的缓存问题
- 2017年1月2日