3. Compile Source

Step 1, unzip the source

tar xvf rk356x_linux5.10_source-20230905.tar.bz2
cd rk356x_linux5.10_source\
sudo tar xvf debian.tar.bz2

Step 2, set the compile board

./build.sh -h            //view the build command
./build.sh device/rockchip/rk356x/BoardConfig-rk3566-evb2-lp4x-v10.mk

or use the command

./build.sh lunch

print 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/Compile_all.png

User can also use the single-step to 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 complied kernel as follow

cd kernel
make ARCH=arm64 menuconfig

The reconfig kernel file is located in kernel\, and the kernel’s 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

Step 4, Compile debian11

cd debian/
sudo apt-get install binfmt-support qemu-user-static live-build
sudo dpkg -i ubuntu-build-service/packages/*
sudo apt-get install -f
RELEASE=bullseye TARGET=desktop ARCH=arm64 ./mk-base-debian.sh
VERSION=debug ARCH=arm64 ./mk-rootfs-bullseye.sh
./mk-image.sh

After compile, will get linaro-rootfs.img in the directory rrk356x_linux5.10_source\debian

Compile_debian11

Execute the command to clean the build after compilation.

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