第 18.2 节 系统安装

自树莓派 3B+ 开始,无需任何改动,系统即可从 U 盘启动,经过测试了 FreeBSD 12/13/14 都是支持的,但是速度非常慢,一方面树莓派 3B+ 使用 USB2.0 极大的限制的总线速度,另一方面可能是玄学问题。(测试用的是东芝(TOSHIBA)64GB USB3.0 U 盘 U364 高速迷你车载 U 盘)。

因此 3B+ 不建议使用 U 盘启动,慢的我要打年年猫,年年猫是谁?是一只调皮的野生狸花猫而已。

我们所有要准备的有树莓派 4 板子一块,网线一段,存储卡一枚。从 https://FreeBSD.org 下载适用于树莓派 4 的镜像:

https://download.freebsd.org/ftp/releases/arm64/aarch64/ISO-IMAGES/13.2/FreeBSD-13.2-RELEASE-arm64-aarch64-RPI.img.xz

下载后解压缩。使用 rufus 刻录。插入网线,将存储卡插入树莓派,通电等待约五分钟,查看路由器后台获取 IP。建议最后外接个显示器以免卡住了还不知道还在苦等。

注意: 刻录完需要挂载 FAT 分区 替换里面的所有文件,否则会启动花屏,替换的文件路径为:

https://github.com/FreeBSD-Ask/FreeBSD-rpi4-firmware

【变通方案】FreeBSD 与树莓派 4B 8G 启动失败问题

如果卡彩虹屏不启动,下载 FreeBSD 14 镜像写入后将 FAT 分区内容替换即可(默认分区是隐藏的,使用 diskgenius 激活隐藏分区分配盘符即可)

https://github.com/FreeBSD-Ask/FreeBSD-rpi4-firmware

修改 config.txt 为以下内容:

arm_64bit=1
dtoverlay=disable-bt
dtoverlay=mmc
device_tree_address=0x4000
kernel=u-boot.bin
armstub=armstub8-gic.bin
hdmi_safe=0
force_turbo=0 #超频
arm_freq=2000 #超频
over_voltage=6 #超频

ZFS 与树莓派

如果固件不是最新的,先使用树莓派官方系统更新下固件!

注意

FreeBSD 默认提供的 IMG 镜像使用 UFS 文件系统。想使用 ZFS 的用户可在存储卡上刻录好 img 正常启动。再插入 U 盘,加载 ZFS 模块。运行命令 bsdinstall 正常安装(安装位置选择 U 盘)即可。如果想在存储卡上使用 ZFS,反过来用 U 盘进行安装即可。

安装前:(mmcsd0 为存储卡,da0 为 U 盘。要往 U 盘里创建一个使用 zfs 的树莓派 FreeBSD 系统)

使用正常镜像写入存储卡,启动后再插上空白 U 盘, U 盘保持 FAT32 ,MBR 分区表即可。

# gpart show
=>       63  246947777  mmcsd0  MBR  (118G)
         63       1985          - free -  (993K)
       2048     102400       1  fat16  [active]  (50M)
     104448  246835200       2  freebsd  (118G)
  246939648       8192          - free -  (4.0M)

=>        0  246835200  mmcsd0s2  BSD  (118G)
          0        128            - free -  (64K)
        128  230057856         1  freebsd-ufs  (110G)
  230057984   16777216         2  freebsd-swap  (8.0G)

=>      63  60088257  da0  MBR  (29G)
        63      4033       - free -  (2.0M)
      4096  60084224    1  fat32lba  [active]  (29G)

一定要先加载 zfs 模块,否则分区会错误 sysctl: unknown oid 'vfs.zfs.min_auto_ashift' 之类的。

# kldload zfs

开始安装:

# bsdinstall

安装后复制固件即可,注意不要覆盖了 EFI 分区原有的东西。

安装后:

