diff options
Diffstat (limited to 'env')
-rw-r--r-- | env/Kconfig | 19 | ||||
-rw-r--r-- | env/common.c | 2 | ||||
-rw-r--r-- | env/env.c | 3 | ||||
-rw-r--r-- | env/ext4.c | 5 | ||||
-rw-r--r-- | env/fat.c | 9 | ||||
-rw-r--r-- | env/flash.c | 1 | ||||
-rw-r--r-- | env/mmc.c | 2 | ||||
-rw-r--r-- | env/sf.c | 18 |
8 files changed, 44 insertions, 15 deletions
diff --git a/env/Kconfig b/env/Kconfig index af63ac52f7..ca7fef682b 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -592,6 +592,25 @@ 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. + +config ENV_ACCESS_IGNORE_FORCE + bool "Block forced environment operations" + default n + help + If defined, don't allow the -f switch to env set override variable + access flags. + if SPL_ENV_SUPPORT config SPL_ENV_IS_NOWHERE bool "SPL Environment is not stored" diff --git a/env/common.c b/env/common.c index 1fd1bd01d3..088b2aebb4 100644 --- a/env/common.c +++ b/env/common.c @@ -8,9 +8,11 @@ */ #include <common.h> +#include <bootstage.h> #include <command.h> #include <env.h> #include <env_internal.h> +#include <log.h> #include <sort.h> #include <linux/stddef.h> #include <search.h> @@ -7,6 +7,9 @@ #include <common.h> #include <env.h> #include <env_internal.h> +#include <log.h> +#include <linux/bitops.h> +#include <linux/bug.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/env/ext4.c b/env/ext4.c index 911e19c6d3..8e90bb71b7 100644 --- a/env/ext4.c +++ b/env/ext4.c @@ -19,6 +19,7 @@ */ #include <common.h> +#include <part.h> #include <command.h> #include <env.h> @@ -45,7 +46,7 @@ static int env_ext4_save(void) { env_t env_new; struct blk_desc *dev_desc = NULL; - disk_partition_t info; + struct disk_partition info; int dev, part; int err; const char *ifname = env_ext4_get_intf(); @@ -87,7 +88,7 @@ static int env_ext4_load(void) { ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE); struct blk_desc *dev_desc = NULL; - disk_partition_t info; + struct disk_partition info; int dev, part; int err; loff_t off; @@ -7,17 +7,18 @@ */ #include <common.h> - #include <command.h> #include <env.h> #include <env_internal.h> -#include <linux/stddef.h> +#include <part.h> #include <malloc.h> #include <memalign.h> #include <search.h> #include <errno.h> #include <fat.h> #include <mmc.h> +#include <asm/cache.h> +#include <linux/stddef.h> #ifdef CONFIG_SPL_BUILD /* TODO(sjg@chromium.org): Figure out why this is needed */ @@ -32,7 +33,7 @@ static int env_fat_save(void) { env_t __aligned(ARCH_DMA_MINALIGN) env_new; struct blk_desc *dev_desc = NULL; - disk_partition_t info; + struct disk_partition info; int dev, part; int err; loff_t size; @@ -78,7 +79,7 @@ static int env_fat_load(void) { ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE); struct blk_desc *dev_desc = NULL; - disk_partition_t info; + struct disk_partition info; int dev, part; int err; diff --git a/env/flash.c b/env/flash.c index e05f7ef74b..3198147c38 100644 --- a/env/flash.c +++ b/env/flash.c @@ -14,6 +14,7 @@ #include <env.h> #include <env_internal.h> #include <flash.h> +#include <log.h> #include <linux/stddef.h> #include <malloc.h> #include <search.h> @@ -27,7 +27,7 @@ DECLARE_GLOBAL_DATA_PTR; #if CONFIG_IS_ENABLED(OF_CONTROL) static inline int mmc_offset_try_partition(const char *str, s64 *val) { - disk_partition_t info; + struct disk_partition info; struct blk_desc *desc; int len, i, ret; @@ -12,11 +12,14 @@ #include <dm.h> #include <env.h> #include <env_internal.h> +#include <flash.h> #include <malloc.h> #include <spi.h> #include <spi_flash.h> #include <search.h> #include <errno.h> +#include <uuid.h> +#include <asm/cache.h> #include <dm/device-internal.h> #include <u-boot/crc.h> @@ -50,15 +53,14 @@ static int setup_flash_device(void) env_flash = dev_get_uclass_priv(new); #else + if (env_flash) + spi_flash_free(env_flash); + env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS, + CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE); if (!env_flash) { - env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, - CONFIG_ENV_SPI_CS, - CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE); - if (!env_flash) { - env_set_default("spi_flash_probe() failed", 0); - return -EIO; - } + env_set_default("spi_flash_probe() failed", 0); + return -EIO; } #endif return 0; @@ -305,7 +307,7 @@ U_BOOT_ENV_LOCATION(sf) = { .location = ENVL_SPI_FLASH, ENV_NAME("SPI Flash") .load = env_sf_load, - .save = ENV_SAVE_PTR(env_sf_save), + .save = CONFIG_IS_ENABLED(SAVEENV) ? ENV_SAVE_PTR(env_sf_save) : NULL, #if defined(INITENV) && (CONFIG_ENV_ADDR != 0x0) .init = env_sf_init, #endif |