# Run FreeBSD on Banana Pi M2+?



## Knogle (Sep 30, 2020)

Ahoy friends.
Currently i'm struggeling in order to get my Banana Pi M2+ running with something, it's quite difficult, because there is less information available compared to Raspberry Pi.
I've found the Banana Pi M2+ in den list of supported devices, so i've downloaded the SD card images from the download page for the Banana Pi.
Later on i've flashed it onto the SD card, but unfortunately it's not possible to boot the Banana Pi using this image.
Is there anything i'm missing? I've just dd'ed the image onto the SD card, and partitions seem fine.
Did i miss some step, or what do i have to do in order to get it working?

I hope someone could help!
Thanks in advance!


----------



## tingo (Oct 1, 2020)

Where did you find a FreeBSD image for the Banana Pi M2+?
AFAIK, the only FreeBSD image is for the original Banana Pi, not any other models (I could be wrong).


----------



## Knogle (Oct 2, 2020)

tingo said:


> Where did you find a FreeBSD image for the Banana Pi M2+?
> AFAIK, the only FreeBSD image is for the original Banana Pi, not any other models (I could be wrong).


I took a look onto this page https://wiki.freebsd.org/action/show/arm/Allwinner?action=show&redirect=FreeBSD/arm/Allwinner
So according to FreeBSD the SoC seems to be supported, so i took the Banana Pi Image from Download page.
Or do i have to go a different way in order to get it working?


----------



## tingo (Oct 2, 2020)

Hmm, the Banana Pi M2+ seems to be an Allwinner H3 http://www.banana-pi.org/m2p.html. But the original Banana Pi is an Allwinner A20 http://banana-pi.org/m1.html, I have no idea if the image for this board would work on the M2+ at all.


----------



## George (Oct 3, 2020)

> but unfortunately it's not possible to boot the Banana Pi using this image.



Maybe compare your error message to the ones reported here:





						Bug List
					






					bugs.freebsd.org


----------



## Knogle (Feb 24, 2021)

Thanks friends.
I was able to get at least a running system using the Orange Pi u-boot image, provided by FreeBSD mirrors.

My dmesg output.