ykla@ykla:~ $ gpart show
=>      34  60088253  da0  GPT  (29G)
        34         6       - free -  (3.0K)
        40    532480    1  ms-basic-data  (260M)
    532520      2008       - free -  (1.0M)
    534528   4194304    2  freebsd-swap  (2.0G)
   4728832  55357440    3  freebsd-zfs  (26G)
  60086272      2015       - free -  (1.0M)

后续我在存储卡上又安装了一遍,以下为启动输出:

root@ykla:/home/ykla # dmesg 
---<<BOOT>>---
GDB: debug ports: uart
GDB: current port: uart
KDB: debugger backends: ddb gdb
KDB: current backend: ddb
WARNING: Cannot find freebsd,dts-version property, cannot check DTB compliance
Copyright (c) 1992-2023 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 14.0-CURRENT aarch64 1400093 #0 main-n264358-474708c334a7: Thu Jul 27 08:02:18 UTC 2023
    root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC arm64
FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152)
WARNING: WITNESS option enabled, expect reduced performance.
VT(efifb): resolution 656x512
module scmi already present!
module firmware already present!
real memory  = 8443125760 (8051 MB)
avail memory = 8201211904 (7821 MB)
Starting CPU 1 (1)
Starting CPU 2 (2)
Starting CPU 3 (3)
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
random: unblocking device.
random: entropy device external interface
kbd0 at kbdmux0
ofwbus0: <Open Firmware Device Tree>
simplebus0: <Flattened device tree simple bus> on ofwbus0
ofw_clkbus0: <OFW clocks bus> on ofwbus0
clk_fixed0: <Fixed clock> on ofw_clkbus0
clk_fixed1: <Fixed clock> on ofw_clkbus0
clk_fixed2: <Fixed clock> on ofwbus0
clk_fixed3: <Fixed clock> on ofwbus0
simplebus1: <Flattened device tree simple bus> on ofwbus0
simplebus2: <Flattened device tree simple bus> on ofwbus0
regfix0: <Fixed Regulator> on ofwbus0
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
regfix1: <Fixed Regulator> on ofwbus0
regfix2: <Fixed Regulator> on ofwbus0
regfix3: <Fixed Regulator> on ofwbus0
regfix4: <Fixed Regulator> on ofwbus0
simplebus3: <Flattened device tree simple bus> on ofwbus0
simple_mfd0: <Simple MFD (Multi-Functions Device)> mem 0x7d5d2000-0x7d5d2eff on simplebus0
bcm2835_firmware0: <BCM2835 Firmware> on simplebus0
ofw_clkbus1: <OFW clocks bus> on bcm2835_firmware0
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
gic0: <ARM Generic Interrupt Controller> mem 0x40041000-0x40041fff,0x40042000-0x40043fff,0x40044000-0x40045fff,0x40046000-0x40047fff irq 30 on simplebus0
gic0: pn 0x2, arch 0x2, rev 0x1, implementer 0x43b irqs 256
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
gpio0: <BCM2708/2835 GPIO controller> mem 0x7e200000-0x7e2000b3 irq 14,15 on simplebus0
gpiobus0: <OFW GPIO bus> on gpio0
gpio1: <Raspberry Pi Firmware GPIO controller> on bcm2835_firmware0
gpiobus1: <GPIO bus> on gpio1
regfix0: Cannot configure GPIO pin: 5
REGNODE_INIT failed: 6
regfix0: Cannot register regulator.
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
regfix2: Cannot set GPIO pin: 6
REGNODE_INIT failed: 6
regfix2: Cannot register regulator.
mbox0: <BCM2835 VideoCore Mailbox> mem 0x7e00b880-0x7e00b8bf irq 13 on simplebus0
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
gpioregulator0: <GPIO controlled regulator> on ofwbus0
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
generic_timer0: <ARMv8 Generic Timer> irq 4,5,6,7 on ofwbus0
Timecounter "ARM MPCore Timecounter" frequency 54000000 Hz quality 1000
Event timer "ARM MPCore Eventtimer" frequency 54000000 Hz quality 1000
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
bcm_dma0: <BCM2835 DMA Controller> mem 0x7e007000-0x7e007aff irq 31,32,33,34,35,36,37,38,39,40,41 on simplebus0
usb_nop_xceiv0: <USB NOP PHY> on ofwbus0
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
bcm2835_clkman0: <BCM283x Clock Manager> mem 0x7e101000-0x7e102fff on simplebus0
gpioc0: <GPIO controller> on gpio0
uart0: <PrimeCell UART (PL011)> mem 0x7e201000-0x7e2011ff irq 16 on simplebus0
uart0: debug port (115200,n,8,1)
sdhci_bcm0: <Broadcom 2708 SDHCI controller> mem 0x7e300000-0x7e3000ff irq 24 on simplebus0
mmc0: <MMC/SD bus> on sdhci_bcm0
bcmwd0: <BCM2708/2835 Watchdog> mem 0x7e100000-0x7e100113,0x7e00a000-0x7e00a023,0x7ec11000-0x7ec1101f on simplebus0
bcmrng0: <Broadcom BCM2835/BCM2838 RNG> mem 0x7e104000-0x7e104027 on simplebus0
gpioc1: <GPIO controller> on gpio1
fb0: <BCM2835 VT framebuffer driver> on simplebus0
fb0: keeping existing fb bpp of 32
fbd0 on fb0
WARNING: Device "fb" is Giant locked and may be deleted before FreeBSD 14.0.
VT: Replacing driver "efifb" with new "fb".
fb0: 656x512(656x512@0,0) 32bpp
fb0: fbswap: 1, pitch 2624, base 0x3eab2000, screen_size 1343488
sdhci_bcm1: <Broadcom 2708 SDHCI controller> mem 0x7e340000-0x7e3400ff irq 79 on simplebus1
mmc1: <MMC/SD bus> on sdhci_bcm1
pmu0: <Performance Monitoring Unit> irq 0,1,2,3 on ofwbus0
cpulist0: <Open Firmware CPU Group> on ofwbus0
cpu0: <Open Firmware CPU> on cpulist0
bcm2835_cpufreq0: <CPU Frequency Control> on cpu0
pcib0: <BCM2838-compatible PCI-express controller> mem 0x7d500000-0x7d50930f irq 80,81 on simplebus2
pcib0: hardware identifies as revision 0x304.
pci0: <OFW PCI bus> on pcib0
pcib1: <PCI-PCI bridge> irq 91 at device 0.0 on pci0
pci1: <OFW PCI bus> on pcib1
bcm_xhci0: <VL805 USB 3.0 controller (on the Raspberry Pi 4b)> irq 92 at device 0.0 on pci1
bcm_xhci0: 32 bytes context size, 64-bit DMA
usbus0 on bcm_xhci0
genet0: <RPi4 Gigabit Ethernet> mem 0x7d580000-0x7d58ffff irq 82,83 on simplebus2
genet0: GENET version 5.0 phy 0x0000
miibus0: <MII bus> on genet0
brgphy0: <BCM54213PE 1000BASE-T media interface> PHY 1 on miibus0
brgphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto
genet0: Ethernet address: d8:3a:dd:27:a8:b3
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
clk_fixed4: <Fixed clock> disabled on ofwbus0
clk_fixed4: Cannot FDT parameters.
device_attach: clk_fixed4 attach returned 6
gpioled0: <GPIO LEDs> on ofwbus0
lock order reversal: (sleepable after non-sleepable)
 1st 0xffff000000d0a6f0 LED mtx (LED mtx, sleep mutex) @ /usr/src/sys/dev/led/led.c:298
 2nd 0xffffa000019c2c10 Raspberry Pi firmware gpio (Raspberry Pi firmware gpio, sx) @ /usr/src/sys/arm/broadcom/bcm2835/raspberrypi_gpio.c:252
