The kernel version from Rockchip can be downloaded from GitHub at the link: https://github.com/rockchip-linux/kernel. There is also a complete SDK development environment available directly from the manufacturer, including uboot, buildroot, kernel, etc. Additionally, there are some open-source projects from openEuler, which are quite varied and chaotic. For version 5.10, there are multiple sub-versions, and the differences are significant. The two versions I have on hand are 5.10.160 (provided by some board manufacturers) and 5.10.226 (downloaded from GitHub).
I compiled the boot.img kernel burn file directly in the directory of the 5.10.226 kernel version downloaded from GitHub, without using the SDK tools, but encountered the following error:
bull-man@ubuntu:~/RockChip/kernel-develop-5.10$ ./build.sh ## No change to .config# CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh CHK include/generated/compile.hfatal: not a git repository (or any of the parent directories): .git LZ4 arch/arm64/boot/Image.lz4Incorrect parametersUsage : lz4 [arg] [input] [output]
input : a filename with no FILE, or when FILE is - or stdin, read standard inputArguments : -1 : Fast compression (default) -9 : High compression -d : decompression (default for .lz4 extension) -z : force compression -f : overwrite output without prompting -h/-H : display help/long help and exitarch/arm64/boot/Makefile:31: recipe for target 'arch/arm64/boot/Image.lz4' failedmake[2]: *** [arch/arm64/boot/Image.lz4] Error 1make[2]: *** Deleting file 'arch/arm64/boot/Image.lz4'arch/arm64/Makefile:170: recipe for target 'Image.lz4' failedmake[1]: *** [Image.lz4] Error 2arch/arm64/Makefile:214: recipe for target 'rk3588-evb1-v10.img' failedmake: *** [rk3588-evb1-v10.img] Error 2
This indicates that the parameters for the lz4 compression command are incorrect. The build.sh script I wrote is as follows:
export CROSS_COMPILE=/opt/aarch64-linux-gnu-12.3.0/bin/aarch64-none-linux-gnu-make OK3588-C-linux_defconfig ARCH=arm64make ARCH=arm64 rk3588-evb1-v10.img Image.gz
The compilation targets are rk3588-evb1-v10.img and Image.gz, and ultimately, the Image, dtb, and logo files are merged into boot.img, which can be flashed to the kernel partition using RKDevTool software.
During the process of generating this boot.img, some kernel versions can succeed while others report errors, which is quite confusing. Below is the solution.
The rules for Image.lz4 are defined in the file kernel-develop-5.10/arch/arm64/boot/Makefile as follows:
OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
targets := Image Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo
$(obj)/Image: vmlinux FORCE $(call if_changed,objcopy)
$(obj)/Image.bz2: $(obj)/Image FORCE $(call if_changed,bzip2)
$(obj)/Image.gz: $(obj)/Image FORCE $(call if_changed,gzip)
$(obj)/Image.lz4: $(obj)/Image FORCE $(call if_changed,lz4)
In kernel-develop-5.10/scripts/Makefile.lib, the command execution scripts for lz4 and lz4c are defined. The parameters executed below should be incorrect:$(LZ4) -l -12
quiet_cmd_lz4 = LZ4 $@ cmd_lz4 = { cat $(real-prereqs) | \
$(LZ4) -l -12 --favor-decSpeed stdin stdout; \
$(size_append); } > $@
quiet_cmd_lz4c = LZ4C $@ cmd_lz4c = { cat $(real-prereqs) | \
$(LZ4) -12 --favor-decSpeed stdin stdout; \
$(size_append); } > $@
I am using an Ubuntu 18.04 virtual machine, and the lz4 information is as follows: version from May 20, 2021.
bull-man@ubuntu:~/RockChip/kernel-develop-5.10$ lz4 -h*** LZ4 command line interface 64-bits r128, by Yann Collet (May 20 2021) ***Usage : lz4 [arg] [input] [output]
input : a filename with no FILE, or when FILE is - or stdin, read standard inputArguments : -1 : Fast compression (default) -9 : High compression -d : decompression (default for .lz4 extension) -z : force compression -f : overwrite output without prompting -h/-H : display help/long help and exit
After comparing with other available kernel versions, I found that changing the lz4 execution parameters to the following resolves the issue:$(LZ4) -l -c1
quiet_cmd_lz4 = LZ4 $@ cmd_lz4 = { cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout; \
$(size_append); } > $@
After saving the modifications, recompiling resolved the issue, and there were no errors when executing lz4:LZ4 arch/arm64/boot/Image.lz4
bull-man@ubuntu:~/RockChip/kernel-develop-5.10$ ./build.sh ## No change to .config# CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh CHK include/generated/compile.hfatal: not a git repository (or any of the parent directories): .git LZ4 arch/arm64/boot/Image.lz4Warning : stdout won't be used ! Do you want multiple input files (-m) ? Image: resource.img (with rk3588-evb1-v10.dtb logo.bmp logo_kernel.bmp) is ready Image: boot.img (with Image resource.img) is ready Image: zboot.img (with Image.lz4 resource.img) is ready CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh CHK include/generated/compile.hfatal: not a git repository (or any of the parent directories): .git
In the root directory of kernel-develop-5.10, I found the boot.img file.