Difference between revisions of "APITestPage/zh"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
Line 1: Line 1:
===Build u-boot and kernel===
+
====Flash to TF====
====Kernel and u-boot versions====
+
Visit [http://download.friendlyelec.com/{{#replace:{{#replace:{{BASEPAGENAME}}| |}}|/zh|}} download link]to download image files (in the "01_Official images/01_SD card images" directory) and utilities (in the "05_Tools" directory):<br />
{| class="wikitable"  
+
{| class="wikitable"
 
|-
 
|-
! Operating System
+
  | colspan=3 | '''Image Files'''
! Kernel Version
+
! U-boot version
+
! Cross-compiler
+
! Partition type
+
! Packaging Tool
+
! Kernel branch
+
! Kernel configuration
+
! U-boot branch
+
! U-boot configuration
+
 
|-
 
|-
| buildroot
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
| rowspan="12" | linux v5.10.y
+
  | rk3588-sd-friendlywrt-21.02-YYYYMMDD.img.gz
| rowspan="12" | u-boot <br />v2017.09
+
  | [[How to Build FriendlyWrt|FriendlyWrt]] lite image file, based on OpenWrt 21.02, kernel version 5.10.y
| rowspan="12" | 11.3-aarch64
+
| rowspan="12" | [https://github.com/friendlyarm/sd-fuse_rk3588/blob/master/prebuilt/parameter.template GPT]
+
| rowspan="12" | [https://github.com/friendlyarm/sd-fuse_rk3588/tree/master sd-fuse]
+
| rowspan="12" | [https://github.com/friendlyarm/kernel-rockchip/tree/nanopi5-v5.10.y_opt nanopi5-v5.10.y_opt]
+
| rowspan="8" | nanopi6_linux_defconfig
+
| rowspan="12" | [https://github.com/friendlyarm/uboot-rockchip/tree/nanopi6-v2017.09 nanopi6-v2017.09]
+
| rowspan="12" | rk3588_defconfig
+
 
|-
 
|-
| ubuntu-jammy-desktop-arm64
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
 +
  | rk3588-sd-friendlywrt-21.02-docker-YYYYMMDD.img.gz
 +
  | [[How to Build FriendlyWrt|FriendlyWrt]] with Docker image file, based on OpenWrt 21.02, kernel version 5.10.y
 
|-
 
|-
| ubuntu-jammy-minimal-arm64
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
 +
  | rk3588-sd-friendlywrt-22.03-YYYYMMDD.img.gz
 +
  | [[How to Build FriendlyWrt|FriendlyWrt]] lite image file, based on OpenWrt 22.03, kernel version 5.10.y
 
|-
 
|-
| friendlycore-focal-arm64
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
 +
  | rk3588-sd-friendlywrt-22.03-docker-YYYYMMDD.img.gz
 +
  | [[How to Build FriendlyWrt|FriendlyWrt]] with Docker image file, based on OpenWrt 22.03, kernel version 5.10.y
 
|-
 
|-
| debian-bullseye-core-arm64
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
 +
  | rk3588-sd-androidtv-YYYYMMDD.img.zip
 +
  | Android 12 TV
 
|-
 
|-
| debian-bullseye-desktop-arm64
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
 +
  | rk3588-sd-android12-YYYYMMDD.img.zip
 +
  | Android 12 Tablet
 
|-
 
|-
| debian-bullseye-minimal-arm64
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
 +
  | rk3588-sd-debian-bullseye-core-5.10-arm64-YYYYMMDD.img.gz
 +
  | Debian 11(Bullseye) Core, no desktop environment, command line only, kernel version 5.10.y
 
|-
 
|-
| debian-buster-desktop-arm64
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
 +
  | rk3588-sd-debian-bullseye-minimal-5.10-arm64-YYYYMMDD.img.gz
 +
  | Debian 11(Bullseye) Desktop, uses Xfce as default desktop, no pre-installed recommended software, supports hardware acceleration, kernel version 5.10.y
 
|-
 
|-
| friendlywrt21
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
| rowspan="4" | nanopi6_linux_defconfig<br />friendlywrt.config
+
  | rk3588-sd-debian-bullseye-desktop-5.10-arm64-YYYYMMDD.img.gz
 +
  | Debian 11(Bullseye) Desktop, uses Xfce as default desktop, pre-installed mpv, smplayer and chromium brower, supports hardware acceleration, kernel version 5.10.y
 
|-
 
|-
| friendlywrt21-docker
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
 +
  | rk3588-sd-ubuntu-focal-desktop-5.10-arm64-YYYYMMDD.img.gz
 +
  | Ubuntu20.04(Focal) Desktop, uses LXQT as default desktop, pre-installed mpv, smplayer and chromium brower, supports hardware acceleration, kernel version 5.10.y
 
|-
 
|-
| friendlywrt22
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
 +
  | rk3588-sd-ubuntu-jammy-desktop-5.10-arm64-YYYYMMDD.img.gz
 +
  | Ubuntu 22.04 with GNOME and Wayland, pre-installed web browser and other recommended software, kernel version 5.10.y
 
|-
 
|-
| friendlywrt22-docker
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
|}
+
  | rk3588-sd-ubuntu-jammy-minimal-5.10-arm64-YYYYMMDD.img.gz
* Kernel git repo:https://github.com/friendlyarm/kernel-rockchip
+
  | Lightweight Ubuntu 22.04 with GNOME and Wayland, recommended software is not included, kernel version 5.10.y
* U-boot git repo:https://github.com/friendlyarm/uboot-rockchip
+
* 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_rk3588/tree/master sd-fuse] is a  helper script to make bootable SD card image.
+
====Build kernel linux-v5.10.y====
+
Clone the repository to your local drive then build:
+
<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
+
# Load default configuration
+
make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 nanopi6_linux_defconfig
+
# Optionally, load configuration for FriendlyWrt
+
# make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 nanopi6_linux_defconfig friendlywrt.config
+
# Optionally, if you want to change the default kernel config
+
# make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 menuconfig
+
# Start building kernel
+
make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 nanopi6-images -j$(nproc)
+
# Start building kernel 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>
+
The generated files:
+
{| class="wikitable"
+
 
|-
 
|-
| kernel.img
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
| resource.img
+
  | rk3588-sd-ubuntu-jammy-x11-desktop-arm64-YYYYMMDD.img.gz
| <del>boot.img This img is deprecated</del>
+
  | Ubuntu 22.04 with Xubuntu and X11, pre-installed Panfrost GPU driver and other recommended software, kernel version 5.10.y
| The kernel modules are located in the out-modules directory
+
|}
+
Run your build: <br>
+
Please click on [[#Running the build]]<br>
+
====Build u-boot v2017.09====
+
Clone the repository to your local drive then build:
+
<syntaxhighlight lang="bash">
+
git clone https://github.com/friendlyarm/rkbin --single-branch --depth 1 -b nanopi6
+
git clone https://github.com/friendlyarm/uboot-rockchip --single-branch --depth 1 -b nanopi6-v2017.09
+
export PATH=/opt/FriendlyARM/toolchain/11.3-aarch64/bin/:$PATH
+
cd uboot-rockchip/
+
./make.sh nanopi6
+
</syntaxhighlight>
+
After the compilation, the following files will be generated:
+
{| class="wikitable"
+
 
|-
 
|-
| uboot.img
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
| rk3588_spl_loader_v1.08.111.bin (aka MiniLoaderAll.bin)
+
  | rk3588-sd-friendlycore-focal-5.10-arm64-YYYYMMDD.img.gz
|}
+
   | 64-bit FriendlyCore image file,pre-installed Qt5, based on Ubuntu core 20.04, kernel version 5.10.y
Run your build: <br>
+
|-
Please click on [[#Running the build]]<br>
+
  | colspan=3 | '''Other Image'''
 
+
|-
====Running your AOSP build====
+
  | [[File:WiringNP-GPIO-ALL.jpg|frameless|40px]]
=====Install to target board=====
+
  | Github Actions
RK3588 uses GPT partitions by default, you can use the dd command, but be careful to choose the right output device:
+
  | [https://github.com/friendlyarm/Actions-FriendlyWrt/releases FriendlyWrt]
* The SD/TF Card device node: /dev/mmcblk0 <br />
+
* The eMMC device node: /dev/mmcblk2 <br />
+
<br />
+
Use the 'parted' command to view the partition layout:
+
<syntaxhighlight lang="bash">
+
parted /dev/mmcblk2 print
+
</syntaxhighlight>
+
Sample outputs:
+
<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.
+
 
+
=====Packaging and creating an SD image=====
+
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
+
  | colspan=3 | '''Flash Utility:'''
! Packaging Tool
+
 
|-
 
|-
| linux v5.10.y
+
  |  
| [https://github.com/friendlyarm/sd-fuse_rk3588/tree/master sd-fuse_rk3588]
+
  | win32diskimager.rar
 +
  | Windows utility. Under Linux users can use "dd"
 
|}
 
|}
=====USB flashing=====
+
The detailed steps are as follows:<br />
======Linux======
+
* Get an 8G SDHC card and backup its data if necessary;
To flash U-Boot and kernel using the "upgrade_tool" tool, please use the following command:
+
* Download and extract the xxx.img.gz and win32diskimager;
<syntaxhighlight lang="bash">
+
* Run the win32diskimager utility under Windows as administrator. On the utility's main window select your SD card's drive, the wanted image file and click on "write" to start flashing the SD card. Under Linux run "dd" to flash the rkXXXX-sd-OSNAME-YYYYMMDD.img file to your SD card;
sudo upgrade_tool ul MiniLoaderAll.bin
+
* Take out the SD and insert it to {{{1}}}'s microSD card slot;
sudo upgrade_tool di -p parameter.txt
+
* Power on {{{1}}} and it will be booted from your TF card;
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).
+
===Building AOSP from source===
+
====Download source from the netdrive====
+
Netdisk URL: [http://download.friendlyelec.com/{{#replace:{{#replace:{{BASEPAGENAME}}| |}}|/zh|}} Click here]<br />
+
File location on netdisk:"07_Source codes/rk35xx-android12-xxxxxxx-YYYYMMDD.tgz" (YYYYMMDD represents the date of the package, and xxxxxxx represents the final commit-id)<br />
+
Unzip and fetch updates:
+
<syntaxhighlight lang="bash">
+
tar xzf '/path/to/netdisk/07_Source codes/rk35xx-android12-xxxxxxx-YYYYMMDD.tgz'
+
cd rk35xx-android12
+
git pull
+
</syntaxhighlight>
+
====Tablet profile build====
+
<syntaxhighlight lang="bash">
+
echo "ROCKCHIP_DEVICE_DIR := device/rockchip/rk3588/nanopi6" > .rockchip_device.mk
+
# export INSTALL_GAPPS_FOR_TESTING=yes  # include google apps
+
. setenv.sh
+
./build.sh -FMu
+
</syntaxhighlight>
+
====TV profile build====
+
<syntaxhighlight lang="bash">
+
echo "ROCKCHIP_DEVICE_DIR := device/rockchip/rk3588/nanopi6_box" > .rockchip_device.mk
+
# export INSTALL_GAPPS_FOR_TESTING=yes  # include google apps
+
. setenv.sh
+
./build.sh -FMu
+
</syntaxhighlight>
+
====Running your AOSP build====
+
After the Android compilation is completed, the image file will be stored in the rockdev/Image-aosp_nanopi3 subdirectory of the Android source code directory.
+
=====USB Flashing=====
+
Use the rockchip tool to flash the following file: rockdev/Image-aosp_nanopi3/update.img
+
=====SD-to-eMMC Flashing=====
+
Refer to the following steps: <br />
+
1) Insert the SD card of the eflasher system into the host; <br />
+
2) Copy the files in the rockdev/Image-aosp_nanopi3 directory to the android12 or androidtv directory in the FRIENDLYARM partition of the SD card: <br />
+
<syntaxhighlight lang="bash">
+
sudo cp -af parameter.txt config.cfg MiniLoaderAll.bin uboot.img \
+
    dtbo.img vbmeta.img boot.img recovery.img \
+
    misc.img pcba_small_misc.img pcba_whole_misc.img \
+
    baseparameter.img super.img /media/$USER/FriendlyARM/android12
+
</syntaxhighlight>
+
3) Insert the SD card into {{{1}}} and re-flash; <br />
+
====Pack the new SD Image====
+
<syntaxhighlight lang="bash">
+
git clone https://github.com/friendlyarm/sd-fuse_rk3588.git
+
SDFUSE=$PWD/sd-fuse_rk3588
+
mkdir $SDFUSE/android12
+
 
+
cd /path/to/rk35xx-android12/rockdev/Image-aosp_nanopi3
+
cp -af parameter.txt config.cfg MiniLoaderAll.bin uboot.img \
+
    dtbo.img vbmeta.img boot.img recovery.img \
+
    misc.img pcba_small_misc.img pcba_whole_misc.img \
+
    baseparameter.img super.img $SDFUSE/android12
+
 
+
cd $SDFUSE/
+
./mk-sd-image.sh android12
+
 
+
tar xvzf /path/to/netdrive/03_Partition\ image\ files/emmc-flasher-images.tgz
+
./mk-emmc-image.sh android12
+
</syntaxhighlight>
+
For more information, please refer to [[#Packaging and creating an SD image]]<br>
+

Revision as of 06:03, 1 August 2023

Flash to TF

Visit download linkto download image files (in the "01_Official images/01_SD card images" directory) and utilities (in the "05_Tools" directory):

Image Files
WiringNP-GPIO-ALL.jpg rk3588-sd-friendlywrt-21.02-YYYYMMDD.img.gz FriendlyWrt lite image file, based on OpenWrt 21.02, kernel version 5.10.y
WiringNP-GPIO-ALL.jpg rk3588-sd-friendlywrt-21.02-docker-YYYYMMDD.img.gz FriendlyWrt with Docker image file, based on OpenWrt 21.02, kernel version 5.10.y
WiringNP-GPIO-ALL.jpg rk3588-sd-friendlywrt-22.03-YYYYMMDD.img.gz FriendlyWrt lite image file, based on OpenWrt 22.03, kernel version 5.10.y
WiringNP-GPIO-ALL.jpg rk3588-sd-friendlywrt-22.03-docker-YYYYMMDD.img.gz FriendlyWrt with Docker image file, based on OpenWrt 22.03, kernel version 5.10.y
WiringNP-GPIO-ALL.jpg rk3588-sd-androidtv-YYYYMMDD.img.zip Android 12 TV
WiringNP-GPIO-ALL.jpg rk3588-sd-android12-YYYYMMDD.img.zip Android 12 Tablet
WiringNP-GPIO-ALL.jpg rk3588-sd-debian-bullseye-core-5.10-arm64-YYYYMMDD.img.gz Debian 11(Bullseye) Core, no desktop environment, command line only, kernel version 5.10.y
WiringNP-GPIO-ALL.jpg rk3588-sd-debian-bullseye-minimal-5.10-arm64-YYYYMMDD.img.gz Debian 11(Bullseye) Desktop, uses Xfce as default desktop, no pre-installed recommended software, supports hardware acceleration, kernel version 5.10.y
WiringNP-GPIO-ALL.jpg rk3588-sd-debian-bullseye-desktop-5.10-arm64-YYYYMMDD.img.gz Debian 11(Bullseye) Desktop, uses Xfce as default desktop, pre-installed mpv, smplayer and chromium brower, supports hardware acceleration, kernel version 5.10.y
WiringNP-GPIO-ALL.jpg rk3588-sd-ubuntu-focal-desktop-5.10-arm64-YYYYMMDD.img.gz Ubuntu20.04(Focal) Desktop, uses LXQT as default desktop, pre-installed mpv, smplayer and chromium brower, supports hardware acceleration, kernel version 5.10.y
WiringNP-GPIO-ALL.jpg rk3588-sd-ubuntu-jammy-desktop-5.10-arm64-YYYYMMDD.img.gz Ubuntu 22.04 with GNOME and Wayland, pre-installed web browser and other recommended software, kernel version 5.10.y
WiringNP-GPIO-ALL.jpg rk3588-sd-ubuntu-jammy-minimal-5.10-arm64-YYYYMMDD.img.gz Lightweight Ubuntu 22.04 with GNOME and Wayland, recommended software is not included, kernel version 5.10.y
WiringNP-GPIO-ALL.jpg rk3588-sd-ubuntu-jammy-x11-desktop-arm64-YYYYMMDD.img.gz Ubuntu 22.04 with Xubuntu and X11, pre-installed Panfrost GPU driver and other recommended software, kernel version 5.10.y
WiringNP-GPIO-ALL.jpg rk3588-sd-friendlycore-focal-5.10-arm64-YYYYMMDD.img.gz 64-bit FriendlyCore image file,pre-installed Qt5, based on Ubuntu core 20.04, kernel version 5.10.y
Other Image
WiringNP-GPIO-ALL.jpg Github Actions FriendlyWrt
Flash Utility:
win32diskimager.rar Windows utility. Under Linux users can use "dd"

The detailed steps are as follows:

  • Get an 8G SDHC card and backup its data if necessary;
  • Download and extract the xxx.img.gz and win32diskimager;
  • Run the win32diskimager utility under Windows as administrator. On the utility's main window select your SD card's drive, the wanted image file and click on "write" to start flashing the SD card. Under Linux run "dd" to flash the rkXXXX-sd-OSNAME-YYYYMMDD.img file to your SD card;
  • Take out the SD and insert it to {{{1}}}'s microSD card slot;
  • Power on {{{1}}} and it will be booted from your TF card;