lock order LED mtx -> Raspberry Pi firmware gpio attempted at:
#0 0xffff0000004d2264 at witness_checkorder+0xa98
#1 0xffff00000046dfb0 at _sx_xlock+0x7c
#2 0xffff0000008b107c at rpi_fw_gpio_pin_set+0xe0
#3 0xffff0000001c75c4 at led_create_state+0x158
#4 0xffff000000191474 at gpioled_attach+0x290
#5 0xffff00000049e2a0 at device_attach+0x3f8
#6 0xffff00000049de10 at device_probe_and_attach+0x7c
#7 0xffff0000004a0150 at bus_generic_new_pass+0xfc
#8 0xffff0000004a0100 at bus_generic_new_pass+0xac
#9 0xffff0000004a0100 at bus_generic_new_pass+0xac
#10 0xffff00000049b02c at bus_set_pass+0x4c
#11 0xffff0000003e96c8 at mi_startup+0x1fc
#12 0xffff0000000008ac at virtdone+0x70
uma_zalloc_debug: zone "malloc-64" with the following non-sleepable locks held:
exclusive sleep mutex LED mtx (LED mtx) r = 0 (0xffff000000d0a6f0) locked @ /usr/src/sys/dev/led/led.c:298
stack backtrace:
#0 0xffff0000004d26a8 at witness_debugger+0x5c
#1 0xffff0000004d38ac at witness_warn+0x400
#2 0xffff000000782798 at uma_zalloc_debug+0x30
#3 0xffff000000782318 at uma_zalloc_arg+0x2c
#4 0xffff000000436dc8 at malloc+0x8c
#5 0xffff0000008a6330 at bcm2835_firmware_property+0x44
#6 0xffff0000008b1094 at rpi_fw_gpio_pin_set+0xf8
#7 0xffff0000001c75c4 at led_create_state+0x158
#8 0xffff000000191474 at gpioled_attach+0x290
#9 0xffff00000049e2a0 at device_attach+0x3f8
#10 0xffff00000049de10 at device_probe_and_attach+0x7c
#11 0xffff0000004a0150 at bus_generic_new_pass+0xfc
#12 0xffff0000004a0100 at bus_generic_new_pass+0xac
#13 0xffff0000004a0100 at bus_generic_new_pass+0xac
#14 0xffff00000049b02c at bus_set_pass+0x4c
#15 0xffff0000003e96c8 at mi_startup+0x1fc
#16 0xffff0000000008ac at virtdone+0x70
uma_zalloc_debug: zone "malloc-16" with the following non-sleepable locks held:
exclusive sleep mutex LED mtx (LED mtx) r = 0 (0xffff000000d0a6f0) locked @ /usr/src/sys/dev/led/led.c:298
stack backtrace:
#0 0xffff0000004d26a8 at witness_debugger+0x5c
#1 0xffff0000004d38ac at witness_warn+0x400
#2 0xffff000000782798 at uma_zalloc_debug+0x30
#3 0xffff000000782318 at uma_zalloc_arg+0x2c
#4 0xffff000000436dc8 at malloc+0x8c
#5 0xffff0000007cd648 at bounce_bus_dmamem_alloc+0x50
#6 0xffff0000008a8d80 at bcm2835_mbox_property+0xdc
#7 0xffff0000008a6364 at bcm2835_firmware_property+0x78
#8 0xffff0000008b1094 at rpi_fw_gpio_pin_set+0xf8
#9 0xffff0000001c75c4 at led_create_state+0x158
#10 0xffff000000191474 at gpioled_attach+0x290
#11 0xffff00000049e2a0 at device_attach+0x3f8
#12 0xffff00000049de10 at device_probe_and_attach+0x7c
#13 0xffff0000004a0150 at bus_generic_new_pass+0xfc
#14 0xffff0000004a0100 at bus_generic_new_pass+0xac
#15 0xffff0000004a0100 at bus_generic_new_pass+0xac
#16 0xffff00000049b02c at bus_set_pass+0x4c
#17 0xffff0000003e96c8 at mi_startup+0x1fc
uma_zalloc_debug: zone "malloc-128" with the following non-sleepable locks held:
exclusive sleep mutex LED mtx (LED mtx) r = 0 (0xffff000000d0a6f0) locked @ /usr/src/sys/dev/led/led.c:298
stack backtrace:
#0 0xffff0000004d26a8 at witness_debugger+0x5c
#1 0xffff0000004d38ac at witness_warn+0x400
#2 0xffff000000782798 at uma_zalloc_debug+0x30
#3 0xffff000000782318 at uma_zalloc_arg+0x2c
#4 0xffff000000436dc8 at malloc+0x8c
#5 0xffff0000007cd698 at bounce_bus_dmamem_alloc+0xa0
#6 0xffff0000008a8d80 at bcm2835_mbox_property+0xdc
#7 0xffff0000008a6364 at bcm2835_firmware_property+0x78
#8 0xffff0000008b1094 at rpi_fw_gpio_pin_set+0xf8
#9 0xffff0000001c75c4 at led_create_state+0x158
#10 0xffff000000191474 at gpioled_attach+0x290
#11 0xffff00000049e2a0 at device_attach+0x3f8
#12 0xffff00000049de10 at device_probe_and_attach+0x7c
#13 0xffff0000004a0150 at bus_generic_new_pass+0xfc
#14 0xffff0000004a0100 at bus_generic_new_pass+0xac
#15 0xffff0000004a0100 at bus_generic_new_pass+0xac
#16 0xffff00000049b02c at bus_set_pass+0x4c
#17 0xffff0000003e96c8 at mi_startup+0x1fc
armv8crypto0: CPU lacks AES instructions
Timecounters tick every 1.000 msec
usbus0: 5.0Gbps Super Speed USB v3.0
ZFS filesystem version: 5
ZFS storage pool version: features support (5000)
ugen0.1: <(0x1106) XHCI root HUB> at usbus0
uhub0 on usbus0
uhub0: <(0x1106) XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
sdhci_bcm0-slot0: Got command interrupt 0x00030000, but there is no active command.
sdhci_bcm0-slot0: ============== REGISTER DUMP ==============
sdhci_bcm0-slot0: Sys addr: 0x00000000 | Version:  0x00009902
sdhci_bcm0-slot0: Blk size: 0x00000000 | Blk cnt:  0x00000000
sdhci_bcm0-slot0: Argument: 0x000001aa | Trn mode: 0x00000000
sdhci_bcm0-slot0: Present:  0x000f0000 | Host ctl: 0x00000001
sdhci_bcm0-slot0: Power:    0x0000000f | Blk gap:  0x00000000
sdhci_bcm0-slot0: Wake-up:  0x00000000 | Clock:    0x00003947
sdhci_bcm0-slot0: Timeout:  0x00000000 | Int stat: 0x00000000
sdhci_bcm0-slot0: Int enab: 0x01ff00bb | Sig enab: 0x01ff00bb
sdhci_bcm0-slot0: AC12 err: 0x00000000 | Host ctl2:0x00000000
sdhci_bcm0-slot0: Caps:     0x00000000 | Caps2:    0x00000000
sdhci_bcm0-slot0: Max curr: 0x00000001 | ADMA err: 0x00000000
sdhci_bcm0-slot0: ADMA addr:0x00000000 | Slot int: 0x00000000
sdhci_bcm0-slot0: ===========================================
sdhci_bcm0-slot0: Got command interrupt 0x00030000, but there is no active command.
sdhci_bcm0-slot0: ============== REGISTER DUMP ==============
sdhci_bcm0-slot0: Sys addr: 0x00000000 | Version:  0x00009902
sdhci_bcm0-slot0: Blk size: 0x00000000 | Blk cnt:  0x00000000
sdhci_bcm0-slot0: Argument: 0x000001aa | Trn mode: 0x00000000
sdhci_bcm0-slot0: Present:  0x000f0000 | Host ctl: 0x00000001
sdhci_bcm0-slot0: Power:    0x0000000f | Blk gap:  0x00000000
sdhci_bcm0-slot0: Wake-up:  0x00000000 | Clock:    0x00003947
sdhci_bcm0-slot0: Timeout:  0x00000000 | Int stat: 0x00000000
sdhci_bcm0-slot0: Int enab: 0x01ff00bb | Sig enab: 0x01ff00bb
sdhci_bcm0-slot0: AC12 err: 0x00000000 | Host ctl2:0x00000000
sdhci_bcm0-slot0: Caps:     0x00000000 | Caps2:    0x00000000
sdhci_bcm0-slot0: Max curr: 0x00000001 | ADMA err: 0x00000000
sdhci_bcm0-slot0: ADMA addr:0x00000000 | Slot int: 0x00000000
sdhci_bcm0-slot0: ===========================================
sdhci_bcm0-slot0: Got command interrupt 0x00030000, but there is no active command.
sdhci_bcm0-slot0: ============== REGISTER DUMP ==============
sdhci_bcm0-slot0: Sys addr: 0x00000000 | Version:  0x00009902
sdhci_bcm0-slot0: Blk size: 0x00000000 | Blk cnt:  0x00000000
sdhci_bcm0-slot0: Argument: 0x00000000 | Trn mode: 0x00000000
sdhci_bcm0-slot0: Present:  0x000f0000 | Host ctl: 0x00000001
sdhci_bcm0-slot0: Power:    0x0000000f | Blk gap:  0x00000000
sdhci_bcm0-slot0: Wake-up:  0x00000000 | Clock:    0x00003947
sdhci_bcm0-slot0: Timeout:  0x00000000 | Int stat: 0x00000000
sdhci_bcm0-slot0: Int enab: 0x01ff00bb | Sig enab: 0x01ff00bb
sdhci_bcm0-slot0: AC12 err: 0x00000000 | Host ctl2:0x00000000
sdhci_bcm0-slot0: Caps:     0x00000000 | Caps2:    0x00000000
sdhci_bcm0-slot0: Max curr: 0x00000001 | ADMA err: 0x00000000
sdhci_bcm0-slot0: ADMA addr:0x00000000 | Slot int: 0x00000000
sdhci_bcm0-slot0: ===========================================
sdhci_bcm0-slot0: Got command interrupt 0x00030000, but there is no active command.
sdhci_bcm0-slot0: ============== REGISTER DUMP ==============
sdhci_bcm0-slot0: Sys addr: 0x00000000 | Version:  0x00009902
sdhci_bcm0-slot0: Blk size: 0x00000000 | Blk cnt:  0x00000000
sdhci_bcm0-slot0: Argument: 0x00000000 | Trn mode: 0x00000000
sdhci_bcm0-slot0: Present:  0x000f0000 | Host ctl: 0x00000001
sdhci_bcm0-slot0: Power:    0x0000000f | Blk gap:  0x00000000
sdhci_bcm0-slot0: Wake-up:  0x00000000 | Clock:    0x00003947
sdhci_bcm0-slot0: Timeout:  0x00000000 | Int stat: 0x00000000
sdhci_bcm0-slot0: Int enab: 0x01ff00bb | Sig enab: 0x01ff00bb
sdhci_bcm0-slot0: AC12 err: 0x00000000 | Host ctl2:0x00000000
sdhci_bcm0-slot0: Caps:     0x00000000 | Caps2:    0x00000000
sdhci_bcm0-slot0: Max curr: 0x00000001 | ADMA err: 0x00000000
sdhci_bcm0-slot0: ADMA addr:0x00000000 | Slot int: 0x00000000
sdhci_bcm0-slot0: ===========================================
mmc0: No compatible cards found on bus
mmcsd0: 126GB <SDHC LX128 1.0 SN 41A84716 MFG 05/2023 by 173 LS> at mmc1 50.0MHz/4bit/65535-block
bcm2835_cpufreq0: ARM 600MHz, Core 200MHz, SDRAM 400MHz, Turbo OFF
CPU  0: ARM Cortex-A72 r0p3 affinity:  0
                   Cache Type = <64 byte D-cacheline,64 byte I-cacheline,PIPT ICache,64 byte ERG,64 byte CWG>
 Instruction Set Attributes 0 = <CRC32>
 Instruction Set Attributes 1 = <>
 Instruction Set Attributes 2 = <>
         Processor Features 0 = <AdvSIMD,FP,EL3 32,EL2 32,EL1 32,EL0 32>
         Processor Features 1 = <>
      Memory Model Features 0 = <TGran4,TGran64,SNSMem,BigEnd,16bit ASID,16TB PA>
      Memory Model Features 1 = <8bit VMID>
      Memory Model Features 2 = <32bit CCIDX,48bit VA>
             Debug Features 0 = <DoubleLock,2 CTX BKPTs,4 Watchpoints,6 Breakpoints,PMUv3,Debugv8>
             Debug Features 1 = <>
         Auxiliary Features 0 = <>
         Auxiliary Features 1 = <>
