02 Compilation Instructions
The SDK can be compiled through the set-up Docker image environment. For details, please refer to this part of the document content.
1 Docker Image Environment Compilation SDK
1.1 SDK Auto Compilation Command
Switch to the SDK root directory that needs to be compiled in Docker. The fully automatic compilation default is Buildroot. You can specify different rootfs by setting the environment variable RK_ROOTFS_SYSTEM. Currently, three systems can be set: Buildroot, Debian, Yocto.
# Enter the specified container that has been created
sudo docker exec -it -w $cwd_contents $containerID /bin/bash
#$cwd_contents: SDK root directory in the container
#$containerID: Container ID
# Query compilation help
sudo ./build.sh -h
# Enable multi-threading (optional)
export MAKEFLAGS="-j4" #4: number of threads
# Specify Debian to enable automatic compilation
sudo RK_ROOTFS_SYSTEM=debian ./build.sh1.2 Configure Kernel Compilation Options
After the automatic compilation starts, you will need to configure the kernel compilation options adapted to 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 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 the user ID under the root user of the container. After creation, re-execute RK_ROOTFS_SYSTEM=debian ./build.sh under the created user. The following takes creating a user with User ID 1001 as an example:
# Create a new group, add a user and set user permissions
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
# Query the username with User ID 1001
id 1001
# Switch user
su - newsperson
# Execute automatic compilation again
sudo RK_ROOTFS_SYSTEM=debian ./build.sh1.3 Copy 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 in this directory to the host machine. However, since the files in this directory are symbolic link files, you need to copy them using the symbolic link method.
# Copy files from Docker container to host machine
sudo docker cp --follow-link $CONTAINER:$Docker_PATH $Host_PATH
#$CONTAINER: Container name or ID
#$Docker_PATH: Path of the file to be copied in the Docker container
#$Host_PATH: Path to accept the file in the host machine
# Example
sudo docker cp --follow-link 0370ec8f1fda:/home/hjf/SDK/output/firmware/update.img /home/ubuntu/directory1.4 Other Common Commands
# Clean all old compilation file contents
sudo ./build.sh cleanall