3. Compile Source

Step 1, unzip the source

tar xvf rk356x_linux5.10_source-20230905.tar.bz2   // unzip source
cd rk356x_linux5.10_source\
sudo tar xvf debian.tar.bz2
./build.sh -h                                 // view the build command

Step 2, configure

./build.sh lunch                              // configure

Print out as follow. Select 2

processing option: lunch
You're building on Linux
Lunch menu...pick a combo:
0. default BoardConfig.mk
1. BoardConfig-rk3566-evb2-lp4x-v10-32bit.mk
2. BoardConfig-rk3566-evb2-lp4x-v10.mk
3. BoardConfig-rk3568-evb1-ddr4-v10-32bit.mk
4. BoardConfig-rk3568-evb1-ddr4-v10-spi-nor-64M.mk
5. BoardConfig-rk3568-evb1-ddr4-v10.mk
6. BoardConfig-rk3568-nvr-spi-nand.mk
7. BoardConfig-rk3568-nvr.mk
8. BoardConfig-rk3568-uvc-evb1-ddr4-v10.mk
9. BoardConfig.mk

Which would you like? [0]: 2  (BoardConfig-rk3566-evb2-lp4x-v10.mk)

switching to board: /home/EM1126/rk3566_linux_source/device/rockchip/rk356x/BoardConfig-rk3566-evb2-lp4x-v10.mk

Step 3, compile uboot, kernel, recovery, buildroot

./build.sh   //Compile all in one step

After compile the firmwares are generated in rk356x_linux5.10_source\rockdev

_images/Buildroot_Compile.png

User can also single-step compile.

./build.sh uboot    //compile uboot
./build.sh kernel   //compile kernel

It will pop out a window about config the IO Power Domain Map when first time compile kernel, you need to configure according to below form.

RK3566-IO-Power-Domain-Map

kernel.img, resource.img and boot.img are generated in directory rk3566_linux_source\kernel.

If only configure the kernel, please complie as follow

cd kernel
make ARCH=arm64 menuconfig

The reconfig kernel file is located in kernel\. The kernel default configuration file is kernel\arch\arm64\configs\rockchip_linux_defconfig. So It needs to copy the update from kernel\.config to kernel\arch\arm64\configs\rockchip_linux_defconfig after reconfig.

source envsetup.sh
cd buildroot
make recovery-rebuild
cd ..
./build.sh recovery    //compile recovery
./build.sh rootfs      //compile buildroot

Clean the build after compilation

sudo ./build.sh cleanall     //Clean the build