20250519使用TF卡将NanoPi NEO core开发板刷机为Ubuntu core22.04.3系统完成之后执行poweroff自动关机
1、h3-sd-friendlycore-xenial-4.14-armhf-20210618.img.gz 在WIN10下使用7-ZIP解压缩/ubuntu20.04下使用tar
2、Win32DiskImager.exe 写如32GB的TF卡。【以管理员身份运行】
3、TF卡如果已经做过会有3个磁盘分区,可以使用SD Card Formatter/SDCardFormatterv5_WinEN.zip格式化TF卡。DiskGenius可以尝试。
制作好Ubuntu core22.04.3系统的IMG固件之后,还需要你编辑TF卡中的文件:
1、修改H:\eflasher.conf
autoStart=/mnt/sdcard/friendlycore-jammy
autoExit=true
2、root@NanoPi-NEO-Core:/opt# vi run-eflasher.sh
root@NanoPi-NEO-Core:/opt# cat run-eflasher.sh
poweroff
如果能够直接编辑IMG固件就好了。到时候写TF卡之后不需要每次都来编辑这两个文件。
20250519使用TF卡将NanoPi NEO core开发板刷机为Ubuntu core22.04.3系统完成之后执行poweroff自动关机
2025/5/19 15:38
缘起:在上电之后,TF卡将NanoPi NEO core开发板刷机之后自动关机,安全/保险一点。
【不会丢数据^_】
【你放心吧】生产线的工人只会问你插入TF卡之后上电几分钟刷机完成。【2分钟搞定】
不要想他们会去看DEBUG串口打印信息。
【切记,不需要在H:\eflasher.conf的autoStart项目之后手工输入autoExit项目。conf配置文件有/自带的。^_】
1、使用Win32DiskImager.exe写TF卡之后,将TF卡插入读卡器之后插入到WIN10/WIN11的电脑。
【理论上在ubuntu20.04.6下使用gedit修改也OK的。】
修改H:\eflasher.conf。【具体盘符H以您的电脑为准。^_不通的电脑肯定会变化的!】
C:\TF1emmc-jammy22.04\FriendlyARM\eflasher.conf
; This is the eFlasher configuration file.
; See http://wiki.friendlyarm.com/wiki/index.php/EFlasher for detailed information.
[General]
; Automate OS installation at system startup,
; Use the "autoStart" field to specify the image path or RAW image file,
; The RAW image file can be a gzip compressed file,
; The RAW image file extension must be ".raw" or ".gz",
; Available values: friendlycore-jammy
autoStart=friendlycore-jammy
; If the "autoExit" field set to true, the eflasher-gui will automatically exit after burning or restoring is completed,
; You can do something else after burning or restoring by modifying /opt/run-eflasher.sh.
autoExit=false
; Don't erase the flash before burning, useful if you only want to update part of the system files
disableLowFormatting=false
[UI]
; HDMI overscan option, examples:
; screenSizePercent=auto
; screenSizePercent=90
screenSizePercent=auto
welcomeMessage=
hideMenuButton=false
hideBackupAndRestoreButton=false
hideStatusBar=false
autoRebootWhenSDBeEjected=true
修改成为:
H:\eflasher.conf
; This is the eFlasher configuration file.
; See http://wiki.friendlyarm.com/wiki/index.php/EFlasher for detailed information.
[General]
; Automate OS installation at system startup,
; Use the "autoStart" field to specify the image path or RAW image file,
; The RAW image file can be a gzip compressed file,
; The RAW image file extension must be ".raw" or ".gz",
; Available values: friendlycore-jammy
autoStart=/mnt/sdcard/friendlycore-jammy
; If the "autoExit" field set to true, the eflasher-gui will automatically exit after burning or restoring is completed,
; You can do something else after burning or restoring by modifying /opt/run-eflasher.sh.
autoExit=true
; Don't erase the flash before burning, useful if you only want to update part of the system files
disableLowFormatting=false
[UI]
; HDMI overscan option, examples:
; screenSizePercent=auto
; screenSizePercent=90
screenSizePercent=auto
welcomeMessage=
hideMenuButton=false
hideBackupAndRestoreButton=false
hideStatusBar=false
autoRebootWhenSDBeEjected=true
2、将TF卡插入到NanoPi NEO core开发板,使用vi编辑run-eflasher.sh:【加入poweroff关机】
详细LOG:
root@NanoPi-NEO-Core:/# ll
total 72
drwxr-xr-x 19 root root 4096 Mar 20 14:32 ./
drwxr-xr-x 19 root root 4096 Mar 20 14:32 ../
drwxr-xr-x 2 root root 4096 Mar 20 14:32 Settings/
lrwxrwxrwx 1 root root 7 Aug 22 2023 bin -> usr/bin/
drwxr-xr-x 2 root root 4096 Apr 18 2022 boot/
drwxr-xr-x 14 root root 3860 Mar 20 14:32 dev/
drwxr-xr-x 65 root root 4096 Mar 20 14:32 etc/
drwxr-xr-x 3 root root 4096 Aug 22 2023 home/
lrwxrwxrwx 1 root root 7 Aug 22 2023 lib -> usr/lib/
drwx------ 2 root root 16384 Apr 2 2025 lost+found/
drwxr-xr-x 2 root root 4096 Aug 22 2023 media/
drwxr-xr-x 4 root root 4096 Mar 21 2025 mnt/
drwxr-xr-x 2 root root 4096 Nov 28 2024 opt/
dr-xr-xr-x 116 root root 0 Jan 1 1970 proc/
drwx------ 2 root root 4096 Mar 20 2023 root/
drwxr-xr-x 19 root root 520 Mar 20 14:32 run/
lrwxrwxrwx 1 root root 8 Aug 22 2023 sbin -> usr/sbin/
drwxr-xr-x 2 root root 4096 Aug 22 2023 srv/
dr-xr-xr-x 12 root root 0 Feb 11 2016 sys/
drwxrwxrwt 11 root root 4096 Mar 20 14:32 tmp/
drwxr-xr-x 11 root root 4096 Jul 16 2024 usr/
drwxr-xr-x 11 root root 4096 Aug 22 2023 var/
root@NanoPi-NEO-Core:/# cd opt/
root@NanoPi-NEO-Core:/opt# ll
total 3248
drwxr-xr-x 2 root root 4096 Nov 28 2024 ./
drwxr-xr-x 19 root root 4096 Mar 20 14:32 ../
-rwxr-xr-x 1 root root 3309892 Mar 19 2025 eflasher-gui*
-rwxr-xr-x 1 root root 80 Aug 25 2022 run-eflasher.sh*
root@NanoPi-NEO-Core:/opt#
root@NanoPi-NEO-Core:/opt#
root@NanoPi-NEO-Core:/opt# cp run-eflasher.sh /etc/
root@NanoPi-NEO-Core:/opt# ll
total 3248
drwxr-xr-x 2 root root 4096 Nov 28 2024 ./
drwxr-xr-x 19 root root 4096 Mar 20 14:32 ../
-rwxr-xr-x 1 root root 3309892 Mar 19 2025 eflasher-gui*
-rwxr-xr-x 1 root root 80 Aug 25 2022 run-eflasher.sh*
root@NanoPi-NEO-Core:/opt#
root@NanoPi-NEO-Core:/opt#
root@NanoPi-NEO-Core:/opt# vi run-eflasher.sh
root@NanoPi-NEO-Core:/opt#
root@NanoPi-NEO-Core:/opt#
root@NanoPi-NEO-Core:/opt# vi run-eflasher.sh
root@NanoPi-NEO-Core:/opt# ll
total 3248
drwxr-xr-x 2 root root 4096 Nov 28 2024 ./
drwxr-xr-x 19 root root 4096 Mar 20 14:32 ../
-rwxr-xr-x 1 root root 3309892 Mar 19 2025 eflasher-gui*
-rwxr-xr-x 1 root root 91 Mar 20 14:34 run-eflasher.sh*
root@NanoPi-NEO-Core:/opt# cat run-eflasher.sh
#!/bin/bash
. /usr/bin/setqt4env
cd /opt/
./eflasher-gui -qws >/dev/null 2>&1
poweroff
root@NanoPi-NEO-Core:/opt# sync
root@NanoPi-NEO-Core:/opt# sync
root@NanoPi-NEO-Core:/opt# poweroff
3、上电刷机的LOG:
【在黄灯快闪的时候,通过top可以看见:eflasher-+ 在工作ING中!】
[ OK ] Finished Permit User Sessions.
[ OK ] Started Serial Getty on ttyS0.
Starting Set console scheme...
[ OK ] Finished Set console scheme.
[ OK ] Created slice Slice /system/getty.
[ OK ] Finished Load/Save Random Seed.
[ OK ] Started OpenBSD Secure Shell server.
Ubuntu 22.04 LTS NanoPi-NEO-Core ttyS0
Default Login:
Username = pi
Password = pi
NanoPi-NEO-Core login: root
Password:
Last login: Mon Mar 20 14:32:28 UTC 2023 on ttyS0
root@NanoPi-NEO-Core:~# top
top - 14:32:38 up 0 min, 1 user, load average: 1.06, 0.27, 0.09
Tasks: 102 total, 2 running, 100 sleeping, 0 stopped, 0 zombie
%Cpu(s): 2.7 us, 13.6 sy, 0.0 ni, 53.6 id, 30.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 491.8 total, 32.8 free, 74.6 used, 384.4 buff/cache
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 401.8 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
374 root 20 0 102776 40396 19364 S 16.7 8.0 0:06.80 eflasher-+
515 root 20 0 5712 2068 1804 R 12.5 0.4 0:00.09 top
1 root 20 0 31656 7472 5728 S 0.0 1.5 0:05.45 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 I 0.0 0.0 0:00.00 kworker/0+
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0+
5 root 20 0 0 0 0 I 0.0 0.0 0:00.05 kworker/u+
6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu+
7 root 20 0 0 0 0 S 0.0 0.0 0:00.03 ksoftirqd+
8 root 20 0 0 0 0 I 0.0 0.0 0:00.09 rcu_sched
9 root 20 0 0 0 0 I 0.0 0.0 0:00.00 rcu_bh
10 root rt 0 0 0 0 S 0.0 0.0 0:00.03 migration+
11 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/0
12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/1
13 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration+
14 root 20 0 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd+
top - 14:32:41 up 0 min, 1 user, load average: 1.06, 0.27, 0.09
Tasks: 101 total, 2 running, 99 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.9 us, 13.0 sy, 0.0 ni, 80.1 id, 6.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 491.8 total, 26.3 free, 74.6 used, 390.9 buff/cache
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 401.5 avail Mem
4、完美谢幕/曲终人散,上电大概2分钟之后,你就可以看到TF卡旁边的红灯/黄灯都灭了!
【刷机完成了。拔卡,下一个!NEXT ^_】
如果你接入了串口,就可以在串口打印中看到NanoPi NEO core开发板执行关机步骤的LOG了。