env: Convert CONFIG_DELAY_ENVIRONMENT to Kconfig
PATCH 1/6 env: Convert CONFIG_DELAY_ENVIRONMENT to Kconfig
This converts ad-hoc CONFIG_DELAY_ENVIRONMENT to Kconfig.
--- env/Kconfig | 12 ++++++++++++ scripts/config_whitelist.txt | 1 - 2 files changed, 12 insertions(+), 1 deletion(-)
env/Kconfig +12 -0
@@ -592,6 +592,18 @@ config ENV_VARS_UBOOT_RUNTIME_CONFIG run-time determined information about the hardware to the environment. These will be named board_name, board_rev. +config DELAY_ENVIRONMENT + bool "Delay environment loading" + depends on !OF_CONTROL + help + Enable this to inhibit loading the environment during board + initialization. This can address the security risk of untrusted data + being used during boot. Normally the environment is loaded when the + board is initialised so that it is available to U-Boot. This inhibits + that so that the environment is not available until explicitly loaded + later by U-Boot code. With CONFIG_OF_CONTROL this is instead + controlled by the value of /config/load-environment. + if SPL_ENV_SUPPORT config SPL_ENV_IS_NOWHERE bool "SPL Environment is not stored"
scripts/config_whitelist.txt +0 -1
@@ -306,7 +306,6 @@ CONFIG_DEFAULT CONFIG_DEFAULT_CONSOLE CONFIG_DEFAULT_IMMR CONFIG_DEF_HWCONFIG -CONFIG_DELAY_ENVIRONMENT CONFIG_DESIGNWARE_ETH CONFIG_DEVELOP CONFIG_DEVICE_TREE_LIST
Signature · 1 line
2.17.1
PATCH 2/6 board_r: env: Use IS_ENABLED() instead of #ifdefs
Use IS_ENABLED() instead of #ifdef in should_load_env and initr_env functions.
No functional change intended.
--- common/board_r.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
common/board_r.c +11 -10
@@ -464,13 +464,14 @@ static int initr_mmc(void)*/ static int should_load_env (void ) { -#ifdef CONFIG_OF_CONTROL -return fdtdec_get_config_int (gd->fdt_blob,"load-environment" ,1 ); -#elif definedCONFIG_DELAY_ENVIRONMENT -return 0 ; -#else +if (IS_ENABLED (CONFIG_OF_CONTROL )) +return fdtdec_get_config_int (gd->fdt_blob, +"load-environment" ,1 ); + +if (IS_ENABLED (CONFIG_DELAY_ENVIRONMENT )) +return 0 ; +return 1 ; -#endif }static int initr_env (void )
@@ -480,10 +481,10 @@ static int initr_env(void)env_relocate (); else env_set_default(NULL, 0); -#ifdef CONFIG_OF_CONTROL -env_set_hex ("fdtcontroladdr" , - (unsigned long )map_to_sysmem (gd->fdt_blob)); -#endif + +if (IS_ENABLED (CONFIG_OF_CONTROL )) +env_set_hex ("fdtcontroladdr" , + (unsigned long )map_to_sysmem (gd->fdt_blob));/* Initialize from environment */ image_load_addr =env_get_ulong ("loadaddr" ,16 , image_load_addr);
Signature · 1 line
2.17.1
PATCH 2/6 board_r: env: Use IS_ENABLED() instead of #ifdefs
Quoted 6 lines · Ovidiu Panait
Use
IS_ENABLED()instead of #ifdef inshould_load_envandinitr_envfunctions.No functional change intended.
Signed-off-by Ovidiu Panait <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200515/502e268f/attachment.sig>
PATCH 3/6 board_r: Introduce CONFIG_PCI_INIT_R Kconfig option
In reply to Ovidiu PanaitWith CONFIG_DM_PCI enabled, PCI buses are not enumerated at boot, as they are without that config option enabled. However, there are cases such as DM PCI-based Ethernet devices that need the PCI bus enumerated so that they can be discovered by their drivers.
Currently, to solve this, some boards enumerate the pci bus using "pci enum" preboot command, while others do it manually in board files (in board_init/board_late_init/etc. functions).
In order to possibly make the pci enumeration process uniform across all boards, introduce CONFIG_PCI_INIT_R Kconfig option.
This change also preserves the current behavior in the !DM_PCI case (pci_init is run unconditionally at boot).
--- common/Kconfig | 10 ++++++++++ common/board_r.c | 5 ++--- 2 files changed, 12 insertions(+), 3 deletions(-)
common/Kconfig +10 -0
@@ -932,6 +932,16 @@ config LAST_STAGE_INIT U-Boot calls last_stage_init() before the command-line interpreter is started. +config PCI_INIT_R + bool "Enumerate PCI buses during init" + depends on PCI + default y if !DM_PCI + help + With this option U-Boot will call pci_init() soon after relocation, + which will enumerate PCI buses. This is needed, for instance, in the + case of DM PCI-based Ethernet devices, which will not be detected + without having the enumeration performed earlier. + endmenu menu "Security support"
common/board_r.c +2 -3
@@ -232,9 +232,8 @@ static int initr_unlock_ram_in_cache(void)#ifdef CONFIG_PCI static int initr_pci (void ) { -#ifndef CONFIG_DM_PCI -pci_init (); -#endif +if (IS_ENABLED (CONFIG_PCI_INIT_R )) +pci_init ();return 0 ; }
Signature · 1 line
2.17.1
PATCH 3/6 board_r: Introduce CONFIG_PCI_INIT_R Kconfig option
Quoted 9 lines · Ovidiu Panait
With
CONFIG_DM_PCIenabled, PCI buses are not enumerated at boot, as they are without that config option enabled. However, there are cases such as DM PCI-based Ethernet devices that need the PCI bus enumerated so that they can be discovered by their drivers.Currently, to solve this, some boards enumerate the pci bus using "pci enum" preboot command, while others do it manually in board files (in board_init/board_late_init/etc. functions).
Quoted 7 lines
In order to possibly make the pci enumeration process uniform across all boards, introduce
CONFIG_PCI_INIT_RKconfigoption.This change also preserves the current behavior in the !DM_PCI case (
pci_initis run unconditionally at boot).Signed-off-by Ovidiu Panait <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200515/4957dcb4/attachment.sig>
PATCH 4/6 qemu_arm64_defconfig: Enable CONFIG_PCI_INIT_R
In reply to Ovidiu PanaitReplace the "pci enum" preboot sequence with CONFIG_PCI_INIT_R=y.
--- configs/qemu_arm64_defconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
configs/qemu_arm64_defconfig +1 -2
@@ -10,10 +10,9 @@ CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y CONFIG_FIT_BEST_MATCH=y CONFIG_LEGACY_IMAGE_FORMAT=y -CONFIG_USE_PREBOOT=y -CONFIG_PREBOOT="pci enum" # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set +CONFIG_PCI_INIT_R=y CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_PCI=y
Signature · 1 line
2.17.1
PATCH 4/6 qemu_arm64_defconfig: Enable CONFIG_PCI_INIT_R
Quoted 3 lines · Ovidiu Panait
Replace the "pci enum" preboot sequence with
CONFIG_PCI_INIT_R=y.Signed-off-by Ovidiu Panait <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200515/3b547dd2/attachment.sig>
PATCH 5/6 qemu_arm_defconfig: Enable CONFIG_PCI_INIT_R
In reply to Ovidiu PanaitReplace the "pci enum" preboot sequence with CONFIG_PCI_INIT_R=y.
--- configs/qemu_arm_defconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
configs/qemu_arm_defconfig +1 -2
@@ -12,10 +12,9 @@ CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y CONFIG_FIT_BEST_MATCH=y CONFIG_LEGACY_IMAGE_FORMAT=y -CONFIG_USE_PREBOOT=y -CONFIG_PREBOOT="pci enum" # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set +CONFIG_PCI_INIT_R=y CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_PCI=y
Signature · 1 line
2.17.1
PATCH 5/6 qemu_arm_defconfig: Enable CONFIG_PCI_INIT_R
Quoted 3 lines · Ovidiu Panait
Replace the "pci enum" preboot sequence with
CONFIG_PCI_INIT_R=y.Signed-off-by Ovidiu Panait <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200515/01e12701/attachment.sig>
PATCH 6/6 qemu-x86*_defconfig: Enable CONFIG_PCI_INIT_R
In reply to Ovidiu PanaitEnable CONFIG_PCI_INIT_R for qemux86 and qemux86-64 pci enumeration during boot in order to eliminate the custom preboot commands in include/configs/qemu-x86.h.
--- configs/qemu-x86_64_defconfig | 1 + configs/qemu-x86_defconfig | 1 + include/configs/qemu-x86.h | 2 -- 3 files changed, 2 insertions(+), 2 deletions(-)
configs/qemu-x86_64_defconfig +1 -0
@@ -34,6 +34,7 @@ CONFIG_SPL_NET_SUPPORT=y CONFIG_SPL_PCI=y CONFIG_SPL_PCH_SUPPORT=y CONFIG_SPL_RTC_SUPPORT=y +CONFIG_PCI_INIT_R=y CONFIG_CMD_CPU=y CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_NVEDIT_EFI=y
configs/qemu-x86_defconfig +1 -0
@@ -18,6 +18,7 @@ CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y +CONFIG_PCI_INIT_R=y CONFIG_CMD_CPU=y CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_NVEDIT_EFI=y
include/configs/qemu-x86.h +0 -2
@@ -22,8 +22,6 @@#include <config_distro_bootcmd.h> #include <configs/x86-common.h> -#define CONFIG_PREBOOT "pci enum" -#define CONFIG_SYS_MONITOR_LEN (1 << 20)#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,i8042-kbd\0" \
Signature · 1 line
2.17.1
PATCH 6/6 qemu-x86*_defconfig: Enable CONFIG_PCI_INIT_R
Quoted 5 lines · Ovidiu Panait
Enable
CONFIG_PCI_INIT_Rfor qemux86 and qemux86-64 pci enumeration during boot in order to eliminate the custom preboot commands ininclude/configs/qemu-x86.h.Signed-off-by Ovidiu Panait <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200515/63e44753/attachment.sig>
PATCH 1/6 env: Convert CONFIG_DELAY_ENVIRONMENT to Kconfig
In reply to Ovidiu PanaitQuoted 3 lines · Ovidiu Panait
This converts ad-hoc
CONFIG_DELAY_ENVIRONMENTtoKconfig.Signed-off-by Ovidiu Panait <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200515/bc159238/attachment-0001.sig>