android build

本文深入解析了Android设备配置过程,包括envsetup.sh、Makefile等关键文件的作用与使用方法,提供了添加新设备及更改现有设备配置的指南。

Android Device

This is a breakdown of the files build/envsetup.sh, Makefile and the files they use, which describes how a device is specified and how Android is configured for it.

For each file there are some comments and code lines from the make files or scripts, which describe what they are doing and which files they are using. Also the files which can be used as an example are presented and the commands how to search for them.

This text is for developers who want to add a new device or change the configuration of an existing device. This gives some indications which files are involved.

Contents

build/envsetup.sh

Some functions are defined by calling

. build/envsetup.sh

in the top directory.

Some environment variables are set by calling

lunch

in the top directory.

export TARGET_PRODUCT=$product
export TARGET_BUILD_VARIANT=$variant
export TARGET_SIMULATOR=false
export TARGET_BUILD_TYPE=release

vendorsetup.sh is searched at this places:

vendor/*/vendorsetup.sh 
vendor/*/*/vendorsetup.sh 
device/*/*/vendorsetup.sh

vendorsetup.sh

This file is executed by build/envsetup.sh, and can use anythingdefined in envsetup.sh.

In particular, you can add lunch options with the add_lunch_combofunction:

add_lunch_combo full_crespo-userdebug

The values of the macros TARGET_PRODUCT and TARGET_BUILD_VARIANT are derived from the option name: add_lunch_combo $TARGET_PRODUCT-$TARGET_BUILD_VARIANT
In the above example the resulting values are TARGET_PRODUCT=full_crespo and TARGET_BUILD_VARIANT=userdebug.

These files can be used as an example:

find . -name vendorsetup.sh 
./device/samsung/crespo/vendorsetup.sh
./device/samsung/crespo4g/vendorsetup.sh
./device/htc/passion/vendorsetup.sh

Makefile

Build process is started by calling

make 

in the top directory.

The Makefile calls build/core/main.mk

build/core/main.mk

Set up various standard variables based on configuration and host information.

include $(BUILD_SYSTEM)/config.mk

This allows us to force a clean build - included after the config.makeenvironment setup is done, but before we generate any dependencies. Thisfile does the rm -rf inline so the deps which are all done below willbe generated correctly

include $(BUILD_SYSTEM)/cleanbuild.mk

These are the modifier targets that don't do anything themselves, butchange the behavior of the build.(must be defined before including definitions.make)

INTERNAL_MODIFIER_TARGETS := showcommands checkbuild all

Bring in standard build system definitions.

include $(BUILD_SYSTEM)/definitions.mk

build/core/config.mk

Various mappings to avoid hard-coding paths all over the place

include $(BUILD_SYSTEM)/pathmap.mk

Try to include buildspec.mk, which will try to set stuff up.If this file doesn't exist, the environemnt variables willbe used, and if that doesn't work, then the default is anarm build

-include $(TOPDIR)buildspec.mk

Define most of the global variables. These are the ones thatare specific to the user's build configuration.

include $(BUILD_SYSTEM)/envsetup.mk

