Compilation Instructions
The SDK can be compiled through the set-up Docker image environment. Refer to the documentation in this section for details.
1 Compiling the SDK in the Docker Image Environment
1.1 SDK Automatic Compilation Command
Switch to the SDK root directory to be compiled inside Docker. The default fully-automatic compilation is Buildroot. You can specify a 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.sh1.2 Configuring Kernel Compilation Options
After automatic compilation starts, you need to configure the kernel compilation options to match the development board. The development board uses the RK3568 chip paired with DDR4, so you need to select compilation option 5. You can also run ./build.sh lunch before automatic compilation to make the selection 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]: 5Note: If a user ID not found error occurs, create that user ID under the container's root user, then re-run RK_ROOTFS_SYSTEM=debian ./build.sh under the newly created user. The following takes creating 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.sh1.3 Copying Files
After compilation is complete, the compiled firmware and the complete upgrade package packaged as update.img will be placed in the output/firmware directory. You can copy the files from this directory to the host machine. Since the files in this directory are symbolic link files, you need to copy them in symbolic-link mode.
#从 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