本文将讲述如何在 RK3568 Android12 SDK 中新增一个自定义的 lunch 选项,并配置相关的内核和设备树文件。
步骤一:修改 device/rockchip/rk356x 目录
1. 新增自定义产品目录
进入 device/rockchip/rk356x
目录,复制已有的 rk3568_s 目录并将其重命名为 rk3568_neardi_lba3568
。此目录将代表新设备配置。
cp -r device/rockchip/rk356x/rk3568_s device/rockchip/rk356x/rk3568_neardi_lba3568
2. 修改产品配置文件
将 rk3568_s
相关的标记替换为 rk3568_neardi_lba3568
,确保所有文件中的标识符正确映射到新的产品名称。
需要修改的文件包括:
- Android.mk
- AndroidBoard.mk
- BoardConfig.mk
- 其他自定义的配置文件如 media_profiles_default.xml 等。
3.修改 AndroidProducts.mk 文件
编辑 device/rockchip/rk356x/AndroidProducts.mk 文件,新增以下内容以支持新的 lunch 选项:
--- a/device/rockchip/rk356x/AndroidProducts.mk
+++ b/device/rockchip/rk356x/AndroidProducts.mk
@@ -15,6 +15,7 @@
#
PRODUCT_MAKEFILES := \
+ $(LOCAL_DIR)/rk3568_neardi_lba3568/rk3568_neardi_lba3568.mk \
$(LOCAL_DIR)/rk3566_sgo/rk3566_sgo.mk \
$(LOCAL_DIR)/rk3566_32bit/rk3566_32bit.mk \
$(LOCAL_DIR)/rk3566_r/rk3566_r.mk \
@@ -24,6 +25,8 @@ PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/rk3566_einkw6/rk3566_einkw6.mk
COMMON_LUNCH_CHOICES := \
+ rk3568_neardi_lba3568-userdebug \
+ rk3568_neardi_lba3568-user \
rk3566_32bit-userdebug \
步骤二:修改内核文件
1.新增设备树文件(DTS 和 DTSI)
cp kernel-4.19/arch/arm64/boot/dts/rockchip/rk3566-evb2-lp4x-v10.dts \
kernel-4.19/arch/arm64/boot/dts/rockchip/rk3568-neardi-lba3568-lp4x.dts
cp kernel-4.19/arch/arm64/boot/dts/rockchip/rk3566-evb2-lp4x-v10.dtsi \
kernel-4.19/arch/arm64/boot/dts/rockchip/rk3568-neardi-lba3568-lp4x.dtsi
cp kernel-4.19/arch/arm64/boot/dts/rockchip/rk3568.dtsi \
kernel-4.19/arch/arm64/boot/dts/rockchip/rk3568-neardi.dtsi
cp kernel-4.19/arch/arm64/configs/rockchip_defconfig \
kernel-4.19/arch/arm64/configs/rk3568_neardi_lba3568_defconfig
步骤三:更新 BoardConfig.mk
1.修改 BoardConfig.mk
device/rockchip/rk356x/rk3568_neardi_lba3568/BoardConfig.mk
文件中,添加以下内容以指定新的 DTS 和内核配置文件:
+++ b/device/rockchip/rk356x/rk3568_neardi_lba3568/BoardConfig.mk
@@ -26,7 +26,8 @@ ifeq ($(strip $(BOARD_USES_AB_IMAGE)), true)
endif
PRODUCT_UBOOT_CONFIG := rk3568
-PRODUCT_KERNEL_DTS := rk3568-evb1-ddr4-v10
+PRODUCT_KERNEL_DTS := rk3568-neardi-lba3568-lp4x
+PRODUCT_KERNEL_CONFIG := rk3568_neardi_lba3568_defconfig
BOARD_GSENSOR_MXC6655XA_SUPPORT := true
步骤四:编译
1.配置编译环境
进入 SDK 根目录,执行环境设置脚本:
source build/envsetup.sh
2.选择 lunch 新增自定义选项
lunch rk3568_neardi_lba3568-userdebug
3.完整编译SDK
./build.sh -AKUpu