[U-Boot] [PATCH 06/42] Use separate options for TPL support

Masahiro Yamada yamada.masahiro at socionext.com
Thu Aug 25 04:20:10 CEST 2016


2016-08-25 1:51 GMT+09:00 Simon Glass <sjg at chromium.org>:
> At present TPL uses the same options as SPL support. In a few cases the board
> config enables or disables the SPL options depending on whether
> CONFIG_TPL_BUILD is defined.
>
> With the move to Kconfig, options are determined for the whole build and
> (without a hack like an #undef in a header file) cannot be controlled in this
> way.
>
> Create new TPL options for these and update users. This will allow Kconfig
> conversion to proceed for these boards.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
>  common/Makefile                | 12 +++++++++++-
>  drivers/Makefile               | 16 +++++++++++++++-
>  include/common.h               | 15 +++++++++------
>  include/configs/C29XPCIE.h     | 16 ++++++++--------
>  include/configs/P1010RDB.h     | 14 +++++++-------
>  include/configs/P1022DS.h      | 14 +++++++-------
>  include/configs/p1_p2_rdb_pc.h | 14 +++++++-------
>  lib/Makefile                   |  9 +++++++--
>  scripts/Makefile.spl           | 10 +++++++++-
>  9 files changed, 80 insertions(+), 40 deletions(-)
>
> diff --git a/common/Makefile b/common/Makefile
> index 21619b3..9a9a065 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -99,10 +99,16 @@ obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o
>  obj-$(CONFIG_USB_STORAGE) += usb_storage.o
>  endif
>  # environment
> -ifdef CONFIG_SPL_ENV_SUPPORT
> +ifdef CONFIG_TPL_BUILD
> +obj-$(CONFIG_TPL_ENV_SUPPORT) += env_attr.o
> +obj-$(CONFIG_TPL_ENV_SUPPORT) += env_flags.o
> +obj-$(CONFIG_TPL_ENV_SUPPORT) += env_callback.o
> +else
>  obj-$(CONFIG_SPL_ENV_SUPPORT) += env_attr.o
>  obj-$(CONFIG_SPL_ENV_SUPPORT) += env_flags.o
>  obj-$(CONFIG_SPL_ENV_SUPPORT) += env_callback.o
> +endif
> +ifneq ($(CONFIG_TPL_ENV_SUPPORT)$(CONFIG_SPL_ENV_SUPPORT),)
>  obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
>  obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
>  obj-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o
> @@ -123,7 +129,11 @@ obj-$(CONFIG_SPD_EEPROM) += ddr_spd.o
>  obj-$(CONFIG_HWCONFIG) += hwconfig.o
>  obj-$(CONFIG_BOUNCE_BUFFER) += bouncebuf.o
>  ifdef CONFIG_SPL_BUILD
> +ifdef CONFIG_TPL_BUILD
> +obj-$(CONFIG_TPL_SERIAL_SUPPORT) += console.o
> +else
>  obj-$(CONFIG_SPL_SERIAL_SUPPORT) += console.o
> +endif
>  else
>  obj-y += console.o
>  endif
> diff --git a/drivers/Makefile b/drivers/Makefile
> index 7861d34..ca98273 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -40,8 +40,22 @@ obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/
>  obj-$(CONFIG_SPL_SATA_SUPPORT) += block/
>  obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += block/
>  obj-$(CONFIG_SPL_MMC_SUPPORT) += block/
> +endif
> +
> +ifdef CONFIG_TPL_BUILD
> +
> +obj-$(CONFIG_TPL_I2C_SUPPORT) += i2c/
> +obj-$(CONFIG_TPL_DRIVERS_MISC_SUPPORT) += misc/ sysreset/
> +obj-$(CONFIG_TPL_MMC_SUPPORT) += mmc/
> +obj-$(CONFIG_TPL_MPC8XXX_INIT_DDR_SUPPORT) += ddr/fsl/
> +obj-$(CONFIG_TPL_NAND_SUPPORT) += mtd/nand/
> +obj-$(CONFIG_TPL_SERIAL_SUPPORT) += serial/
> +obj-$(CONFIG_TPL_SPI_FLASH_SUPPORT) += mtd/spi/
> +obj-$(CONFIG_TPL_SPI_SUPPORT) += spi/
> +
> +endif
>
> -else
> +ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
>
>  obj-y += adc/
>  obj-$(CONFIG_DM_DEMO) += demo/
> diff --git a/include/common.h b/include/common.h



I'd say a strong "no" to this patch.

The root cause of this pita is in the booting order.

For CONFIG_SPL=y && CONFIG_TPL=n,
    Boot ROM ->  SPL  ->  U-Boot proper


For CONFIG_SPL=y && CONFIG_TPL=y,
    Boot ROM ->  SPL  ->  TPL  -> U-Boot proper


For the latter case, TPL can be big enough to use
environments and/or device drivers.
While, SPL is a really small program
that is only possible in ad-hoc implementation,
so that probably enable none of CONFIG_SPL_ options.


How about this idea:
Let's exploit the fact that TPL exists for SoCs
that load a really small program (4KB or less).
Swap the order of SPL and TPL like follows:

  Boot ROM ->  TPL  ->  SPL   ->  U-Boot proper

With this change,  TPL is too small to enable luxury features.
No need to add CONFIG_TPL_ stuff in Kconfig.

Let's think TPL is a short of "Tiny Program Loader" instead of
"Tertiary Program Loader".
(SPL is no longer "Secondary" in this case, so a bit funny, though.)





-- 
Best Regards
Masahiro Yamada


More information about the U-Boot mailing list