AArch32 Instruction Set Attributes 5 = <CRC32,SEVL>
AArch32 Media and VFP Features 0 = <FPRound,FPSqrt,FPDivide,DP VFPv3+v4,SP VFPv3+v4,AdvSIMD>
AArch32 Media and VFP Features 1 = <SIMDFMAC,FPHP DP Conv,SIMDHP SP Conv,SIMDSP,SIMDInt,SIMDLS,FPDNaN,FPFtZ>
CPU  1: ARM Cortex-A72 r0p3 affinity:  1
CPU  2: ARM Cortex-A72 r0p3 affinity:  2
CPU  3: ARM Cortex-A72 r0p3 affinity:  3
Trying to mount root from zfs:zroot/ROOT/default []...
Release APs...done
TCP_ratelimit: Is now initialized
WARNING: WITNESS option enabled, expect reduced performance.
uhub0: 5 ports with 4 removable, self powered
ugen0.2: <vendor 0x2109 USB2.0 Hub> at usbus0
uhub1 on uhub0
uhub1: <vendor 0x2109 USB2.0 Hub, class 9/0, rev 2.10/4.21, addr 1> on usbus0
Root mount waiting for: usbus0
uhub1: 4 ports with 4 removable, self powered
Warning: no time-of-day clock registered, system time will not be set accurately
genet0: link state changed to UP
lo0: link state changed to UP
genet0: link state changed to DOWN
genet0: link state changed to UP
Security policy loaded: MAC/ntpd (mac_ntpd)

树莓派 4B 8G 编译安装世界和内核

  • 编译世界(用户空间)约用时 17 小时 16 分钟。

>>> World build completed on Fri Aug  4 19:04:06 CST 2023
>>> World built in 62132 seconds, ncpu: 4, make -j4
  • 编译内核约用时 51 分钟。

--------------------------------------------------------------
>>> Kernel build for GENERIC completed on Fri Aug  4 20:00:09 CST 2023
--------------------------------------------------------------
>>> Kernel(s)  GENERIC built in 3105 seconds, ncpu: 4, make -j4
--------------------------------------------------------------

故障排除

  • newfs_msdos /dev/gpt/efiboot0:operation not permitted

该问题主要出现在用 zfs 的存储卡安装系统到 U 盘出现的,目前无解,只能用另一个 UFS 的 U 盘启动盘来安装 U 盘。

可能用到的命令:gpart destroy -F da2 摧毁这一步错误创建的文件系统,以防止系统不识别。

最后更新于