FreeBSD on the CubieBoard2

Frederic Cambus March 14, 2022 [FreeBSD] [ARM]

I have previously been running NetBSD/evbarm and OpenBSD/armv7 on my CubieBoard2, and wrote about it here and here.

The Cubieboard2 is an ARMv7 device which was released in 2013 so it is quite ancient by now. However, a renewed interest in FreeBSD on my side prompted me to try running the system on this device.

ARMv7 is a Tier 2 architecture on FreeBSD, so the system cannot be upgraded by freebsd-update and must be kept up to date by source. On the plus side, binary packages are available on this platform. For those interested, the FreeBSD wiki has more information about running FreeBSD on Allwinner systems.

Cubieboard2

Required steps for creating a bootable micro SD card are as follow: on a FreeBSD machine, we need to install the u-boot-cubieboard2 package and write the image file and the bootloader to the card.

pkg install u-boot-cubieboard2
dd if=FreeBSD-13.0-RELEASE-arm-armv7-GENERICSD.img of=/dev/da0 bs=1M conv=sync
dd if=/usr/local/share/u-boot/u-boot-cubieboard2/u-boot-sunxi-with-spl.bin of=/dev/da0 bs=1k seek=8 conv=sync

The partition will be automatically resized during first boot to span the whole capacity of the card.

Here is the output of running file on executables:

ELF 32-bit LSB executable, ARM, EABI5 version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, FreeBSD-style, for FreeBSD 13.0 (1300139), stripped

Here is the result of the md5 -t benchmark:

MD5 time trial. Digesting 100000 10000-byte blocks ... done
Digest = 766a2bb5d24bddae466c572bcabca3ee
Time = 13.895305 seconds
Speed = 68.632843 MiB/second

And this is the result of the sha1 -t benchmark:

SHA1 time trial. Digesting 100000 10000-byte blocks ... done
Digest = 02522491d7a8253fcab708560acfa84b2fb7ef1c
Time = 23.223881 seconds
Speed = 41.064381 MiB/second

For the record, OpenSSL speed benchmark results are available here.

Finally, here is a dmesg for reference purposes:

Copyright (c) 1992-2021 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 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr  9 06:33:09 UTC 2021
    root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm.armv7/sys/GENERIC arm
FreeBSD clang version 11.0.1 (git@github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe)
VT: init without driver.
No PSCI/SMCCC call function found
CPU: ARM Cortex-A7 r0p4 (ECO: 0x00000000)
CPU Features: 
  Multiprocessing, Thumb2, Security, Virtualization, Generic Timer, VMSAv7,
  PXN, LPAE, Coherent Walk
Optional instructions: 
  SDIV/UDIV, UMULL, SMULL, SIMD(ext)
LoUU:2 LoC:3 LoUIS:2 
Cache level 1:
 32KB/64B 4-way data cache WB Read-Alloc Write-Alloc
 32KB/32B 2-way instruction cache Read-Alloc
Cache level 2:
 256KB/64B 8-way unified cache WB Read-Alloc Write-Alloc
