ZFS support in custom u-boot build...

To all those of concern,
I am in need of help regarding building u-boot with ZFS support for the Orange Pi 5 Plus.
I have tried working out the following...
https://github.com/u-boot/u-boot/blob/22ad69b7987eb4b10221330661db4427e40174...
The URL link above specifies using the board specific config file, which for the Orange Pi 5 Plus is (so I believe) orangepi-build/userpatches/config-default.conf. I therefore edited this file in question with CONFIG_CMD_ZFS="yes" and uncommenting the line install_zfs="yes".
However, it still does not allow me to boot with root ZFS on the NVMe SSD with the official Orange Pi Debian v12 (Bookwork) ARM image. ZFS does not seem to be referenced in the custom u-boot source code build output as well. I followed the build instructions located at the following URL link...
http://www.orangepi.org/orangepiwiki/index.php/Orange_Pi_5_Plus#Compile_u-bo...
...but am I required to apply a patch to the u-boot source for ZFS support? If so, then that could be my problem. If a patch is required, then how would I go about applying this accordingly?
Thank you in advance for help in this matter. Kindest regards, -Stacey Pellegrino

Hello Stacey,
Am Thu, Oct 05, 2023 at 11:22:14AM +0100 schrieb Stacey Pellegrino:
To all those of concern,
I am in need of help regarding building u-boot with ZFS support for the Orange Pi 5 Plus.
I have tried working out the following...
https://github.com/u-boot/u-boot/blob/22ad69b7987eb4b10221330661db4427e40174...
The URL link above specifies using the board specific config file, which for the Orange Pi 5 Plus is (so I believe) orangepi-build/userpatches/config-default.conf. I therefore edited this file in question with CONFIG_CMD_ZFS="yes" and uncommenting the line install_zfs="yes".
In that regard this README.zfs is somewhat outdated. You should set CMD_ZFS through Kconfig instead. Which means: pick the matching defconfig from configs/ subfolder, then run menuconfig and enable CMD_ZFS, and build that.
Not sure if that Orange Pi 5 Plus is already supported by U-Boot mainline already. From a quick glance at the defconfig filenames I would not know which to pick.
However, it still does not allow me to boot with root ZFS on the NVMe SSD with the official Orange Pi Debian v12 (Bookwork) ARM image. ZFS does not seem to be referenced in the custom u-boot source code build output as well. I followed the build instructions located at the following URL link...
http://www.orangepi.org/orangepiwiki/index.php/Orange_Pi_5_Plus#Compile_u-bo...
Oh you should have told before. This uses a custom build script not part of U-Boot, probably to call U-Boot build. Please contact that project on how to change U-Boot config instead. Or look at their build.sh and figure out how it configures and builds U-Boot.
...but am I required to apply a patch to the u-boot source for ZFS support? If so, then that could be my problem. If a patch is required, then how would I go about applying this accordingly?
Although they seem to use an outdated and patched version v2017.09 of u-boot: probably not. Please try with enabling CMD_ZFS in your U-Boot config first. It's in the menuconfig, also in v2017.09 already.
Greets Alex
Thank you in advance for help in this matter. Kindest regards, -Stacey Pellegrino

Hey Alex,
Many thanks for your email response! Updated compilation configuration to enable CONFIG_CMD_ZFS with make menuconfig. However, when using the build.sh script it tends to overwrite the .config file for the u-boot compile in question. Steven (CCed on this email) from Orange Pi is looking into this for me (so I believe)? Upon getting ZFS compiled into u-boot will then be the options needed to pass for booting a root ZFS partition accordingly. All supporting information regarding this would be so much appreciated! Kindest regards, -Stacey Pellegrino
On Tue, 10 Oct 2023 at 12:01, Alexander Dahl ada@thorsis.com wrote:
Hello Stacey,
Am Thu, Oct 05, 2023 at 11:22:14AM +0100 schrieb Stacey Pellegrino:
To all those of concern,
I am in need of help regarding building u-boot with ZFS support for the Orange Pi 5 Plus.
I have tried working out the following...
https://github.com/u-boot/u-boot/blob/22ad69b7987eb4b10221330661db4427e40174...
The URL link above specifies using the board specific config file, which for the Orange Pi 5 Plus is (so I believe) orangepi-build/userpatches/config-default.conf. I therefore edited this file in question with CONFIG_CMD_ZFS="yes" and uncommenting the line install_zfs="yes".
In that regard this README.zfs is somewhat outdated. You should set CMD_ZFS through Kconfig instead. Which means: pick the matching defconfig from configs/ subfolder, then run menuconfig and enable CMD_ZFS, and build that.
Not sure if that Orange Pi 5 Plus is already supported by U-Boot mainline already. From a quick glance at the defconfig filenames I would not know which to pick.
However, it still does not allow me to boot with root ZFS on the NVMe SSD with the official Orange Pi Debian v12 (Bookwork) ARM image. ZFS does not seem to be referenced in the custom u-boot source code build output as well. I followed the build instructions located at the following URL
link...
http://www.orangepi.org/orangepiwiki/index.php/Orange_Pi_5_Plus#Compile_u-bo...
Oh you should have told before. This uses a custom build script not part of U-Boot, probably to call U-Boot build. Please contact that project on how to change U-Boot config instead. Or look at their build.sh and figure out how it configures and builds U-Boot.
...but am I required to apply a patch to the u-boot source for ZFS
support?
If so, then that could be my problem. If a patch is required, then how would I go about applying this accordingly?
Although they seem to use an outdated and patched version v2017.09 of u-boot: probably not. Please try with enabling CMD_ZFS in your U-Boot config first. It's in the menuconfig, also in v2017.09 already.
Greets Alex
Thank you in advance for help in this matter. Kindest regards, -Stacey Pellegrino

