4. Compile Android14.0 firmware

4.1. Download Android14.0 SDK

SDK source code and bundle compression package are stored in the Google Drive.

4.1.1. Download Android SDK

  • The SDK can be obtained by email. Send the order number to sales@t-firefly.com and indicate the required SDK name firefly_rk3588_android14_git_20240822

  • After downloading, verify the MD5 code:

    $ md5sum /path/to/firefly_rk3588_android14_git_240822.7z.001
    $ md5sum /path/to/firefly_rk3588_android14_git_240822.7z.002
    $ md5sum /path/to/firefly_rk3588_android14_git_240822.7z.003
    $ md5sum /path/to/firefly_rk3588_android14_git_240822.7z.004
    $ md5sum /path/to/firefly_rk3588_android14_git_240822.7z.005
    $ md5sum /path/to/firefly_rk3588_android14_git_240822.7z.006
    $ md5sum /path/to/firefly_rk3588_android14_git_240822.7z.007
    $ md5sum /path/to/firefly_rk3588_android14_git_240822.7z.008
    $ md5sum /path/to/firefly_rk3588_android14_git_240822.7z.009
    $ md5sum /path/to/firefly_rk3588_android14_git_240822.7z.010
    $ md5sum /path/to/firefly_rk3588_android14_git_240822.7z.011
    
    c9cc4863a3ad3b48f3c74d1f061d0438  firefly_rk3588_android14_git_240822.7z.001
    e81083e1b9b435e4e666f7d08dcd1bd6  firefly_rk3588_android14_git_240822.7z.002
    49b7aace84ab01b9a014b410fa26f42f  firefly_rk3588_android14_git_240822.7z.003
    1632fc98d881d5f4a8ed953afc9c73b1  firefly_rk3588_android14_git_240822.7z.004
    f581633cefdef6103de584501612e5dd  firefly_rk3588_android14_git_240822.7z.005
    f0e591f54a8969755775642567dabb17  firefly_rk3588_android14_git_240822.7z.006
    ee3d00d688ac0ad2bb43f8fe73f354bd  firefly_rk3588_android14_git_240822.7z.007
    09dc458646cce9f53a792d68e0ece3ec  firefly_rk3588_android14_git_240822.7z.008
    add00c4da466d50782ea5dba279c72d1  firefly_rk3588_android14_git_240822.7z.009
    51438ba104f0a67fd4fa09b5fee0d301  firefly_rk3588_android14_git_240822.7z.010
    b733f1d13c070862b5af6ce71052c020  firefly_rk3588_android14_git_240822.7z.011
    
  • After confirming that it is correct, we can unzip:

    cd ~/proj/
    7z x ./firefly_rk3588_android14.0_git_20240822.7z.001 -oRK3588_Android14.0
    cd ./RK3588_Android14.0
    git reset --hard
    

    Attention: To avoid unnecessary errors, please do not unzip the SDK in shared folders, mounted folders or non-english directories.

4.2. iCore-3588JQ product compilation method

4.2.1. The overall compilation

4.2.1.1. HDMI Firmware Compilation

./FFTools/make.sh -d rk3588-firefly-aio-3588q -j8 -l rk3588_firefly_aio_3588q-userdebug
./FFTools/mkupdate/mkupdate.sh -l rk3588_firefly_aio_3588q-userdebug

4.2.1.2. 10.1‘ MIPI DSI0 Firmware Compilation:

./FFTools/make.sh -d rk3588-firefly-aio-3588q-mipi101-M101014-BE45-A1 -j8 -l rk3588_firefly_aio_3588q_mipi-userdebug
./FFTools/mkupdate/mkupdate.sh -l rk3588_firefly_aio_3588q_mipi-userdebug

4.2.1.3. NV156FHM-T06 edp Firmware compilation

./FFTools/make.sh -d rk3588-firefly-aio-3588q-edp-NV156FHM-T06 -j8 -l rk3588_firefly_aio_3588q_edp-userdebug
./FFTools/mkupdate/mkupdate.sh -l rk3588_firefly_aio_3588q_edp-userdebug

4.2.1.4. Dual Camera CAM-2MS2MF Compile

4.2.1.4.1. HDMI+CAM-2MS2MF
  • modify dts

--- a/kernel-6.1/arch/arm64/boot/dts/rockchip/rk3588-firefly-aio-3588q.dts
+++ b/kernel-6.1/arch/arm64/boot/dts/rockchip/rk3588-firefly-aio-3588q.dts
@@ -7,8 +7,8 @@
 #include "rk3588-firefly-aio-3588q.dtsi"
-#include "rk3588-firefly-aio-cam-8ms1m.dtsi"
-//#include "rk3588-firefly-aio-cam-2ms2mf.dtsi"
+//#include "rk3588-firefly-aio-cam-8ms1m.dtsi"
+#include "rk3588-firefly-aio-cam-2ms2mf.dtsi"
 #include "rk3588-firefly-demo.dtsi"
  • Compile

./FFTools/make.sh -d rk3588-firefly-aio-3588q -j8 -l rk3588_firefly_aio_3588q-userdebug
./FFTools/mkupdate/mkupdate.sh -l rk3588_firefly_aio_3588q-userdebug

4.2.1.5. HDMI TO MIPI_CSI(RK628D) Compile

  • modify dts

--- a/kernel-6.1/arch/arm64/boot/dts/rockchip/rk3588-firefly-aio-3588q.dts
+++ b/kernel-6.1/arch/arm64/boot/dts/rockchip/rk3588-firefly-aio-3588q.dts
@@ -7,9 +7,9 @@
 /dts-v1/;

 #include "rk3588-firefly-aio-3588q.dtsi"
-#include "rk3588-firefly-aio-cam-8ms1m.dtsi"
+//#include "rk3588-firefly-aio-cam-8ms1m.dtsi"
 //#include "rk3588-firefly-aio-cam-2ms2mf.dtsi"
-//#include "rk3588-firefly-aio-3588q-tf-hdmi-mipi-rk628.dtsi"
+#include "rk3588-firefly-aio-3588q-tf-hdmi-mipi-rk628.dtsi"
 #include "rk3588-firefly-demo.dtsi"
  • Compile

./FFTools/make.sh -d rk3588-firefly-aio-3588q -j8 -l rk3588_firefly_aio_3588q-userdebug
./FFTools/mkupdate/mkupdate.sh -l rk3588_firefly_aio_3588q-userdebug

4.2.2. Step by step to compile

  • Compile the kernel:

cd ~/path/to/sdk/kernel-6.1
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 pcie_wifi.config
msk ARCH=arm64   BOOT_IMG=../rockdev/Image-rk3588_firefly_aio_3588q/boot.img rk3588-firefly-aio-3588q.img -j8
  • Compile uboot:

cd ~/path/to/sdk/u-boot/
./make.sh rk3588
  • Compile Android:

cd ~/path/to/sdk/
source build/envsetup.sh
lunch rk3588_firefly_aio_3588q-userdebug
make installclean
make -j8
./mkimage.sh

4.2.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 rk3588_firefly_aio_3588q-userdebug

After packaging, it will be in rockdev/Image-rk3588_firefly_aio_3588q/ 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.

4.3. Some Introduction about Compiling

4.3.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-rk3588_firefly_aio_3588q/ directory.

4.3.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/RK3588_Android14.0/kernel-6.1
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-rk3588_firefly_aio_3588q/boot.img rk3588-firefly-aio-3588q.img -j8

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

4.4. 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-rk3588_firefly_aio_3588q/. 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.

4.5. OTA Compilation

Refer to the OTA Compilation section

4.6. FAQs

4.6.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