Search for BoardConfig.mk in
$(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk
device/*/$(TARGET_DEVICE)/BoardConfig.mk
vendor/*/$(TARGET_DEVICE)/BoardConfig.mk
and load the file

 include $(board_config_mk)
 include $(BUILD_SYSTEM)/dumpvar.mk

BoardConfig.mk

These files can be used as an example:

find . -name BoardConfig.mk
./device/samsung/crespo/BoardConfig.mk
./device/samsung/crespo4g/BoardConfig.mk
./device/htc/passion/BoardConfig.mk
./build/target/board/generic/BoardConfig.mk
./build/target/board/generic_x86/BoardConfig.mk
./build/target/board/emulator/BoardConfig.mk
./build/target/board/sim/BoardConfig.mk

build/buildspec.mk.default

This is a do-nothing template file. To use it, copy it to a filenamed "buildspec.mk" in the root directory, and uncomment or changethe variables necessary for your desired configuration. The file"buildspec.mk" should never be checked in to source control.

Choose a product to build for. Look in the products directory for onesthat work.
TARGET_PRODUCT

Choose a variant to build. If you don't pick one, the default is eng.
User is what we ship.
Userdebug is that, with a few flags turned onfor debugging.
Eng has lots of extra tools for development.
TARGET_BUILD_VARIANT

CUSTOM_MODULES
TARGET_SIMULATOR

Set this to debug or release if you care. Otherwise, it defaults torelease for arm and debug for the simulator.
TARGET_BUILD_TYPE

HOST_BUILD_TYPE
DEBUG_MODULE_ModuleName
TARGET_TOOLS_PREFIX
HOST_CUSTOM_DEBUG_CFLAGS
TARGET_CUSTOM_DEBUG_CFLAGS
CUSTOM_LOCALES
OUT_DIR
ADDITIONAL_BUILD_PROPERTIES
NO_FALLBACK_FONT
WEBCORE_INSTRUMENTATION
ENABLE_SVG
BUILD_ENV_SEQUENCE_NUMBER

build/envsetup.mk

Set up version information.

include $(BUILD_SYSTEM)/version_defaults.mk

If you update the build system such that the environment setupor buildspec.mk need to be updated, increment this number, andpeople who haven't re-run those will have to do so before theycan build. Make sure to also update the corresponding value inbuildspec.mk.default and envsetup.sh.

CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 10
include $(BUILD_SYSTEM)/product_config.mk

TARGET_PRODUCT: sim full
TARGET_BUILD_VARIANT: eng user userdebug tests

build/core/version_defaults.mk

Handle various build version information.

Guarantees that the following are defined:
PLATFORM_VERSION
PLATFORM_SDK_VERSION
PLATFORM_VERSION_CODENAME
DEFAULT_APP_TARGET_SDK
BUILD_ID
BUILD_NUMBER

Look for an optional file $(BUILD_SYSTEM)/build_id.mk containing overrides of the defaults
INTERNAL_BUILD_ID_MAKEFILE

include $(BUILD_SYSTEM)/build_id.mk

build/core/build_id.mk

BUILD_ID is usually used to specify the branch name
BUILD_ID

DISPLAY_BUILD_NUMBER

build/product_config.mk

Provide "PRODUCT-<prodname>-<goal>" targets, which lets you builda particular configuration without needing to set up the environment.

TARGET_PRODUCT := $(word 1,$(product_goals))
TARGET_BUILD_VARIANT := $(word 2,$(product_goals))

Provide "APP-<appname>" targets, which lets you buildan unbundled app.

Include the product definitions.We need to do this to translate TARGET_PRODUCT into itsunderlying TARGET_DEVICE before we start defining any rules.

PRODUCT_DEVICE is defined in the product file $(TARGET_PRODUCT).mk.
The product file $(TARGET_PRODUCT).mk is searched in the list of product make files $(PRODUCT_MAKEFILES).
PRODUCT_MAKEFILES is set in AndroidProducts.mk files.

$(call import-products,$(call get-product-makefiles,
      $(SRC_TARGET_DIR)/product/AndroidProducts.mk))

Convert a short name like "sooner" into the path to the productfile defining that product.

INTERNAL_PRODUCT := $(call resolve-short-product-name, $(TARGET_PRODUCT))
TARGET_DEVICE := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEVICE)
PRODUCT_LOCALES := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_LOCALES))
PRODUCT_BRAND
PRODUCT_MODEL
PRODUCT_MANUFACTURER
PRODUCT_OTA_PUBLIC_KEYS

AndroidProducts.mk

This file should set PRODUCT_MAKEFILES to a list of product makefilesto expose to the build system. LOCAL_DIR will already be set tothe directory containing this file.

This file may not rely on the value of any variable other thanLOCAL_DIR; do not use any conditionals, and do not look up thevalue of any variable that isn't set in this file or in a file thatit includes.

File device/samsung/crespo/AndroidProducts.mk

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

These files can be used as an example:

find . -name AndroidProducts.mk
./device/sample/products/AndroidProducts.mk
./device/samsung/crespo/AndroidProducts.mk
./device/samsung/crespo4g/AndroidProducts.mk
./device/htc/passion/AndroidProducts.mk
./build/target/product/AndroidProducts.mk

The command which returns the list of all AndroidProducts.mk files is defined in build/core/product.mk :

define _find-android-products-files
$(shell test -d device && find device -maxdepth 6 -name AndroidProducts.mk) \
  $(shell test -d vendor && find vendor -maxdepth 6 -name AndroidProducts.mk) \
  $(SRC_TARGET_DIR)/product/AndroidProducts.mk
