Difference between revisions of "APITestPage"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
(updated by API)
 
(121 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[How to use overlay fs on Linux|English]]
 
  
==什么是OverlayFS==
+
{{RockchipUnbrick|NanoPC-T4}}
Overlayfs是Linux下的一种堆叠文件系统,通俗地讲,根文件系统虽然在逻辑仍然是一个分区,但物理上被拆分成了两个分区来存储,其中,一个分区只读存放固化的系统数据(rootfs分区),另一个分区存储写入的数据(data分区),优点如下:<br />
+
1) 方便恢复出厂设置,格式化data分区即可;<br />
+
2) 避免重复掉电或异常掉电导致data分区挂载异常无法进入系统,由于rootfs是只读的,此时仍可以进入系统,方便维护升级;<br />
+
==哪些平台与系统支持OverlayFS==
+
===支持的硬件平台===
+
H3, H5, S5P4418, S5P6818, RK3399系列开发板
+
===支持的软件平台===
+
FriendlyCore, FriendlyDesktop, Lubuntu
+
==如何鉴别系统是否工作在OverlayFS==
+
执行df命令,如果/分区挂载类型为 overlay,表示OverlayFS正在工作:
+
<syntaxhighlight lang="bash">
+
pi@NanoPi-M1-Plus:~$ df
+
Filesystem    1K-blocks    Used Available Use% Mounted on
+
udev              474848      0    474848  0% /dev
+
tmpfs            102304    3564    98740  4% /run
+
overlay        28925547 1315493  26112465  5% /
+
tmpfs            511512      0    511512  0% /dev/shm
+
tmpfs              5120      4      5116  1% /run/lock
+
tmpfs            511512      0    511512  0% /sys/fs/cgroup
+
/dev/mmcblk0p1    40862  11852    29010  30% /boot
+
tmpfs            102304      0    102304  0% /run/user/1000
+
</syntaxhighlight>
+
==使用OverlayFS时的分区布局==
+
会有三个分区,分别为 rootfs分区、data分区与boot分区,对应映像文件rootfs.img, userdata.img 和 boot.img:
+
<syntaxhighlight lang="bash">
+
root@NanoPi-M1-Plus:~# lsblk /dev/mmcblk0
+
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
+
mmcblk0    179:0    0 29.7G  0 disk
+
|-mmcblk0p2 179:2    0  1.2G  0 part
+
|-mmcblk0p3 179:3    0 28.5G  0 part
+
`-mmcblk0p1 179:1    0  40M  0 part /boot
+
</syntaxhighlight>
+
其中,rootfs分区存放固化的系统数据,所有对根目录的数据写入,都会写入到 data分区。
+
==使用OverlayFS实现恢复出厂设置功能==
+
在内核命令行参数中加入 wipedata=yes,S5P4418与S5P6818平台可以在系统运行时进行修改:
+
===设置下次开机时抹掉data分区的数据(即恢复出厂设置)===
+
<syntaxhighlight lang="bash">
+
sudo fw_setenv bootargs "`cat /proc/cmdline` wipedata=yes"
+
sudo reboot
+
</syntaxhighlight>
+
===开机时不再抹掉data分区===
+
<syntaxhighlight lang="bash">
+
sudo fw_setenv bootargs "`cat /proc/cmdline` wipedata=no"
+
sudo reboot
+
</syntaxhighlight>
+
其他平台需要根据BSP提供的方法进行kernel command line修改,也可以开机进入uboot命令行进行设置。
+
==临时禁用OverlayFS==
+
可以做完TF启动卡之后,用 fdisk 操作TF卡,删除 data 分区。
+

Latest revision as of 09:23, 4 June 2024

1 Unbricking Method

If the ROM is not installed correctly, causing the development board to become bricked, and you might not have the opportunity to reinstall the ROM via an SD card, you need to enter Maskrom mode to unbrick it by erasing the storage device.

1.1 Windows Users

1.1.1 Download Required Files

  • Get the necessary tools: Visit here, find RKDevTool_v3.19_for_window.zip and DriverAssitant_v5.12.zip in the 05_Tools directory, and download them to your local machine.
  • Install Rockchip USB driver and RKDevTool: Extract DriverAssitant_v5.12.zip to install the Rockchip USB driver, and extract RKDevTool_v3.19_for_window.zip to obtain the Rockchip flashing tool RKDevTool.
  • Get the loader: Visit here, enter the tools directory corresponding to your CPU model, and download MiniLoaderAll.bin.

1.1.2 Enter Maskrom Mode to Erase the Storage Device

  • Connect NanoPC-T4 to your computer using a USB data cable.
  • Start RKDevTool on your computer.
  • Disconnect the power from NanoPC-T4, hold down the MASK button, connect the power, and release the button when you see Found One MASKROM Device displayed at the bottom of the interface, as shown below:

Rkdevtool found one maskrom device.png

  • Click the Advanced Function tab in the RKDevTool interface.
  • In the Boot text box, select MiniLoaderAll.bin, then click the Download button.
  • Select EMMC, click Switch Storage, then click the EraseAll button to erase the eMMC.

Rkdevtool erase emmc.png

  • At this point, NanoPC-T4 is restored to its initial state and can be normally booted via SD card or eMMC.

1.2 Linux/Mac Users

1.2.1 Download the Required Files

  • Get the necessary tools: Visit here and find upgrade_tool_v2.30_for_linux.tgz (or for Mac users, select upgrade_tool_v2.25_for_mac.tgz) in the 05_Tools directory and download it locally.
  • Get the loader: Visit here, enter the tools directory corresponding to your CPU model, and download MiniLoaderAll.bin.

1.2.2 Installation for upgrade_tool

The following commands are for Linux, with only slight differences in file and directory names for Mac users:

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 Enter Maskrom Mode to Erase the Storage Device

  • Connect NanoPC-T4 to the computer using a USB data cable.
  • Disconnect the power from NanoPC-T4, hold down the MASK button, connect the power, and release the button after 4 seconds.
  • Check the connection with the following command:
upgrade_tool LD

A result similar to "DevNo=1 Vid=0x2207,Pid=0x350b,LocationID=13 Mode=Maskrom SerialNo=" indicates that the device has been detected.

  • Erase the eMMC with the following command:
upgrade_tool EF MiniLoaderAll.bin
  • At this point, NanoPC-T4 has been restored to its initial state and can boot the system normally via SD card or eMMC.