Development environment setup is divided into direct server setup and Docker compilation environment setup. Docker compilation is recommended!1 Server Development Environment Setup1.1 Prepare Development EnvironmentWe 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. 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: | 代码块 |
|---|
| sudo apt-get update && sudo apt-get install git ssh make gcc libssl-dev \
liblz4-tool expect expect-dev g++ patchelf chrpath gawk texinfo chrpath \
diffstat binfmt-support qemu-user-static live-build bison flex fakeroot \
cmake gcc-multilib g++-multilib unzip device-tree-compiler ncurses-dev \
libgucharmap-2-90-dev bzip2 expat gpgv2 cpp-aarch64-linux-gnu libgmp-dev \
libmpc-dev bc python-is-python3 python2
|
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 VersionMethods to check and upgrade the host Python version are as follows: - Check host Python version
| 代码块 |
|---|
| python3 --version
Python 3.10.6
|
If Python >= 3.6 requirement is not met, you can upgrade as follows: - Upgrade to Python 3.6.15 new version
| 代码块 |
|---|
| PYTHON3_VER=3.6.15
echo "wget https://www.python.org/ftp/python/${PYTHON3_VER}/Python-${PYTHON3_VER}.tgz"
echo "tar xf Python-${PYTHON3_VER}.tgz"
echo "cd Python-${PYTHON3_VER}"
echo "sudo apt-get install libsqlite3-dev"
echo "./configure --enable-optimizations"
echo "sudo make install -j8"
|
1.2.2 Check and Upgrade Host Make VersionMethods to check and upgrade the host Make version are as follows: | 代码块 |
|---|
| $ make -v
GNU Make 4.2
Built for x86_64-pc-linux-gnu
|
- Upgrade to Make 4.2 new version
| 代码块 |
|---|
| $ sudo apt update && sudo apt install -y autoconf autopoint
git clone https://gitee.com/mirrors/make.git
cd make
git checkout 4.2
git am $BUILDROOT_DIR/package/make/*.patch
autoreconf -f -i
./configure
make make -j8
sudo install -m 0755 make /usr/bin/make
|
1.2.3 Check and Upgrade Host LZ4 VersionMethods to check and upgrade the host LZ4 version are as follows: | 代码块 |
|---|
| $ lz4 -v
*** LZ4 command line interface 64-bits v1.9.3, by Yann Collet ***
|
- Upgrade to LZ4 new version
| 代码块 |
|---|
| git clone https://gitee.com/mirrors/LZ4_old1.git
cd LZ4_old1
make
sudo make install
sudo install -m 0755 lz4 /usr/bin/lz4
|
1.2.4 Check and Upgrade Host Git Version| 代码块 |
|---|
| $ git -v
git version 2.38.0
|
- Upgrade to Git new version
| 代码块 |
|---|
| $ sudo apt update && sudo apt install -y libcurl4-gnutls-dev
git clone https://gitee.com/mirrors/git.git --depth 1 -b v2.38.0
cd git
make git -j8
make install
sudo install -m 0755 git /usr/bin/git
|
2. Docker Compilation Environment Setup2.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 System | Minimum Memory Requirement | Recommended Memory Configuration | Linux (Non-graphical environment) | 16GB | 32GB or higher |
2.2 Build Dockerfile Image in SDK Root Directory| 代码块 |
|---|
| mkdir -p docker
cat > 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| 代码块 |
|---|
| cat > 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 MethodSame as Rockchip normal compilation method, for example: | 代码块 |
|---|
| #Normal compilation method
./build.sh kernel
#Docker compilation method
./docker_build.sh kernel
|
|