Skip to main content

Linux Development Environment Setup

1 Server Development Environment Setup

1.1 Prepare Development Environment

We recommend using Ubuntu 22.04 or higher for compilation. Other Linux versions may require corresponding adjustments to software packages. In addition to system requirements, there are other hardware and software requirements.

Hardware Requirements: 64-bit system, disk space greater than 40GB. If you perform multiple builds, you will need more disk space.

Software Requirements: Ubuntu 22.04 or higher system.

1.2 Install Libraries and Toolsets

When using the command line for device development, you can install the libraries and tools required for compiling the SDK through the following steps.

Use the following apt-get command to install the libraries and tools required for subsequent operations:

Notes:

The installation command applies to Ubuntu 22.04. For other versions, please use the corresponding installation command based on the package names. If compilation errors occur, you can install the corresponding software packages based on the error messages. Among them:

  • Python requires Python 3.6 or higher. Python 3.6 is used here as an example.
  • Make requires Make 4.0 or higher. Make 4.2 is used here as an example.
  • LZ4 requires LZ4 1.7.3 or higher.
  • Compiling Yocto requires VPN network. Git should not have CVE-2022-39253 security patch.

1.2.1 Check and Upgrade Host Python Version

Methods to check and upgrade the host Python version are as follows:

  • Check host Python version

If Python >= 3.6 requirement is not met, you can upgrade as follows:

  • Upgrade to Python 3.6.15 new version

1.2.2 Check and Upgrade Host Make Version

Methods to check and upgrade the host Make version are as follows:

  • Check host Make version

  • Upgrade to Make 4.2 new version

1.2.3 Check and Upgrade Host LZ4 Version

Methods to check and upgrade the host LZ4 version are as follows:

  • Check host LZ4 version

  • Upgrade to LZ4 new version

1.2.4 Check and Upgrade Host Git Version

  • Check host Git version

  • Upgrade to Git new version

2. Docker Compilation Environment Setup

2.1 System Environment Requirements

  • Docker version requirement: 10.10 or higher
  • Docker Compose: Docker Compose V2 is recommended
  • Container resource allocation: Ensure sufficient system resources (CPU, memory) are allocated for Docker

Note: Ensure your device has Docker installed

Operating SystemMinimum Memory RequirementRecommended Memory Configuration
Linux (Non-graphical environment)16GB32GB or higher

2.2 Build Dockerfile Image in SDK Root Directory

docker/Dockerfile << EOF
# Use ubuntu base
FROM ubuntu:22.04

# Prevent dpkg interactive dialogues
ENV DEBIAN_FRONTEND=noninteractive

# Install required packages
RUN apt-get update && apt-get install -y \
bc \
binfmt-support \
bison \
build-essential \
cpio \
debootstrap \
debhelper \
device-tree-compiler \
dosfstools \
fakeroot \
fdisk \
flex \
gcc-aarch64-linux-gnu \
git-lfs \
kmod \
libssl-dev \
parted \
python-is-python3 \
python2 \
python3 \
qemu-efi \
qemu-system-arm \
qemu-user-static \
rsync \
u-boot-tools \
udev \
uuid-runtime \
xz-utils \
libelf-dev \
dwarves \
&& rm -rf /var/lib/apt/lists/*

# Set the working directory
WORKDIR /opt
EOF
]]>

2.3 Build Compilation Script

docker_build.sh << EOF
#!/bin/bash -e

#Configure operational parameters
DOCKER="docker run --privileged --network=host --rm -it \
--user $(id -u):$(id -g) \
-v \"$(pwd)\":/opt ubuntu-rockchip-build /bin/bash"

echo "Docker run build.sh!!!!"
docker build -t ubuntu-rockchip-build docker
eval "${DOCKER}" ./build.sh "$1" "$2" "$3"
EOF
]]>

2.4 Docker Compilation Method

Same as Rockchip normal compilation method, for example: