Skip to main content

Linux BSP User Guide for RK3568 series Debian11

Introduction

This guide provides comprehensive instructions for building and deploying Linux BSP for RK3568 series development boards running Debian 11.

Linux BSP Version

  • Operating System: Debian 11.x
  • Kernel Version: 5.10.160

Build Environment on Host

Currently, we adopt Docker as the build environment for consistent development experience.

You can get the latest version of advrisc/u20.04-rklbv1 Docker image for developing Rockchip RK3568 projects.

Docker Installation Commands

sudo apt-get install -y qemu-user-static
sudo apt-get install -y live-build
sudo docker pull advrisc/u20.04-rklbv1

Run Docker Example

Step 1: Run Docker Container

sudo docker run -it --name rk356x_linux5.10_v130_risc \
-v /home/bsp/myLinux:/home/adv/BSP:rw \
--privileged advrisc/u20.04-rklbv1:latest /bin/bash

Step 2: Change User Ownership in Container

adv@7cc0fa834366:~$ sudo chown adv:adv -R BSP

Getting Linux Source Code

cd ~/BSP
git clone https://github.com/ADVANTECH-Rockchip/repo.git
mkdir rk356x_linux5.10_v130_risc
cd rk356x_linux5.10_v130_risc
git config --global user.name "Your Name"
git config --global user.email you@example.com
../repo/repo init -u https://AIM-Linux@dev.azure.com/AIM-Linux/RISC-RK3568-Linux/_git/manifest \
-b rk356x_linux5.10_v130_risc -m default.xml
../repo/repo sync
../repo/repo forall -c git checkout -b local --track advantech-azure/rk356x_linux5.10_v130_risc

Build Choose Project

RSB-4810 Project Build

export TOP=`pwd`
cd $TOP
./build.sh adv_rk3568_rsb4810a2_defconfig

ROM-5880 Project Build

export TOP=`pwd`
cd $TOP
./build.sh adv_rk3568_rom5880a1_defconfig

AFE-E630 Project Build

export TOP=`pwd`
cd $TOP
./build.sh adv_rk3568_afee630a1_defconfig

EBC-RB07 Project Build

export TOP=`pwd`
cd $TOP
# Coming soon

Build Components

Build U-boot

cd $TOP
./build.sh uboot

Build Kernel

cd $TOP
./build.sh kernel

Build Recovery

cd $TOP
rm buildroot/output/rockchip_rk3568_recovery -rf
./build.sh recovery

Build Debian 11.x

cd $TOP
sudo dpkg -i debian/ubuntu-build-service/packages/*
sudo apt-get install -f -y
./build.sh debian

Generate Firmware Images

Push All Images to rockdev Folder

cd $TOP
./build.sh firmware

All images will be generated in the rockdev/ directory. The ./mkfirmware.sh script from the previous step will repack boot.img and rootfs.img, and copy other related image files to the rockdev/ directory.

Common Image Files

The following image files will be generated:

  • boot.img - Boot partition image
  • misc.img - Miscellaneous partition image
  • oem.img - OEM partition image
  • recovery.img - Recovery partition image
  • rootfs.img - Root filesystem image
  • uboot.img - U-Boot bootloader image
  • userdata.img - User data partition image
  • MiniLoaderAll.bin - Mini loader binary
  • parameter.txt - Partition parameter file

Make update.img

cd $TOP
sudo apt-get install bsdmainutils
./build.sh updateimg

You can get update.img in the rockdev/ directory.

How to Update Images

There are three methods to update images on your target device:

Method 1: Using AndroidTool

This method has no limitations and provides the most flexibility for flashing images.

Features:

  • No restrictions on update scenarios
  • Supports all partition updates
  • Works regardless of device boot state

Method 2: Using Storage Device (SD Card or USB Disk) with update.zip

This method has specific limitations that must be considered:

Requirements:

  • The target device must be able to boot up to Debian
  • Only supports updating images from the same OS (e.g., Debian upgrade to Debian)
  • Must use update.img for the upgrade process

Limitations:

  • Device must be functional and bootable
  • Cross-OS updates are not supported

Method 3: Using Bootup SD Disk Made by SDDiskTool

This method creates a bootable SD card for system updates:

Requirements:

  • Only supports updating images from the same OS (e.g., Debian upgrade to Debian)
  • Must use update.img for the upgrade process

Limitations:

  • Same-OS restriction applies
  • Requires SDDiskTool for SD card preparation

Troubleshooting

Common Issues

  1. Docker Permission Issues: Ensure proper user permissions are set using chown command
  2. Build Failures: Verify all dependencies are installed and Docker image is up to date
  3. Source Code Issues: Check network connectivity and Git credentials for repository access
  4. Update Failures: Ensure compatibility between source and target OS versions

Build Dependencies

Make sure the following packages are installed in your build environment:

  • qemu-user-static
  • live-build
  • bsdmainutils

Additional Notes

  • This documentation was last modified on 19 September 2024
  • Always verify your build configuration matches your target hardware
  • Maintain proper Git configuration for source code management
  • Regular backup of working configurations is recommended

This guide is part of the ESS-WIKI documentation system for Advantech embedded systems development.