Manual Version
Disclaimer
While every effort has been made to ensure accuracy in this document, errors or omissions may still exist. Users should carefully assess its applicability; we reserve the right to make revisions at any time and do not guarantee the validity of content from previous versions. For the latest product information, please regularly visit the official website of LCSC Dev Boards for updated materials. The copyright and final interpretation of this document belong to Shenzhen JLC Technology Group Co.,Ltd. Please take note of this disclaimer and assess the risks independently when making decisions. We are not responsible for any issues arising from the use of this document. Thank you for your understanding and support.
Introduction
Here, we will introduce the Linux system and compilation method for the Taishan-RK3566 development board. Also everyone can refer to it:
《Rockchip_Developer_Guide_Linux_Software_CN.pdf》
This document provides a detailed explanation of compiling and using the Rockchip Linux SDK.
《Rockchip_Developer_Guide_Linux_Software_CN.pdf》下载
📌 Download Center (Click to Jump)
📌 In the Download Center
->Baidu Netdisk Resource Content
->Chapter 04.Reference Materials
->【[Rockchip] Official Resources
->Linux
Folder
WARNING
📌 If you are a beginner, we highly recommend following the tutorial of Pangniu Phone from the training camp for more detailed instructions:
Preparation
Computer Configuration: Compile Linux system compared to Android on the computer requirements are not so high, the following is my computer configuration, theoretically worse than my configuration can be compiled, according to the actual situation.
Virtual machine configuration: ubnutu version information:NAME="Ubuntu"
VERSION="18.04.6 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.6 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
2
3
4
5
6
7
8
9
10
11
12
Download SDK
we provide development board resources on the Baidu Netdisk, which SDK data directory is as follows for you to download:
SDK Download
📌 In the Download Center
->Baidu Netdisk Resource Content
->Chapter 05.System SDK
->【SDK】Linux
->tspi_linux_sdk_xxxxxxxx.tar.gz
- The xxxxxxxx in the directory represents the date.
- The SDK in this directory is regularly updated, so the version you download will always be the latest.
- The Linux system is quite large, so the provided SDK might contain bugs. If you encounter any issues, please contact us in time.
Upload tspi_linux_sdk_xxxxxxxx.tar.gz to your Ubuntu virtual machine. You can choose the directory, but ensure that the path does not contain Chinese characters and that there is at least 100GB of free space. After the compilation is complete, the entire SDK size will be around 80GB. There are several ways to upload, such as Samba, shared folders, SFTP, etc. In this case, we use SFTP for uploading.
Extract SDK
Run the following extraction command in the directory where tspi_linux_sdk_xxxxxxxx.tar.gz is located:
tar -zxvf tspi_linux_sdk_xxxxxxxx.tar.gz
Command Explanation:
tar: The extraction command.
-z: Use the gzip compression algorithm to extract or compress.
-x: Extract the files.
-v: Show detailed operation information, listing the files being extracted.
-f: Specify the file to operate on.
tspi_linux_sdk_xxxxxxxx.tar.gz: The file being extracted.
2
3
4
5
6
7
8
Extract
tar -zxvf tspi_linux_sdk_20230916.tar.gz
After extraction, you will get tspi_linux_sdk_20230916:
ls
Result:
tspi_linux_sdk_20230916 tspi_linux_sdk_20230916.tar.gz
SDK Directory Overview
Navigate to the extracted SDK directory tspi_linux_sdk_20230916:
cd tspi_linux_sdk_20230916
View the contents of the SDK directory as follows:
tspi_linux_sdk_20230916# ls
app buildroot debian envsetup.sh IMAGE Makefile prebuilts rkflash.sh tools yocto
br.log build.sh device external kernel mkfirmware.sh rkbin rockdev u-boot
2
3
app
: Contains higher-level applications, such as qcamera, qfm, qplayer, settings, and other utility programs.buildroot
: Root filesystem based on buildroot (2018.02-rc3), used for developing the root filesystem.debian
: Root filesystem based on Debian 10, supporting certain chipsets.device/rockchip
: Contains chip-level configurations, parameter files, scripts, and tools for compiling and packaging firmware.IMAGE
: Stores output directories with compile time, XML files, patches, and firmware images.external
: Contains third-party repositories, including audio, video, network, and recovery tools.kernel
: Contains kernel development code, typically based on kernel versions 4.4 or 4.19.prebuilts
: Stores cross-compilation toolchains.rkbin
: Stores Rockchip-related binaries and tools.rockdev
: Stores the compiled output firmware.tools
: Contains commonly used tools for both Linux and Windows environments.u-boot
: Contains U-Boot source code developed from version v2017.09.yocto
: Root filesystem based on Yocto Gatesgarth 3.2, supporting certain chipsets.
Compilation Environment Setup
Here, we demonstrate compiling directly on Ubuntu 18.04. Since everyone's compilation environment may differ, unexpected errors might occur. If your environment is unable to compile successfully, you can use a Docker environment for reference in setting up the [Docker] compilation environment. If you are using Docker, you can skip this chapter and proceed with SDK compilation on your own.
To compile the Linux SDK, you need to install the following libraries: (Note: not all of them should be copied and pasted directly)
sudo apt-get install git ssh make gcc libssl-dev liblz4-tool expect \
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
2
3
4
Run the following command:
LCSC Taishan-RK3566-Linux Dev Board SDK Board-Level Configuration
Before starting the compilation, you need to configure the board for the LCSC Taishan-RK3566-Linux. There are two methods for configuration:
./build.sh device/rockchip/rk356x/BoardConfig-rk3566-tspi-v10.mk
Run the command as follows:
Method 2:./build.sh lunch
Run the command and select BoardConfig-rk3566-tspi-v10.mk. The serial number here is 3, so we choose 3 and press Enter.
To check if the configuration has been applied correctly: ./build.sh -h kernel
After running this, you should see that the configuration file is indeed tisp, confirming that the configuration is active.
Buildroot Compilation
Full Compilation
Select the Buildroot operating system:
export RK_ROOTFS_SYSTEM=buildroot
Run the automatic full compilation command:
./build.sh all # Only compile module code (u-Boot, kernel, Rootfs, Recovery)
# After that, run ./mkfirmware.sh to package the firmware
2
The first compilation requires selecting the power source.
Compilation successful:
Although the compilation is complete, we still need to execute the firmware packaging:./mkfirmware.sh
root@lckfb:/home/lckfb_tspi/linux/tspi_linux_sdk_20230916/rockdev# ls
boot.img misc.img parameter.txt rootfs.img update.img
MiniLoaderAll.bin oem.img recovery.img uboot.img userdata.img
2
3
Download
Single Compilation
u-boot Compilation
# U-Boot compilation command
./build.sh uboot
# View detailed U-Boot compilation command
./build.sh -h uboot
2
3
4
Compilation success output:
Kernel Compilation
# Kernel compilation command
./build.sh kernel
# View detailed Kernel compilation command
./build.sh -h kernel
2
3
4
Compilation success output:
Recovery Compilation Command
# Recovery compilation command
./build.sh recovery
# View detailed Recovery compilation command
./build.sh -h recovery
2
3
4
Note: Recovery is not a mandatory feature, and some board-level configurations may not set it.
Buildroot Compilation
Rootfs Compilation Enter the project directory’s root folder and execute the following command to automatically complete the compilation and packaging of Rootfs:
./build.sh rootfs
After compilation, rootfs.ext4 will be generated in the Buildroot directory under output/rockchip_rk3566/images.
Module Compilation For example, the qplayer module. Common compilation commands are as follows:
- Compile qplayer
SDK$make qplayer
- Rebuild qplayer
SDK$make qplayer-rebuild
- Delete qplayer
SDK$ make qplayer-dirclean
or
SDK$ rm -rf /buildroot/output/rockchip_rk3566/build/qlayer-1.0
2
3
Compile Debian
Select Debian as the operating system:
export RK_ROOTFS_SYSTEM=debian
Run the automatic full compilation command:
./build.sh all # Only compile module code (u-Boot, kernel, Rootfs, Recovery)
# You need to run ./mkfirmware.sh to pack the firmware
2
Compilation success:
Although the compilation is complete, we still need to execute the firmware packaging:./mkfirmware.sh
root@lckfb:/home/lckfb_tspi/linux/tspi_linux_sdk_20230916/rockdev# ls
boot.img misc.img parameter.txt rootfs.img update.img
MiniLoaderAll.bin oem.img recovery.img uboot.img userdata.img
2
3
Download
Download Distributed Image
For the burning tool usage, refer to theImage Flashing Guide, and import the configuration file:
Configuration File Download
📌 Download Center (click to jump)
📌 In the Download Center
->Baidu Netdisk Resource Content
->Chapter 05.System SDK
->【SDK】Linux
->Tspi_Linux_config.cfg
Then change the path to the one where the files generated after your compilation are located.
Download update.img
If you need to download update.img, run the following command to generate or update the update.img:
./build.sh updateimg
Ubuntu Root File System Creation
Method 1: Manual Creation of Ubuntu 18.04:
Preparation
Install qemu
Install the emulator on the Linux PC host:
sudo apt-get install qemu-user-static
Download and Extract Ubuntu-Core
Download from:ubuntu cdimg , and select ubuntu-base-18.04.5-base-arm64.tar.gz
.
After downloading, create a temporary folder and extract the root file system:
filex@filex-virtual-machine:~/ubuntu18_4$ mkdir temp
filex@filex-virtual-machine:~/ubuntu18_4$ tar -xpf ubuntu-base-18.04.5-base-arm64.tar.gz -C temp/
2
Modify Root File System
Preparation
Prepare the network:
filex@filex-virtual-machine:~/ubuntu18_4$ cp -b /etc/resolv.conf temp/etc/resolv.conf
Prepare qemu:
filex@filex-virtual-machine:~/ubuntu18_4$ cp /usr/bin/qemu-aarch64-static temp/usr/bin/
Enter the Root File System for Ubuntu 18.04 Operations:
filex@filex-virtual-machine:~/ubuntu18_4$ vim rootfs-mount.sh
#!/bin/bash
function mnt() {
echo "MOUNTING"
sudo mount -t proc /proc ${2}/proc
sudo mount -t sysfs /sys ${2}/sys
sudo mount -o bind /dev ${2}/dev
sudo chroot ${2}
}
function umnt() {
echo "UNMOUNTING"
sudo umount ${2}/proc
sudo umount ${2}/sys
sudo umount ${2}/dev
}
if [] && [] ;
then
mnt $1 $2
elif [] && [];
then
umnt $1 $2
else
echo ""
echo "Either 1'st, 2'nd or both parameters were missing"
echo ""
echo "1'st parameter can be one of these: -m(mount) OR -u(umount)"
echo "2'nd parameter is the full path of rootfs directory(with trailing '/')"
echo ""
echo "For example: ch-mount -m /media/sdcard/"
echo ""
echo 1st parameter : ${1}
echo 2nd parameter : ${2}
fi
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Add execute permissions:
filex@filex-virtual-machine:~/ubuntu18_4$ sudo chmod +x rootfs-mount.sh
Enter the system:
filex@filex-virtual-machine:~/ubuntu18_4$ sudo bash rootfs-mount.sh -m temp
The above steps are required for Ubuntu 18.04.5, otherwise, you will encounter errors with apt-get update:
Get:4 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease []
0% []gpgv: Signature made Thu Apr 26 23:38:40 2018 UTC
gpgv: using RSA key 3B4FE6ACC0B21F32
gpgv: Good signature from "Ubuntu Archive Automatic Signing Key (2012)
autolinkftpmaster@ubuntu.comautolink
"
terminate called after throwing an instance of 'std::runtime_error'
what(): random_device::random_device(const std::string&)
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted (core dumped)
2
3
4
5
6
7
8
9
10
Update and Install (This is performed in the VMware Ubuntu virtual machine, simulating the ARM-based Ubuntu):
root@filex-virtual-machine:/# apt-get update
root@filex-virtual-machine:/# apt upgrade
Preconfigure the necessary features:
root@filex-virtual-machine:/# apt install vim
root@filex-virtual-machine:/# apt install git
2
apt-get install ssh
apt-get install ethtool
apt-get install rsyslog
apt-get install bash-completion
apt-get install htop
apt-get install net-tools
apt-get install wireless-tools
apt-get install network-manager
apt-get install iputils-ping
--------Suggested essential packages---------
apt-get install vim # Language packages
apt-get install language-pack-en-base # This is necessary to generate /etc/network/interfaces configuration file
apt-get install ifupdown
# Ping
apt-get install inetutils-ping # For serial communication
apt-get install cutecom # Audio recording
apt-get install audacity # For camera
apt-get install v4l-utils
apt-get install cheese # Browser
apt-get install chromium-browser
Wifi
apt-get install wpasupplicant
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Install xubuntu (If you don't need a GUI, you can skip this step):
root@filex-virtual-machine:/# apt-get install xubuntu-desktop
Configure Network
Attention!!
For networks like campus networks, you can only connect using NAT mode!
vim /etc/network/interfaces
source-directory /etc/network/interfaces.d # Ethernet
auto eth0
iface eth0 inet dhcp
#wifi
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_config.conf
2
3
4
5
6
7
8
vim /etc/resolv.conf
nameserver 8.8.8.8
nameserver 114.114.114.114
2
3
Add Users and Set Passwords
Add a new user:
root@filex-virtual-machine:/# useradd -s '/bin/bash' -m -G adm,sudo lckfb
Set the user's password:
root@filex-virtual-machine:/# passwd tspi
Set the root user's password:
root@filex-virtual-machine:/# passwd root
After modifying the root filesystem, exit:
root@filex-virtual-machine:/# exit
filex@filex-virtual-machine:~/ubuntu18_4$ sudo bash rootfs-mount.sh -u temp
Create the Root File System
Check the size of the temp folder:
filex@filex-virtual-machine:~/ubuntu18_4$ sudo du -h --max-depth=1
3.5G ./temp
4.0K ./rootfs
3.5G .
2
3
4
Create the root filesystem image. Adjust the count value based on the size of the temp folder. Since temp is 3.5G, use count=5000*bs=1M to ensure it's larger than temp.
mkdir rootfs
dd if=/dev/zero of=linuxroot.img bs=1M count=6000
mkfs.ext4 linuxroot.img
sudo mount linuxroot.img rootfs/
sudo cp -rfp temp/* rootfs/
sudo umount rootfs/
e2fsck -p -f linuxroot.img
resize2fs -M linuxroot.img
2
3
4
5
6
7
8
Now, linuxroot.img
is the final root filesystem image file.
Download
For burning the image, refer to the Image Flashing Guide, import the configuration file:
Configuration File Download
📌 Download Center (Click to Jump)
📌 In Download Center
->Baidu Netdisk Resource Content
->Chapter 05.System SDK
->【SDK】Linux
->Tspi_Linux_config.cfg
After downloading, modify the path to point to the location where you have compiled the files.
A special note is that the rootfs
path needs to be updated to point to the linuxroot.img
of the Ubuntu filesystem you created earlier.