[PATCH v2 00/22] vbe: Series part F

Simon Glass sjg at chromium.org
Thu Jan 16 02:27:01 CET 2025


This includes various patches towards implementing the VBE abrec
bootmeth in U-Boot. It mostly focuses on introducing a relocating
SPL-loader so that VBE can run in the limited amount of SRAM available
on many devices.

Another minor new feature is support in VBE for specifying the image
phase when loading from a FIT. This allows a single FIT to include
images for several boot phases, thus simplifying image-creation.

One lingering niggle in this series is that it has a different code path
for sandbox, since it does not support the relocating jump. It should be
possible to resolve this with additional work, but I have not attempted
this so far.

For v2, I have split the first patch into 5 pieces, to make it easier to
see the code-size impact, plus added a few tweaks to reduce code size.

Again, only MMC is supported so far.

Looking ahead, series G will have some more plumbing and H some rk3399
pieces. That should be enough to complete these feature.

Here is a run in my lab, with the VBE ABrec bootmeth. You can see that
VPL runs before memory is set up. SPL sets up memory and can be upgraded
in the field reliably.

$ ub-int vbe
Building U-Boot in sourcedir for rk3399-generic
Bootstrapping U-Boot from dir /tmp/b/rk3399-generic
Writing U-Boot using method rockchip

U-Boot TPL 2025.01-rc3-00345-gdfbdbf1eb56c-dirty (Jan 08 2025 - 10:47:58)
Trying to boot from vbe_abrec
load: Firefly-RK3399 Board
   Using 'config-3' configuration
   Trying 'image-vpl' firmware subimage
   Using 'config-3' configuration
   Trying 'fdt-3' fdt subimage

U-Boot VPL 2025.01-rc3-00345-gdfbdbf1eb56c-dirty (Jan 08 2025 - 10:47:58)
Trying to boot from vbe_abrec
load: Firefly-RK3399 Board
Starting with empty state
VBE: Firmware pick A at 800000
   Using 'config-3' configuration
   Trying 'spl' firmware subimage
   Using 'config-3' configuration
   Trying 'fdt-3' fdt subimage
Channel 0: DDR3, 800MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
Channel 1: DDR3, 800MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
256B stride

U-Boot SPL 2025.01-rc3-00345-gdfbdbf1eb56c-dirty (Jan 08 2025 - 10:47:58 -0700)
Trying to boot from vbe_abrec
load: Firefly-RK3399 Board
VBE: Firmware pick A at 900000
load_simple_fit: Skip load 'atf-5': image size is 0!
Relocating bloblist ff8eff00 to 100000: done
ns16550_serial serial at ff1a0000: pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19

U-Boot 2025.01-rc3-00345-gdfbdbf1eb56c-dirty (Jan 08 2025 - 10:47:58 -0700)

SoC: Rockchip rk3399
Reset cause: POR
Model: Firefly-RK3399 Board
DRAM:  4 GiB (effective 3.9 GiB)
Core:  314 devices, 33 uclasses, devicetree: separate
MMC:   mmc at fe310000: 3, mmc at fe320000: 1, mmc at fe330000: 0
Loading Environment from SPIFlash... Invalid bus 0 (err=-19)
*** Warning - spi_flash_probe_bus_cs() failed, using default environment

In:    serial,usbkbd
Out:   serial,vidconsole
Err:   serial,vidconsole
Model: Firefly-RK3399 Board
Net:   PMIC:  RK808
eth0: ethernet at fe300000

starting USB...
Bus usb at fe380000: USB EHCI 1.00
Bus usb at fe3a0000: USB OHCI 1.0
Bus usb at fe3c0000: USB EHCI 1.00
Bus usb at fe3e0000: USB OHCI 1.0
Bus usb at fe900000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb at fe380000 for devices... 1 USB Device(s) found
scanning bus usb at fe3a0000 for devices... 1 USB Device(s) found
scanning bus usb at fe3c0000 for devices... 2 USB Device(s) found
scanning bus usb at fe3e0000 for devices... 1 USB Device(s) found
scanning bus usb at fe900000 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0


Changes in v2:
- Split patch into several pieces
- Split patch into several pieces
- Add new patch to convert some checks to assertions
- Split patch into several pieces
- Split patch into several pieces
- Reduce inclusion of headers to only those necessary
- Split patch into several pieces
- Reword commit subject
- Move common code to the end of the file
- Split up the first patch into 5 separate patches, to highlight code size

Simon Glass (22):
  vbe: Use blk_read() to read blocks
  vbe: Start a common header file
  vbe: Use a block device instead of descriptor
  vbe: Pass simple_priv to internal functions
  vbe: Convert some checks to assertions
  vbe: Create a common function to get the block device
  vbe: Move reading the version into the common file
  vbe: Move reading the nvdata into the common file
  vbe: Split out reading a FIT into the common file
  vbe: Allocate space for the FIT header
  vbe: Allow VBE to load FITs on any architecture
  vbe: Tidy up error checking with blk_read()
  vbe: Handle loading from an unaligned offset
  vbe: Allow loading loadables if there is no firmware
  vbe: Support loading an FDT from the FIT
  spl: Add fields for VBE
  spl: Add a type for the jumper function
  spl: Add support for a relocating jump to the next phase
  spl: Plumb in the relocating loader
  vbe: Support loading an FDT with the relocating loader
  vbe: Support loading SPL images
  vbe: Update simple-fw to support using the SPL loader

 boot/Makefile          |   2 +-
 boot/vbe_common.c      | 375 +++++++++++++++++++++++++++++++++++++++++
 boot/vbe_common.h      | 137 +++++++++++++++
 boot/vbe_simple.c      |  98 ++---------
 boot/vbe_simple.h      |  16 +-
 boot/vbe_simple_fw.c   | 207 +++++++++--------------
 common/spl/Kconfig     |   8 +
 common/spl/Kconfig.tpl |   8 +
 common/spl/Kconfig.vpl |   8 +
 common/spl/Makefile    |   1 +
 common/spl/spl.c       |  15 +-
 common/spl/spl_reloc.c | 183 ++++++++++++++++++++
 include/spl.h          |  90 +++++++++-
 13 files changed, 924 insertions(+), 224 deletions(-)
 create mode 100644 boot/vbe_common.c
 create mode 100644 boot/vbe_common.h
 create mode 100644 common/spl/spl_reloc.c

-- 
2.34.1



More information about the U-Boot mailing list