3. 编译 Android11.0 固件¶
运行 Android11.0,ROC-RK3566-PC需要满足如下条件:
DDR至少需要 2GB
eMMC至少需要 16GB
3.1. Android SDK¶
SDK 源码与 bundle 压缩包均存放在云盘中。
3.1.1. 第一步,下载 SDK¶
由于 SDK 较大,可以去下载页面选择云盘下载 Firefly-RK356X_Android11.0_git
下载完成后,在解压前先校验下 MD5 码:
$ md5sum /path/to/Firefly-RK356X_Android11.0_git_20210824.7z.001 $ md5sum /path/to/Firefly-RK356X_Android11.0_git_20210824.7z.002 $ md5sum /path/to/Firefly-RK356X_Android11.0_git_20210824.7z.003 $ md5sum /path/to/Firefly-RK356X_Android11.0_git_20210824.7z.004 $ md5sum /path/to/Firefly-RK356X_Android11.0_git_20210824.7z.005 b4c3d014a688d230bb25156a4c5aea26 Firefly-RK356X_Android11.0_git_20210824.7z.001 1ddfec58d0d69aee6029982fcbe4343c Firefly-RK356X_Android11.0_git_20210824.7z.002 d08b16c244545ac68b496e2980d3c6a7 Firefly-RK356X_Android11.0_git_20210824.7z.003 2b628cc10a55214b8d9a3619673c01c3 Firefly-RK356X_Android11.0_git_20210824.7z.004 6f7e63955c96ca3c9ba6e4e49d52c90c Firefly-RK356X_Android11.0_git_20210824.7z.005
然后解压:
注意:不要在共享文件夹、挂载文件夹以及非英文目录解压SDK,避免产生不必要的错误
$ mkdir ~/proj
$ mv /path/to/Firefly-RK356X_Android11.0_git_20210824.7z.* ~/proj
$ cd ~/proj/
$ 7z x ./Firefly-RK356X_Android11.0_git_20210824.7z.001 -oRK356X_Android11.0
$ cd ./RK356X_Android11.0
$ git reset --hard
3.1.2. 第二步,更新 SDK¶
下载 SDK 后,从 gitlab 处更新代码的方法:
#1. 进入 SDK 根目录
cd ~/proj/RK356X_Android11.0
#2. 下载远程 bundle 仓库
git clone https://gitlab.com/TeeFirefly/rk356x-android11-bundle.git .bundle
#3. 若下载仓库失败,目前 bundle 仓库占用空间较大,所以同步的时候可能会出现卡住或失败的问题,
# 可以从云盘下载 bundle 并解压到 SDK 根目录,解压指令如下:
7z x rk356x-android11-bundle.7z -r -o. && mv rk356x-android11-bundle/ .bundle/
#4. 更新 SDK,并且后续更新不需要再次拉取远程仓库,直接执行以下命令即可
.bundle/update
#5. 按照提示已经更新内容到 FETCH_HEAD,同步 FETCH_HEAD 到 firefly 分支
git rebase FETCH_HEAD
随着 SDK 的更新,bundle 也会随之越来越大,可以去下载页面选择云盘下载 bundle。
3.2. ROC-RK3566-PC 产品编译方法¶
注意:若是第一次编译该Android Product,请使用公版编译命令进行一次完整编译
3.2.1. 公版编译¶
3.2.1.1. HDMI¶
./FFTools/make.sh -d rk3566-roc-pc -j8 -l rk3566_roc_pc-userdebug
./FFTools/mkupdate/mkupdate.sh -l rk3566_roc_pc-userdebug
3.2.2. 显示屏 DM-M10R800 V2 编译¶
3.2.2.1. MIPI_DSI¶
./FFTools/make.sh -d rk3566-roc-pc-mipi101_M101014_BE45_A1 -j8 -l rk3566_roc_pc_mipi-userdebug
./FFTools/mkupdate/mkupdate.sh -l rk3566_roc_pc_mipi-userdebug
3.2.3. 双目摄像头 CAM-2MS2MF 编译¶
3.2.3.1. HDMI+CAM-2MS2MF¶
修改 dts
diff --git a/kernel/arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts b/kernel/arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts index 3fd84cea761..715cf0cceeb 100644 --- a/kernel/arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts +++ b/kernel/arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts @@ -12,8 +12,8 @@ * using single camera xc7160 ----> rk3566-roc-pc-cam-8ms1m.dtsi * using dual camera gc2053/gc2093 ----> rk3566-roc-pc-cam-2ms2m.dtsi */ -#include "rk3566-roc-pc-cam-8ms1m.dtsi" -//#include "rk3566-roc-pc-cam-2ms2m.dtsi" +//#include "rk3566-roc-pc-cam-8ms1m.dtsi" +#include "rk3566-roc-pc-cam-2ms2m.dtsi"
编译
./FFTools/make.sh -d rk3566-roc-pc -j8 -l rk3566_roc_pc-userdebug ./FFTools/mkupdate/mkupdate.sh -l rk3566_roc_pc-userdebug
3.2.4. HDMI TO MIPI_CSI(RK628D) 编译¶
修改 dts
diff --git a/kernel/arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts b/kernel/arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts index 1a274d6..12805d3 100644 --- a/kernel/arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts +++ b/kernel/arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts @@ -13,9 +13,9 @@ * using dual camera gc2053/gc2093 ----> rk3566-roc-pc-cam-2ms2m.dtsi * using rk628d ----> rk3566-roc-pc-tf-hdmi-mipi-rk628.dtsi */ -#include "rk3566-roc-pc-cam-8ms1m.dtsi" +//#include "rk3566-roc-pc-cam-8ms1m.dtsi" //#include "rk3566-roc-pc-cam-2ms2m.dtsi" -//#include "rk3566-roc-pc-tf-hdmi-mipi-rk628.dtsi" +#include "rk3566-roc-pc-tf-hdmi-mipi-rk628.dtsi"
编译
./FFTools/make.sh -d rk3566-roc-pc -j8 -l rk3566_roc_pc-userdebug ./FFTools/mkupdate/mkupdate.sh -l rk3566_roc_pc-userdebug
3.3. 手动编译 ROC-RK3566-PC Android 11.0¶
编译前执行如下命令配置环境变量:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
编译 kernel:
cd ~/proj/RK356X/kernel/
make ARCH=arm64 firefly_defconfig android-11.config rk356x.config
make ARCH=arm64 BOOT_IMG=../rockdev/Image-rk3566_roc_pc/boot.img rk3566-roc-pc.img -j8
注意:进行内核debug的时候,单编译生成boot.img如果出现运行错误,可参考FAQs
编译 uboot:
cd ~/proj/RK356X/u-boot/
./make.sh rk3566
编译 Android:
cd ~/proj/RK356X/
source build/envsetup.sh
lunch rk3566_roc_pc-userdebug
make installclean
make -j8
./mkimage.sh
3.4. 打包成统一固件 update.img¶
编译完可以用Firefly官方的脚本打包成统一固件,执行如下命令:
./FFTools/mkupdate/mkupdate.sh -l rk3566_roc_pc-userdebug
打包完成后将在rockdev/Image-XXX/ 目录下生成统一固件: product名XXX_XXX_日期XXX.img
在 Windows 下打包统一固件 update.img 也很简单,将编译生成的文件拷贝到 AndroidTool 的 rockdev\Image 目录中,然后运行 rockdev 目录下的 mkupdate.bat 批处理文件即可创建 update.img 并存放到 rockdev\Image 目录里。