endef

Product Files

Search for the files which can be used as an example:

grep -R PRODUCT_DEVICE device build
device/samsung/crespo/full_crespo.mk:PRODUCT_DEVICE := crespo
device/samsung/crespo4g/full_crespo4g.mk:PRODUCT_DEVICE := crespo4g
device/htc/passion/full_passion.mk:PRODUCT_DEVICE := passion
build/target/product/sdk.mk:PRODUCT_DEVICE := generic
build/target/product/generic.mk:PRODUCT_DEVICE := generic
build/target/product/generic_x86.mk:PRODUCT_DEVICE := generic_x86
build/target/product/core.mk:PRODUCT_DEVICE := generic
build/target/product/full_x86.mk:PRODUCT_DEVICE := generic_x86
build/target/product/full.mk:PRODUCT_DEVICE := generic
build/target/product/sim.mk:PRODUCT_DEVICE := sim

PRODUCT_DEVICE is used in these files

build/core/product.mk:    PRODUCT_DEVICE \
build/core/product_config.mk:TARGET_DEVICE := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEVICE)

Add new device

Add the configuration files for the new device mydevice of the company mycompany.

Create AndroidProducts.mk

mkdir -p device/mycompany/mydevice
nano device/mycompany/mydevice/AndroidProducts.mk
PRODUCT_MAKEFILES := \
    $(LOCAL_DIR)/full_mydevice.mk

Create file full_mydevice.mk
Example is build/target/product/full.mk

nano device/mycompany/mydevice/full_mydevice.mk
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic/device.mk)

# Overrides
PRODUCT_NAME := full_mydevice
PRODUCT_DEVICE := mydevice
PRODUCT_BRAND := Android
PRODUCT_MODEL := Full Android on mydevice

Create file vendorsetup.sh

nano device/mycompany/mydevice/vendorsetup.sh
add_lunch_combo full_mydevice-eng

Create file BoardConfig.mk

Examples are
build/target/board/generic/BoardConfig.mk
device/samsung/crespo/BoardConfig.mk
device/samsung/crespo/BoardConfigCommon.mk

mkdir -p device/mycompany/mydevice
nano device/mycompany/mydevice/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_CPU_ABI := armeabi
HAVE_HTC_AUDIO_DRIVER := true
BOARD_USES_GENERIC_AUDIO := true

# no hardware camera
USE_CAMERA_STUB := true

# Set /system/bin/sh to mksh, not ash, to test the transition.
TARGET_SHELL := mksh

# CPU
TARGET_ARCH_VARIANT := armv7-a-neon
ARCH_ARM_HAVE_TLS_REGISTER := true

Configure Android for mydevice

. build/envsetup.sh 
including device/htc/passion/vendorsetup.sh
including device/mycompany/mydevice/vendorsetup.sh
including device/samsung/crespo4g/vendorsetup.sh
including device/samsung/crespo/vendorsetup.sh
lunch
You're building on Linux

Lunch menu... pick a combo:
     1. full-eng
     2. full_x86-eng
     3. simulator
     4. full_passion-userdebug
     5. full_mydevice-eng
     6. full_crespo4g-userdebug
     7. full_crespo-userdebug

Which would you like? [full-eng] 5

============================================
PLATFORM_VERSION_CODENAME=AOSP
PLATFORM_VERSION=AOSP
TARGET_PRODUCT=full_mydevice
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=OPENMASTER
============================================

Build Android for mydevice