`---<<BOOT>>---
KDB: debugger backends: ddb
KDB: current backend: ddb
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 14.0-CURRENT #0 main-n244889-fa3bd463cee: Thu Feb 18 08:33:14 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)
WARNING: WITNESS option enabled, expect reduced performance.
VT: init without driver.
CPU: ARM Cortex-A7 r0p5 (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:
 512KB/64B 8-way unified cache WB Read-Alloc Write-Alloc
real memory  = 1039605760 (991 MB)
avail memory = 999620608 (953 MB)
No PSCI/SMCCC call function found
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
random: unblocking device.
random: entropy device external interface
WARNING: Device "openfirm" is Giant locked and may be deleted before FreeBSD 14.0.
WARNING: Device "kbd" is Giant locked and may be deleted before FreeBSD 14.0.
kbd0 at kbdmux0
ofwbus0: <Open Firmware Device Tree>
ofw_clkbus0: <OFW clocks bus> on ofwbus0
clk_fixed0: <Fixed clock> on ofw_clkbus0
clk_fixed1: <Fixed clock> on ofw_clkbus0
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
rtc0: <Allwinner RTC> mem 0x1f00000-0x1f003ff irq 45,46 on simplebus0
rtc0: registered as a time-of-day clock, resolution 1.000000s
ccu_h3ng0: <Allwinner H3/H5 Clock Control Unit NG> mem 0x1c20000-0x1c203ff on simplebus0
ccu_sun8i_r0: <Allwinner SUN8I_R Clock Control Unit NG> mem 0x1f01400-0x1f014ff on simplebus0
gic0: <ARM Generic Interrupt Controller> mem 0x1c81000-0x1c81fff,0x1c82000-0x1c83fff,0x1c84000-0x1c85fff,0x1c86000-0x1c87fff irq 42 on simplebus0
gic0: pn 0x1, arch 0x2, rev 0x1, implementer 0x43b irqs 160
gpio0: <Allwinner GPIO/Pinmux controller> mem 0x1c20800-0x1c20bff irq 23,24 on simplebus0
gpiobus0: <OFW GPIO bus> on gpio0
gpio1: <Allwinner GPIO/Pinmux controller> mem 0x1f02c00-0x1f02fff irq 49 on simplebus0
gpiobus1: <OFW GPIO bus> on gpio1
gpioregulator0: <GPIO controlled regulator> on ofwbus0
generic_timer0: <ARMv7 Generic Timer> irq 4,5,6,7 on ofwbus0
Timecounter "ARM MPCore Timecounter" frequency 24000000 Hz quality 1000
Event timer "ARM MPCore Eventtimer" frequency 24000000 Hz quality 1000
aw_syscon0: <Allwinner syscon> mem 0x1c00000-0x1c00fff on simplebus0
aw_sid0: <Allwinner Secure ID Controller> mem 0x1c14000-0x1c143ff on simplebus0
awusbphy0: <Allwinner USB PHY> mem 0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803,0x1c1c800-0x1c1c803,0x1c1d800-0x1c1d803 on simplebus0
a31dmac0: <Allwinner DMA controller> mem 0x1c02000-0x1c02fff irq 8 on simplebus0
aw_mmc0: <Allwinner Integrated MMC/SD controller> mem 0x1c0f000-0x1c0ffff irq 10 on simplebus0
musbotg0: <Allwinner USB DRD> mem 0x1c19000-0x1c193ff irq 14 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 0x1c1a000-0x1c1a0ff irq 15 on simplebus0
usbus1: EHCI version 1.0
usbus1 on ehci0
ohci0: <Generic OHCI Controller> mem 0x1c1a400-0x1c1a4ff irq 16 on simplebus0
usbus2 on ohci0
ehci1: <Generic EHCI Controller> mem 0x1c1b000-0x1c1b0ff irq 17 on simplebus0
usbus3: EHCI version 1.0
usbus3 on ehci1
ohci1: <Generic OHCI Controller> mem 0x1c1b400-0x1c1b4ff irq 18 on simplebus0
usbus4 on ohci1
gpioc0: <GPIO controller> on gpio0
awg0: <Allwinner Gigabit Ethernet> mem 0x1c30000-0x1c3ffff irq 27 on simplebus0
miibus0: <MII bus> on awg0
ukphy0: <Generic IEEE 802.3u media interface> PHY 0 on miibus0
ukphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto, auto-flow
ukphy1: <Generic IEEE 802.3u media interface> PHY 1 on miibus0
ukphy1:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto, auto-flow
awg0: Ethernet address: 02:81:e6:05:63:f7
aw_wdog0: <Allwinner A31 Watchdog> mem 0x1c20ca0-0x1c20cbf irq 30 on simplebus0
uart0: <16750 or compatible> mem 0x1c28000-0x1c283ff irq 35 on simplebus0
uart0: console (115384,n,8,1)
gpioc1: <GPIO controller> on gpio1
aw_thermal0: <Allwinner Thermal Sensor Controller> mem 0x1c25000-0x1c253ff irq 60 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
cpu2: <Open Firmware CPU> on cpulist0
cpu3: <Open Firmware CPU> on cpulist0
pmu0: <Performance Monitoring Unit> irq 0,1,2,3 on ofwbus0
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
Release APs
usbus4: 12Mbps Full Speed USB v1.0
WARNING: WITNESS option enabled, expect reduced performance.
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
ugen1.1: <Generic EHCI root HUB> at usbus1
ugen0.1: <Mentor Graphics OTG Root HUB> at usbus0
ugen3.1: <Generic EHCI root HUB> at usbus3
ugen2.1: <Generic OHCI root HUB> at usbus2
Root mount waiting for:ugen4.1: <Generic OHCI root HUB> at usbus4
sysctl_warn_reuse: can't re-use a leaf (dev.uhub.%parent)!
uhub0 on usbus1
uhub0: <Generic EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
uhub3 on usbus3
uhub3: <Generic EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus3
uhub1 on usbus2
uhub1: <Generic OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus2
uhub4 usbus0 on usbus4
 usbus1 usbus2 usbus3sysctl_warn_reuse: can't re-use a leaf (dev.uhub.%parent)!
 usbus4uhub4: <Generic OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus4

uhub2 on usbus0
uhub2: <Mentor Graphics OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
uhub1: 1 port with 1 removable, self powered
uhub4: 1 port with 1 removable, self powered
uhub2: 1 port with 1 removable, self powered
mmc0: <MMC/SD bus> on aw_mmc0
mmcsd0: 8GB <SDHC SS08G 8.0 SN 0A5AD9B1 MFG 12/2019 by 3 SD> at mmc0 50.0MHz/4bit/32768-block
mmc0: Failed to set VCCQ for card at relative address 58916
uhub0: 1 port with 1 removable, self powered
uhub3: 1 port with 1 removable, self powered
mountroot: waiting for device /dev/ufs/rootfs...
WARNING:  was not properly dismounted
lo0: link state changed to UP
awg0: link state changed to DOWN
ugen3.2: <SMI Intenso Ultra Line> at usbus3
umass0 on uhub3
umass0: <SMI Intenso Ultra Line, class 0/0, rev 2.10/11.00, addr 2> on usbus3
umass0:  SCSI over Bulk-Only; quirks = 0x4000
umass0:0:0: Attached to scbus0
da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
da0: <Intenso Ultra Line 1100> Removable Direct Access SPC-4 SCSI device
da0: Serial Number 22009081300295
da0: 40.000MB/s transfers
da0: 14800MB (30310400 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>`

Unfortunately i am not able to get the awg0 ethernet interface working, status says : no carrier.
Is there anything i could do? There are also no blinking leds when plugging in an ethernet cable. So up to now i have to use UART in order to access the system.
I've tried GENERICSD ARM image, as well as the Banana Pi ones with the Orange Pi u-boot image for the H3 Allwinner.


----------



## tingo (Feb 27, 2021)

The machine has usb ports - yes? If so, you could attach either an usb-to-ethernet or an usb-to-wireless dongle as a way to get network to it, until you (or someone else) figures out whats wrong with the network interface on it.


----------



## Tjure (May 1, 2021)

I got it working with FreeBSD 12.2 and 13.0 using u-boot-sunxi-with-spl.bin and sun8i-h3-bananapi-m2-plus.dtb from u-boot git.

I have attached these files and a Linux-script to patch the FreeBSD-GENERICD images:
patch_freebsd.sh FreeBSD-13.0-RELEASE-arm-armv7-GENERICSD.img m2-plus

I have no idea if the HDMI-output is working, but USB and Ethernet certainly are operating.


----------



## Knogle (May 2, 2021)

Thanks a lot!! It is working flawlessly!! But somehow, the Ethernet Port LEDs are blinking in a weird manner heh.


----------



## Tjure (May 3, 2021)

I don't observe weirdly blinking ethernet LEDs. Just a thought: Do you have version 1.2 of the M2+? 
http://wiki.banana-pi.org/File:V1.2_hardware_2.jpg


----------