real memory  = 1039581184 (991 MB)
avail memory = 1002311680 (955 MB)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
random: unblocking device.
random: entropy device external interface
WARNING: Device "kbd" is Giant locked and may be deleted before FreeBSD 14.0.
kbd0 at kbdmux0
WARNING: Device "openfirm" is Giant locked and may be deleted before FreeBSD 14.0.
ofwbus0: <Open Firmware Device Tree>
aw_ccu0: <Allwinner Clock Control Unit> on ofwbus0
clk_fixed0: <Fixed clock> on aw_ccu0
clk_fixed1: <Fixed clock> on aw_ccu0
clk_fixed2: <Fixed clock> on aw_ccu0
clk_fixed3: <Fixed clock> on aw_ccu0
simplebus0: <Flattened device tree simple bus> on ofwbus0
regfix0: <Fixed Regulator> on ofwbus0
regfix1: <Fixed Regulator> on ofwbus0
regfix2: <Fixed Regulator> on ofwbus0
regfix3: <Fixed Regulator> on ofwbus0
regfix4: <Fixed Regulator> on ofwbus0
regfix5: <Fixed Regulator> on ofwbus0
rtc0: <Allwinner RTC> mem 0x1c20d00-0x1c20d1f irq 39 on simplebus0
rtc0: registered as a time-of-day clock, resolution 1.000000s
aw_gmacclk0: <Allwinner GMAC Clock> mem 0x1c20164-0x1c20167 on aw_ccu0
ccu_a10ng0: <Allwinner A10/A20 Clock Control Unit NG> mem 0x1c20000-0x1c203ff on simplebus0
gic0: <ARM Generic Interrupt Controller> mem 0x1c81000-0x1c81fff,0x1c82000-0x1c83fff,0x1c84000-0x1c85fff,0x1c86000-0x1c87fff irq 77 on simplebus0
gic0: pn 0x1, arch 0x2, rev 0x1, implementer 0x43b irqs 160
aw_nmi0: <Allwinner NMI Controller> mem 0x1c00030-0x1c0003b irq 6 on simplebus0
gpio0: <Allwinner GPIO/Pinmux controller> mem 0x1c20800-0x1c20bff irq 31 on simplebus0
gpiobus0: <OFW GPIO bus> on gpio0
iichb0: <Allwinner Integrated I2C Bus Controller> mem 0x1c2ac00-0x1c2afff irq 59 on simplebus0
iicbus0: <OFW I2C bus> on iichb0
axp2xx_pmu0: <X-Powers AXP209 Power Management Unit> at addr 0x68 irq 82 on iicbus0
gpiobus1: <OFW GPIO bus> on axp2xx_pmu0
iichb1: <Allwinner Integrated I2C Bus Controller> mem 0x1c2b000-0x1c2b3ff irq 60 on simplebus0
iicbus1: <OFW I2C bus> on iichb1
generic_timer0: <ARMv7 Generic Timer> irq 0,1,2,3 on ofwbus0
Timecounter "ARM MPCore Timecounter" frequency 24000000 Hz quality 1000
Event timer "ARM MPCore Eventtimer" frequency 24000000 Hz quality 1000
aw_sid0: <Allwinner Secure ID Controller> mem 0x1c23800-0x1c239ff on simplebus0
awusbphy0: <Allwinner USB PHY> mem 0x1c13400-0x1c1340f,0x1c14800-0x1c14803,0x1c1c800-0x1c1c803 on simplebus0
cpulist0: <Open Firmware CPU Group> on ofwbus0
cpu0: <Open Firmware CPU> on cpulist0
cpufreq_dt0: <Generic cpufreq driver> on cpu0
cpu1: <Open Firmware CPU> on cpulist0
pmu0: <Performance Monitoring Unit> irq 4,5 on ofwbus0
a10dmac0: <Allwinner DMA controller> mem 0x1c02000-0x1c02fff irq 7 on simplebus0
aw_mmc0: <Allwinner Integrated MMC/SD controller> mem 0x1c0f000-0x1c0ffff irq 16 on simplebus0
musbotg0: <Allwinner USB DRD> mem 0x1c13000-0x1c133ff irq 20 on simplebus0
musbotg0: setting phy mode 3
usbus0: Dynamic FIFO sizing detected, assuming 16Kbytes of FIFO RAM
usbus0 on musbotg0
ehci0: <Generic EHCI Controller> mem 0x1c14000-0x1c140ff irq 21 on simplebus0
usbus1: EHCI version 1.0
usbus1 on ehci0
ohci0: <Generic OHCI Controller> mem 0x1c14400-0x1c144ff irq 22 on simplebus0
usbus2 on ohci0
ahci0: <Allwinner Integrated AHCI controller> mem 0x1c18000-0x1c18fff irq 26 on simplebus0
ahci0: AHCI v1.10 with 1 3Gbps ports, Port Multiplier not supported
ahci0: quirks=0x2<NOPMP>
ehci1: <Generic EHCI Controller> mem 0x1c1c000-0x1c1c0ff irq 27 on simplebus0
usbus3: EHCI version 1.0
usbus3 on ehci1
ohci1: <Generic OHCI Controller> mem 0x1c1c400-0x1c1c4ff irq 28 on simplebus0
usbus4 on ohci1
gpioc0: <GPIO controller> on gpio0
aw_wdog0: <Allwinner A10 Watchdog> mem 0x1c20c90-0x1c20c9f irq 38 on simplebus0
aw_ir0: <Allwinner CIR controller> mem 0x1c21800-0x1c2183f irq 41 on simplebus0
pcm0: <Allwinner Audio Codec> mem 0x1c22c00-0x1c22c3f irq 46 on simplebus0
pcm0: cannot find codec clock
device_attach: pcm0 attach returned 6
aw_ts0: <Allwinner Touch Screen controller> mem 0x1c25000-0x1c250ff irq 48 on simplebus0
uart0: <16750 or compatible> mem 0x1c28000-0x1c283ff irq 49 on simplebus0
uart0: console (115384,n,8,1)
gpioc1: <GPIO controller> on axp2xx_pmu0
iic0: <I2C generic I/O> on iicbus0
iic1: <I2C generic I/O> on iicbus1
dwc0: <A20 Gigabit Ethernet Controller> mem 0x1c50000-0x1c5ffff irq 72 on simplebus0
miibus0: <MII bus> on dwc0
rlphy0: <RTL8201L 10/100 media interface> PHY 1 on miibus0
rlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
dwc0: Ethernet address: 02:0a:09:03:27:08
gpioled0: <GPIO LEDs> on ofwbus0
cryptosoft0: <software crypto>
Timecounters tick every 1.000 msec
usbus0: 480Mbps High Speed USB v2.0
usbus1: 480Mbps High Speed USB v2.0
usbus2: 12Mbps Full Speed USB v1.0
usbus3: 480Mbps High Speed USB v2.0
usbus4: 12Mbps Full Speed USB v1.0
Release APs
ugen0.1: <Mentor Graphics OTG Root HUB> at usbus0
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
uhub0Root mount waiting for: on usbus0
 usbus0uhub0: <Mentor Graphics OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
 usbus1ugen1.1: <Generic EHCI root HUB> at usbus1
 usbus2uhub1 usbus3 on usbus1
 usbus4uhub1: <Generic EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
 CAMugen2.1: <Generic OHCI root HUB> at usbus2

uhub2 on usbus2
uhub2: <Generic OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus2
ugen4.1: <Generic OHCI root HUB> at usbus4
ugen3.1: <Generic EHCI root HUB> at usbus3
uhub3 on usbus4
uhub4 on usbus3
uhub3: <Generic OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus4
uhub4: <Generic EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus3
mmc0: <MMC/SD bus> on aw_mmc0
mmcsd0: 249GB <SDHC SD256 6.1 SN 35B0016A MFG 09/2020 by 159 TI> at mmc0 50.0MHz/4bit/32768-block
mmc0: Failed to set VCCQ for card at relative address 20552
uhub2: 1 port with 1 removable, self powered
uhub3: 1 port with 1 removable, self powered
uhub0: 1 port with 1 removable, self powered
uhub1: 1 port with 1 removable, self powered
uhub4: 1 port with 1 removable, self powered
mountroot: waiting for device /dev/ufs/rootfs...
lo0: link state changed to UP
dwc0: link state changed to UP

Back to top