RK3588 Android12 SDK 中在device介绍及如何新建自己的产品lunch项
文章目录
目的
RK3588 Android12 在编译的时候需要先lunch选择产品,这个lunch项会根据不同的产品配置对应的参数,比如配置系统参数、配置产品个性化需求、是否支持HDMI、是否支持4G网络、配置分区信息等等。可以针对不同的产品新建对应的lunch,满足在同一套代码下开发不同产品的需求。本文将介绍RK3588 Android12的device结构和如何新建一个产品lunch。
RK3588 Android12的device结构
RK3588 Android12的device结构如下图,一个产品的配置包括common、rk3588、产品目录,分别对应Android平台配置、芯片平台配置、产品配置这三级,从下往上include。
devices下产品相关配置介绍
Rockchip Android平台通用配置
代码路径:device/rockchip/common
这个目录下通常不需要修改,如果有修改可以在产品目录下重写对应的配置进行overlay。 主要内容包括如下:
- 编译脚本
包括编译脚本和工具:
device/rockchip/common/build/rockchip/build.sh //编译脚本
device/rockchip/common/mkimage.sh //打包image的脚本
device/rockchip/common/scripts/fstab_tools/ //fstab自动生成工具及配置信息
device/rockchip/common/scripts/parameter_tools/ //parameter分区表自动生成工具及配置信息
- init服务
ls device/rockchip/common/rootdir/
init.recovery.rk30board.rc //recovery模式下init服务配置
init.rk30board.usb.rc //usb相关的初始化服务和配置
ueventd.rockchip.rc //设备节点初始化属性配置
init.rk30board.rc //rockchip平台相关的初始化服务和配置
init.rockchip.rc //rockchip平台相关的初始化服务和配置
- sepolicy
设备节点的selinux权限配置ls device/rockchip/common/sepolicy/ private public split vendor
- device.mk
平台相关的配置及编译选项配置,可以在这里控制编译哪些模块,如app、模块等等 - Boardconfig.mk
平台默认的产品属性配置,以及平台功能的宏的定义和编译选项配置
RK3588芯片平台配置
代码路径:device/rockchip/rk3588
- RK3588 的配置:device/rockchip/rk3588/Boardconfig.mk
主要信息说明如下:
#CPUD的arm64(64位)的配置
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_ABI2 :=
TARGET_CPU_VARIANT := generic
TARGET_CPU_VARIANT_RUNTIME := cortex-a76
#CPUD的arm32(32位)的配置
TARGET_2ND_ARCH := arm
TARGET_2ND_ARCH_VARIANT := armv8-a
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := generic
TARGET_2ND_CPU_VARIANT_RUNTIME := cortex-a76
#GPU信息:
TARGET_BOARD_PLATFORM := rk3588
TARGET_BOARD_PLATFORM_GPU := mali-G610
#配置kernel版本
PRODUCT_KERNEL_VERSION := 5.10
#其他相关信息
- 编译和系统属性配置:device/rockchip/rk3588/device.mk
主要信息说明如下:
#编译是拷贝文件
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/init.rk3588.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.rk3588.rc \
$(LOCAL_PATH)/wake_lock_filter.xml:system/etc/wake_lock_filter.xml \
$(LOCAL_PATH)/package_performance.xml:$(TARGET_COPY_OUT_ODM)/etc/package_performance.xml \
$(TARGET_DEVICE_DIR)/media_profiles_default.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_V1_0.xml\
#配置系统prop属性
#
# add Rockchip properties here
#
PRODUCT_PROPERTY_OVERRIDES += \
ro.ril.ecclist=112,911 \
ro.opengles.version=196610 \
wifi.interface=wlan0 \
ro.audio.monitorOrientation=true \
debug.nfc.fw_download=false \
debug.nfc.se=false \
vendor.hwc.compose_policy=1 \
sys.wallpaper.rgb565=0 \
sf.power.control=2073600 \
sys.rkadb.root=0 \
ro.sf.fakerotation=false \
ro.tether.denied=false \
sys.resolution.changed=false \
ro.default.size=100 \
ro.product.usbfactory=rockchip_usb \
wifi.supplicant_scan_interval=15 \
ro.factory.tool=0 \
ro.kernel.android.checkjni=0 \
ro.build.shutdown_timeout=6 \
persist.enable_task_snapshots=false \
ro.vendor.frameratelock=true
产品配置
代码路径:
device/rockchip/rk3588/rk3588_s
device/rockchip/rk3588/rk3588s_s
device/rockchip/rk3588/rk3588_box
device/rockchip/rk3588/rk3588_xr
以rk3588_s为例说明:
wlq@sys2_206:~/3_Android12_29_debug/device/rockchip/rk3588/rk3588_s$ ls
AndroidBoard.mk //配置lunch信息
BoardConfig.mk //配置产品相关编译宏,并且包含device/rockchip/rk3588/BoardConfig.mk
config.cfg //固件烧写工具的配置文件
config.cfg_ab_gki
media_profiles_default.xml //配置多媒体的信息,如支持格式等
preinstall //将要预安装的apk放在这里目录下即可实现apk于安装
recovery.fstab_AB //AB系统的recovery分区表
Android.mk
bt_vendor.conf //蓝牙的配置文件,可以配置蓝牙使用的串口等信息
config.cfg_ab //AB系统固件烧写工具的配置文件
dt-overlay.in //dtbo的配置信息
ota //ota升级loader和parameter的源文件存放目录
rk3588_s.mk //产品级的编译和属性配置文件
- 产品配置信息:BoardConfig.mk
include device/rockchip/rk3588/BoardConfig.mk
BUILD_WITH_GO_OPT := false #配置是否启用go配置,可以节省内存但是部分功能受限
# AB image definition
BOARD_USES_AB_IMAGE := false
BOARD_ROCKCHIP_VIRTUAL_AB_ENABLE := false
# 配置支持的sensor类型
BOARD_GRAVITY_SENSOR_SUPPORT := true
BOARD_COMPASS_SENSOR_SUPPORT := true
BOARD_SENSOR_COMPASS_AK8963-64 := true
BOARD_GYROSCOPE_SENSOR_SUPPORT := true
BOARD_PROXIMITY_SENSOR_SUPPORT := true
BOARD_LIGHT_SENSOR_SUPPORT := true
ifeq ($(strip $(BOARD_USES_AB_IMAGE)), true)
include device/rockchip/common/BoardConfig_AB.mk
TARGET_RECOVERY_FSTAB := device/rockchip/rk3588/rk3588_s/recovery.fstab_AB
endif
#配置产品的默认编译信息,如默认dts、uboot config等
PRODUCT_UBOOT_CONFIG := rk3588
PRODUCT_KERNEL_DTS := rk3588-evb1-lp4-v10
BOARD_GSENSOR_MXC6655XA_SUPPORT := true
#配置是否支持usb camera
BOARD_CAMERA_SUPPORT_EXT := true
#配置是否支持以太网
BOARD_HS_ETHERNET := true
#配置是否支持HDMI-IN
BOARD_HDMI_IN_SUPPORT := true
- 产品编译和属性配置信息:rk3588_s.mk
# First lunching is S, api_level is 31
PRODUCT_SHIPPING_API_LEVEL := 31
PRODUCT_DTBO_TEMPLATE := $(LOCAL_PATH)/dt-overlay.in
include device/rockchip/common/build/rockchip/DynamicPartitions.mk
include device/rockchip/rk3588/rk3588_s/BoardConfig.mk
include device/rockchip/common/BoardConfig.mk
$(call inherit-product, device/rockchip/rk3588/device.mk)
$(call inherit-product, device/rockchip/common/device.mk)
$(call inherit-product, frameworks/native/build/tablet-10in-xhdpi-2048-dalvik-heap.mk)
DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/../overlay
PRODUCT_CHARACTERISTICS := tablet
#配置产品名称信息
PRODUCT_NAME := rk3588_s
PRODUCT_DEVICE := rk3588_s
PRODUCT_BRAND := rockchip
PRODUCT_MODEL := rk3588_s
PRODUCT_MANUFACTURER := rockchip
PRODUCT_AAPT_PREF_CONFIG := mdpi
#
## add Rockchip properties
#
PRODUCT_PROPERTY_OVERRIDES += ro.sf.lcd_density=320
PRODUCT_PROPERTY_OVERRIDES += ro.wifi.sleep.power.down=true
PRODUCT_PROPERTY_OVERRIDES += persist.wifi.sleep.delay.ms=0
PRODUCT_PROPERTY_OVERRIDES += persist.bt.power.down=true
PRODUCT_PROPERTY_OVERRIDES += vendor.hwc.device.primary=DSI
PRODUCT_PROPERTY_OVERRIDES += vendor.hwc.device.extend=HDMI-A,eDP
PRODUCT_PROPERTY_OVERRIDES += sys.mouse.presentation=1
新建自己的产品目录(新加lunch项)
以RK3588平台新建rk3588s_s产品为例,分以下步骤:
1)修改device/rockchip/rk3588/AndroidProducts.mk增加rk3588s_s的lunch
--- a/AndroidProducts.mk
+++ b/AndroidProducts.mk
@@ -17,10 +17,14 @@
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/rk3566_s/rk3588_s.mk \
+ $(LOCAL_DIR)/rk3588_s/rk3588s_s.mk \
COMMON_LUNCH_CHOICES := \
rk3588_s-userdebug \
rk3588_s-user \
+ rk3588s_s-userdebug \
+ rk3588s_s-user \
2)在device/rockchip/rk3588目录下新建rk3588s_s目录
参考device/rockchip/rk3588下已有的rk3588_s产品目录新建,可以先直接拷贝rk3588_s为rk3588s_s,然后将rk3588s_s目录下的所有rk3588_s
字符改为rk3588s_s