1 前言
用了许久的TF卡坏了,先使用手边的16G的U盘给树莓派做个系统。现在树莓派可以很方便的使用U盘做系统,我使用的工具是Raspberry Pi Images。我选择的烧录系统是:2022-04-04-raspios-bullseye-arm64,是目前最新的64位镜像。
Raspberry Pi Images 下载官网:www.raspberrypi.com/software/
本文的大纲如下:
- 使用U盘烧录系统,配置启动项,设置中文
- 给系统更换国内镜像源,提高下载速度
- 对完成初始化的系统进行Bench.sh和Unixbench测试
开始之前,如果您觉得本文不错,可以分享给你的朋友。让我们开始吧!
2 烧录系统
1.点击选择烧录镜像,下拉点击使用其他镜像。
2.选择你要烧录的设备,比如我下面选的U盘。
3.点击初始化设置,就可以直接连上WIFI和设置密码了。
4.点击烧录就可以,U盘确实比tf卡要快。
系统会自动扩容,ssh连接后,sudo raspi-config 把vnc打开。
然后,使用vnc连接,在树莓派系统设置里面改一下中文,然后重启,基本的初始化就搞完了。
然后我发现,新的系统镜像python2已经被删除了,输入python输出的就是python3.
python2终究还是被淘汰了。
3 更换镜像源
默认的镜像源的速度大概是2Mbps,换一个离自己近的镜像源,我这里选择中科大的镜像源。
Raspbian 软件源
sudo nano /etc/apt/sources.list
注释三行,增加下面三行。
deb https://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.ustc.edu.cn/debian-security bullseye-security main contrib non-free
archive.raspberrypi.org 软件源
sudo nano /etc/apt/sources.list.d/raspi.list
注释一行,增加下面一行
deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian/ bullseye main
PyPI 镜像源
新系统没有python2,pip就是原来的pip3
pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple
最后,sudo apt update
,更新软件列表
测试脚本Bench.sh
sudo wget -qO- bench.sh | bash
测试截图,供大家参考。
4 Unixbench跑分
环境说明
配置:树莓派400 ,4核4线程
内存:4GB
硬盘:usb3.0-闪迪16GB-U盘
系统:2022-04-04-raspios-bullseye-arm64
跑分
# 下载阿里云版本unixbench
wget https://github.com/aliyun/byte-unixbench/releases/download/v5.1.6/UnixBench-5.1.6.tar.gz
tar -zxvf UnixBench-5.1.6.tar.gz
cd UnixBench-5.1.6/UnixBench
./Run
大概1个小时左右,跑分结果(仅供参考):
------------------------------------------------------------------------
Benchmark Run: Sun May 08 2022 16:56:14 - 17:24:30
4 CPUs in system; running 1 parallel copy of tests
Dhrystone 2 using register variables 19686271.8 lps (10.0 s, 7 samples)
Double-Precision Whetstone 3220.7 MWIPS (9.9 s, 7 samples)
Execl Throughput 1891.0 lps (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 194928.1 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 58641.4 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 509358.2 KBps (30.0 s, 2 samples)
Pipe Throughput 198668.9 lps (10.0 s, 7 samples)
Pipe-based Context Switching 38667.0 lps (10.0 s, 7 samples)
Process Creation 3257.4 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 4075.1 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 1128.8 lpm (60.0 s, 2 samples)
System Call Overhead 160264.8 lps (10.0 s, 7 samples)
System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 19686271.8 1686.9
Double-Precision Whetstone 55.0 3220.7 585.6
Execl Throughput 43.0 1891.0 439.8
File Copy 1024 bufsize 2000 maxblocks 3960.0 194928.1 492.2
File Copy 256 bufsize 500 maxblocks 1655.0 58641.4 354.3
File Copy 4096 bufsize 8000 maxblocks 5800.0 509358.2 878.2
Pipe Throughput 12440.0 198668.9 159.7
Pipe-based Context Switching 4000.0 38667.0 96.7
Process Creation 126.0 3257.4 258.5
Shell Scripts (1 concurrent) 42.4 4075.1 961.1
Shell Scripts (8 concurrent) 6.0 1128.8 1881.3
System Call Overhead 15000.0 160264.8 106.8
========
System Benchmarks Index Score 439.0
------------------------------------------------------------------------
Benchmark Run: Sun May 08 2022 17:24:30 - 17:52:47
4 CPUs in system; running 4 parallel copies of tests
Dhrystone 2 using register variables 77585180.7 lps (10.0 s, 7 samples)
Double-Precision Whetstone 12823.4 MWIPS (9.9 s, 7 samples)
Execl Throughput 5157.5 lps (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 662582.3 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 228934.2 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 1108141.8 KBps (30.0 s, 2 samples)
Pipe Throughput 784852.7 lps (10.0 s, 7 samples)
Pipe-based Context Switching 122406.8 lps (10.0 s, 7 samples)
Process Creation 9142.2 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 9084.3 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 1194.7 lpm (60.1 s, 2 samples)
System Call Overhead 626201.7 lps (10.0 s, 7 samples)
System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 77585180.7 6648.3
Double-Precision Whetstone 55.0 12823.4 2331.5
Execl Throughput 43.0 5157.5 1199.4
File Copy 1024 bufsize 2000 maxblocks 3960.0 662582.3 1673.2
File Copy 256 bufsize 500 maxblocks 1655.0 228934.2 1383.3
File Copy 4096 bufsize 8000 maxblocks 5800.0 1108141.8 1910.6
Pipe Throughput 12440.0 784852.7 630.9
Pipe-based Context Switching 4000.0 122406.8 306.0
Process Creation 126.0 9142.2 725.6
Shell Scripts (1 concurrent) 42.4 9084.3 2142.5
Shell Scripts (8 concurrent) 6.0 1194.7 1991.2
System Call Overhead 15000.0 626201.7 417.5
========
System Benchmarks Index Score 1286.3
5 总结
树莓派400单核439分,还不错了,比主频1.5Ghz版本的树莓派4B相比强了大概10%左右。
python3.已经发版到3.10了,新镜像树莓派上去除了python2,树莓派上python2的时代已经彻底翻篇了
更换合适的镜像源,很多人推荐清华的镜像源,可能因为我这里距离清华太远了,速度拉胯,所以我一般都用中科大的镜像源。
用U盘做系统其实比用TF卡划算,64GB还不错的U盘比TF卡便宜了10元左右,而且U盘比较好售后。
如果你对本文有想说的观点,请留言给我,互相学习交流。
本作品采用知识共享署名-非商业性使用-禁止演绎4.0国际许可协议进行许可