Difference between revisions of "APITestPage/zh"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
 
(59 intermediate revisions by the same user not shown)
Line 1: Line 1:
===Setup Development Environment===
+
 
====Using Docker to Cross-Compile====
+
{{RockchipUnbrick/zh|NanoPC-T6}}
Please refre to [https://github.com/friendlyarm/docker-cross-compiler-novnc docker-cross-compiler-novnc]
+
====Build a cross-compiling environment====
+
=====Install required packages=====
+
Install and run requirements ubuntu 20.04, install required packages using the following commands:
+
<syntaxhighlight lang="bash">
+
sudo apt-get -y update
+
sudo apt-get install -y sudo curl
+
sudo bash -c \
+
  "$(curl -fsSL https://raw.githubusercontent.com/friendlyarm/build-env-on-ubuntu-bionic/master/install.sh)"
+
</syntaxhighlight>
+
The following cross-compilers will be installed:
+
{| class="wikitable"
+
|-
+
! Version
+
! Architecture
+
! Compiler path
+
! Purpose
+
|-
+
| 4.9.3
+
| armhf
+
| /opt/FriendlyARM/toolchain/4.9.3
+
| Used for compiling 32-bit ARM applications
+
|-
+
| 6.4
+
| aarch64
+
| /opt/FriendlyARM/toolchain/6.4-aarch64
+
| Used for cross-compiling kernel 4.4
+
|-
+
| 11.3
+
| aarch64
+
| /opt/FriendlyARM/toolchain/11.3-aarch64
+
| Used for cross-compiling kernel 4.19 and above (including 5.10, 5.15) and U-Boot
+
|}
+
=====Setting Cross Compiler=====
+
Based on the table in the previous section, select the appropriate version of the compiler and add the compiler's path to PATH. For example, if you want to use the 11.3 cross-compiler, edit ~/.bashrc using vi and add the following content to the end:
+
<syntaxhighlight lang="bash">
+
export PATH=/opt/FriendlyARM/toolchain/11.3-aarch64/bin:$PATH
+
export GCC_COLORS=auto
+
</syntaxhighlight>
+
Run the ~/.bashrc script to make it effective in the current commandline. Note: there is a space after ".":
+
<syntaxhighlight lang="bash">
+
. ~/.bashrc
+
</syntaxhighlight>
+
To verify if the installation was successful:
+
<syntaxhighlight lang="bash">
+
$ aarch64-linux-gcc -v
+
Using built-in specs.
+
COLLECT_GCC=aarch64-linux-gcc
+
COLLECT_LTO_WRAPPER=/opt/FriendlyARM/toolchain/11.3-aarch64/libexec/gcc/aarch64-cortexa53-linux-gnu/11.3.0/lto-wrapper
+
Target: aarch64-cortexa53-linux-gnu
+
Configured with: /home/cross/arm64/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=aarch64-cortexa53-linux-gnu --prefix=/opt/FriendlyARM/toolchain/11.3-aarch64 --exec_prefix=/opt/FriendlyARM/toolchain/11.3-aarch64 --with-sysroot=/opt/FriendlyARM/toolchain/11.3-aarch64/aarch64-cortexa53-linux-gnu/sysroot --enable-languages=c,c++ --enable-fix-cortex-a53-843419 --with-arch=armv8-a+crypto+crc --with-cpu=cortex-a53 --with-pkgversion=ctng-1.25.0-119g-FA --with-bugurl=http://www.friendlyelec.com/ --enable-objc-gc --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --disable-libmpx --with-gmp=/home/cross/arm64/buildtools --with-mpfr=/home/cross/arm64/buildtools --with-mpc=/home/cross/arm64/buildtools --with-isl=/home/cross/arm64/buildtools --enable-lto --enable-threads=posix --disable-libstdcxx-pch --enable-clocale=gnu --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-indirect-function --enable-gnu-unique-object --enable-default-pie --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-gold --with-libintl-prefix=/home/cross/arm64/buildtools --disable-multilib --with-local-prefix=/opt/FriendlyARM/toolchain/11.3-aarch64/aarch64-cortexa53-linux-gnu/sysroot --enable-long-long --enable-checking=release --enable-link-serialization=2
+
Thread model: posix
+
Supported LTO compression algorithms: zlib
+
gcc version 11.3.0 (ctng-1.25.0-119g-FA)
+
</syntaxhighlight>
+

Latest revision as of 07:13, 4 June 2024

1 救砖办法

如何固件没有正确安装,导致开发板变砖,而且可能没有机会通过SD卡重新安装固件,这时,就需要进入Maskrom模式,通过擦除存储设备的办法救砖。

1.1 Windows用户

1.1.1 下载所需文件

  • 获取所需工具:访问这里,在 05_Tools 目录中找到 RKDevTool_v3.19_for_window.zip, DriverAssitant_v5.12.zip 下载到本地
  • 安装Rockchip USB驱动和RKDevTool: 解压 DriverAssitant_v5.12.zip 安装Rockchip USB驱动, 解压 RKDevTool_v3.19_for_window.zip 获得 Rockchip烧写工具 RKDevTool
  • 获取loader: 访问这里,进入CPU型号对应的tools目录,下载 MiniLoaderAll.bin

1.1.2 进入Maskrom模式擦除存储设备

  • 在电脑上启动 RKDevTool
  • 按住Mask按键不放, 插上电源, 保持按住Mask键, 状态灯亮起3秒后即可松开
  • 用USB C-to-A数据线, 将NanoPC-T6与电脑进行连接, 连接到NanoPC-T6的USB C接口

T6LTS-usbflash.jpg

  • 正常情况下,界面下方会显示 Found One MASKROM Device, 如下图所示:

Rkdevtool found one maskrom device.png

  • RKDevTool 界面上点击 Advanced Function 选项卡
  • Boot 编辑框中选择 MiniLoaderAll.bin,然后点击 Download 按钮
  • 选中 EMMC,点 Switch Storage,再点击 ErashAll 按钮擦除eMMC

Rkdevtool erase emmc.png

  • (可选): 如果你的NanoPC-T6上有SPI Nor Flash,选中 SPINOR, 点 Switch Storage,再点击 ErashAll 按钮擦除SPI Nor Flash

Rkdevtool erase spinorflash.png

  • 至此,NanoPC-T6恢复至初始状态,可以正常通过SD卡或eMMC引导系统了

1.2 Linux

1.2.1 下载所需文件

  • 获取所需工具:访问这里,在 05_Tools 目录中找到 upgrade_tool_v2.30_for_linux.tgz 下载到本地
  • 获取loader: 访问这里,进入CPU型号对应的tools目录,下载 MiniLoaderAll.bin

1.2.2 安装upgrade_tool工具

输入如下命令:

tar xzf upgrade_tool_v2.30_for_linux.tgz
cd upgrade_tool_v2.30_for_linux
sudo cp upgrade_tool /usr/local/sbin/
sudo chmod 755 /usr/local/sbin/upgrade_tool

1.2.3 进入Maskrom模式擦除存储设备

  • 使用USB数据线将NanoPC-T6与电脑相连接
  • 将NanoPC-T6断开电源,按住 MASK 键,连接电源,4秒后松开按键
  • 用如下命令检查连接:
upgrade_tool LD

显示类似 "DevNo=1 Vid=0x2207,Pid=0x350b,LocationID=13 Mode=Maskrom SerialNo=" 的内容表示已检测到设备。

  • 用如下命令擦除eMMC:
upgrade_tool EF MiniLoaderAll.bin
  • (可选): 如果你的NanoPC-T6上有SPI Nor Flash,用如下命令擦除SPI Nor Flash:
upgrade_tool DB MiniLoaderAll.bin
upgrade_tool SSD   #选5, SPINOR
dd if=/dev/zero of=zero.img bs=1M count=16   # 针对16M NOR FLASH
upgrade_tool WL 0 zero.img
  • 至此,NanoPC-T6恢复至初始状态,可以正常通过SD卡或eMMC引导系统了

1.3 Mac Users

我们测试发现Mac下的upgrade_tool_v2.25无法正常工作,因此建议使用Windows和Linux,除非获得了更新版本的upgrade_tool。