一、卷首
在开启一个新的android案子时,为了和原有项目区分开,一般均需要创建新产品自己的device或者Product目录。本文即以全志H713平台为例子,介绍新增一个名为myboard的产品。同时因为其派生自公版h713-tuna_p3,所以将其源码目录命名为h713-tuna_p3_myboard。
二、新增device目录
2.1 基本信息
- 确定产品基于device/softwinner/ares/h713-tuna_p3,也就是和h713-tuna_p3比较像
- 新board,或者新产品的名字叫:h713-tuna_p3_myboard
2.2 操作步骤
(1)cp -rf h713-tuna_p3 h713-tuna_p3_myboard ,可对比类似产品,看是否有Product差异配置,本案例此处完全相同
(2)cp h713_tuna_p3.mk h713_tuna_p3_myboard.mk,同理,本案例需修改
(3)编辑h713_tuna_p3_myboard.mk
(4)编辑AndroidProducts.mk,新增产品选项
2.3 编辑h713_tuna_p3_myboard.mk
- 新增并修改A:\works\aw\android\device\softwinner\ares\h713_tuna_p3_myboard.mk
- 通过和相似产品的mk文件进行对比,即可得知需要配置的项目
- 修改项目如下
PRODUCT_NAME := h713_tuna_p3_myboard
PRODUCT_DEVICE := h713-tuna_p3_myboard
PRODUCT_BOARD := tuna_p3_myboard
PRODUCT_MODEL := QUAD-CORE h713 tuna_p3_myboard
2.4 编辑AndroidProducts.mk
- 如下,增加如下修改
diff --git a/device/softwinner/ares/AndroidProducts.mk b/device/softwinner/ares/AndroidProducts.mk
index 7a48abbb78..b3e7173f32 100644
--- a/device/softwinner/ares/AndroidProducts.mk
+++ b/device/softwinner/ares/AndroidProducts.mk
@@ -17,6 +17,7 @@
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/h713_tuna_p3.mk \
$(LOCAL_DIR)/h713_tuna_perf1.mk \
+ $(LOCAL_DIR)/h713_tuna_p3_myboard.mk \
$(LOCAL_DIR)/h713m_tuna_p3.mk \
$(LOCAL_DIR)/h716m_tuna_p3.mk \
$(LOCAL_DIR)/tv303c2_tuna_p4.mk \
@@ -37,6 +38,8 @@ COMMON_LUNCH_CHOICES := \
h713_tuna_p3-user \
h713_tuna_perf1-userdebug \
h713_tuna_perf1-user \
+ h713_tuna_p3_myboard-userdebug \
+ h713_tuna_p3_myboard-user \
h713m_tuna_p3-userdebug \
h713m_tuna_p3-user \
h716m_tuna_p3-userdebug \
三、新增内核配置
3.1 新增config目录
- 产品派生自tuna_p3公版,所以直接复制即可
cd longan/device/config/chips/h713/configs/
cp -rf tuna_p3 tuna_p3_myboard
3.2 新增defconfig文件
- 产品派生自tuna_p3公版,所以直接复制即可
cd longan/kernel/linux-5.4/arch/arm/configs/
cp sun50iw12p1smp_android_tuna_defconfig sun50iw12p1smp_android_tuna_myboard_defconfig
- 同时修改 configs\tuna_p3\android\BoardConfig.mk,将defconfig执行我们新增的这个配置:
LICHEE_KERN_DEFCONF:=sun50iw12p1smp_android_tuna_myboard_defconfig
四、差异列表
4.1 git add 之前
szhou@oa-R630:~/works/aw/android$ git status .
On branch dev_myboard
Your branch is up to date with 'origin/dev_myboard'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: device/softwinner/ares/AndroidProducts.mk
Untracked files:
(use "git add <file>..." to include in what will be committed)
device/softwinner/ares/h713-tuna_p3_myboard/
device/softwinner/ares/h713_tuna_p3_myboard.mk
longan/device/config/chips/h713/configs/tuna_p3_myboard/
longan/kernel/linux-5.4/arch/arm/configs/sun50iw12p1smp_android_tuna_myboard_defconfig
It took 2.79 seconds to enumerate untracked files. 'status -uno'
may speed it up, but you have to be careful not to forget to add
new files yourself (see 'git help status').
no changes added to commit (use "git add" and/or "git commit -a")
szhou@oa-R630:~/works/aw/android$
4.2 git add 之后
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: device/softwinner/ares/AndroidProducts.mk
new file: device/softwinner/ares/h713-tuna_p3_myboard/BoardConfig.mk
new file: device/softwinner/ares/h713-tuna_p3_myboard/audio/audio_mixer_paths.xml
new file: device/softwinner/ares/h713-tuna_p3_myboard/audio/bootanimation.zip
new file: device/softwinner/ares/h713-tuna_p3_myboard/camera/camera.cfg
new file: device/softwinner/ares/h713-tuna_p3_myboard/camera/config.mk
new file: device/softwinner/ares/h713-tuna_p3_myboard/camera/hawkview/sensor_list_cfg.ini
new file: device/softwinner/ares/h713-tuna_p3_myboard/camera/init.camera.rc
new file: device/softwinner/ares/h713-tuna_p3_myboard/camera/media_profiles.xml
new file: device/softwinner/ares/h713-tuna_p3_myboard/input/config.mk
new file: device/softwinner/ares/h713-tuna_p3_myboard/input/gsensor.cfg
new file: device/softwinner/ares/h713-tuna_p3_myboard/input/init.input.rc
new file: device/softwinner/ares/h713-tuna_p3_myboard/input/sunxi-keyboard.kl
new file: device/softwinner/ares/h713-tuna_p3_myboard/panel_config/panel_config.ini
new file: device/softwinner/ares/h713-tuna_p3_myboard/secure/config.mk
new file: device/softwinner/ares/h713-tuna_p3_myboard/system/awbms_config
new file: device/softwinner/ares/h713-tuna_p3_myboard/system/dragon_toc.cfg
new file: device/softwinner/ares/h713-tuna_p3_myboard/system/env.cfg
new file: device/softwinner/ares/h713-tuna_p3_myboard/system/sys_partition.fex
new file: device/softwinner/ares/h713-tuna_p3_myboard/system/vendor_ramdisk.modules
new file: device/softwinner/ares/h713_tuna_p3_myboard.mk
new file: longan/device/config/chips/h713/configs/tuna_p3_myboard/android/BoardConfig.mk
new file: longan/device/config/chips/h713/configs/tuna_p3_myboard/android/sys_partition.fex
new file: longan/device/config/chips/h713/configs/tuna_p3_myboard/arisc.config
new file: longan/device/config/chips/h713/configs/tuna_p3_myboard/board-min.dts
new file: longan/device/config/chips/h713/configs/tuna_p3_myboard/board.dts
new file: longan/device/config/chips/h713/configs/tuna_p3_myboard/dragonboard/BoardConfig.mk
new file: longan/device/config/chips/h713/configs/tuna_p3_myboard/dragonboard/env.cfg
new file: longan/device/config/chips/h713/configs/tuna_p3_myboard/dragonboard/sys_partition.fex
new file: longan/device/config/chips/h713/configs/tuna_p3_myboard/dragonboard/test_config.fex
new file: longan/device/config/chips/h713/configs/tuna_p3_myboard/linux-5.4/board.dts
new file: longan/device/config/chips/h713/configs/tuna_p3_myboard/longan/BoardConfig.mk
new file: longan/device/config/chips/h713/configs/tuna_p3_myboard/reserve0/panel_config.ini
new file: longan/device/config/chips/h713/configs/tuna_p3_myboard/sys_config.fex
new file: longan/device/config/chips/h713/configs/tuna_p3_myboard/uboot-board.dts
new file: longan/kernel/linux-5.4/arch/arm/configs/sun50iw12p1smp_android_tuna_myboard_defconfig
五、编译
5.1 编译kernel
szhou@bc01-R630:~/works/aw/android/longan$ ./build.sh config
Welcome to mkscript setup progress
All available platform:
0. android
1. linux
Choice [android]: 0
All available ic:
0. h713
1. h713m
2. h716m
3. tv303-c1
4. tv303-c2
Choice [h713]: 0
All available board:
0. ft
1. tuna_p3
2. tuna_p3_myboard
3. tuna_perf1
4. tuna_qa
Choice [tuna_p3_myboard]: 2
All available flash:
0. default
1. nor
Choice [default]: 0
All available arch:
0. arm
1. arm64
Choice [arm]: 0
INFO: Prepare toolchain ...
……略……
szhou@bc01-R630:~/works/aw/android/longan$
szhou@bc01-R630:~/works/aw/android/longan$ ./build.sh
5.2 编译Android
szhou@bc01-R630:~/works/aw/android$ source build/envsetup.sh
szhou@bc01-R630:~/works/aw/android$ lunch
You're building on Linux
Lunch menu... pick a combo:
1. aosp_arm-eng
2. aosp_arm64-eng
3. aosp_x86-eng
4. aosp_x86_64-eng
5. h713_tuna_p3-user
6. h713_tuna_p3-userdebug
7. h713_tuna_p3_myboard-user
8. h713_tuna_p3_myboard-userdebug
9. h713_tuna_perf1-user
10. h713_tuna_perf1-userdebug
……略……
Which would you like? [aosp_arm-eng] 8
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=11
TARGET_PRODUCT=h713_tuna_p3_myboard
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a7
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.15.0-91-generic-x86_64-Ubuntu-20.04.6-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=RP1A.201005.006
OUT_DIR=out
============================================
szhou@bc01-R630:~/works/aw/android$ make -j32 & pack