第 18.2 节 树莓派安装 FreeBSD
FreeBSD 对体系结构的支持依等级而划分,ARM 属于一级架构,但软件支持上仍略逊 AMD64,某些软件无法通过 ports 以源码的形式进行构建。
准备前提
我们所有要准备的有:
一块树莓派板子;
一段网线;
一枚存储卡;
二选一:一根 CH340 USB 转串口线、或者一台 1080P 显示器 ;
一台普通路由器,有没有互联网 不重要;
若使用 Windows 10/11(操作系统)
XShell(软件)
WinSCP(软件)
基本安装思路
在 https://FreeBSD.org 下载适用于树莓派的镜像;
下载后解压缩;
使用 rufus 制作启动盘;
插入网线、网卡、接入显示器等等;
将存储卡插入树莓派;
通电等待约五分钟;
技巧
建议外接个显示器(或 CH340 USB 串口线)以免卡住了还不知道仍在苦等。
如使用 USB 串口线,请务必购买 CH340 芯片的,否则会出现卡住、没输出、输入没反应、驱动打不上、Windows 10 不兼容等等各种乱七八糟的问题;
如果使用显示器,屏幕分辨率请务必不要低于 1080P(1920 x 1080),屏幕尺寸不应小于 8 寸——否则接了和没接是一个效果。只能看是不是亮了,字是完全看不清的。
如果接入了显示器,请尽量确保树莓派和显示器同时通电。显示器可晚于树莓派通电,但不应太晚。
——附 CH340 USB 转串口官方驱动下载地址 https://www.wch.cn/download/CH341SER_EXE.html
查看路由器后台获取 IP
SSH 连接。
注意: 刻录完需要挂载 FAT 分区 替换里面的所有文件,否则会启动花屏,替换的文件路径为:
https://github.com/FreeBSD-Ask/FreeBSD-rpi4-firmware
FreeBSD ZFS 与树莓派(基于树莓派 4,但 5 亦通用)
如果固件不是最新的,先使用树莓派官方系统(Raspberry pi)更新下固件!
注意
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)
后续我在存储卡上又安装了一遍,以下为启动输出:
点击此处展开树莓派 5 dmesg 输出
树莓派 5 8G
FreeBSD 15.0-CURRENT
外接 RTL 8156B 网卡
启动盘为 256G NVMe SSD
UEFI:rpi5-uefi v0.3
root@ykla:~ # dmesg
---<<BOOT>>---
GDB: no debug ports present
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2024 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 15.0-CURRENT #0 main-fef0e39f6: Tue Aug 6 07:22:04 CST 2024
root@ykla:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC arm64
FreeBSD clang version 18.1.6 (https://github.com/llvm/llvm-project.git llvmorg-18.1.6-0-g1118c2e05e67)
WARNING: WITNESS option enabled, expect reduced performance.
VT(efifb): resolution 1920x1080
module scmi already present!
real memory = 8569733120 (8172 MB)
avail memory = 8316317696 (7931 MB)
Starting CPU 1 (100)
Starting CPU 2 (200)
Starting CPU 3 (300)
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
random: unblocking device.
random: entropy device external interface
kbd0 at kbdmux0
acpi0: <RPIFDN RPI5>
acpi0: Power Button (fixed)
acpi0: Could not update all GPEs: AE_NOT_CONFIGURED
psci0: <ARM Power State Co-ordination Interface Driver> on acpi0
gic0: <ARM Generic Interrupt Controller> iomem 0x107fff9000-0x107fff9fff,0x107fffa000-0x107fffafff on acpi0
gic0: pn 0x2, arch 0x2, rev 0x1, implementer 0x43b irqs 320
generic_timer0: <ARM Generic Timer> irq 5,6,7,8 on acpi0
Timecounter "ARM MPCore Timecounter" frequency 54000000 Hz quality 1000
Event timer "ARM MPCore Eventtimer" frequency 54000000 Hz quality 1000
efirtc0: <EFI Realtime Clock>
efirtc0: registered as a time-of-day clock, resolution 1.000000s
smbios0: <System Management BIOS>
smbios0: Version: 3.3
pmu0: <Performance Monitoring Unit> on acpi0
cpu0: <ACPI CPU> on acpi0
acpi_syscontainer0: <System Container> on acpi0
pcib0: <ARM PCI Firmware config space host controller> on acpi0
pci0: <PCI bus> on pcib0
pcib1: <PCI-PCI bridge> at device 0.0 on pci0
pci1: <PCI bus> on pcib1
nvme0: <Generic NVMe Device> mem 0xc0000000-0xc0003fff at device 0.0 on pci1
nvme0: unable to allocate MSI-X
nvme0: unable to allocate MSI
acpi_syscontainer1: <System Container> on acpi0
sdhci_acpi0: <Intel Bay Trail/Braswell SDXC Controller> iomem 0x1000fff000-0x1000fff25f irq 3 on acpi0
mmc0: <MMC/SD bus> on sdhci_acpi0
sdhci_acpi1: <Intel Bay Trail/Braswell SDXC Controller> iomem 0x1001100000-0x100110025f irq 4 on acpi0
mmc1: <MMC/SD bus> on sdhci_acpi1
uart0: <PrimeCell UART (PL011)> iomem 0x107d001000-0x107d0011ff irq 0 on acpi0
xhci0: <Generic USB 3.0 controller> iomem 0x1f00200000-0x1f002fffff irq 1 on acpi0
xhci0: 64 bytes context size, 64-bit DMA
usbus0 on xhci0
xhci1: <Generic USB 3.0 controller> iomem 0x1f00300000-0x1f003fffff irq 2 on acpi0
xhci1: 64 bytes context size, 64-bit DMA
usbus1 on xhci1
armv8crypto0: <AES-CBC,AES-XTS,AES-GCM>
Timecounters tick every 1.000 msec
usbus0: 5.0Gbps Super Speed USB v3.0
usbus1: 5.0Gbps Super Speed USB v3.0
ugen1.1: <Generic XHCI root HUB> at usbus1
uhub0 on usbus1
uhub0: <Generic XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus1
ugen0.1: <Generic XHCI root HUB> at usbus0
uhub1 on usbus0
uhub1: <Generic XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
ZFS filesystem version: 5
ZFS storage pool version: features support (5000)
nvme0: Allocated 16MB host memory buffer
mmcsd0: 126GB <SDHC LX128 1.0 SN 41A84716 MFG 05/2023 by 173 LS> at mmc0 50.0MHz/4bit/65535-block
mmc1: No compatible cards found on bus
Trying to mount root from zfs:zroot/ROOT/default []...
CPU 0: ARM Cortex-A76 r4p1 affinity: 0 0
Cache Type = <64 byte D-cacheline,64 byte I-cacheline,PIPT ICache,64 byte ERG,64 byte CWG,IDC>
Instruction Set Attributes 0 = <DP,RDM,Atomic,CRC32,SHA2,SHA1,AES+PMULL>
Instruction Set Attributes 1 = <RCPC-8.3,DCPoP>
Instruction Set Attributes 2 = <>
Processor Features 0 = <CSV3,CSV2,RAS,AdvSIMD+HP,FP+HP,EL3,EL2,EL1,EL0 32>
Processor Features 1 = <PSTATE.SSBS>
Processor Features 2 = <>
Memory Model Features 0 = <TGran4,TGran64,TGran16,SNSMem,BigEnd,16bit ASID,1TB PA>
Memory Model Features 1 = <XNX,PAN+ATS1E1,LO,HPD+TTPBHA,VH,16bit VMID,HAF+DS>
Memory Model Features 2 = <32bit CCIDX,48bit VA,IESB,UAO,CnP>
Memory Model Features 3 = <>
Memory Model Features 4 = <>
Debug Features 0 = <DoubleLock,2 CTX BKPTs,4 Watchpoints,6 Breakpoints,PMUv3p1,Debugv8p2>
Debug Features 1 = <>
Auxiliary Features 0 = <>
Auxiliary Features 1 = <>
AArch32 Instruction Set Attributes 5 = <RDM,CRC32,SHA2,SHA1,AES+VMULL,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 Arith,SIMDHP Arith,SIMDSP,SIMDInt,SIMDLS,FPDNaN,FPFtZ>
CPU 1: ARM Cortex-A76 r4p1 affinity: 1 0
CPU 2: ARM Cortex-A76 r4p1 affinity: 2 0
CPU 3: ARM Cortex-A76 r4p1 affinity: 3 0
gic0: using for IPIs
Release APs...done
nda0 at nvme0 bus 0 scbus0 target 0 lun 1
nda0: <Fanxiang S542Pro 256GB SN12517 FX240440260>
nda0: Serial Number FX240440260
nda0: nvme version 1.4
nda0: 244198MB (500118192 512 byte sectors)
TCP_ratelimit: Is now initialized
WARNING: WITNESS option enabled, expect reduced performance.
uhub1: 3 ports with 3 removable, self powered
uhub0: 3 ports with 3 removable, self powered
ugen0.2: <Realtek USB 10/100/1G/2.5G LAN> at usbus0
lo0: link state changed to UP
cdce0 on uhub1
cdce0: <Realtek USB 10/100/1G/2.5G LAN, class 0/0, rev 3.20/31.04, addr 1> on usbus0
ue0: <USB Ethernet> on cdce0
ue0: Ethernet address: c8:4d:44:29:99:91
ue0: link state changed to DOWN
ue0: link state changed to UP
Security policy loaded: MAC/ntpd (mac_ntpd)
点击此处展开树莓派 4 dmesg 输出
树莓派 4 8G
FreeBSD 14.0-CURRENT
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)
树莓派 5 8G 编译安装世界和内核
示例采用:FreeBSD 15.0-CURRENT,均为默认参数。
root@ykla:/usr/src # git rev-parse HEAD fef0e39f64a1db796ded8777dbee71fc287f6107
编译世界(用户空间)约用时 6 小时。
--- buildworld_epilogue ---
--------------------------------------------------------------
>>> World build completed on Tue Aug 6 04:01:22 CST 2024
>>> World built in 21438 seconds, ncpu: 4, make -j4
--------------------------------------------------------------
编译内核约用时 26 分钟。
--------------------------------------------------------------
>>> Kernel build for GENERIC completed on Tue Aug 6 07:22:22 CST 2024
--------------------------------------------------------------
>>> Kernel(s) GENERIC built in 1564 seconds, ncpu: 4, make -j4
--------------------------------------------------------------
故障排除
newfs_msdos /dev/gpt/efiboot0:operation not permitted
该问题主要出现在用 zfs 的存储卡安装系统到 U 盘出现的,目前无解,只能用另一个 UFS 的 U 盘启动盘来安装 U 盘。
可能用到的命令:gpart destroy -F da2
摧毁这一步错误创建的文件系统,以防止系统不识别。
参考文献
归档内容(旧的,但可能仍有用)
(变通方案)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 # 超频
最后更新于