Skip to content
Home » System On Modules » ARM SoM: Linux Firmware Compilation & Flashing Guide

ARM SoM: Linux Firmware Compilation & Flashing Guide

When working with embedded systems, compiling and flashing Linux firmware for ARM SoM is a crucial step. This guide provides a comprehensive walkthrough, from setting up the environment and compiling the SDK to flashing the firmware onto the device.


1. Development Environment & Tools Preparation

1.1 Required Software Packages

Rockchip Linux SDK: linux-5.10-gen-rkr4

Development Host:

OS: Ubuntu 20.04 (recommended disk space ≥ 100GB)

Virtual Machine Tool: VMware

Remote Connection Tool: MobaXterm (for easier file transfer)


2. Setting Up SDK Compilation Environment

2.1 Install Required Libraries & Tools

Run the following command to install necessary dependencies:

sudo apt-get install git ssh make gcc libssl-dev liblz4-tool expect g++ patchelf chrpath gawk texinfo 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 time mtd-utils

2.2 Create Working Directory

mkdir ~/RK3588

Use MobaXterm to transfer the SDK to the ~/RK3588 directory and extract it:

cat linux-5.10-gen-rkr4.tar.gzaa* | tar xzvf -

2.3 Upgrade Necessary Packages

Check make Version (Requires ≥ 4.0):

make -v

If an upgrade is needed:

git clone https://github.com/mirror/make.git
cd make
git checkout 4.2
autoreconf -f -i
./configure
make -j8
sudo install -m 0755 make /usr/bin/make

Check lz4 Version (Requires ≥ 1.7.3):

lz4 -v

If an upgrade is needed:

git clone https://github.com/lz4/lz4.git
cd lz4
make
sudo make install
sudo install -m 0755 lz4 /usr/bin/lz4

Check & Upgrade git Version:

git clone https://github.com/mirror/make.git --depth 1 -b 4.2
cd make
git am $BUILDROOT_DIR/package/make/*.patch
autoreconf -f -i
./configure
make -j8
sudo install -m 0755 make /usr/local/bin/make

2.4 Configure git in the SDK Directory

cd ~/RK3588/linux-5.10-gen-rkr4
git config --global user.name "your name"
git config --global user.email "your email"

2.5 Install repo

mkdir ~/bin
export PATH=~/bin:$PATH
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o ~/bin/repo
chmod a+x ~/bin/repo

3. Compiling the SDK

For reference, check device/rockchip/common/README.md for compilation details.

3.1 View SDK Compilation Commands

make help

3.2 SDK Configuration

Run the following command to configure the build environment:

make lunch

or

./build.sh lunch

For additional configurations, use:

make menuconfig

3.3 Full Automatic Compilation

Navigate to the SDK directory and execute:

./build.sh all  # Compiles modules (u-Boot, Kernel, Rootfs, Recovery)
./mkfirmware.sh # Packages firmware

To generate an update.img upgrade package:

./build.sh  

All compiled files will be located in the out directory.

By default, the system uses Buildroot. You can specify other root filesystems:

export RK_ROOTFS_SYSTEM=debian
./build.sh

Supported options: buildroot, debian, yocto.

3.4 Module Compilation

To compile specific modules separately:

./build.sh uboot
./build.sh kernel
./build.sh recovery
./build.sh rootfs

4. Flashing the Firmware

4.1 Install Flashing Tools

Windows Driver Assistant:

~/RK3588/linux-5.10-gen-rkr4/tools/windows/DriverAssitant_v5.12.zip

Windows Flashing Tool:

~/RK3588/linux-5.10-gen-rkr4/tools/windows/RKDevTool_Release_v3.15

4.2 Packaging the Firmware

To package separate firmware components into a single update.img file for easy upgrading, use the firmware packaging tool:

/tools/linux/Linux_Pack_Firmware/rockdev

4.3 Flashing the Firmware

4.3.1 Flashing the Complete System Firmware

1.Install the driver by running DriverInstall.exe from DriverAssitant_v5.12.

2.Connect the board to the PC via a Type-C cable.

3.Open RKDevTool.exe. The tool can recognize the board in one of the following modes:

MASKROM Mode: The board is in a blank state, or the MASKROM button is pressed at power-on.

LOADER Mode: The board reboots into loader mode (reboot loader command).

ADB Mode: The system is running.

Flashing Steps:

•If the tool detects MASKROM Mode, select Firmware, load the update.img file, and click Upgrade.

•If the tool detects ADB Mode, click Switch to enter LOADER Mode, then select Firmware, load update.img, and click Upgrade.

4.3.2 Flashing Specific Partitions

If you only need to update certain partitions (e.g., kernel, uboot, system), follow these steps:

1.Reboot the board into LOADER Mode:

reboot loader

2.Open RKDevTool.exe, select Device Partition Table, and check partition addresses.

3.Select the specific partition and flash the required component.


5. Using ADB for Debugging

5.1 Install ADB on Windows

1.Download and extract adb.zip to C:\adb.

2.Configure environment variables:

•Press Win + R, type sysdm.cpl, and open System Properties.

• Navigate to AdvancedEnvironment VariablesSystem Variables.

•Find Path, click Edit, add C:\adb, and click OK.

5.2 Common ADB Commands

adb help            # View all commands
adb version         # Check ADB version
adb start-server    # Start ADB server
adb kill-server     # Stop ADB server
adb devices         # List connected devices
adb shell           # Open shell on the device
adb push <local> <remote>  # Copy file to the device
adb pull <remote> <local>  # Copy file from the device

Conclusion

This guide covers the entire process of compiling and flashing Linux firmware for ARM SoM. By following these steps, developers can efficiently set up the development environment, build the SDK, and flash the firmware onto their devices.