Hey (again) Alex,
As a follow up to my previous email (see below) the following has been achieved...
spellegrino@orangepi-build-sys:~/src/orangepi-build/u-boot/v2017.09-rk3588$ *sudo make distclean* spellegrino@orangepi-build-sys:~/src/orangepi-build/u-boot/v2017.09-rk3588$ *sudo make orangepi_5_plus_defconfig* HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/zconf.lex.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config # spellegrino@orangepi-build-sys:~/src/orangepi-build/u-boot/v2017.09-rk3588$ *grep ZFS .config* # CONFIG_CMD_ZFS is not set spellegrino@orangepi-build-sys:~/src/orangepi-build/u-boot/v2017.09-rk3588$ *sudo vi .config* spellegrino@orangepi-build-sys:~/src/orangepi-build/u-boot/v2017.09-rk3588$ *grep ZFS .config* CONFIG_CMD_ZFS=y
spellegrino@orangepi-build-sys:~/src/orangepi-build/u-boot/v2017.09-rk3588$ *sudo make CROSS_COMPILE=aarch64-linux-gnu- all*
...
CC cmd/zfs.o cmd/zfs.c: In function ‘do_zfs_load’: cmd/zfs.c:43:14: error: unused variable ‘buf’ [-Werror=unused-variable] 43 | char buf[12]; | ^~~ cc1: all warnings being treated as errors make[1]: *** [scripts/Makefile.build:281: cmd/zfs.o] Error 1 make: *** [Makefile:1307: cmd] Error 2
spellegrino@orangepi-build-sys:~/src/orangepi-build/u-boot/v2017.09-rk3588$ *grep Werror Makefile* KBUILD_CFLAGS += -fshort-wchar -Werror KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) spellegrino@orangepi-build-sys:~/src/orangepi-build/u-boot/v2017.09-rk3588$ *sudo vi Makefile* (remove the -Werror flag) spellegrino@orangepi-build-sys:~/src/orangepi-build/u-boot/v2017.09-rk3588$ *grep Werror Makefile* KBUILD_CFLAGS += $(call cc-option,-Werror=date-time)
spellegrino@orangepi-build-sys:~/src/orangepi-build/u-boot/v2017.09-rk3588$ *sudo make CROSS_COMPILE=aarch64-linux-gnu- all*
spellegrino@orangepi-build-sys:~/src/orangepi-build/u-boot/v2017.09-rk3588$ *ls -lrt* total 20348 -rw-rw-r-- 1 root root 34 Oct 4 22:13 PREUPLOAD.cfg -rw-rw-r-- 1 root root 14626 Oct 4 22:13 MAINTAINERS drwxrwxr-x 2 root root 4096 Oct 4 22:13 Licenses -rw-rw-r-- 1 root root 16071 Oct 4 22:13 Kconfig -rw-rw-r-- 1 root root 1863 Oct 4 22:13 Kbuild drwxrwxr-x 3 root root 4096 Oct 4 22:13 Documentation -rw-rw-r-- 1 root root 187683 Oct 4 22:13 README drwxrwxr-x 2 root root 4096 Oct 4 22:13 api drwxrwxr-x 14 root root 4096 Oct 4 22:13 arch drwxrwxr-x 181 root root 4096 Oct 4 22:13 board -rw-rw-r-- 1 root root 2260 Oct 4 22:13 config.mk drwxrwxr-x 2 root root 61440 Oct 4 22:13 configs drwxrwxr-x 10 root root 12288 Oct 4 22:13 doc drwxrwxr-x 4 root root 4096 Oct 4 22:13 examples -rwxrwxr-x 1 root root 21097 Oct 4 22:13 make.sh drwxrwxr-x 5 root root 4096 Oct 4 22:13 post -rw-rw-r-- 1 root root 17 Oct 4 22:13 snapshot.commit drwxrwxr-x 6 root root 4096 Oct 4 22:13 scripts drwxr-xr-x 3 root root 4096 Oct 23 15:16 tmp -rw-r--r-- 1 root root 57653 Oct 23 16:01 Makefile.ORIGINAL -rw-rw-r-- 1 root root 57645 Oct 23 16:29 Makefile drwxrwxr-x 18 root root 12288 Oct 23 16:29 tools drwxrwxr-x 6 root root 12288 Oct 23 16:29 cmd drwxrwxr-x 6 root root 12288 Oct 23 16:30 common drwxrwxr-x 2 root root 4096 Oct 23 16:30 disk drwxrwxr-x 57 root root 4096 Oct 23 16:30 drivers drwxrwxr-x 2 root root 4096 Oct 23 16:31 env drwxrwxr-x 12 root root 4096 Oct 23 16:31 fs drwxrwxr-x 15 root root 12288 Oct 23 16:31 lib drwxrwxr-x 2 root root 4096 Oct 23 16:31 net drwxrwxr-x 12 root root 4096 Oct 23 16:31 test -rw-r--r-- 1 root root 1304 Oct 23 16:31 u-boot.lds -rw-r--r-- 1 root root 936894 Oct 23 16:31 u-boot.map -rwxr-xr-x 1 root root 9549784 Oct 23 16:31 u-boot -rwxr-xr-x 1 root root 3273004 Oct 23 16:31 u-boot.srec -rwxr-xr-x 1 root root 1138400 Oct 23 16:31 u-boot-nodtb.bin drwxrwxr-x 2 root root 4096 Oct 23 16:31 dts -rw-r--r-- 1 root root 1150948 Oct 23 16:31 u-boot-dtb.bin -rw-r--r-- 1 root root 1150952 Oct 23 16:31 u-boot.bin -rw-r--r-- 1 root root 365877 Oct 23 16:31 u-boot.sym -rw-r--r-- 1 root root 188951 Oct 23 16:31 System.map drwxr-xr-x 13 root root 4096 Oct 23 16:32 spl -rw-r--r-- 1 root root 1233408 Oct 23 16:32 u-boot.img drwxr-xr-x 10 root root 4096 Oct 23 16:32 tpl -rw-r--r-- 1 root root 12548 Oct 23 16:32 u-boot.dtb -rw-r--r-- 1 root root 1233408 Oct 23 16:32 u-boot-dtb.img drwxrwxr-x 34 root root 20480 Oct 23 16:32 include -rw-r--r-- 1 root root 18126 Oct 23 16:32 u-boot.cfg -rw-r--r-- 1 root root 11596 Oct 23 16:32 u-boot.cfg.configs
So I can now cross-compile. With this directory listing do I just dd u-boot.bin to the NVMe card? Thank you and kindest regards, -Stacey Pellegrino
On Mon, 23 Oct 2023 at 15:52, Stacey Pellegrino stacey.pellegrino@gmail.com wrote:
Hey Alex,
Many thanks for your email response! Updated compilation configuration to enable CONFIG_CMD_ZFS with make menuconfig. However, when using the build.sh script it tends to overwrite the .config file for the u-boot compile in question. Steven (CCed on this email) from Orange Pi is looking into this for me (so I believe)? Upon getting ZFS compiled into u-boot will then be the options needed to pass for booting a root ZFS partition accordingly. All supporting information regarding this would be so much appreciated! Kindest regards, -Stacey Pellegrino
On Tue, 10 Oct 2023 at 12:01, Alexander Dahl ada@thorsis.com wrote:
Hello Stacey,
Am Thu, Oct 05, 2023 at 11:22:14AM +0100 schrieb Stacey Pellegrino:
To all those of concern,
I am in need of help regarding building u-boot with ZFS support for the Orange Pi 5 Plus.
I have tried working out the following...
https://github.com/u-boot/u-boot/blob/22ad69b7987eb4b10221330661db4427e40174...
The URL link above specifies using the board specific config file, which for the Orange Pi 5 Plus is (so I believe) orangepi-build/userpatches/config-default.conf. I therefore edited this file in question with CONFIG_CMD_ZFS="yes" and uncommenting the line install_zfs="yes".
In that regard this README.zfs is somewhat outdated. You should set CMD_ZFS through Kconfig instead. Which means: pick the matching defconfig from configs/ subfolder, then run menuconfig and enable CMD_ZFS, and build that.
Not sure if that Orange Pi 5 Plus is already supported by U-Boot mainline already. From a quick glance at the defconfig filenames I would not know which to pick.
However, it still does not allow me to boot with root ZFS on the NVMe
SSD
with the official Orange Pi Debian v12 (Bookwork) ARM image. ZFS does
not
seem to be referenced in the custom u-boot source code build output as well. I followed the build instructions located at the following URL
link...
http://www.orangepi.org/orangepiwiki/index.php/Orange_Pi_5_Plus#Compile_u-bo...
Oh you should have told before. This uses a custom build script not part of U-Boot, probably to call U-Boot build. Please contact that project on how to change U-Boot config instead. Or look at their build.sh and figure out how it configures and builds U-Boot.
...but am I required to apply a patch to the u-boot source for ZFS
support?
If so, then that could be my problem. If a patch is required, then how would I go about applying this accordingly?
Although they seem to use an outdated and patched version v2017.09 of u-boot: probably not. Please try with enabling CMD_ZFS in your U-Boot config first. It's in the menuconfig, also in v2017.09 already.
Greets Alex
Thank you in advance for help in this matter. Kindest regards, -Stacey Pellegrino
participants (2)
-
Alexander Dahl
-
Stacey Pellegrino