Difference between revisions of "Main Page"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
Line 1: Line 1:
 
+
===How to compile custom kernel and u-boot===
<div id="GettingStarted"></div>
+
====Kernel and u-boot versions for each OS====
=Getting Started=
+
{| class="wikitable"  
{| border="0" cellpadding="10" width="100%"
+
 
|-
 
|-
|width="32%" valign="top" align="left"|
+
! Operating System
*[https://github.com/friendlyarm/build-env-on-ubuntu-bionic How to setup the Compiling Environment on Ubuntu bionic]
+
! Kernel Version
*[[BakeBit Starter Kit with NanoPi NEO/NEO2/NEO Air|Get Started with BakeBit Starter Kit]]
+
! U-boot version
*[[Get Started with Matrix Starter Kit]]
+
! Cross-compiler
*[[Hardware testing]]
+
! Partition type
|width="32%" valign="top" align="left"|
+
! Build toolset
|}
+
! Kernel code branch
 
+
! Kernel configuration
<div id="Learning"></div>
+
! U-boot code branch
 
+
! u-boot configuration
=Software & Development Tools=
+
{| border="0" cellpadding="10" width="100%"
+
 
|-
 
|-
|width="32%" valign="top" align="left"|
+
| buildroot
===Embedded Operating Systems===
+
| rowspan="10" | linux v5.10.y
*[https://github.com/friendlyarm/Actions-FriendlyWrt FriendlyWrt]
+
| rowspan="10" | u-boot <br />v2017.09
*[[Buildroot|Buildroot]]
+
| rowspan="10" | 11.3-aarch64
*[[Debian Bullseye Desktop|Debian11 (Bullseye)]]
+
| rowspan="10" | [https://github.com/friendlyarm/sd-fuse_rk3568/blob/master/prebuilt/parameter.template GPT]
*[[Debian Buster Desktop|Debian10 (Buster)]]
+
| rowspan="10" | [https://github.com/friendlyarm/sd-fuse_rk3568/tree/master sd-fuse]
*[[FriendlyDesktop 18.04 for RK3399|FriendlyDesktop 18.04 for RK3399]]
+
| rowspan="10" | [https://github.com/friendlyarm/kernel-rockchip/tree/nanopi5-v5.10.y_opt nanopi5-v5.10.y_opt]
*[[FriendlyCore (based on ubuntu-core with Qt)|FriendlyCore]]
+
| rowspan="6" | nanopi5_linux_defconfig
*[[Lubuntu desktop 16.04 for RK3399]]
+
| rowspan="10" | [https://github.com/friendlyarm/uboot-rockchip/tree/nanopi5-v2017.09 nanopi5-v2017.09]
*[[Lubuntu desktop|Lubuntu desktop 16.04 for S5P4418/S5P6818]]
+
| rowspan="10" | rk3568_defconfig
*[https://dietpi.com/docs/hardware/#nanopi-series-friendlyarm DietPi OS]
+
<!--
+
*[[DietPi|DietPi for H3]]
+
*[[DietPi|DietPi for H5]]
+
*[[Debian Jessie]]
+
-->
+
 
+
=== Utilities ===
+
*[[EFlasher]]
+
*[[npi-config]]
+
*[[How to make your own SD-bootable ROM]]
+
*[[Use NetworkManager to configure network settings]]
+
*[[How to use overlayfs on Linux]]
+
 
+
=== Building from open source code ===
+
*[[How to Build FriendlyWrt]]
+
*[[How to Build, Install and Setting Qt Application|Qt dev: How to Build, Install and Setting Qt Application]]
+
*[[Building U-boot and Linux for H5/H3/H2+]]
+
*Cross-compiling Qt application in Docker:  [https://github.com/friendlyarm/friendlyelec-ubuntu18-docker [RK3399 platform]] [http://github.com/friendlyarm/friendlyelec-ubuntu16-docker [S5P4418/S5P6818/H3/H5 platform platform]]
+
*Building Android open source project in Docker: [http://github.com/friendlyarm/friendlyelec-android-docker [RK3399/S5P4418/S5P6818/H3/H5 platform]]
+
*[https://github.com/friendlyarm/ble-server-sample-for-linux Building and running BLE GATT Server Example on FriendlyCore]
+
|width="32%" valign="top" align="left"|
+
 
+
=== AI, Qt, IoT and more… ===
+
*[[How to Install Docker on Debian]]
+
*[[WiringPi for RK3399|WiringPi for RK3399]]
+
*[[WiringPi-Python for RK3399|WiringPi-Python for RK3399]]
+
*[[WiringNP: NanoPi NEO/NEO2/Air GPIO Programming with C]]
+
*[[RPi.GPIO : NanoPi NEO/NEO2/Air GPIO Programming with Python]]
+
*[[FriendlyThings for RK3399|Android: FriendlyThings for RK3399]]
+
*[[FriendlyThings|Android: FriendlyThings for S5P4418/S5P6818/H3/H5 Platforms]]
+
*[[FriendlyThings APIs|Android: FriendlyThings APIs]]
+
*[https://github.com/friendlyarm/install-opencv-on-friendlycore Installing OpenCV on FriendlyCore]
+
*[https://github.com/friendlyarm/install-caffe-on-friendlycore Installing Caffe on FriendlyCore]
+
*[https://github.com/friendlyarm/install-tensorflow-on-friendlycore Installing Tensorflow  on RK3399 boards]
+
*[[Install ROS Melodic on NanoPC-T4/zh|Install ROS Melodic on NanoPC-T4]]
+
*[[How to use MIPI camera on RK3399 boards]]
+
*[[How to use 4G Module on NanoPC-T4]]
+
*[[How to use 4G Module on Debian/zh|How to use 4G Module on Debian]]
+
*[[How to setup RTMP server on NanoPC-T4]]
+
*[[How to setup VNC server on NanoPC-T4]]
+
*[[How to setup XRDP server on NanoPC-T4]]
+
*[[How to install chinese input method on FriendlyDesktop|如何在FriendlyDesktop上安装中文输入法]]
+
*[[Template:RK3399-Linux-Install-Docker|How to install and use docker on RK3399 boards]]
+
*[[Template:Linux-Create-WiFiAP|How to setup WiFiAP / HotAP]]
+
*[[How to setup JellyFin media system on NanoPi-R2S/zh|在NanoPi-R2S上安装使用JellyFin影音服务器]]
+
*[[How to use a USB WiFi adapter as an access point on FriendlyWrt|如何在FriendlyWrt下使用USB WiFi作为AP]]
+
|}
+
 
+
<div id="Products"></div>
+
 
+
=Hardware Settings and Controls (TBD) =
+
{| border="0" cellpadding="10" width="100%"
+
 
|-
 
|-
|width="32%" valign="top" align="left"|
+
| friendlycore-focal-arm64
*[[WiFi]]
+
*[[LED]]
+
*[[Serial port]]
+
<!--*[[PWM]]-->
+
*[[SPI]]
+
*[[USB OTG]]
+
*[[LCD]]
+
*[[CPU]]
+
*[[Network]]
+
|width="32%" valign="top" align="left"|
+
*[[I2S]]
+
*[[I2C]]
+
*[[CVBS]]
+
*[[Watchdog]]
+
*[[GSM/GPRS]]
+
*[[Codec]]
+
*[[PCIe]]
+
*[[GPIO]]
+
*[[eMMC]]
+
|width="32%" valign="top" align="left"|
+
*[[Bluetooth]]
+
*[[HDMI]]
+
*[[Camera]]
+
*[[Memory]]
+
*[[RTC]]
+
*[[EEPROM]]
+
*[[MIPI-DSI]]
+
|}
+
<div id="Products"></div>
+
 
+
=Products=
+
===CPU Boards===
+
<div id="CPUBoards"></div>
+
{| border="0" cellpadding="10" width="100%"
+
 
|-
 
|-
|width="32%" valign="top" align="left"|
+
| debian-bullseye-core-arm64
*[[Micro2451]]
+
*[http://www.friendlyarm.com/ Tiny4412,Super4412,Smart210,Tiny210,Tiny6410,Tiny2451,Tiny2416 ]
+
 
+
|width="32%" valign="top" align="left"|
+
*[[Smart4418]]
+
*[[Smart6818]]
+
*[[Core4418]]
+
*[[SOM-4418]]
+
*[[SOM-RK3399]]
+
*[[SOM-RK3399v2]]
+
 
+
<!--*[[Tiny4412]]-->
+
<!--*[[Super4412]]-->
+
<!--*[[Smart210]]-->
+
<!--*[[Tiny210]]-->
+
<!--*[[Tiny3358]]-->
+
<!--*[[Tiny6410]]-->
+
<!--*[[Micro2440]]-->
+
<!--*[[Tiny2451]]-->
+
<!--*[[Tiny2416]]-->
+
 
+
|}
+
 
+
===Carrier Boards===
+
<div id="CarrierBoards"></div>
+
{| border="0" cellpadding="10" width="100%"
+
 
|-
 
|-
|width="32%" valign="top" align="left"|
+
| debian-bullseye-desktop-arm64
*[[Smart210/4418 SDK]]
+
*[[Smart4418SDK 1305]]
+
*[[Smart4418SDK 1606]]
+
*[[Smart4418/6818SDK V2]]
+
*[[All-in-One Android Touch Screen]]
+
*[[Smart210/4418 ADK]]
+
 
+
|width="32%" valign="top" align="left"|
+
*[[SOM-RK3399 Dev Kit]]
+
*[[Edge-RT300]]
+
 
+
|width="32%" valign="top" align="left"|
+
<!--*[[Tiny2416/2451/6410/210 ADK]]-->
+
<!--*[[Tiny2416/2451/6410/210 SDK]]-->
+
<!--*[[Tiny3358 ITX SDK]]-->
+
<!--*[[Micro2440/2451 SDK]]-->
+
 
+
|width="32%" valign="top" align="left"|
+
<!--*[[Tiny4412 ADK]]-->
+
<!--*[[Tiny4412 SDK]]-->
+
 
+
|}
+
 
+
===NanoPC/Pi Series===
+
<div id="NanoPCSeries"></div>
+
{| border="0" cellpadding="10" width="100%"
+
 
|-
 
|-
|width="25%" valign="top" align="left"|
+
| debian-bullseye-minimal-arm64
*[[NanoPC-T1]]
+
|-
*[[NanoPC-T2]]
+
| debian-buster-desktop-arm64
*[[NanoPC-T3]]
+
*[[NanoPC-T3 Plus]]
+
*[[NanoPC-T4]]
+
*[[NanoPi]]
+
*[[NanoPi 2]]
+
*[[NanoPi 2 Fire]]
+
*[[NanoPi Fire2A]]
+
*[[NanoPi Fire3]]
+
*[[NanoPi S2]]
+
*[[NanoPi A64]]
+
*[[NanoPi Duo]]
+
*[[NanoPi Duo2]]
+
|width="25%" valign="top" align="left"|
+
*[[NanoPi K1 Plus]]
+
*[[NanoPi K2]]
+
*[[NanoPi M1]]
+
*[[NanoPi M1 Plus]]
+
*[[NanoPi M2]]
+
*[[NanoPi M2A]]
+
*[[NanoPi M3]]
+
*[[NanoPi M4]]
+
*[[NanoPi M4V2]]
+
*[[NanoPi M4B]]
+
|width="25%" valign="top" align="left"|
+
*[[NanoPi NEO]]
+
*[[NanoPi NEO2]]
+
*[[NanoPi NEO2 Black]]
+
*[[NanoPi NEO3]]
+
*[[NanoPi NEO4]]
+
*[[NanoPi NEO Air]]
+
*[[NanoPi NEO Core]]
+
*[[NanoPi NEO Core2]]
+
*[[NanoPi NEO Plus2]]
+
*[[ZeroPi]]
+
|width="25%" valign="top" align="left"|
+
*[[NanoPi R1]]
+
*[[NanoPi R1S-H3]]
+
*[[NanoPi R1S-H5]]
+
*[[NanoPi R2S]]
+
*[[NanoPi R2C]]
+
*[[NanoPi R2C Plus]]
+
*[[NanoPi R4S]]
+
*[[NanoPi R4SE]]
+
*[[NanoPi R5S]]
+
*[[NanoPi R5C]]
+
*[[NanoPi R6S]]
+
*[[NanoPi R6C]]
+
|}
+
 
+
===Mini Boards===
+
<div id="MiniBoards"></div>
+
:[http://www.friendlyarm.com/ Mini210s, Mini2440, Mini2451, Mini6410]
+
<!--
+
{| border="0" cellpadding="10" width="100%"
+
 
|-
 
|-
|width="32%" valign="top" align="left"|
+
| friendlywrt21
*[[Mini210S]]
+
| rowspan="4" | nanopi5_linux_defconfig<br />friendlywrt.config
*[[Mini2440]]
+
|-
 
+
| friendlywrt21-docker
|width="32%" valign="top" align="left"|
+
|-
*[[Mini2451]]
+
| friendlywrt22
 
+
|-
|width="32%" valign="top" align="left"|
+
| friendlywrt22-docker
*[[Mini6410]]
+
 
+
 
|}
 
|}
-->
+
* Kernel source code repository:https://github.com/friendlyarm/kernel-rockchip
<div id="Matrix"></div>
+
* u-boot source code repository:https://github.com/friendlyarm/uboot-rockchip
{{Matrix}}
+
* The cross-compile toolchain is located in the path: /opt/FriendlyARM/toolchain/. Before using it, you need to export it to the PATH environment variable:
 
+
<syntaxhighlight lang="bash">
===Starter Kit===
+
export PATH=/opt/FriendlyARM/toolchain/11.3-aarch64/bin/:$PATH
<div id="Starter Kit"></div>
+
</syntaxhighlight>
{| border="0" cellpadding="10" width="100%"
+
* The [https://github.com/friendlyarm/sd-fuse_rk3568/tree/master sd-fuse] build toolset can be used to quickly compile the kernel and u-boot, as well as repackaging SD card image and SD-to-eMMC image.
 +
====Compile kernel linux-v5.10.y====
 +
Download the source code and compile as follows:
 +
<syntaxhighlight lang="bash">
 +
git clone https://github.com/friendlyarm/kernel-rockchip --single-branch --depth 1 -b nanopi5-v5.10.y_opt kernel-rockchip
 +
cd kernel-rockchip
 +
export PATH=/opt/FriendlyARM/toolchain/11.3-aarch64/bin/:$PATH
 +
touch .scmversion
 +
# Configuring the Kernel
 +
# Option1: Load Linux system configuration
 +
make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 nanopi5_linux_defconfig
 +
# Option2: Load FriendlyWrt system configuration
 +
# make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 nanopi5_linux_defconfig friendlywrt.config
 +
# Launch configuration interface
 +
# make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 menuconfig
 +
# Compiling Kernel
 +
make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 nanopi5-images -j$(nproc)
 +
# Compiling the driver modules
 +
mkdir -p out-modules && rm -rf out-modules/*
 +
make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 INSTALL_MOD_PATH="$PWD/out-modules" modules -j$(nproc)
 +
make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 INSTALL_MOD_PATH="$PWD/out-modules" modules_install
 +
KERNEL_VER=$(make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 kernelrelease)
 +
[ ! -f "$PWD/out-modules/lib/modules/${KERNEL_VER}/modules.dep" ] && depmod -b $PWD/out-modules -E Module.symvers -F System.map -w ${KERNEL_VER}
 +
(cd $PWD/out-modules && find . -name \*.ko | xargs aarch64-linux-strip --strip-unneeded)
 +
</syntaxhighlight>
 +
You will get the following file:
 +
{| class="wikitable"  
 
|-
 
|-
|width="32%" valign="top" align="left"|
+
| kernel.img
*[[Matrix Starter Kit with NanoPi]]
+
| resource.img
*[[Matrix Starter Kit with RasberryPi]]
+
| <del>boot.img This img is deprecated</del>
*[[Matrix Starter Kit with Arduino]]
+
| The kernel modules are located in the out-modules directory
*[[BakeBit|BakeBit Starter Kit with NEO]]
+
 
+
 
+
|width="32%" valign="top" align="left"|
+
 
+
|width="32%" valign="top" align="left"|
+
 
+
 
|}
 
|}
 
+
Installing the kernel: <br>
===LCD Modulse===
+
Please click on [[#Download u-boot and the kernel to the target board]]<br>
{| border="0" cellpadding="10" width="100%"
+
====Compile u-boot v2017.09====
 +
Download the source code and compile as follows:
 +
<syntaxhighlight lang="bash">
 +
git clone https://github.com/friendlyarm/rkbin --single-branch --depth 1 -b nanopi5
 +
git clone https://github.com/friendlyarm/uboot-rockchip --single-branch --depth 1 -b nanopi5-v2017.09
 +
export PATH=/opt/FriendlyARM/toolchain/11.3-aarch64/bin/:$PATH
 +
cd uboot-rockchip/
 +
./make.sh nanopi5
 +
</syntaxhighlight>
 +
After the compilation, the following files will be generated:
 +
{| class="wikitable"  
 
|-
 
|-
|width="32%" valign="top" align="left"|
+
| uboot.img
*[[LCD-H43]]
+
| rk356x_spl_loader_v1.15.112.bin (Before packaging, you need to rename it to MiniLoaderAll.bin)
*[[LCD-HD700]]
+
*[[LCD-HD702]]
+
*[[LCD-HD702V]]
+
*[[LCD-HD702E]]
+
*[[LCD-HD101]]
+
*[[LCD-K116E]]
+
*[[LCD-L80]]
+
*[[LCD-T35]]
+
 
+
|width="32%" valign="top" align="left"|
+
*[[LCD-TD35]]
+
*[[LCD-X710]]
+
*[[LCD-N35]]
+
*[[LCD-N43]]
+
*[[LCD-P35]]
+
*[[LCD-P43]]
+
 
+
 
|}
 
|}
 +
Installing the u-boot: <br>
 +
Please click on [[#Download u-boot and the kernel to the target board]]<br>
  
{| border="0" cellpadding="10" width="100%"
+
====Download u-boot and the kernel to the target board====
|-
+
=====Download to the installed system=====
|width="32%" valign="top" align="left"|
+
Since the RK3568's OS uses GPT partitions by default, you can use the dd command to write the image file to the partition, the device nodes for SD card and eMMC are shown below:
*[[LCD-S430]]
+
* The SD/TF Card device node: /dev/mmcblk0 <br />
*[[LCD-S70]]
+
* The eMMC device node: /dev/mmcblk2 <br />
*[[LCD-S700]]
+
The following is an example of how to update the kernel to eMMC:<br />
*[[LCD-S700]]
+
Use the 'parted' command to view the partition layout:
*[[LCD-S702]]
+
<syntaxhighlight lang="bash">
*[[LCD-S70D]]
+
parted /dev/mmcblk2 print
 +
</syntaxhighlight>
 +
You should get output similar to the following:
 +
<syntaxhighlight lang="bash">
 +
Model: MMC A3A551 (sd/mmc)
 +
Disk /dev/mmcblk2: 31.0GB
 +
Sector size (logical/physical): 512B/512B
 +
Partition Table: gpt
 +
Disk Flags:
  
|width="32%" valign="top" align="left"|
+
Number  Start  End    Size    File system  Name      Flags
*[[LCD-W35]]
+
1      8389kB  12.6MB  4194kB              uboot
*[[LCD-W35B]]
+
2      12.6MB  16.8MB  4194kB              misc
*[[LCD-W50]]
+
3      16.8MB  21.0MB  4194kB              dtbo
*[[LCD-W101]]
+
4      21.0MB  37.7MB  16.8MB              resource
*[[LCD-W500]]
+
5      37.7MB  79.7MB  41.9MB              kernel
 +
6      79.7MB  113MB  33.6MB              boot
 +
7      113MB  147MB  33.6MB              recovery
 +
8      147MB  31.0GB  30.9GB  ext4        rootfs
 +
</syntaxhighlight>
 +
as shown above, the resource partition is located at 4 and the kernel partition is located at 5. Use the dd command to write the resource.img and kernel.img files to these partitions, the commands are as follows:
 +
<syntaxhighlight lang="bash">
 +
dd if=resource.img of=/dev/mmcblk2p4 bs=1M
 +
dd if=kernel.img of=/dev/mmcblk2p5 bs=1M
 +
</syntaxhighlight>
 +
If you want to update u-boot:
 +
<syntaxhighlight lang="bash">
 +
dd if=boot.img of=/dev/mmcblk2p1 bs=1M
 +
</syntaxhighlight>
 +
To update new driver modules, copy the newly compiled driver modules to the appropriate directory under /lib/modules.
  
|}
+
=====How to create a new OS image file=====
 
+
To create a new OS image file, you need to use the "sd-fuse" packaging tool.<br />
===3D Models===
+
<br />
<div id="3DModules"></div>
+
"sd-fuse" is a collection of scripts that can be used to create bootable SD card images for FriendlyElec boards. Its main features include:<br />
 
+
* Creation of root filesystem images from a directory <br />
===Accessories===
+
* Building of bootable SD card images<br />
<div id="Accessories"></div>
+
* Simple compilation of kernel, U-Boot, and third-party drivers<br />
{| border="0" cellpadding="10" width="100%"
+
Please click on the following link to find out more:
 +
{| class="wikitable"  
 
|-
 
|-
|width="32%" valign="top" align="left"|
+
! Kernel version
*[[NanoPC-T1 Case]]
+
! Build toolset
 
+
|-
|width="32%" valign="top" align="left"|
+
| linux v5.10.y
 
+
| [https://github.com/friendlyarm/sd-fuse_rk3568/tree/master<br /> sd-fuse_rk3568]
 
+
|width="32%" valign="top" align="left"|
+
 
+
 
|}
 
|}
 +
=====USB flashing=====
 +
======Linux======
 +
To flash U-Boot and kernel using the "upgrade_tool" tool, please use the following command:
 +
<syntaxhighlight lang="bash">
 +
sudo upgrade_tool ul MiniLoaderAll.bin
 +
sudo upgrade_tool di -p parameter.txt
 +
sudo upgrade_tool di uboot uboot.img
 +
sudo upgrade_tool di resource resource.img
 +
sudo upgrade_tool di kernel kernel.img
 +
sudo upgrade_tool RD
 +
</syntaxhighlight>
 +
Note: "upgrade_tool" is a command-line tool provided by Rockchip for Linux operating systems (Linux_Upgrade_Tool).

Revision as of 02:53, 30 March 2023

1 How to compile custom kernel and u-boot

1.1 Kernel and u-boot versions for each OS

Operating System Kernel Version U-boot version Cross-compiler Partition type Build toolset Kernel code branch Kernel configuration U-boot code branch u-boot configuration
buildroot linux v5.10.y u-boot
v2017.09
11.3-aarch64 GPT sd-fuse nanopi5-v5.10.y_opt nanopi5_linux_defconfig nanopi5-v2017.09 rk3568_defconfig
friendlycore-focal-arm64
debian-bullseye-core-arm64
debian-bullseye-desktop-arm64
debian-bullseye-minimal-arm64
debian-buster-desktop-arm64
friendlywrt21 nanopi5_linux_defconfig
friendlywrt.config
friendlywrt21-docker
friendlywrt22
friendlywrt22-docker
export PATH=/opt/FriendlyARM/toolchain/11.3-aarch64/bin/:$PATH
  • The sd-fuse build toolset can be used to quickly compile the kernel and u-boot, as well as repackaging SD card image and SD-to-eMMC image.

1.2 Compile kernel linux-v5.10.y

Download the source code and compile as follows:

git clone https://github.com/friendlyarm/kernel-rockchip --single-branch --depth 1 -b nanopi5-v5.10.y_opt kernel-rockchip
cd kernel-rockchip
export PATH=/opt/FriendlyARM/toolchain/11.3-aarch64/bin/:$PATH
touch .scmversion
# Configuring the Kernel
# Option1: Load Linux system configuration
make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 nanopi5_linux_defconfig
# Option2: Load FriendlyWrt system configuration
# make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 nanopi5_linux_defconfig friendlywrt.config
# Launch configuration interface
# make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 menuconfig
# Compiling Kernel
make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 nanopi5-images -j$(nproc)
# Compiling the driver modules
mkdir -p out-modules && rm -rf out-modules/*
make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 INSTALL_MOD_PATH="$PWD/out-modules" modules -j$(nproc)
make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 INSTALL_MOD_PATH="$PWD/out-modules" modules_install
KERNEL_VER=$(make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 kernelrelease)
[ ! -f "$PWD/out-modules/lib/modules/${KERNEL_VER}/modules.dep" ] && depmod -b $PWD/out-modules -E Module.symvers -F System.map -w ${KERNEL_VER}
(cd $PWD/out-modules && find . -name \*.ko | xargs aarch64-linux-strip --strip-unneeded)

You will get the following file:

kernel.img resource.img boot.img This img is deprecated The kernel modules are located in the out-modules directory

Installing the kernel:
Please click on #Download u-boot and the kernel to the target board

1.3 Compile u-boot v2017.09

Download the source code and compile as follows:

git clone https://github.com/friendlyarm/rkbin --single-branch --depth 1 -b nanopi5
git clone https://github.com/friendlyarm/uboot-rockchip --single-branch --depth 1 -b nanopi5-v2017.09
export PATH=/opt/FriendlyARM/toolchain/11.3-aarch64/bin/:$PATH
cd uboot-rockchip/
./make.sh nanopi5

After the compilation, the following files will be generated:

uboot.img rk356x_spl_loader_v1.15.112.bin (Before packaging, you need to rename it to MiniLoaderAll.bin)

Installing the u-boot:
Please click on #Download u-boot and the kernel to the target board

1.4 Download u-boot and the kernel to the target board

1.4.1 Download to the installed system

Since the RK3568's OS uses GPT partitions by default, you can use the dd command to write the image file to the partition, the device nodes for SD card and eMMC are shown below:

  • The SD/TF Card device node: /dev/mmcblk0
  • The eMMC device node: /dev/mmcblk2

The following is an example of how to update the kernel to eMMC:
Use the 'parted' command to view the partition layout:

parted /dev/mmcblk2 print

You should get output similar to the following:

Model: MMC A3A551 (sd/mmc)
Disk /dev/mmcblk2: 31.0GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
 
Number  Start   End     Size    File system  Name      Flags
 1      8389kB  12.6MB  4194kB               uboot
 2      12.6MB  16.8MB  4194kB               misc
 3      16.8MB  21.0MB  4194kB               dtbo
 4      21.0MB  37.7MB  16.8MB               resource
 5      37.7MB  79.7MB  41.9MB               kernel
 6      79.7MB  113MB   33.6MB               boot
 7      113MB   147MB   33.6MB               recovery
 8      147MB   31.0GB  30.9GB  ext4         rootfs

as shown above, the resource partition is located at 4 and the kernel partition is located at 5. Use the dd command to write the resource.img and kernel.img files to these partitions, the commands are as follows:

dd if=resource.img of=/dev/mmcblk2p4 bs=1M
dd if=kernel.img of=/dev/mmcblk2p5 bs=1M

If you want to update u-boot:

dd if=boot.img of=/dev/mmcblk2p1 bs=1M

To update new driver modules, copy the newly compiled driver modules to the appropriate directory under /lib/modules.

1.4.2 How to create a new OS image file

To create a new OS image file, you need to use the "sd-fuse" packaging tool.

"sd-fuse" is a collection of scripts that can be used to create bootable SD card images for FriendlyElec boards. Its main features include:

  • Creation of root filesystem images from a directory
  • Building of bootable SD card images
  • Simple compilation of kernel, U-Boot, and third-party drivers

Please click on the following link to find out more:

Kernel version Build toolset
linux v5.10.y
sd-fuse_rk3568
1.4.3 USB flashing
1.4.3.1 Linux

To flash U-Boot and kernel using the "upgrade_tool" tool, please use the following command:

sudo upgrade_tool ul MiniLoaderAll.bin
sudo upgrade_tool di -p parameter.txt
sudo upgrade_tool di uboot uboot.img
sudo upgrade_tool di resource resource.img
sudo upgrade_tool di kernel kernel.img
sudo upgrade_tool RD

Note: "upgrade_tool" is a command-line tool provided by Rockchip for Linux operating systems (Linux_Upgrade_Tool).