3. Compile Android14.0 firmware

3.1. ROC-RK3576-PC product compilation method

3.1.1. The overall compilation

3.1.1.1. HDMI Firmware Compilation

./FFTools/make.sh -d rk3576-firefly-roc-rk3576-pc -j8 -l rk3576_firefly_roc_rk3576_pc-userdebug
./FFTools/mkupdate/mkupdate.sh -l rk3576_firefly_roc_rk3576_pc-userdebug

3.1.1.2. 10.1‘ MIPI DSI0 Firmware Compilation:

./FFTools/make.sh -d rk3576-firefly-roc-rk3576-pc-mipi101-M101014-BE45-A1 -j8 -l rk3576_firefly_roc_rk3576_pc_mipi-userdebug
./FFTools/mkupdate/mkupdate.sh -l rk3576_firefly_roc_rk3576_pc_mipi-userdebug

3.1.2. Step by step to compile

  • Compile the kernel:

cd ~/proj/RK3576_Android14.0/kernel-6.10
export PATH=../prebuilts/clang/host/linux-x86/clang-r487747c/bin:$PATH
alias msk='make CROSS_COMPILE=aarch64-linux-gnu- LLVM=1 LLVM_IAS=1'
msk ARCH=arm64 firefly_defconfig android-14.config rk3576.config
msk ARCH=arm64 BOOT_IMG=../rockdev/Image-rk3576_firefly_roc_rk3576_pc/boot.img rk3576-firefly-roc-rk3576-pc.img -j8
  • Compile uboot:

cd ~/proj/RK3588_Android14.0/u-boot/
./make.sh rk3576
  • Compile Android:

cd ~/proj/RK3588_Android14.0/
source build/envsetup.sh
lunch rk3576_firefly_roc_rk3576_pc-userdebug
make installclean
make -j8
./mkimage.sh

3.1.3. Packaged into unified firmware update.img

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

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

After packaging, it will be in rockdev/Image-rk3576_firefly_roc_rk3576_pc/ Generate unified firmware under the directory: (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 up date.img and store it in rockdev \ Image directory.

3.2. Some Introduction about Compiling

3.2.1. Android14.0 can’t be upgraded directly kernel.img and resource.img

kernel.img and resource.img for Android14.0 are included in boot.img, After compiling the kernel, you need to run the ./mkimage.sh command in the android root directory to repackage boot.img, and then upgrade boot.img of the rockdev/Image-rk3576_firefly_roc_rk3576_pc/ directory.

3.2.2. Compiling kernel generation separately boot.img

Principle of compilation: in the kernel directory, the generated kernel.img And resource.img Replace with old boot.img, so you need to use BOOT_IMG=XXX parameter specification boot.img when compiling. The command is as follows:

cd ~/proj/RK3576_Android14.0/kernel-6.10
export PATH=../prebuilts/clang/host/linux-x86/clang-r487747c/bin:$PATH
alias msk='make CROSS_COMPILE=aarch64-linux-gnu- LLVM=1 LLVM_IAS=1'
msk ARCH=arm64 firefly_defconfig android-14.config rk3576.config
msk ARCH=arm64 BOOT_IMG=../rockdev/Image-rk3576_firefly_roc_rk3576_pc/boot.img rk3576-firefly-roc-rk3576-pc.img -j8

After compiling, boot.img in the kernel directory can be directly upgrade.

3.3. Partition image

When compiling, executing ./mkimage.sh will repackage boot.img and super.img, and copy other related image files to the directory rockdev/Image-rk3576_firefly_roc_rk3576_pc/. The following lists the image files used by general firmware:

Image Instruction
boot.img including ramdis、kernel、dtb
dtbo.img Device Tree Overlays
MiniLoaderAll.bin including first level loader
misc.img including recovery-wipe boot symbol information, after flashing it will enter recovery
parameter.txt including partition information
recovery.img including recovery-ramdis、kernel、dtb
super.img including the contents of odm、vendor、system partitions
uboot.img including uboot image
vbmeta.img including avb verification information, used for AVB verification
update.img including the above img files to be flashed, can be used for the tool to directly flash the whole image package

For details about how to upgrade a partition image file, see Upgrade the firmware via USB cable.

3.4. OTA Compilation

Refer to the OTA Compilation section

3.5. FAQs

3.5.1. git clone remote bundle repository failed

Q: Error occurred in git clone remote bundle repository while updating SDK:

$ git clone https://gitlab.com/T-Firefly/rk3588-Android14.0-bundle.git .bundle
Cloning into '.bundle'...
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (18/18), done.
error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: unpack-objects failed

A: The buffer size is insufficient and needs to be enlarged:

git config --global https.postBuffer 1048576000