vpl: Introduce a verifying program loader
Subsystems (2)
cover vpl: Introduce a verifying program loader
U-Boot provides a verified-boot feature based around FIT, but there is no standard way of implementing it for a board. At present the various required pieces must be built up separately, to produce a working implementation. In particular, there is no built-in support for selecting A/B boot or recovery mode.
This series introduces VPL, a verified program loader. Its purpose is to run the verified-boot process and decide which SPL binary should be run. Adding VPL into the boot flow provides a standard way of implementing verified boot. So far, only the phase itself is added. More work is needed to add logic to the phase, based on continuing discussions about how best to standardise this feature.
Simon Glass (4):
doc: Convert SPL documentation to ReST
doc: Expand SPL docs to explain the phase and config
binman: Add VPL support
Introduce Verifying Program Loader (VPL)
common/Kconfig | 67 ++++++++
common/spl/Kconfig | 168 ++++++++++++++++++++-
common/spl/spl.c | 25 ++-
doc/develop/index.rst | 1 +
doc/{README.SPL => develop/spl.rst} | 99 +++++++-----
include/bootstage.h | 2 +
include/linux/kconfig.h | 3 +
include/spl.h | 20 ++-
lib/Kconfig | 54 +++++++
scripts/Kbuild.include | 4 +
scripts/Makefile.build | 4 +
tools/binman/etype/u_boot_vpl.py | 42 ++++++
tools/binman/etype/u_boot_vpl_bss_pad.py | 44 ++++++
tools/binman/etype/u_boot_vpl_dtb.py | 28 ++++
tools/binman/etype/u_boot_vpl_expanded.py | 45 ++++++
tools/binman/etype/u_boot_vpl_nodtb.py | 42 ++++++
tools/binman/ftest.py | 110 +++++++++++---
tools/binman/state.py | 3 +-
tools/binman/test/082_fdt_update_all.dts | 2 +
tools/binman/test/201_u_boot_vpl.dts | 11 ++
tools/binman/test/202_u_boot_vpl_nodtb.dts | 13 ++
tools/binman/test/203_fdt_incl_vpl.dts | 13 ++
tools/binman/test/204_vpl_bss_pad.dts | 17 +++
23 files changed, 748 insertions(+), 69 deletions(-)
rename doc/{README.SPL => develop/spl.rst} (61%)
create mode 100644 tools/binman/etype/u_boot_vpl.py
create mode 100644 tools/binman/etype/u_boot_vpl_bss_pad.py
create mode 100644 tools/binman/etype/u_boot_vpl_dtb.py
create mode 100644 tools/binman/etype/u_boot_vpl_expanded.py
create mode 100644 tools/binman/etype/u_boot_vpl_nodtb.py
create mode 100644 tools/binman/test/201_u_boot_vpl.dts
create mode 100644 tools/binman/test/202_u_boot_vpl_nodtb.dts
create mode 100644 tools/binman/test/203_fdt_incl_vpl.dts
create mode 100644 tools/binman/test/204_vpl_bss_pad.dtsSignature · 1 line
2.31.1.607.g51e8a6a459-goog
PATCH 1/4 doc: Convert SPL documentation to ReST
Move this documentation over to .rst format.
---
doc/develop/index.rst | 1 +
doc/{README.SPL => develop/spl.rst} | 36 +++++++++++++++--------------
2 files changed, 20 insertions(+), 17 deletions(-)
rename doc/{README.SPL => develop/spl.rst} (87%)doc/develop/index.rst +1 -0
@@ -14,6 +14,7 @@ Implementation global_data logging menus + spl uefi/index version
doc/develop/spl.rst renamed from doc/README.SPL +19 -17
@@ -20,19 +20,19 @@ u-boot-spl.map. A config option named CONFIG_SPL_BUILD is enabled by Kconfig for SPL. Source files can therefore be compiled for SPL with different settings. -For example: +For example:: -ifeq ($(CONFIG_SPL_BUILD),y) -obj-y += board_spl.o -else -obj-y += board.o -endif + ifeq ($(CONFIG_SPL_BUILD),y) + obj-y += board_spl.o + else + obj-y += board.o + endif -obj-$(CONFIG_SPL_BUILD) += foo.o + obj-$(CONFIG_SPL_BUILD) += foo.o -#ifdef CONFIG_SPL_BUILD - foo(); -#endif + #ifdef CONFIG_SPL_BUILD + foo(); + #endif The building of SPL images can be enabled by CONFIG_SPL option in Kconfig.
@@ -71,11 +71,13 @@ Device tree The U-Boot device tree is filtered by the fdtgrep tools during the build process to generate a much smaller device tree used in SPL (spl/u-boot-spl.dtb) with: + - the mandatory nodes (/alias, /chosen, /config) - the nodes with one pre-relocation property: 'u-boot,dm-pre-reloc' or 'u-boot,dm-spl' fdtgrep is also used to remove: + - the properties defined in CONFIG_OF_SPL_REMOVE_PROPS - all the pre-relocation properties ('u-boot,dm-pre-reloc', 'u-boot,dm-spl' and 'u-boot,dm-tpl')
@@ -98,14 +100,14 @@ stack usage at various points in run sequence of SPL. The -fstack-usage option to gcc will produce '.su' files (such as arch/arm/cpu/armv7/syslib.su) that will give stack usage information and cflow can construct program flow. -Must have gcc 4.6 or later, which supports -fstack-usage +Must have gcc 4.6 or later, which supports -fstack-usage: -1) Build normally -2) Perform the following shell command to generate a list of C files used in -SPL: -$ find spl -name '*.su' | sed -e 's:^spl/::' -e 's:[.]su$:.c:' > used-spl.list -3) Execute cflow: -$ cflow --main=board_init_r `cat used-spl.list` 2>&1 | $PAGER +#. Build normally +#. Perform the following shell command to generate a list of C files used in + SPL: +#. `find spl -name '*.su' | sed -e 's:^spl/::' -e 's:[.]su$:.c:' > used-spl.list` +#. Execute cflow: + `$ cflow --main=board_init_r $(cat used-spl.list) 2>&1 | $PAGER` cflow will spit out a number of warnings as it does not parse the config files and picks functions based on #ifdef. Parsing the '.i'
Signature · 1 line
2.31.1.607.g51e8a6a459-goog
PATCH 2/4 doc: Expand SPL docs to explain the phase and config
In reply to Simon GlassAdd a bit more information about how to use SPL.
---
doc/develop/spl.rst | 59 +++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 23 deletions(-)
doc/develop/spl.rst +36 -23
@@ -42,29 +42,42 @@ configured by defining CONFIG_SPL_TEXT_BASE. The linker script has to be defined with CONFIG_SPL_LDSCRIPT. To support generic U-Boot libraries and drivers in the SPL binary one can -optionally define CONFIG_SPL_XXX_SUPPORT. Currently following options -are supported: - -CONFIG_SPL_LIBCOMMON_SUPPORT (common/libcommon.o) -CONFIG_SPL_LIBDISK_SUPPORT (disk/libdisk.o) -CONFIG_SPL_I2C_SUPPORT (drivers/i2c/libi2c.o) -CONFIG_SPL_GPIO_SUPPORT (drivers/gpio/libgpio.o) -CONFIG_SPL_MMC_SUPPORT (drivers/mmc/libmmc.o) -CONFIG_SPL_SERIAL_SUPPORT (drivers/serial/libserial.o) -CONFIG_SPL_SPI_FLASH_SUPPORT (drivers/mtd/spi/libspi_flash.o) -CONFIG_SPL_SPI_SUPPORT (drivers/spi/libspi.o) -CONFIG_SPL_FS_FAT (fs/fat/libfat.o) -CONFIG_SPL_FS_EXT4 -CONFIG_SPL_LIBGENERIC_SUPPORT (lib/libgeneric.o) -CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o) -CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/raw/libnand.o) -CONFIG_SPL_DRIVERS_MISC_SUPPORT (drivers/misc) -CONFIG_SPL_DMA (drivers/dma/libdma.o) -CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o) -CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/raw/nand_spl_load.o) -CONFIG_SPL_SPI_LOAD (drivers/mtd/spi/spi_spl_load.o) -CONFIG_SPL_RAM_DEVICE (common/spl/spl.c) -CONFIG_SPL_WATCHDOG_SUPPORT (drivers/watchdog/libwatchdog.o) +optionally define CONFIG_SPL_XXX_SUPPORT (or CONFIG_SPL_XXX_SUPPORT for older +options). + +Adding SPL-specific code +------------------------ + +To check whether a feature is enabled, use CONFIG_IS_ENABLED():: + + if (CONFIG_IS_ENABLED(CLK)) + ... + +This checks CONFIG_CLK for the main build, CONFIG_SPL_CLK for the SPL build, +CONFIG_TPL_CLK for the TPL build, etc. + +U-Boot Phases +------------- + +U-Boot boots through the following phases: + +TPL + Very early init, as tiny as possible. This loads SPL. + +SPL + Secondary program loader. Sets up SDRAM and loads U-Boot proper. It may also + load other firmware components. + +U-Boot + U-Boot proper, containing the command line and boot logic. + + +Checking the boot phase +----------------------- + +Use `spl_phase()` to find the current U-Boot phase, e.g. `PHASE_SPL`. You can +also find the previous and next phase and get the phase name. + Device tree -----------
Signature · 1 line
2.31.1.607.g51e8a6a459-goog
PATCH 3/4 binman: Add VPL support
In reply to Simon GlassAdd support for U-Boot's Verifying Program Loader phase.
---
tools/binman/etype/u_boot_vpl.py | 42 ++++++++ tools/binman/etype/u_boot_vpl_bss_pad.py | 44 +++++++++ tools/binman/etype/u_boot_vpl_dtb.py | 28 ++++++ tools/binman/etype/u_boot_vpl_expanded.py | 45 +++++++++ tools/binman/etype/u_boot_vpl_nodtb.py | 42 ++++++++ tools/binman/ftest.py | 110 +++++++++++++++++---- tools/binman/state.py | 3 +- tools/binman/test/082_fdt_update_all.dts | 2 + tools/binman/test/201_u_boot_vpl.dts | 11 +++ tools/binman/test/202_u_boot_vpl_nodtb.dts | 13 +++ tools/binman/test/203_fdt_incl_vpl.dts | 13 +++ tools/binman/test/204_vpl_bss_pad.dts | 17 ++++ 12 files changed, 348 insertions(+), 22 deletions(-) create mode 100644 tools/binman/etype/u_boot_vpl.py create mode 100644 tools/binman/etype/u_boot_vpl_bss_pad.py create mode 100644 tools/binman/etype/u_boot_vpl_dtb.py create mode 100644 tools/binman/etype/u_boot_vpl_expanded.py create mode 100644 tools/binman/etype/u_boot_vpl_nodtb.py create mode 100644 tools/binman/test/201_u_boot_vpl.dts create mode 100644 tools/binman/test/202_u_boot_vpl_nodtb.dts create mode 100644 tools/binman/test/203_fdt_incl_vpl.dts create mode 100644 tools/binman/test/204_vpl_bss_pad.dts
tools/binman/etype/u_boot_vpl.py new file +42 -0
@@ -0,0 +1,42 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# Entry-type module for vpl/u-boot-vpl.bin +# + +from binman import elf +from binman.entry import Entry +from binman.etype.blob import Entry_blob + +class Entry_u_boot_vpl(Entry_blob): + """U-Boot VPL binary + + Properties / Entry arguments: + - filename: Filename of u-boot-vpl.bin (default 'vpl/u-boot-vpl.bin') + + This is the U-Boot VPL (Verifying Program Loader) binary. This is a small + binary which loads before SPL, typically into on-chip SRAM. It is + responsible for locating, loading and jumping to SPL, the next-stage + loader. Note that VPL is not relocatable so must be loaded to the correct + address in SRAM, or written to run from the correct address if direct + flash execution is possible (e.g. on x86 devices). + + SPL can access binman symbols at runtime. See: + + 'Access to binman entry offsets at run time (symbols)' + + in the binman README for more information. + + The ELF file 'vpl/u-boot-vpl' must also be available for this to work, since + binman uses that to look up symbols to write into the VPL binary. + """ + def __init__(self, section, etype, node): + super().__init__(section, etype, node) + self.elf_fname = 'vpl/u-boot-vpl' + + def GetDefaultFilename(self): + return 'vpl/u-boot-vpl.bin' + + def WriteSymbols(self, section): + elf.LookupAndWriteSymbols(self.elf_fname, self, section.GetImage())
tools/binman/etype/u_boot_vpl_bss_pad.py new file +44 -0
44 lines not on this page · raw message
tools/binman/etype/u_boot_vpl_dtb.py new file +28 -0
@@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <[email protected]> +# +# Entry-type module for U-Boot device tree in VPL (Verifying Program Loader) +# + +from binman.entry import Entry +from binman.etype.blob_dtb import Entry_blob_dtb + +class Entry_u_boot_vpl_dtb(Entry_blob_dtb): + """U-Boot VPL device tree + + Properties / Entry arguments: + - filename: Filename of u-boot.dtb (default 'vpl/u-boot-vpl.dtb') + + This is the VPL device tree, containing configuration information for + VPL. VPL needs this to know what devices are present and which drivers + to activate. + """ + def __init__(self, section, etype, node): + super().__init__(section, etype, node) + + def GetDefaultFilename(self): + return 'vpl/u-boot-vpl.dtb' + + def GetFdtEtype(self): + return 'u-boot-vpl-dtb'
tools/binman/etype/u_boot_vpl_expanded.py new file +45 -0
45 lines not on this page · raw message
tools/binman/etype/u_boot_vpl_nodtb.py new file +42 -0
42 lines not on this page · raw message
tools/binman/ftest.py +89 -21
201 lines not on this page · raw message
tools/binman/state.py +2 -1
@@ -17,6 +17,7 @@ from patman import tout DTB_TYPE_FNAME = { 'u-boot-spl-dtb': 'spl/u-boot-spl.dtb', 'u-boot-tpl-dtb': 'tpl/u-boot-tpl.dtb', + 'u-boot-vpl-dtb': 'vpl/u-boot-vpl.dtb', } # Records the device-tree files known to binman, keyed by entry type (e.g.
@@ -263,7 +264,7 @@ def GetAllFdts(): """Yield all device tree files being used by binman Yields: - Device trees being used (U-Boot proper, SPL, TPL) + Device trees being used (U-Boot proper, SPL, TPL, VPL) """ if main_dtb: yield main_dtb
tools/binman/test/082_fdt_update_all.dts +2 -0
@@ -14,5 +14,7 @@ }; u-boot-tpl-dtb { }; + u-boot-vpl-dtb { + }; }; };
tools/binman/test/201_u_boot_vpl.dts new file +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + u-boot-vpl { + }; + u-boot-vpl-dtb { + }; + }; +};
tools/binman/test/202_u_boot_vpl_nodtb.dts new file +13 -0
@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot-vpl-nodtb { + }; + }; +};
tools/binman/test/203_fdt_incl_vpl.dts new file +13 -0
@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot-vpl { + }; + }; +};
tools/binman/test/204_vpl_bss_pad.dts new file +17 -0
@@ -0,0 +1,17 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot-vpl { + }; + + u-boot-vpl-bss-pad { + }; + + u-boot { + }; + }; +};
Signature · 1 line
2.31.1.607.g51e8a6a459-goog
PATCH 4/4 Introduce Verifying Program Loader (VPL)
In reply to Simon GlassAdd support for VPL, a new phase of U-Boot. This runs after TPL. It is responsible for selecting which SPL binary to run, based on a verified-boot process.
---
common/Kconfig | 67 ++++++++++++++++ common/spl/Kconfig | 168 +++++++++++++++++++++++++++++++++++++++- common/spl/spl.c | 25 +++++- doc/develop/spl.rst | 6 +- include/bootstage.h | 2 + include/linux/kconfig.h | 3 + include/spl.h | 20 ++++- lib/Kconfig | 54 +++++++++++++ scripts/Kbuild.include | 4 + scripts/Makefile.build | 4 + 10 files changed, 345 insertions(+), 8 deletions(-)
common/Kconfig +67 -0
@@ -81,6 +81,15 @@ config TPL_LOGLEVEL int default LOGLEVEL +config VPL_LOGLEVEL + int "loglevel for VPL" + default LOGLEVEL + help + All Messages with a loglevel smaller than the console loglevel will + be compiled in to VPL. See LOGLEVEL for a list of available log + levels. Setting this to a value above 4 may increase the code size + significantly. + config SILENT_CONSOLE bool "Support a silent console" help
@@ -254,6 +263,15 @@ config LOG if LOG +config VPL_LOG + bool "Enable logging support in VPL" + depends on LOG + help + This enables support for logging of status and debug messages. These + can be displayed on the console, recorded in a memory buffer, or + discarded if not needed. Logging supports various categories and + levels of severity. + config LOG_MAX_LEVEL int "Maximum log level to record" default 6
@@ -415,6 +433,47 @@ config TPL_LOG_CONSOLE endif +config VPL_LOG + bool "Enable logging support in VPL" + depends on LOG + help + This enables support for logging of status and debug messages. These + can be displayed on the console, recorded in a memory buffer, or + discarded if not needed. Logging supports various categories and + levels of severity. + +if VPL_LOG + +config VPL_LOG_MAX_LEVEL + int "Maximum log level to record in VPL" + default 3 + help + This selects the maximum log level that will be recorded. Any value + higher than this will be ignored. If possible log statements below + this level will be discarded at build time. Levels: + + 0 - emergency + 1 - alert + 2 - critical + 3 - error + 4 - warning + 5 - note + 6 - info + 7 - debug + 8 - debug content + 9 - debug hardware I/O + +config VPL_LOG_CONSOLE + bool "Allow log output to the console in VPL" + default y + help + Enables a log driver which writes log records to the console. + Generally the console is the serial port or LCD display. Only the + log message is shown - other details like level, category, file and + line number are omitted. + +endif + config LOG_ERROR_RETURN bool "Log all functions which return an error" help
@@ -711,6 +770,14 @@ config TPL_BLOBLIST This enables a bloblist in TPL. The bloblist is set up in TPL and passed to SPL and U-Boot proper. +config VPL_BLOBLIST + bool "Support for a bloblist in VPL" + depends on BLOBLIST + default y if TPL_BLOBLIST + help + This enables a bloblist in VPL. The bloblist is set up in VPL and + passed to SPL and U-Boot proper. + config BLOBLIST_SIZE hex "Size of bloblist" depends on BLOBLIST
common/spl/Kconfig +167 -1
201 lines not on this page · raw message
common/spl/spl.c +22 -3
@@ -55,6 +55,11 @@ binman_sym_declare(ulong, spl, image_pos);binman_sym_declare (ulong, spl, size);#endif +#ifdef CONFIG_VPL +binman_sym_declare (ulong, vpl, image_pos); +binman_sym_declare (ulong, vpl, size); +#endif +/* Define board data structure */ static struct bd_info bdata __attribute__ ((section(".data")));
@@ -137,21 +142,33 @@ void spl_fixup_fdt(void *fdt_blob)ulong spl_get_image_pos (void ) { -return spl_phase () ==PHASE_TPL ? +#ifdef CONFIG_VPL +if (spl_next_phase () ==PHASE_VPL ) +return binman_sym (ulong, vpl, image_pos); +#endif +return spl_next_phase () ==PHASE_SPL ?binman_sym (ulong, spl, image_pos) :binman_sym (ulong, u_boot_any, image_pos); }ulong spl_get_image_size (void ) { -return spl_phase () ==PHASE_TPL ? +#ifdef CONFIG_VPL +if (spl_next_phase () ==PHASE_VPL ) +return binman_sym (ulong, vpl, size); +#endif +return spl_next_phase () ==PHASE_SPL ?binman_sym (ulong, spl, size) :binman_sym (ulong, u_boot_any, size); }ulong spl_get_image_text_base (void ) { -return spl_phase () ==PHASE_TPL ?CONFIG_SPL_TEXT_BASE : +#ifdef CONFIG_VPL +if (spl_next_phase () ==PHASE_VPL ) +return CONFIG_VPL_TEXT_BASE ; +#endif +return spl_next_phase () ==PHASE_SPL ?CONFIG_SPL_TEXT_BASE :CONFIG_SYS_TEXT_BASE ; }
@@ -428,6 +445,8 @@ static enum bootstage_id get_bootstage_id(bool start)if (IS_ENABLED (CONFIG_TPL_BUILD ) && phase ==PHASE_TPL )return start ?BOOTSTAGE_ID_START_TPL :BOOTSTAGE_ID_END_TPL ; +else if (IS_ENABLED (CONFIG_VPL_BUILD ) && phase ==PHASE_VPL ) +return start ?BOOTSTAGE_ID_START_VPL :BOOTSTAGE_ID_END_VPL ;else return start ?BOOTSTAGE_ID_START_SPL :BOOTSTAGE_ID_END_SPL ; }
doc/develop/spl.rst +5 -1
@@ -62,7 +62,11 @@ U-Boot Phases U-Boot boots through the following phases: TPL - Very early init, as tiny as possible. This loads SPL. + Very early init, as tiny as possible. This loads SPL (or VPL if enabled). + +VPL + Optional verification step, which can select one of several SPL binaries, + if A/B verified boot SPL Secondary program loader. Sets up SDRAM and loads U-Boot proper. It may also
include/bootstage.h +2 -0
@@ -174,6 +174,8 @@ enum bootstage_id {BOOTSTAGE_ID_END_TPL ,BOOTSTAGE_ID_START_SPL ,BOOTSTAGE_ID_END_SPL , +BOOTSTAGE_ID_START_VPL , +BOOTSTAGE_ID_END_VPL ,BOOTSTAGE_ID_START_UBOOT_F ,BOOTSTAGE_ID_START_UBOOT_R , BOOTSTAGE_ID_USB_START,
include/linux/kconfig.h +3 -0
@@ -37,6 +37,8 @@#if defined(CONFIG_TPL_BUILD )#define _CONFIG_PREFIX TPL_ +#elif defined(CONFIG_VPL_BUILD ) +#define _CONFIG_PREFIX VPL_#elif defined(CONFIG_SPL_BUILD )#define _CONFIG_PREFIX SPL_#else
@@ -52,6 +54,7 @@* CONFIG_FOO if CONFIG_SPL_BUILD is undefined, * CONFIG_SPL_FOO if CONFIG_SPL_BUILD is defined. * CONFIG_TPL_FOO if CONFIG_TPL_BUILD is defined. +* CONFIG_VPL_FOO if CONFIG_VPL_BUILD is defined. */ #define CONFIG_VAL (option) config_val(option)
include/spl.h +17 -3
@@ -60,6 +60,7 @@ static inline bool u_boot_first_phase(void)enum u_boot_phase {PHASE_NONE ,/* Invalid phase, signifying before U-Boot */ PHASE_TPL ,/* Running in TPL */ +PHASE_VPL ,/* Running in VPL */ PHASE_SPL ,/* Running in SPL */ PHASE_BOARD_F ,/* Running in U-Boot before relocation */ PHASE_BOARD_R ,/* Running in U-Boot after relocation */
@@ -112,7 +113,9 @@ static inline enum u_boot_phase spl_phase(void) {#ifdef CONFIG_TPL_BUILD return PHASE_TPL ; -#elif CONFIG_SPL_BUILD +#elif defined(CONFIG_VPL_BUILD ) +return PHASE_VPL ; +#elif defined(CONFIG_SPL_BUILD )return PHASE_SPL ;#else DECLARE_GLOBAL_DATA_PTR ;
@@ -134,10 +137,15 @@ static inline enum u_boot_phase spl_prev_phase(void) {#ifdef CONFIG_TPL_BUILD return PHASE_NONE ; +#elif defined(CONFIG_VPL_BUILD ) +return PHASE_TPL ;/* VPL requires TPL */ #elif defined(CONFIG_SPL_BUILD ) -return IS_ENABLED (CONFIG_TPL ) ?PHASE_TPL :PHASE_NONE ; +return IS_ENABLED (CONFIG_VPL ) ?PHASE_VPL : +IS_ENABLED (CONFIG_TPL ) ?PHASE_TPL : +PHASE_NONE ;#else -return IS_ENABLED (CONFIG_SPL ) ?PHASE_SPL :PHASE_NONE ; +return IS_ENABLED (CONFIG_SPL ) ?PHASE_SPL : +PHASE_NONE ;#endif }
@@ -150,6 +158,8 @@ static inline enum u_boot_phase spl_prev_phase(void)static inline enum u_boot_phase spl_next_phase (void ) {#ifdef CONFIG_TPL_BUILD +return IS_ENABLED (CONFIG_VPL ) ?PHASE_VPL :PHASE_SPL ; +#elif defined(CONFIG_VPL_BUILD )return PHASE_SPL ;#else return PHASE_BOARD_F ;
@@ -166,6 +176,8 @@ static inline const char *spl_phase_name(enum u_boot_phase phase)switch (phase) {case PHASE_TPL :return "TPL" ; +case PHASE_VPL : +return "VPL" ;case PHASE_SPL :return "SPL" ;case PHASE_BOARD_F :
@@ -180,6 +192,8 @@ static inline const char *spl_phase_name(enum u_boot_phase phase)#ifdef CONFIG_SPL_BUILD # ifdef CONFIG_TPL_BUILD # define SPL_TPL_NAME "TPL" +# elif defined(CONFIG_VPL_BUILD ) +# define SPL_TPL_NAME "VPL"# else # define SPL_TPL_NAME "SPL"# endif
lib/Kconfig +54 -0
90 lines not on this page · raw message
scripts/Kbuild.include +4 -0
@@ -325,11 +325,15 @@ endif ifdef CONFIG_SPL_BUILD SPL_ := SPL_ +ifeq ($(CONFIG_VPL_BUILD),y) +SPL_TPL_ := VPL_ +else ifeq ($(CONFIG_TPL_BUILD),y) SPL_TPL_ := TPL_ else SPL_TPL_ := SPL_ endif +endif else SPL_ := SPL_TPL_ :=
scripts/Makefile.build +4 -0
@@ -4,6 +4,9 @@ # ========================================================================== # Modified for U-Boot +prefix := vpl +src := $(patsubst $(prefix)/%,%,$(obj)) +ifeq ($(obj),$(src)) prefix := tpl src := $(patsubst $(prefix)/%,%,$(obj)) ifeq ($(obj),$(src))
@@ -13,6 +16,7 @@ ifeq ($(obj),$(src)) prefix := . endif endif +endif PHONY := __build __build:
Signature · 1 line
2.31.1.607.g51e8a6a459-goog
cover vpl: Introduce a verifying program loader
In reply to Simon GlassHi Simon,
Quoted 6 lines · Simon Glass
U-Boot provides a verified-boot feature based around FIT, but there is no standard way of implementing it for a board. At present the various required pieces must be built up separately, to produce a working implementation. In particular, there is no built-in support for selecting A/B boot or recovery mode.
Quoted 6 lines
This series introduces VPL, a verified program loader. Its purpose is to run the verified-boot process and decide which SPL binary should be run. Adding VPL into the boot flow provides a standard way of implementing verified boot. So far, only the phase itself is added. More work is needed to add logic to the phase, based on continuing discussions about how best to standardise this feature.
This is quite interesting. Where is that data stored which SPL should run? fallback options? Do you have any proposal/document which describes it?
Thanks,
Michal
cover vpl: Introduce a verifying program loader
Hi Michal,
Quoted 17 lines · Michal Simek
Hi Simon,
Quoted 6 lines · Simon Glass
U-Boot provides a verified-boot feature based around FIT, but there is no standard way of implementing it for a board. At present the various required pieces must be built up separately, to produce a working implementation. In particular, there is no built-in support for selecting A/B boot or recovery mode.
Quoted 6 lines
This series introduces VPL, a verified program loader. Its purpose is to run the verified-boot process and decide which SPL binary should be run. Adding VPL into the boot flow provides a standard way of implementing verified boot. So far, only the phase itself is added. More work is needed to add logic to the phase, based on continuing discussions about how best to standardise this feature.
Quoted 2 lines
This is quite interesting. Where is that data stored which SPL should run? fallback options? Do you have any proposal/document which describes it?
It is not quite ready for release. But I could talk about it on the U-Boot call next week if that suits.
Regards,
Simon
cover vpl: Introduce a verifying program loader
Hi Simon,
Quoted 20 lines · Simon Glass
Hi Michal,
Quoted 17 lines · Michal Simek
Hi Simon,
Quoted 12 lines · Simon Glass
U-Boot provides a verified-boot feature based around FIT, but there is no standard way of implementing it for a board. At present the various required pieces must be built up separately, to produce a working implementation. In particular, there is no built-in support for selecting A/B boot or recovery mode.
This series introduces VPL, a verified program loader. Its purpose is to run the verified-boot process and decide which SPL binary should be run. Adding VPL into the boot flow provides a standard way of implementing verified boot. So far, only the phase itself is added. More work is needed to add logic to the phase, based on continuing discussions about how best to standardise this feature.
Quoted 5 lines
Quoted 2 lines
This is quite interesting. Where is that data stored which SPL should run? fallback options? Do you have any proposal/document which describes it?
It is not quite ready for release. But I could talk about it on the U-Boot call next week if that suits.
I don't have conflict that's why no problem for me. Will try to attend.
Thanks,
Michal
Hi,
Quoted 56 lines · Simon Glass
U-Boot provides a verified-boot feature based around FIT, but there is no standard way of implementing it for a board. At present the various required pieces must be built up separately, to produce a working implementation. In particular, there is no built-in support for selecting A/B boot or recovery mode.
This series introduces VPL, a verified program loader. Its purpose is to run the verified-boot process and decide which SPL binary should be run. Adding VPL into the boot flow provides a standard way of implementing verified boot. So far, only the phase itself is added. More work is needed to add logic to the phase, based on continuing discussions about how best to standardise this feature.
Simon Glass (4):
doc: Convert SPL documentation to ReST
doc: Expand SPL docs to explain the phase and config
binman: Add VPL support
Introduce Verifying Program Loader (VPL)common/Kconfig | 67 ++++++++ common/spl/Kconfig | 168 ++++++++++++++++++++- common/spl/spl.c | 25 ++- doc/develop/index.rst | 1 + doc/{README.SPL => develop/spl.rst} | 99 +++++++----- include/bootstage.h | 2 + include/linux/kconfig.h | 3 + include/spl.h | 20 ++- lib/Kconfig | 54 +++++++ scripts/Kbuild.include | 4 + scripts/Makefile.build | 4 + tools/binman/etype/u_boot_vpl.py | 42 ++++++ tools/binman/etype/u_boot_vpl_bss_pad.py | 44 ++++++ tools/binman/etype/u_boot_vpl_dtb.py | 28 ++++ tools/binman/etype/u_boot_vpl_expanded.py | 45 ++++++ tools/binman/etype/u_boot_vpl_nodtb.py | 42 ++++++ tools/binman/ftest.py | 110 +++++++++++--- tools/binman/state.py | 3 +- tools/binman/test/082_fdt_update_all.dts | 2 + tools/binman/test/201_u_boot_vpl.dts | 11 ++ tools/binman/test/202_u_boot_vpl_nodtb.dts | 13 ++ tools/binman/test/203_fdt_incl_vpl.dts | 13 ++ tools/binman/test/204_vpl_bss_pad.dts | 17 +++ 23 files changed, 748 insertions(+), 69 deletions(-) rename doc/{README.SPL => develop/spl.rst} (61%) create mode 100644 tools/binman/etype/u_boot_vpl.py create mode 100644 tools/binman/etype/u_boot_vpl_bss_pad.py create mode 100644 tools/binman/etype/u_boot_vpl_dtb.py create mode 100644 tools/binman/etype/u_boot_vpl_expanded.py create mode 100644 tools/binman/etype/u_boot_vpl_nodtb.py create mode 100644 tools/binman/test/201_u_boot_vpl.dts create mode 100644 tools/binman/test/202_u_boot_vpl_nodtb.dts create mode 100644 tools/binman/test/203_fdt_incl_vpl.dts create mode 100644 tools/binman/test/204_vpl_bss_pad.dts
Quoted 3 lines
--
2.31.1.607.g51e8a6a459-goog
Are there any comments on this series?
I plan to build on this to actually implement the verifying loader at some point.
Regards,
Simon