make -j4
Combining NOTICE files: out/target/product/mydevice/obj/NOTICE.html
Target system fs image: out/target/product/mydevice/obj/PACKAGING/systemimage_intermediates/system.img
Install system fs image: out/target/product/mydevice/system.img
Installed file list: out/target/product/mydevice/installed-files.txt
内容概要:本文是一篇关于使用RandLANet模型对SensatUrban数据集进行点云语义分割的实战教程,系统介绍了从环境搭建、数据准备、模型训练与测试到精度评估的完整流程。文章详细说明了在Ubuntu系统下配置TensorFlow 2.2、CUDA及cuDNN等深度学习环境的方法,并指导用户下载和预处理SensatUrban数据集。随后,逐步讲解RandLANet代码的获取与运行方式,包括训练、测试命令的执行与参数含义,以及如何监控训练过程中的关键指标。最后,教程涵盖测试结果分析、向官方平台提交结果、解读评估报告及可视化效果等内容,并针对常见问题提供解决方案。; 适合人群:具备一定深度学习基础,熟悉Python编程和深度学习框架,从事计算机视觉或三维点云相关研究的学生、研究人员及工程师;适合希望动手实践点云语义分割项目的初学者与进阶者。; 使用场景及目标:①掌握RandLANet网络结构及其在点云语义分割任务中的应用;②学会完整部署一个点云分割项目,包括数据处理、模型训练、测试与性能评估;③为参与相关竞赛或科研项目提供技术支撑。; 阅读建议:建议读者结合提供的代码链接和密码访问完整资料,在本地或云端环境中边操作边学习,重点关注数据格式要求与训练参数设置,遇到问题时参考“常见问题与解决技巧”部分及时排查。
内容概要:本文详细介绍了三相异步电机SVPWM-DTC(空间矢量脉宽调制-直接转矩控制)的Simulink仿真实现方法,结合DTC响应快与SVPWM谐波小的优点,构建高性能电机控制系统。文章系统阐述了控制原理,包括定子磁链观测、转矩与磁链误差滞环比较、扇区判断及电压矢量选择,并通过SVPWM技术生成固定频率PWM信号,提升系统稳态性能。同时提供了完整的Simulink建模流程,涵盖电机本体、磁链观测器、误差比较、矢量选择、SVPWM调制、逆变器驱动等模块的搭建与参数设置,给出了仿真调试要点与预期结果,如电流正弦性、转矩响应快、磁链轨迹趋圆等,并提出了模型优化与扩展方向,如改进观测器、自适应滞环、弱磁控制和转速闭环等。; 适合人群:电气工程、自动化及相关专业本科生、研究生,从事电机控制算法开发的工程师,具备一定MATLAB/Simulink和电机控制理论基础的技术人员。; 使用场景及目标:①掌握SVPWM-DTC控制策略的核心原理与实现方式;②在Simulink中独立完成三相异步电机高性能控制系统的建模与仿真;③通过仿真验证控制算法有效性,为实际工程应用提供设计依据。; 阅读建议:学习过程中应结合文中提供的电机参数和模块配置逐步搭建模型,重点关注磁链观测、矢量选择表和SVPWM调制的实现细节,仿真时注意滞环宽度与开关频率的调试,建议配合MATLAB官方工具箱文档进行参数校准与结果分析。
已经博主授权,源码转载自 https://pan.quark.cn/s/bf1e0d5b9490 本文重点阐述了Vue2.0多Tab切换组件的封装实践,详细说明了通过封装Tab切换组件达成多Tab切换功能,从而满足日常应用需求。 知识点1:Vue2.0多Tab切换组件的封装* 借助封装Tab切换组件,达成多Tab切换功能* 支持tab切换、tab定位、tab自动化仿React多Tab实现知识点2:TabItems组件的应用* 在index.vue文件中应用TabItems组件,借助name属性设定tab的标题* 通过:isContTab属性来设定tab的内容* 能够采用子组件作为tab的内容知识点3:TabItems组件的样式* 借助index.less文件来设定TabItems组件的样式* 设定tab的标题样式、背景色彩、边框样式等* 使用animation达成tab的切换动画知识点4:Vue2.0多Tab切换组件的构建* 借助运用Vue2.0框架,达成多Tab切换组件的封装* 使用Vue2.0的组件化理念,达成TabItems组件的封装* 通过运用Vue2.0的指令和绑定机制,达成tab的切换功能知识点5:Vue2.0多Tab切换组件的优势* 达成多Tab切换功能,满足日常应用需求* 支持tab切换、tab定位、tab自动化仿React多Tab实现* 能够满足多样的业务需求,具备良好的扩展性知识点6:Vue2.0多Tab切换组件的应用场景* 能够应用于多样的业务场景,例如:管理系统、电商平台、社交媒体等* 能够满足不同的业务需求,例如:多Tab切换、数据展示、交互式操作等* 能够与其它Vue2.0组件结合运用,达成复杂的业务逻辑Vue2.0多Tab切换组件的封装实例提供了...
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值