Compilation Notes
The SDK can be compiled inside the Docker image environment you set up. Refer to the relevant parts of this documentation for details.
1 Compiling the SDK in the Docker Image Environment
1.1 SDK automatic build command
Switch to the SDK root directory you want to compile inside Docker. The fully automatic build defaults to Buildroot; you can select a different rootfs by setting the environment variable RK_ROOTFS_SYSTEM. Three systems are currently supported: Buildroot, Debian, and Yocto.
#进入已经创建的指定容器中
sudo docker exec -it -w $cwd_contents $containerID /bin/bash
#$cwd_contents:容器内 SDK 根目录
#$containerID:容器ID
#查询编译帮助
sudo ./build.sh -h
#开启多线程(可选)
export MAKEFLAGS="-j4" #4:线程数
#指定 Debain 开启自动编译
sudo RK_ROOTFS_SYSTEM=debian ./build.sh1.2 Configuring the kernel build option
After the automatic build starts, you need to configure the kernel build option that matches the development board. The board uses the RK3568 chip with DDR4, so select option 5. You can also run ./build.sh lunch before the automatic build to make the selection ahead of time.
1. rockchip_defconfig
2. rockchip_rk3566_evb2_lp4x_v10_32bit_defconfig
3. rockchip_rk3566_evb2_lp4x_v10_defconfig
4. rockchip_rk3568_evb1_ddr4_v10_32bit_defconfig
5. rockchip_rk3568_evb1_ddr4_v10_defconfig
6. rockchip_rk3568_evb8_lp4_v10_32bit_defconfig
7. rockchip_rk3568_evb8_lp4_v10_defconfig
8. rockchip_rk3568_pcie_ep_lp4x_v10_defconfig
Which would you like? [1]: 5Note: If you get a user ID not found error, create that user ID under the container's root user, then re-run RK_ROOTFS_SYSTEM=debian ./build.sh as the newly created user. The following example creates a user with ID 1001:
#新建组,添加用户并设置用户权限
groupadd newsgroup
useradd -M -u 1001 -g newsgroup newsperson
usermod -aG sudo newsperson
mkdir -p /home/newsperson
chown newsperson:newsgroup /home/newsperson
chmod 700 /home/newsperson
usermod -s /bin/bash newsperson
#查询用户ID为 1001 的用户名
id 1001
#切换用户
su - newsperson
#再次执行自动编译
sudo RK_ROOTFS_SYSTEM=debian ./build.sh1.3 Copying files
After the build completes, the compiled firmware and the complete upgrade package packed as update.img are placed in the output/firmware directory. You can copy the files from this directory to the host machine. Because the files in this directory are symbolic links, you must copy them following the links.
#从 Docker 容器中拷贝文件至宿主机中
sudo docker cp --follow-link $CONTAINER:$Docker_PATH $Host_PATH
#$CONTAINER:容器的名称或 ID
#$Docker_PATH:Docker 容器中需要拷贝的文件路径
#$Host_PATH:宿主机中接受文件的路径
#示例
sudo docker cp --follow-link 0370ec8f1fda:/home/hjf/SDK/output/firmware/update.img /home/ubuntu/directory1.4 Other common commands
#清理所有旧编译文件内容
sudo ./build.sh cleanall