Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Apr 2023 00:27:46 +0000
From:      Dr. Rolf Jansen <freebsd-rj@cyclaero.com>
To:        freebsd-arm <freebsd-arm@freebsd.org>
Cc:        Daniel Engberg <daniel.engberg.lists@pyret.net>
Subject:   Re: Would FreeBSD run on an Orange Pi Zero 2 (Allwinner H616)
Message-ID:  <01070187688fca8d-1c25fac3-8c15-4323-bcd6-fbc9d5032cf0-000000@eu-central-1.amazonses.com>
In-Reply-To: <010701870ecab258-069e4aaf-c018-42d4-bf68-933a970b24d7-000000@eu-central-1.amazonses.com>
References:  <010701870ecab258-069e4aaf-c018-42d4-bf68-933a970b24d7-000000@eu-central-1.amazonses.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> Am 23.03.2023 um 11:06 schrieb Dr. Rolf Jansen =
<freebsd-rj@cyclaero.com>:
>=20
> Hello,
>=20
> For a new project I bought an Orange Pi Zero 2, is it worth trying =
FreeBSD with it. I don=E2=80=99t need graphics and wireless, only =
ethernet.
>=20
> http://www.orangepi.org/orangepiwiki/index.php/Orange_Pi_Zero_2
>=20
> Any insights would be appreciated.
>=20
>=20
>> Anfang der weitergeleiteten Nachricht:
>>=20
>> Von: Daniel Engberg <daniel.engberg.lists@pyret.net>
>> Betreff: Would FreeBSD run on an Orange Pi Zero 2 (Allwinner H616)
>> Datum: 25. M=C3=A4rz 2023 um 16:48:38 GMT-3
>> An: rj@obsigna.com
>>=20
>> Hi,
>>=20
>> Not subscribed but probably not as only some parts of H6 are =
supported and H616 is the next revsion =
(https://wiki.freebsd.org/arm/Allwinner#arm.2FAllwinner.2FH6.H6_Supported_=
Boards).
>> According to https://linux-sunxi.org/Xunlong_Orange_Pi_Zero2 there's =
a build target for your board and you also need to attach the correct =
dts file to the kernel and see how far it boots.
>>=20
>> You need to create a port for u-boot and modify the Makefile in src =
so the kernel includes device tree for your SBC.
>>=20
>> https://cgit.freebsd.org/src/tree/sys/modules/dtb/allwinner/Makefile
>> =
https://cgit.freebsd.org/ports/tree/sysutils/u-boot-orangepi-pc2/Makefile =
(you can use that as a template)
>>=20
>> =
https://cgit.freebsd.org/src/tree/sys/contrib/device-tree/src/arm64/allwin=
ner/sun50i-h616-orangepi-zero2.dts

My Orange Pi Zero 2 arrived, and I built an u-boot port for it following =
Daniels=E2=80=99s suggestions, however, quite possible I missed the one =
or the other point.

I built it on a RPi4B running FreeBSD 14-CURRENT (2023-03-30).

I added to /usr/src/sys/modules/dtb/allwinner/Makefile a line for the =
DTS file of the Orange Pi Zero 2 (before I checked that it exists - it =
does):

   DTS=3D    \
           allwinner/sun50i-a64-nanopi-a64.dts \
   ...
   ...
           allwinner/sun50i-h6-pine-h64-model-b.dts \
           allwinner/sun50i-h616-orangepi-zero2.dts
   ...

Then I started make in that directory and copied the generated =
sun50i-h616-orangepi-zero2.dtb to /boot/dtb/allwinner - perhaps this is =
not necessary, but it shouldn=E2=80=99t harm either.

I created a ports directory systutils/u-boot-orangepi-zero2 and I =
modified the Makefile to:

   MASTERDIR=3D	${.CURDIR}/../u-boot-master

   MODEL=3D		orangepi-zero2
   BOARD_CONFIG=3D	orangepi_zero2_defconfig
   FAMILY=3D		allwinner64
   SUBFAMILY=3D		h616

   .include "${MASTERDIR}/Makefile=E2=80=9C

In that directory, I executed make install clean, and it went through =
without hickup.

Now my Orange Pi Zero 2 boots well from a SD card with Debian 3.0.6 =
Bullseye with Linux 5.16.17-sun50iw9. That SD card is a MBR one, and =
therefore I created a new one by which I replaced the linux-data =
partition by a freebsd one having one freebsd-ufs slice.

The partition scheme of the Linux uSD card:

   =3D>      63  31116225  da2  MBR  (15G)
           63      8129       - free -  (4.0M)
         8192  30793728    1  linux-data  (15G)
     30801920    314368       - free -  (154M)

The partition scheme of the FreeBSD uSD card:

   =3D>      63  15523777  da1  MBR  (7.4G)
           63      8066       - free -  (3.9M)
         8129  15515711    1  freebsd  (7.4G)

   =3D>       0  15515711  da1s1  BSD  (7.4G)
            0  15515711      1  freebsd-ufs  (7.4G)

/dev/da1s1s contains a complete FreeBSD 14-CURRENT-aarch64 installation =
which I cloned from the respective root slice of my running RPi4B. Then =
I put sun50i-h616-orangepi-zero2.dtb into /boot/dtb/allwinner, and I =
dd=E2=80=99ed my new u-boot port to the SD card:

   dd =
if=3D/usr/local/share/u-boot/u-boot-orangepi-zero2/u-boot-sunxi-with-spl.b=
in of=3D/dev/da1 bs=3D128k seek=3D1 conv=3Dsync

I started the Orange Pi Zero 2 from the newly created uSD card and the =
serial console shows me:

   U-Boot SPL 2021.10-orangepi (Aug 09 2022 - 21:00:00 +0800)
   DRAM: 1024 MiB
   Trying to boot from MMC1
   mmc_load_image_raw_sector: mmc block read error
   SPL: failed to boot from all boot devices
   ### ERROR ### Please RESET the board ###

U-Boot SPL 2021.10-orangepi is not the one which I built (2023.01). May =
it be that the Orange Pi comes with an U-Boot somewhere on-board?

Does anybody have ideas any ideas on how to proceed?

Best regards

Rolf=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?01070187688fca8d-1c25fac3-8c15-4323-bcd6-fbc9d5032cf0-000000>