Overview
Embedded systems development is a core area within intelligent technology. RK3568 and RK3588 boards and system-on-modules offer high performance for many application scenarios. This article describes how to build a development environment based on Linux by loading the board's Ubuntu filesystem into Docker on the host machine, enabling a consistent build environment for ARM targets.
Problem: Why environment setup matters
For embedded Linux development, the build environment is the foundation. Traditional approaches often require developers to:
- Search for matching toolchain versions
- Manually configure complex build options
- Iteratively adapt environments across attempts
- Spend days assembling the base environment
- Deal with differences between build and target runtime environments
Solution: Standardized Docker-based build environment
Common ways to ensure consistency include chrooting an Ubuntu system from the board on the host or building directly on the board. This procedure focuses on loading the Ubuntu filesystem intended for the board into a Docker container on the host machine to construct the compile system.
Steps
- Use the vendor SDK to build the RK3588 Ubuntu 22.04 filesystem and compress the binary filesystem into binary.tar.bz2.
- On a host machine with Docker installed, load the local image using the appropriate docker load or import commands.
- After loading, verify the image exists on the host with docker image ls.
- Run the image and mount a host source directory into the container, for example mounting /home/kcy15/ubuntu_dockerimage/code_src on the host to /home/linaro/code_src inside the container.
- Install the build dependencies inside the Docker container.
- If installing build-essential triggers an error about missing directories or files, create the required directory directly and retry the installation.
- Continue installing required packages. After installation completes, verify the toolchain with gcc --version or similar checks.
- To save the configured environment as an image, do not exit the container. Open another terminal and commit or export the running container to a new image. For example, use the current container ID such as 5edec48deb29 when running docker commit or docker export.
- Perform a test build inside the container to validate the environment.
- Reuse the saved image for other hosts or team members.
Image distribution and management
For convenience, save the Docker image locally or push it to a Docker registry so other hosts can pull it directly. To transfer a saved image file to another server, copy the saved tar file and load it locally with docker load. Use docker rmi to remove local images when cleaning up the host.
ALLPCB
