Timeline
Timeline
2025-12-26
init
This article introduces the process of compiling the Topeet RK3568 Linux 5.10 kernel and U-Boot using aarch64-linux-gnu-gcc 15.1.0 in a WSL Archlinux environment. It details the source code modification method to resolve stack pointer errors when configuring clangd, lists various U-Boot defconfig options and their generation results, and notes that the compilation of the root filesystem and recovery will be improved in the future.
Environment
OS
Using Archlinux on WSL
compiler
ARM has currently released a total of 8 architectures: ARMv1, ARMv2, ARMv3, ARMv4, ARMv5, ARMv6, ARMv7, ARMv8.
Can be used for Cortex-A5x processorsaarch64-linux-gnu-gcc -march=armv8-acommand to compile code, the ARM GNU compiler can be downloaded via the link below
The version of aarch64-linux-gnu-gcc downloaded via pacman on Archlinux is 15.1.0

source code
The source code is provided by topeet:
Compile the kernel
Compilation
Using the aarch64-linux-gnu-gcc version 15.1.0 compiler
1 | sudo pacman -Sy bc |
Viewing kernel source code with clangd
Generate compile_command.json
1 | ./scripts/clang-tools/gen_compile_commands.py |
When using clangd as a language server, CompileFlags need to be added because clangd does not recognize some GCC compilation options:
1 | CompileFlags: |
sp error
clangd error:
1 | clang [asm_invalid_global_var_reg]: Register 'sp' unsuitable for global register variables on this target |
Bind the variable current_stack_pointer to the sp register (i.e., the current stack pointer) to directly read the top address of the stack. This syntax is legal when compiling the Linux kernel with GCC (especially under the ARM64 architecture), but Clang has stricter restrictions on this. Therefore, we modifyarch/arm64/include/asm/stack_pointer.hThe source code is as follows, for__clang__Use an inline assembly function to return the value of sp
1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Compile U-Boot
The defconfig for RK3568 is as follows
| defconfig | Support kernel dtb | Description |
|---|---|---|
| rk3568_defconfig | Y | Generic version |
| rk3568-dfu.config | Y | Support dfu |
| rk3568-nand.config | Y | Support MLC/TLC/eMMC |
| rk3568-spl-spi-nand_defconfig | Y | SPI-nand dedicated SPL |
| rk3568-aarch32.config | Y | Support aarch32 mode |
| rk3568-usbplug.config | Y | Support usbplug mode |
1 | make rk3568_defconfig |
Generate:
u-boot(ELF)u-boot.bin(Raw binary)spl/u-boot-spl.bin(If SPL is enabled)tpl/u-boot-tpl.bin(If TPL is enabled)u-boot.dtb(Embedded external device tree)
1 | tools/mkimage -n rk3568 -T rksd -d tpl/u-boot-tpl.bin idbloader.img |
The generated loader may have some issues, TODO for further research
Compile the root file system
1 | make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- rockchip_rk3568_defconfig |
Compile recovery
TODO
Flash
TODO
