编译手册
编译环境要求:
编译主机需在 ubuntu 系统中进行,笔者主机系统为 ubuntu 22.04,推荐使用与笔者相同版本的 ubuntu,避免因为版本不同导致一些工具出现兼容问题。
安装库和工具集:
sudo apt-get update && sudo apt-get install git ssh make gcc libssl-dev \
liblz4-tool expect expect-dev g++ patchelf chrpath gawk texinfo chrpath \
diffstat binfmt-support qemu-user-static live-build bison flex fakeroot \
cmake gcc-multilib g++-multilib unzip device-tree-compiler ncurses-dev \
libgucharmap-2-90-dev bzip2 expat gpgv2 cpp-aarch64-linux-gnu libgmp-dev \
libmpc-dev bc python-is-python3 python2 gettext libc6-dev libncurses-dev rsync
(python 版本要求在 python3.6 及以上版本)
(make 版本要求在 make4.0 及以上版本)
(lz4 版本要求在 lz4 1.7.3 及以上版本)
下载源码包
下载 RV1126b 源码包。
创建编译目录:
mkdir -p ~/my-work/RV1126b/
把源码放到刚创建的目录中,将分卷解压的源码进行合并,随后在解压:
cat myzr-rv1126b.tar.gz.part-* > myzr-rv1126b.tar.gz
tar xvf myzr-rv1126b.tgz -C ~/my-work/RV1126b/
Linux 系统镜像编译及生成
查看具体编译命令:
./build.sh help 或 ./build.sh -h
################################################
./build.sh -h
############### Rockchip Linux SDK ###############
Manifest: rv1126b_linux6.1_release_v1.0.0_20250620.xml
Log colors: message notice warning error fatal
Usage: build.sh [OPTIONS]
Available options:
chip[:<chip>[:<config>]] choose chip
defconfig[:<config>] choose defconfig
*_defconfig switch to specified defconfig
available defconfigs:
myzr_rv1126b_evb1_defconfig
rockchip_defconfig
rockchip_rv1126b_evb1_v10_defconfig
rockchip_rv1126b_evb4_v10_defconfig
rockchip_rv1126b_ipc_32_evb1_v10_defconfig
rockchip_rv1126b_ipc_64_evb1_v10_defconfig
rockchip_rv1126b_robot_defconfig
rockchip_rv1126bp_evb1_v10_defconfig
rockchip_rv1126bp_ipc_32_evb1_v10_defconfig
rockchip_rv1126bp_ipc_64_evb1_v10_defconfig
rockchip_rv1126bp_robot_defconfig
olddefconfig resolve any unresolved symbols in .config
savedefconfig save current config to defconfig
menuconfig interactive curses-based configurator
config modify SDK defconfig
print-parts print partitions
list-parts alias of print-parts
edit-parts edit raw partitions
misc pack misc image
kernel-6.1[:dry-run] build kernel 6.1
kernel[:dry-run] build kernel
recovery-kernel[:dry-run] build kernel for recovery
kernel-modules[:<dst dir>:dry-run] build kernel modules
modules[:<dst dir>:dry-run] alias of kernel-modules
linux-headers[:<arch>:dry-run] build linux-headers
kernel-config[:dry-run] modify kernel defconfig
kconfig[:dry-run] alias of kernel-config
kernel-make[:<arg1>:<arg2>] run kernel make
kmake[:<arg1>:<arg2>] alias of kernel-make
wifibt[:<dst dir>[:<chip>]] build Wifi/BT
amp build and pack amp system
buildroot-config[:<config>] modify buildroot defconfig
bconfig[:<config>] alias of buildroot-config
buildroot-make[:<arg1>:<arg2>] run buildroot make
bmake[:<arg1>:<arg2>] alias of buildroot-make
buildroot-sdk build the buildroot SDK tarball
bsdk alias of buildroot-sdk
rootfs[:<rootfs type>] build default rootfs
buildroot build buildroot rootfs
yocto build yocto rootfs
debian build debian rootfs
recovery build recovery
security-createkeys create keys for security
security-misc build misc with system encryption key
security-ramboot[:system_image] build security ramboot
security-system[:system_image] build security system
security-remote-sign build remote signed image
loader[:dry-run] build loader (u-boot)
uboot[:dry-run] build u-boot
u-boot[:dry-run] alias of uboot
extra-parts pack extra partition images
firmware pack and check firmwares
edit-package-file edit package-file
edit-ota-package-file edit package-file for OTA
updateimg build update image
ota-updateimg build update image for OTA
all build images
release[:<subdir>[:<name>]] release images and build info
all-release[:<subdir>[:<name>]] build and release images
shell setup a shell for developing
buildroot-shell setup a shell for buildroot developing
bshell alias of buildroot-shell
yocto-shell setup a shell for yocto developing
yshell alias of yocto-shell
cleanall cleanup all
clean-config cleanup config
clean-recovery cleanup recovery
clean-rootfs cleanup rootfs
clean-security cleanup security
clean-misc cleanup misc
clean-extra-parts cleanup extra-parts
clean-kernel cleanup kernel
clean-updateimg cleanup updateimg
clean-firmware cleanup firmware
clean-loader cleanup loader
clean-amp cleanup amp
post-rootfs <rootfs dir> trigger post-rootfs hook scripts
help display this information
Default option is 'all'.
选择对应的板级配置,选择 2 号配置 – myzr_rv1126b_evb1_defconfig:
./build.sh lunch
################################################
./build.sh lunch
############### Rockchip Linux SDK ###############
Manifest: rv1126b_linux6.1_release_v1.0.0_20250620.xml
Log colors: message notice warning error fatal
Log saved at /home/wanglk/my-work/rockchip/RV1126B_Linux6.1_SDK/rv1126b_linux6.1_release_v1.0.0_20250620_sync20250825/output/sessions/2025-10-22_05-44-49
Pick a defconfig:
1. rockchip_defconfig
2. myzr_rv1126b_evb1_defconfig
3. rockchip_rv1126b_evb1_v10_defconfig
4. rockchip_rv1126b_evb4_v10_defconfig
5. rockchip_rv1126b_ipc_32_evb1_v10_defconfig
6. rockchip_rv1126b_ipc_64_evb1_v10_defconfig
7. rockchip_rv1126b_robot_defconfig
8. rockchip_rv1126bp_evb1_v10_defconfig
9. rockchip_rv1126bp_ipc_32_evb1_v10_defconfig
10. rockchip_rv1126bp_ipc_64_evb1_v10_defconfig
11. rockchip_rv1126bp_robot_defconfig
进行全局编译并进行固件打包:
./build.sh
只进行全局编译,不执行固件打包操作
./build.sh all
只进行固件打包
./build.sh firmware
清理 SDK 目录:
./build.sh cleanall
各模块单独编译
单独编译 U-Boot:
./build.sh uboot
单独编译 Kernel:
./build.sh kernel
单独编译 recovery:
./build.sh recovery
单独编译 buildroot:
./build.sh rootfs
各个模块单独编译完成后,会自动打包固件,无需再次执行固件打包操作。