4. Compile Android10.0

4.1. Download Android SDK

Due to the larger SDK, you can choose the cloud disk to download Firefly-RK3399_Android10.0_git_20211222.7z from the download page :

Download link

Note: the source code and bundle are stored in the Google Driver

After downloading, verify the MD5 code:

$ md5sum /path/to/Firefly-RK3399_Android10.0_git_20211222.7z.001
$ md5sum /path/to/Firefly-RK3399_Android10.0_git_20211222.7z.002
$ md5sum /path/to/Firefly-RK3399_Android10.0_git_20211222.7z.003
$ md5sum /path/to/Firefly-RK3399_Android10.0_git_20211222.7z.004
$ md5sum /path/to/Firefly-RK3399_Android10.0_git_20211222.7z.005

fb41fcdc48b1cf90ecac4a5bb8fafc7a  Firefly-RK3399_Android10.0_git_20211222.7z.001
82d665fb54fb41245d9317312e7b7578  Firefly-RK3399_Android10.0_git_20211222.7z.002
0dd40827976200a6fb61623c9e87fe7c  Firefly-RK3399_Android10.0_git_20211222.7z.003
32324c3afe615394ee4cdf842c53ea8d  Firefly-RK3399_Android10.0_git_20211222.7z.004
9b1656ae07b4fe9ddf7d9ef2dfa2f95a  Firefly-RK3399_Android10.0_git_20211222.7z.005

After confirming that it is correct, you can unzip:

cd ~/proj/
7z x ./Firefly-RK3399_Android10.0_git_20211222.7z.001 -ork3399_Android10.0
cd ./rk3399_Android10.0
git reset --hard

Note: Be sure to update the remote warehouse after decompression. The following is how to update from gitlab:

1. Enter the SDK root directory
cd ~/proj/rk3399_Android10.0

2. Download remote bundle repository
git clone https://gitlab.com/TeeFirefly/rk3399-android10.0-bundle.git .bundle

3. If the download warehouse fails, the current bundle warehouse is about 1.4G, so there may be stuck or failed problems during synchronization. You can download and unzip it from the cloud disk link below to the SDK root directory.

7z x rk3399-android10.0-bundle.7z  -r -o. && mv rk3399-android10.0-bundle/ .bundle/

4. Update the SDK, and subsequent updates do not need to pull the remote warehouse again, just execute the following command

5. Follow the prompts to update the content to FETCH_HEAD, synchronize FETCH_HEAD to the firefly branch
git rebase FETCH_HEAD

4.2. ROC-RK3399-PC Pro product compilation method

4.2.1. Overall Compilation

Note: Since ROC-RK3399-PC Pro is the Hardware iteration version of ROC-RK3399-PC-PLUS, so the compilation method of software is consistent. Finally generated firmware, such as ROC-RK3399-PC-Pro_ xxx.img is compatible with ROC-RK3399-PC-PLUS. Public Compile HDMI+DP
./FFTools/make.sh -d rk3399-roc-pc-plus -j8 -l rk3399_roc_pc_plus-userdebug
./FFTools/mkupdate/mkupdate.sh -l rk3399_roc_pc_plus-userdebug Display DM-M10R800 V2 Compile MIPI_DSI0+HDMI
./FFTools/make.sh -j8 -d rk3399-roc-pc-plus-mipi101-JDM101014_BC45_A1 -l rk3399_roc_pc_plus_mipi-userdebug
./FFTools/mkupdate/mkupdate.sh -l rk3399_roc_pc_plus_mipi-userdebug Camera OV13850 Compile HDMI+OV13850
  • Modify kernel/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-plus.dtsi


-    XC6130b@23{
+    ov13850b@10{
     status = "okay";
-    XC7022b@1b{
+    ov13850f@10{
     status = "okay";

-    /delete-node/ ov13850b@10;
-    /delete-node/ ov13850f@10;
+    /delete-node/ XC6130b@23;
+    /delete-node/ XC7022b@1b;

  • Compile

./FFTools/make.sh -d rk3399-roc-pc-plus -j8 -l rk3399_roc_pc_plus-userdebug
./FFTools/mkupdate/mkupdate.sh -l rk3399_roc_pc_plus-userdebug Dual Camera SV-TAYSH-TQ Compile HDMI+SV-TAYSH-TQ
  • Modify kernel/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-plus.dtsi

+    status = "disabled";
+    status = "disabled";

+    status = "okay";
+    status = "okay";
  • Compile

./FFTools/make.sh -d rk3399-roc-pc-plus -j8 -l rk3399_roc_pc_plus-userdebug
./FFTools/mkupdate/mkupdate.sh -l rk3399_roc_pc_plus-userdebug

4.2.2. Step by Step Compilation

Take compiling HDMI firmware as an example,Before compiling, execute the following command to configure environment variables:

source ./FFTools/build.sh
  • Compile kernel:

cd ~/proj/rk3399_Android10.0/kernel/
make ARCH=arm64 firefly_defconfig android-10.config rk3399.config
make ARCH=arm64 BOOT_IMG=../rockdev/Image-rk3399_roc_pc_plus/boot.img rk3399-roc-pc-plus.img -j8
  • Note:If you going to do kernel debug,you need pack the resource.img and kernel.img together into boot.img,then upgrade the boot,img into boot partition.

  • Compile uboot:

cd ~/proj/rk3399_Android10.0/u-boot/
./make.sh rk3399
  • Compile Android:

cd ~/proj/rk3399_Android10.0/
lunch rk3399_roc_pc_plus-userdebug
make -j8
  • Packaged into unified firmware

    After compilation, you can use Firefly official scripts to package into unified firmware, execute the following command:

    ./FFTools/mkupdate/mkupdate.sh -l rk3399_roc_pc_plus-userdebug

    According to different -l XXX-userdebug parameters, the packaged unified firmware will be stored in different directories (rockdev/image-XXX/): product name XXX_XXX_date XXX.img

    It is also very simple to package the unified firmware update.img under Windows. Copy the generated files to the rockdev \ Image directory of AndroidTool, and then run the mkupdate.bat batch file under the rockdev directory to create update.img and store it in rockdev \ Image directory.

4.2.3. Partition image

  • boot.img : include ramdis、kernel、dtb

  • dtbo.img : Device Tree Overlays

  • kernel.img : Currently, it cannot be burned separately, it needs to be packaged into boot.img to burn and write

  • MiniLoaderAll.bin : include first loader

  • misc.img : includerecovery-wipe boot flag information ,enter recovery afte v

  • odm.img : include android odm,included in super.img partition ,upgrade alone by the fastboot tool

  • parameter.txt : include partition information

  • pcba_small_misc.img : include pcba boot flag information,enter the simple pcba mode after upgrade

  • pcba_whole_misc.img : include pcba boot flag information,enter the full pcba mode after upgrade

  • recovery.img : include recovery-ramdis、kernel、dtb

  • resource.img : include dtb,kernel and uboot phases log and the uboot charging logo,it should be packed into boot.img,then upgrade it

  • super.img : include odm、vendor、system partition content

  • system.img : include android system,included in super.img partition ,upgrade alone by the fastboot tool

  • trust.img : include BL31、BL32

  • uboot.img : include uboot.img

  • vbmeta.img : include avb,for AVB verify

  • vendor.img : include android vendor,included in super.img partition ,upgrade alone by the fastboot tool

  • update.img : include all the img file above,use tools to upgrade the whole firmware package

4.3. Flash Image

Reference: 《Flash Image》

4.4. Other Android versions