使用树莓派3,将Debian镜像适配到多种架构上进行创建

首先

正如在Debian官方支持页面所提到的,Debian官方支持armel、armhf和arm64架构。
https://www.debian.org/ports/#portlist-released

根据阅读的资料,在2019年夏季计划中的Debian Buster中,Debian官方似乎将支持树莓派3(好像是以arm64版的形式)。树莓派3的Buster预览版已经发布了第二个版本。我们可以使用Windows和Win32 Disk Imager确认可以制作启动用的SD卡。

由于我无法等到Buster版本,所以根据Debian Wiki的指引,想要使用Stretch的arm64或armhf的人们可以尝试使用rpi23-gen-image进行实际制作和性能测试。

The result

虽然开始就得出结论可能不太有趣,但我比较了arm64版的Debian和官方版的Raspbian,发现在Unixbench的综合评价指数System Benchmarks Index Score上几乎没有什么差异。
这表明Raspbian和CPU的优化非常接近完美,但也可以推测rpi23-gen-image可能还有一些进步的空间。
值得注意的是,在之前介绍的raspberry-pi-3-buster-PREVIEW中,性能不佳,完成还需要一些时间。

创建图像的方法 (CJ702UsageGuide)

尽管结果令人遗憾,但只需记录图像创建方法。
由于rpi23-gen-image的更新可能会使Raspbian有相当大的差别,因此我们抱有期望。

适用于树莓派3的64位ARM处理器的Stretch版

在WSL上会失败,请使用虚拟机等其他方式。

$ sudo apt update
$ sudo apt install -y debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo git crossbuild-essential-arm64
$ git clone https://github.com/drtyhlpr/rpi23-gen-image.git
$ cd rpi23-gen-image
$ sudo su

# CONFIG_TEMPLATE=rpi3-stretch-arm64-4.11.y ./rpi23-gen-image.sh
# exit

rpi23-gen-image/images/stretch/2018-**-**-arm64-rpi-4.11.y-rpi3-stretch-arm64.img will be created (2018-**-** refers to the date of creation).

我会将这个写到SD卡中。

$ cd images/stretch/
$ umount /dev/mmcblk0p1
$ umount /dev/mmcblk0p2
$ sudo dd bs=4M if=2018-**-**-arm64-rpi-4.11.y-rpi3-stretch-arm64.img of=/dev/mmcblk0 conv=fsync
$ sync

树莓派3适用的ARMHF版Stretch。

在WSL中会失败,请使用虚拟机等。

$ sudo apt update
$ sudo apt install -y debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo git crossbuild-essential-armhf
$ git clone https://github.com/drtyhlpr/rpi23-gen-image.git
$ cd rpi23-gen-image
$ sudo su

# CONFIG_TEMPLATE=rpi3stretch ./rpi23-gen-image.sh
# exit

在rpi23-gen-image/images/stretch/2018-**-**-debian-rpi3stretch.img的路径下创建日期为2018-**-**的映像文件。

我会将这个写入SD卡中。

$ cd images/stretch/
$ umount /dev/mmcblk0p1
$ umount /dev/mmcblk0p2
$ sudo dd bs=4M if=2018-**-**-debian-rpi3stretch.img of=/dev/mmcblk0 conv=fsync
$ sync

基准测试准备

設定値User NamepiPasswordraspberryHost Namepi3-stretch

使用SSH或者本地登录,执行下列命令。

$ sudo apt update
$ sudo apt install -y git build-essential cpufrequtils
$ grep "" /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

如果显示为”scaling_governor:ondemand”,则表示CPU已经设置为根据负载而全速运行。

然后安装并运行UnixBench基准测试软件。在进行基准测试时,即使安装了散热器,也会触发热警报。作者使用了冰袋来冷却。

$ git clone https://github.com/kdlucas/byte-unixbench.git
$ cd byte-unixbench/UnixBench/
$ make
$ ./Run -c 4

详细结果

Image File2018-04-18-raspbian-stretch-lite.img2018-05-14-arm64-rpi-4.11.y-rpi3-stretch-arm642018-01-08-raspberry-pi-3-buster-PREVIEW.imgLinkDownload Raspbian for Raspberry Pi
RaspberryPi3 – Debian WikiSystem:raspberrypi: GNU/Linuxrpi3-stretch: GNU/Linuxrpi3: GNU/LinuxOS:GNU/Linux — 4.14.34-v7+ — #1110 SMP Mon Apr 16 15:18:51 BST 2018GNU/Linux — 4.11.12-v8 — #1 SMP PREEMPT Mon May 14 23:29:46 JST 2018GNU/Linux — 4.16.0-1-arm64 — #1 SMP Debian 4.16.5-1 (2018-04-29)Machine:armv7l: unknownaarch64: unknownaarch64: unknownLanguage:en_US.utf8 (charmap=”ANSI_X3.4-1968″, collate=”ANSI_X3.4-1968″)en_US.utf8 (charmap=”ANSI_X3.4-1968″, collate=”ANSI_X3.4-1968″)en_US.utf8 (charmap=”ANSI_X3.4-1968″, collate=”ANSI_X3.4-1968″)

基准测试运行:4个CPU;4个并行进程

Image File2018-04-18-raspbian-stretch-lite.img2018-05-14-arm64-rpi-4.11.y-rpi3-stretch-arm642018-01-08-raspberry-pi-3-buster-PREVIEW.imgDhrystone 2 using register variables1485.52023.51102.3Double-Precision Whetstone770.1810.8398.0Execl Throughput506.8603.9365.9File Copy 1024 bufsize 2000 maxblocks553.5471.1327.7File Copy 256 bufsize 500 maxblocks372.8309.8211.1File Copy 4096 bufsize 8000 maxblocks921.8930.6646.2Pipe Throughput946.8921.2517.5Pipe-based Context Switching605.0436.2270.4Process Creation374.4483.8269.3Shell Scripts (1 concurrent)1061.51277.4738.5Shell Scripts (8 concurrent)1024.81131.8670.7System Call Overhead1478.21067.2713.1System Benchmarks Index Score:761.5765.3462.4