02 Compilation Instructions
The SDK can be compiled using the built Docker image environment. Please refer to this document for details.
1 Compile SDK in Docker image environment
1.1 SDK automatic compilation command
Switch to the SDK root directory that needs to be compiled in Docker. The default for fully automatic compilation is Buildroot. You can specify different rootfs by setting the environment variable RK_ROOTFS_SYSTEM. Currently, three systems can be set: 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.sh
1.2 Configuring kernel compilation options
After the automatic compilation starts, you will need to configure the kernel compilation options that are compatible with the development board. The development board uses the RK3568 chip with DDR4, so you need to select the corresponding compilation item 5. You can also run ./build.sh lunch before automatic compilation to select it in advance.
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]: 5
Note: If an error message appears saying that the user ID cannot be found** , create the user ID under the root user of the container. After the creation is complete, re-execute RK_ROOTFS_SYSTEM=debian ./build.sh under the created user. The following example uses the creation of a user with user ID 1001 as an example.
#新建组,添加用户并设置用户权限
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.sh
1.3 Copying Files
After the compilation is completed, the compiled firmware and the complete upgrade package packaged as update.img will be placed in the output/firmware directory. The files in this directory can be copied to the host machine, but since the files in this directory are soft link files, all need to be copied in the form of soft 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/directory
1.4 Other common instructions
#清理所有旧编译文件内容
sudo ./build.sh cleanall