Difference between revisions of "APITestPage"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
Line 1: Line 1:
===How to compile custom kernel and u-boot===
+
===Downloads===
====Kernel and u-boot versions for each OS====
+
====Official image====
{| class="wikitable"  
+
Visit [http://download.friendlyelec.com/{{#replace:{{#replace:{{BASEPAGENAME}}| |}}|/zh|}} download link] to download official image files (in the "01_Official images" directory).<br />
 +
The table below lists all official image, in the table, the word 'XYZ' in image filename meaning: <br />
 +
* '''sd''': SD card image, use to create a bootable SD card
 +
* '''eflasher''': SD-to-eMMC image, use to flash image from SD to eMMC
 +
* '''usb''': USB upgrade image, use to flash image to eMMC via USB
 +
{| class="wikitable"
 
|-
 
|-
! Operating System
+
  ! Icon
! Kernel Version
+
  ! Image Filename
! U-boot version
+
  ! Version
! Cross-compiler
+
  ! Description
! Partition type
+
! Build toolset
+
! Kernel code branch
+
! Kernel configuration
+
! U-boot code branch
+
! u-boot configuration
+
 
|-
 
|-
| buildroot
+
  | [[File:Android-icon.svg|frameless|40px]]
| rowspan="10" | linux v5.10.y
+
  | rk3588-XYZ-androidtv-YYYYMMDD.img.zip
| rowspan="10" | u-boot <br />v2017.09
+
  | 12
| rowspan="10" | 11.3-aarch64
+
  | Android 12 TV
| rowspan="10" | [https://github.com/friendlyarm/sd-fuse_rk3568/blob/master/prebuilt/parameter.template GPT]
+
| rowspan="10" | [https://github.com/friendlyarm/sd-fuse_rk3568/tree/master sd-fuse]
+
| rowspan="10" | [https://github.com/friendlyarm/kernel-rockchip/tree/nanopi5-v5.10.y_opt nanopi5-v5.10.y_opt]
+
| rowspan="6" | nanopi5_linux_defconfig
+
| rowspan="10" | [https://github.com/friendlyarm/uboot-rockchip/tree/nanopi5-v2017.09 nanopi5-v2017.09]
+
| rowspan="10" | rk3568_defconfig
+
 
|-
 
|-
| friendlycore-focal-arm64
+
  | [[File:Android-icon.svg|frameless|40px]]
 +
  | rk3588-XYZ-android12-YYYYMMDD.img.zip
 +
  | 12
 +
  | Android 12 Tablet
 
|-
 
|-
| debian-bullseye-core-arm64
+
  | [[File:Debian-icon.svg|frameless|40px]]
 +
  | rk3588-XYZ-debian-bullseye-core-5.10-arm64-YYYYMMDD.img.gz
 +
  | bullseye
 +
  | Debian 11 Core, command line only, kernel version 5.10.y
 
|-
 
|-
| debian-bullseye-desktop-arm64
+
  | [[File:Debian-icon.svg|frameless|40px]]
 +
  | rk3588-XYZ-debian-bullseye-minimal-5.10-arm64-YYYYMMDD.img.gz
 +
  | bullseye
 +
  | Debian 11 Desktop, Xfce desktop, no pre-installed recommended software, supports HW acceleration, kernel version 5.10.y
 
|-
 
|-
| debian-bullseye-minimal-arm64
+
  | [[File:Debian-icon.svg|frameless|40px]]
 +
  | rk3588-XYZ-debian-bullseye-desktop-5.10-arm64-YYYYMMDD.img.gz
 +
  | bullseye
 +
  | Debian 11 Desktop, Xfce desktop, pre-installed mpv, smplayer and chromium brower, supports HW acceleration, kernel version 5.10.y
 
|-
 
|-
| debian-buster-desktop-arm64
+
  | [[File:Ubuntu-icon.svg|frameless|40px]]
 +
  | rk3588-XYZ-ubuntu-focal-desktop-5.10-arm64-YYYYMMDD.img.gz
 +
  | focal
 +
  | Ubuntu 20.04 Desktop, LXQT desktop, pre-installed mpv, smplayer and chromium brower, supports HW acceleration, kernel version 5.10.y
 
|-
 
|-
| friendlywrt21
+
  | [[File:Ubuntu-icon.svg|frameless|40px]]
| rowspan="4" | nanopi5_linux_defconfig<br />friendlywrt.config
+
  | rk3588-XYZ-ubuntu-jammy-desktop-5.10-arm64-YYYYMMDD.img.gz
 +
  | jammy
 +
  | Ubuntu 22.04 with GNOME and Wayland with recommended software, kernel version 5.10.y
 
|-
 
|-
| friendlywrt21-docker
+
  | [[File:Ubuntu-icon.svg|frameless|40px]]
 +
  | rk3588-XYZ-ubuntu-jammy-minimal-5.10-arm64-YYYYMMDD.img.gz
 +
  | jammy
 +
  | Lightweight Ubuntu 22.04 with GNOME and Wayland, kernel version 5.10.y
 
|-
 
|-
| friendlywrt22
+
  | [[File:Ubuntu-icon.svg|frameless|40px]]
 +
  | rk3588-XYZ-ubuntu-jammy-x11-desktop-arm64-YYYYMMDD.img.gz
 +
  | jammy
 +
  | Ubuntu 22.04 with Xubuntu and X11, use Panfrost GPU driver, kernel version 5.10.y
 
|-
 
|-
| friendlywrt22-docker
+
  | [[File:Ubuntu-icon.svg|frameless|40px]]
|}
+
  | rk3588-XYZ-friendlycore-focal-5.10-arm64-YYYYMMDD.img.gz
* Kernel source code repository:https://github.com/friendlyarm/kernel-rockchip
+
  | focal
* u-boot source code repository:https://github.com/friendlyarm/uboot-rockchip
+
  | FriendlyCore,command line only, pre-installed Qt5, based on Ubuntu core 20.04, kernel version 5.10.y
* The cross-compile toolchain is located in the path: /opt/FriendlyARM/toolchain/. Using the toolchain is as simple as adding the toolchain’s bin directory in your PATH, such as:
+
<syntaxhighlight lang="bash">
+
export PATH=/opt/FriendlyARM/toolchain/11.3-aarch64/bin/:$PATH
+
</syntaxhighlight>
+
* 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"
+
 
|-
 
|-
| kernel.img
+
  | [[File:Openwrt-icon.svg|frameless|40px]]
| resource.img
+
  | rk3588-XYZ-friendlywrt-21.02-YYYYMMDD.img.gz
| <del>boot.img This img is deprecated</del>
+
  | 21.02
| The kernel modules are located in the out-modules directory
+
  | [[How to Build FriendlyWrt|FriendlyWrt]], based on OpenWrt 21.02, kernel version 5.10.y
|}
+
Installing the kernel: <br>
+
Please click on [[#Download u-boot and the kernel to the target board]]<br>
+
====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"
+
 
|-
 
|-
| uboot.img
+
  | [[File:Openwrt-icon.svg|frameless|40px]]
| rk356x_spl_loader_v1.15.112.bin (Before packaging, you need to rename it to MiniLoaderAll.bin)
+
  | rk3588-XYZ-friendlywrt-21.02-docker-YYYYMMDD.img.gz
 +
  | 21.02
 +
  | [[How to Build FriendlyWrt|FriendlyWrt]] with Docker, based on OpenWrt 21.02, kernel version 5.10.y
 +
|-
 +
  | [[File:Openwrt-icon.svg|frameless|40px]]
 +
  | rk3588-XYZ-friendlywrt-22.03-YYYYMMDD.img.gz
 +
  | 22.03
 +
  | [[How to Build FriendlyWrt|FriendlyWrt]], based on OpenWrt 22.03, kernel version 5.10.y
 +
|-
 +
  | [[File:Openwrt-icon.svg|frameless|40px]]
 +
  | rk3588-XYZ-friendlywrt-22.03-docker-YYYYMMDD.img.gz
 +
  | 22.03
 +
  | [[How to Build FriendlyWrt|FriendlyWrt]] with Docker, based on OpenWrt 22.03, kernel version 5.10.y
 +
|-
 +
  | colspan=3 | '''Other Image'''
 +
|-
 +
  | [[File:Openwrt-icon.svg|frameless|40px]]
 +
  | Github Actions - FriendlyWrt
 +
  | 21.02,22.03
 +
  | [https://github.com/friendlyarm/Actions-FriendlyWrt/releases FriendlyWrt]
 +
|-
 +
  | [[File:Linux-tux.svg|frameless|40px]]
 +
  | rk3588-eflasher-multiple-os-YYYYMMDD-25g.img.gz
 +
  | -
 +
  | A collection of multiple OS, you need to connect a monitor and mouse, and select which OS you want to flash on the interface
 
|}
 
|}
Installing the u-boot: <br>
+
====Tools====
Please click on [[#Download u-boot and the kernel to the target board]]<br>
+
Visit [http://download.friendlyelec.com/{{#replace:{{#replace:{{BASEPAGENAME}}| |}}|/zh|}} download link] to download tools (in the "05_Tools" directory).<br />
 
+
{| class="wikitable"
====Download u-boot and the kernel to the target board====
+
|-
=====Download to the installed system=====
+
  ! Filename
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:
+
   ! Description
* The SD/TF Card device node: /dev/mmcblk0 <br />
+
|-
* The eMMC device node: /dev/mmcblk2 <br />
+
   | win32diskimager.rar
The following is an example of how to update the kernel to eMMC:<br />
+
   | This program is designed to write a raw disk image to a removable device or backup a removable device to a raw image file
Use the 'parted' command to view the partition layout:
+
<syntaxhighlight lang="bash">
+
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:
+
 
+
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
+
</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 />
+
<br />
+
"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 />
+
* Building of bootable SD card images<br />
+
* Simple compilation of kernel, U-Boot, and third-party drivers<br />
+
Please click on the following link to find out more:
+
{| class="wikitable"
+
 
|-
 
|-
! Kernel version
+
  | SD Card Formatter
! Build toolset
+
  | A program (application) that allows easy and quick clear the SD card
 
|-
 
|-
| linux v5.10.y
+
  | RKDevTool_Release_v2.84.zip
| [https://github.com/friendlyarm/sd-fuse_rk3568/tree/master<br /> sd-fuse_rk3568]
+
  | Rockchip flashing tool, for USB upgrade
 
|}
 
|}
=====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 09:45, 1 August 2023

1 Downloads

1.1 Official image

Visit download link to download official image files (in the "01_Official images" directory).
The table below lists all official image, in the table, the word 'XYZ' in image filename meaning:

  • sd: SD card image, use to create a bootable SD card
  • eflasher: SD-to-eMMC image, use to flash image from SD to eMMC
  • usb: USB upgrade image, use to flash image to eMMC via USB
Icon Image Filename Version Description
Android-icon.svg rk3588-XYZ-androidtv-YYYYMMDD.img.zip 12 Android 12 TV
Android-icon.svg rk3588-XYZ-android12-YYYYMMDD.img.zip 12 Android 12 Tablet
Debian-icon.svg rk3588-XYZ-debian-bullseye-core-5.10-arm64-YYYYMMDD.img.gz bullseye Debian 11 Core, command line only, kernel version 5.10.y
Debian-icon.svg rk3588-XYZ-debian-bullseye-minimal-5.10-arm64-YYYYMMDD.img.gz bullseye Debian 11 Desktop, Xfce desktop, no pre-installed recommended software, supports HW acceleration, kernel version 5.10.y
Debian-icon.svg rk3588-XYZ-debian-bullseye-desktop-5.10-arm64-YYYYMMDD.img.gz bullseye Debian 11 Desktop, Xfce desktop, pre-installed mpv, smplayer and chromium brower, supports HW acceleration, kernel version 5.10.y
Ubuntu-icon.svg rk3588-XYZ-ubuntu-focal-desktop-5.10-arm64-YYYYMMDD.img.gz focal Ubuntu 20.04 Desktop, LXQT desktop, pre-installed mpv, smplayer and chromium brower, supports HW acceleration, kernel version 5.10.y
Ubuntu-icon.svg rk3588-XYZ-ubuntu-jammy-desktop-5.10-arm64-YYYYMMDD.img.gz jammy Ubuntu 22.04 with GNOME and Wayland with recommended software, kernel version 5.10.y
Ubuntu-icon.svg rk3588-XYZ-ubuntu-jammy-minimal-5.10-arm64-YYYYMMDD.img.gz jammy Lightweight Ubuntu 22.04 with GNOME and Wayland, kernel version 5.10.y
Ubuntu-icon.svg rk3588-XYZ-ubuntu-jammy-x11-desktop-arm64-YYYYMMDD.img.gz jammy Ubuntu 22.04 with Xubuntu and X11, use Panfrost GPU driver, kernel version 5.10.y
Ubuntu-icon.svg rk3588-XYZ-friendlycore-focal-5.10-arm64-YYYYMMDD.img.gz focal FriendlyCore,command line only, pre-installed Qt5, based on Ubuntu core 20.04, kernel version 5.10.y
Openwrt-icon.svg rk3588-XYZ-friendlywrt-21.02-YYYYMMDD.img.gz 21.02 FriendlyWrt, based on OpenWrt 21.02, kernel version 5.10.y
Openwrt-icon.svg rk3588-XYZ-friendlywrt-21.02-docker-YYYYMMDD.img.gz 21.02 FriendlyWrt with Docker, based on OpenWrt 21.02, kernel version 5.10.y
Openwrt-icon.svg rk3588-XYZ-friendlywrt-22.03-YYYYMMDD.img.gz 22.03 FriendlyWrt, based on OpenWrt 22.03, kernel version 5.10.y
Openwrt-icon.svg rk3588-XYZ-friendlywrt-22.03-docker-YYYYMMDD.img.gz 22.03 FriendlyWrt with Docker, based on OpenWrt 22.03, kernel version 5.10.y
Other Image
Openwrt-icon.svg Github Actions - FriendlyWrt 21.02,22.03 FriendlyWrt
Linux-tux.svg rk3588-eflasher-multiple-os-YYYYMMDD-25g.img.gz - A collection of multiple OS, you need to connect a monitor and mouse, and select which OS you want to flash on the interface

1.2 Tools

Visit download link to download tools (in the "05_Tools" directory).

Filename Description
win32diskimager.rar This program is designed to write a raw disk image to a removable device or backup a removable device to a raw image file
SD Card Formatter A program (application) that allows easy and quick clear the SD card
RKDevTool_Release_v2.84.zip Rockchip flashing tool, for USB upgrade