Files
u-boot/doc
Tom Rini 69491eb60a Merge patch series "allow control DTB to double as "FIT image""
Rasmus Villemoes <rv@rasmusvillemoes.dk> says:

The commit message for patch 1 explains what it is I'd like to be able
to do, but here's some more background:

For a long time, we've embedded the boot script in the U-Boot binary
by building a bootscript.itb, and using a .dtsi like

  / {
          config {
                 bootscript = /incbin/("/path/to/bootscript.itb");
          };
  };

which in turn is mentioned in CONFIG_DEVICE_TREE_INCLUDES, that
bootscript.itb FIT image has been embedded in U-Boot's control
dtb. Running that was then a matter of doing

  fdt addr ${fdtcontroladdr} && fdt get addr bsaddr /config bootscript && source ${bsaddr}

There are a couple of advantage of having the bootscript (and other
script logic) embedded in the U-Boot binary. First, there's no need to
figure out some separate partition to store the script in, and making
sure that gets updated whenever the bootloader itself does. Second,
one doesn't need to worry about verifying the script; whatever steps
one needs to take to implement secure boot for U-Boot itself will by
necessity also cover the control dtb (if nothing else then because
that's where the public key for the kernel verification lives). And
third, the boot script is automatically updated together with U-Boot
itself; and if U-Boot is stored in an eMMC boot partition, that update
is guaranteed to be atomic.

Now with the stricter requirements of libfdt starting from v2026.04,
the above command no longer worked, or only half the time, because the
embedded FIT image may not land on an 8-byte aligned address. So that
line had to be changed a little (line breaks added)

  fdt addr ${fdtcontroladdr}
    && fdt get addr bsaddr /config bootscript
    && fdt get size bssize /config bootscript
    && cp.b ${bsaddr} ${loadaddr} ${bssize}
    && source ${loadaddr}

which is getting quite unwieldy.

Then it struck me that one could perhaps simplify all of this quite a
lot: Cut out the intermediate bootscript.itb, just create a .dtsi
which directly puts a /images node inside the control dtb

/ {
  	images {
		default = "bootscript";
		bootscript {
			description = "Boot script";
			data = /incbin/("/path/to/bootscript.sh");
			type = "script";
			compression = "none";
		};
	};
};

and treat the control dtb itself as a FIT image; so the command to put
in $bootcmd becomes simply

  source ${fdtcontroladdr}:bootscript

and embedding other pieces of callable scripts is quite trivial.

And that almost works out-of-the-box, except for the fit_check_format() sanity check.

Introduce a CONFIG_ knob that allows one to opt out of those sanity
checks, for the special case of the address being checked being
identical to gd->fdt_blob.

Link: https://lore.kernel.org/r/20260602213013.558064-1-rv@rasmusvillemoes.dk
2026-06-11 07:56:52 -06:00
..
2025-10-18 11:50:08 +02:00
2026-06-10 11:23:26 +02:00
2026-06-09 11:51:19 +02:00
2026-04-06 11:56:52 -06:00

This patch series adds support for ZFS listing and load to u-boot.

To Enable zfs ls and load commands, modify the board specific config file with
#define CONFIG_CMD_ZFS

Steps to test:

1. After applying the patch, zfs specific commands can be seen
   in the boot loader prompt using
	UBOOT #help

	zfsload- load binary file from a ZFS file system
	zfsls  - list files in a directory (default /)

2. To list the files in zfs pool, device or partition, execute
	zfsls <interface> <dev[:part]> [POOL/@/dir/file]
	For example:
	UBOOT #zfsls mmc 0:5 /rpool/@/usr/bin/

3. To read and load a file from an ZFS formatted partition to RAM, execute
	zfsload <interface> <dev[:part]> [addr] [filename] [bytes]
	For example:
	UBOOT #zfsload mmc 2:2 0x30007fc0 /rpool/@/boot/uImage

References :
	-- ZFS GRUB sources from Solaris GRUB-0.97
	-- GRUB Bazaar repository

Jorgen Lundman <lundman at lundman.net> 2012.