Android编译系统产品线(基于友善之臂tin4412 Androi

1.Android源码中的产品线解析

通常产品厂商在拿到Android源码后会在android源码基础上进行定制修改,以匹配适应自己的产品。这就引入了产品线的概念。Android系统源码中,产品相关的文件通常保存在 device/company/product目录下其目录的组织结构为

技术分享

在tiny4412 android 5.0中如下图所示:

(1)vendorsetup.sh中的内容如下

#调用add_lunch_combo函数将full_tiny4412-userdebug #和full_tiny4412-eng添加到系统相关变量中,后续 #lunch提供的菜单就是根据这些变量产生的 #envsetup.sh末尾通过一个for循环来扫描工程中 #所有可用的vendorsetup.sh并执行它们 #默认会扫面/vendor和/device目录 add_lunch_combo full_tiny4412-userdebug add_lunch_combo full_tiny4412-eng

(2)AndroidProducts.mk中内容为

#当运行了lunch函数选择了编译的产品后 #编译系统会在产品所在的目录下寻找 #AndroidProducts.mk文件,这里记录 #着该产品的一些具体的属性,但是 #通常我们在这个文件中做一个转向 PRODUCT_MAKEFILES := $(LOCAL_DIR)/aosp_tiny4412.mk $(LOCAL_DIR)/full_tiny4412.mk

其中full_tiny4412.mk种的内容为

# Launcher, Camera and Gallery ifeq ($(BOARD_USES_LAUNCHER3),true) PRODUCT_PACKAGES += Launcher3 endif #系统要预装的一系列程序 PRODUCT_PACKAGES += Gallery2 # Live Wallpapers PRODUCT_PACKAGES += HoloSpiralWallpaper LiveWallpapers LiveWallpapersPicker MagicSmokeWallpapers VisualizationWallpapers librs_jni #用于重载系统属性 #格式:key=value #这些属性最终会被存储在设备的 #/system/build.prop文件中 PRODUCT_PROPERTY_OVERRIDES := net.dns1=8.8.8.8 net.dns2=8.8.4.4 # Inherit from those products. Most specific first. #继承 aosp_base_telephony.mk 和device/friendly-arm/tiny4412/device.mk #文件中的定义 $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk) $(call inherit-product, device/friendly-arm/tiny4412/device.mk) #覆盖继承上面两个文件定义的如下几个变量 # Discard inherited values and use our own instead. #产品名称,最终会显示在系统设置中的 #"关于设备的选项中" PRODUCT_NAME := full_tiny4412 #设备名称 PRODUCT_DEVICE := tiny4412 产品生产商 PRODUCT_MANUFACTURER := FriendlyARM () #产品所属品牌 PRODUCT_BRAND := Android #产品型号 PRODUCT_MODEL := Full Android on TINY4412

(3)BoardConfig.mk文件解析

# BoardConfig.mk # # Product-specific compile-time definitions. # # Use the non-open-source parts, if theyre present -include vendor/friendly-arm/tiny4412/BoardConfigVendor.mk #引入BoardConfigCommon.mk # Use the parts that are common between all Exynos4412s include device/friendly-arm/tiny4412/BoardConfigCommon.mk #用来配置SELINUX,SELINUX是android上面的一种安全机制 #我们可以通过配置SELINUX的相关policy,来定制自己的手 #机的一些权限,比如,我们可以完全让root用户没有任何的 #权限和user一样 #配置SELINUX,需要linux内核首先是支持selinux的, #另外需要android的selinux的配置文件sepolicy里面的内容 #然后就是修改BoardConfig.mk #首先会包含厂商定制的sepolicy的文件夹:BOARD_SEPOLICY_DIRS #然后将规则添加到了sepolicy中:BOARD_SEPOLICY_DIRS BOARD_SEPOLICY_DIRS := device/friendly-arm/tiny4412/sepolicy #配置SELINUX BOARD_SEPOLICY_UNION := file_contexts service_contexts app.te boardinit.te bluetooth.te device.te domain.te drmserver.te gpsd.te mediaserver.te system_server.te

接下来分析引入的BoardConfigCommon.mk

# BoardConfigCommon.mk # # Product-specific compile-time definitions. #芯片平台 TARGET_BOARD_PLATFORM := exynos4 #芯片类型 TARGET_SOC := exynos4x12 #CPU配置选项 # CPU options TARGET_CPU_ABI := armeabi-v7a TARGET_CPU_ABI2 := armeabi TARGET_CPU_SMP := true TARGET_ARCH := arm TARGET_ARCH_VARIANT := armv7-a-neon TARGET_ARCH_VARIANT_CPU := cortex-a9 TARGET_CPU_VARIANT := cortex-a9 ARCH_ARM_HAVE_NEON := true ARCH_ARM_HAVE_TLS_REGISTER := true TARGET_GLOBAL_CFLAGS += -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp TARGET_GLOBAL_CPPFLAGS += -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp TARGET_NO_BOOTLOADER := true TARGET_NO_KERNEL := true TARGET_NO_RADIOIMAGE := true TARGET_BOOTLOADER_BOARD_NAME := tiny4412 TARGET_PROVIDES_INIT_RC := true TARGET_PROVIDES_INIT_TARGET_RC := true # Exynos4 support EXYNOS4X12_ENHANCEMENTS := true EXYNOS4_ENHANCEMENTS := true ifeq ($(EXYNOS4X12_ENHANCEMENTS),true) COMMON_GLOBAL_CFLAGS += -DEXYNOS4_ENHANCEMENTS=1 COMMON_GLOBAL_CFLAGS += -DEXYNOS4X12_ENHANCEMENTS=1 endif # Launcher BOARD_USES_LAUNCHER3 := true # Audio BOARD_USES_GENERIC_AUDIO := false BOARD_USES_I2S_AUDIO := true BOARD_USES_PCM_AUDIO := false BOARD_USES_SPDIF_AUDIO := false # ULP, ALP BOARD_USE_ULP_AUDIO := false BOARD_USE_ALP_AUDIO := true #背光配置 # Backlight BOARD_USES_PWMLIGHTS := false #蓝牙配置 # Bluetooth BOARD_HAVE_BLUETOOTH := true BOARD_HAVE_BLUETOOTH_CSR := true BOARD_HAVE_BLUETOOTH_BCM := false BOARD_HAVE_SAMSUNG_BLUETOOTH := false BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/friendly-arm/tiny4412/bluetooth #Wi-Fi配置 # Connectivity - Wi-Fi WPA_SUPPLICANT_VERSION := VER_0_8_X BOARD_WPA_SUPPLICANT_DRIVER := WEXT BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_fawext BOARD_WLAN_DEVICE := fawext #文件系统配置 # Filesystem TARGET_USERIMAGES_USE_EXT4 := true BOARD_SYSTEMIMAGE_PARTITION_SIZE := 629145600 # 600MB BOARD_USERDATAIMAGE_PARTITION_SIZE := 830472192 # 792MB BOARD_CACHEIMAGE_PARTITION_SIZE := 536870912 # 512MB BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4 BOARD_FLASH_BLOCK_SIZE := 4096 #图形配置 # Graphics BOARD_USES_HGL := true BOARD_EGL_CFG := device/friendly-arm/tiny4412/conf/egl.cfg USE_OPENGL_RENDERER := true IGN_EGL_BUFFERCOUNT := true NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3 SCREEN_WIDTH := 800 SCREEN_HEIGHT := 1280 DEFAULT_FB_NUM := 2 # FIMG Acceleration BOARD_USES_FIMGAPI := true BOARD_USES_SKIA_FIMGAPI := true BOARD_USES_SKIAHWJPEG := true COMMON_GLOBAL_CFLAGS += -DSEC_HWJPEG_G2D -DFORCE_SCREENSHOT_CPU_PATH # HWComposer BOARD_USES_HWCOMPOSER := true BOARD_USE_SYSFS_VSYNC_NOTIFICATION := true # TVOut & HDMI # BOARD_USE_SECTVOUT := true # BOARD_USES_SKTEXTBOX := true BOARD_USES_HDMI_SUBTITLES := false BOARD_USES_HDMI := true BOARD_HDMI_STD := STD_1080P BOARD_HDMI_DDC_CH := DDC_CH_I2C_7 BOARD_HDMI_ROTATE := false #Camera配置 # Camera BOARD_CAMERA_HAVE_ISO := true COMMON_GLOBAL_CFLAGS += -DHAVE_ISO COMMON_GLOBAL_CFLAGS += -DSAMSUNG_CAMERA_HARDWARE COMMON_GLOBAL_CFLAGS += -DSAMSUNG_DVFS BOARD_USES_PROPRIETARY_LIBFIMC := true # SEC Camera USE_SEC_CAMERA := false CAMERA_USE_DIGITALZOOM := true # BOARD_USE_S5K3H2 := true #OMX配置 # OMX BOARD_USE_SAMSUNG_COLORFORMAT := true BOARD_NONBLOCK_MODE_PROCESS := true BOARD_USE_STOREMETADATA := true BOARD_USE_METADATABUFFERTYPE := true BOARD_USE_S3D_SUPPORT := true BOARD_USE_DRM := true BOARD_USE_CSC_FIMC := false BOARD_USES_MFC_FPS := true BOARD_USES_FFMPEG := false #V4L2配置 # V4L2 & ION BOARD_USE_V4L2 := false BOARD_USE_V4L2_ION := false BOARD_NO_OVERLAY := false #中兴无线模块配置 # ZTE WIRELESS MODEM BOARD_HAVE_MODEM :=true BOARD_MODEM_VENDOR :=ZTE BOARD_MODEM_ID :=MF210 BOARD_MODEM_HAVE_DATA_DEVICE :=true BOARD_WITH_CALL_FUNCTION:=false

(4)system.prop 

用来配置手机的属性

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/e47261de3c9e073d82d81928fd4139d7.html