From 91b735d11f95ecf608a95a255281c36dcc7e37a4 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 27 Aug 2020 18:01:28 +0200 Subject: common: Kconfig: Add dependency for default variables strings Kconfig provides several config options for setting up default variables but these are unused when variables are passed to U-Boot via file. That's why cover this dependency in Kconfig. Signed-off-by: Michal Simek --- common/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'common') diff --git a/common/Kconfig b/common/Kconfig index c58f08ba91b..b1934b3a9c5 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -378,7 +378,7 @@ config USE_BOOTARGS config BOOTARGS string "Boot arguments" - depends on USE_BOOTARGS + depends on USE_BOOTARGS && !USE_DEFAULT_ENV_FILE help This can be used to pass arguments to the bootm command. The value of CONFIG_BOOTARGS goes into the environment value "bootargs". Note that @@ -395,7 +395,7 @@ config USE_BOOTCOMMAND config BOOTCOMMAND string "bootcmd value" - depends on USE_BOOTCOMMAND + depends on USE_BOOTCOMMAND && !USE_DEFAULT_ENV_FILE default "run distro_bootcmd" if DISTRO_DEFAULTS help This is the string of commands that will be used as bootcmd and if @@ -416,7 +416,7 @@ config USE_PREBOOT config PREBOOT string "preboot default value" - depends on USE_PREBOOT + depends on USE_PREBOOT && !USE_DEFAULT_ENV_FILE default "" help This is the default of "preboot" environment variable. -- cgit v1.2.3 From 21d3946840fd62dc09e93986743915bcbac100b7 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 30 Aug 2020 11:34:12 +0200 Subject: bootm: update image OS image size when decompressing In bootm_load_os() the OS image is decompressed. In later stages of the boot process we need the decompressed size of the image. Update images->os.image_len after decompression. Passing the correct size is necessary if we want to check loaded EFI binararies for file truncation by comparing the loaded size to the header field SizeOfImage. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- common/bootm.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'common') diff --git a/common/bootm.c b/common/bootm.c index 247b600d9c6..b3377490b3e 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -390,6 +390,8 @@ static int bootm_load_os(bootm_headers_t *images, int boot_progress) bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE); return err; } + /* We need the decompressed image size in the next steps */ + images->os.image_len = load_end - load; flush_cache(flush_start, ALIGN(load_end, ARCH_DMA_MINALIGN) - flush_start); -- cgit v1.2.3 From eb39d8ba5f0d1468b01b89a2a464d18612d3ea76 Mon Sep 17 00:00:00 2001 From: Reuben Dowle Date: Tue, 1 Sep 2020 21:32:01 +0000 Subject: Fix data abort caused by mis-aligning FIT data Attempting to place device tree immediately after an image in memory can lead to mis-aligned data accesses if that image size is not divisible by the alignment requirements of the architecture. Data aborts caused by this were observed on a custom Marvel A388 based system, where the image was a uboot FIT file. The total size varies depending on the uboot device tree size, which does not always lead to correct alignment. The minimum alignment specified for ARM [1] and ARM64 [2] linux booting has been used [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm/booting.rst#n126 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm64/booting.rst#n45 Signed-off-by: Reuben Dowle --- common/spl/spl_fit.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 365104fe028..a8bfd388b10 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -349,9 +349,12 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, /* * Use the address following the image as target address for the - * device tree. + * device tree. Load address is aligned to 8 bytes to match the required + * alignment specified for linux arm [1] and arm 64 [2] booting + * [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm/booting.rst#n126 + * [2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm64/booting.rst#n45 */ - image_info.load_addr = spl_image->load_addr + spl_image->size; + image_info.load_addr = ALIGN(spl_image->load_addr + spl_image->size, 8); /* Figure out which device tree the board wants to use */ node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index++); -- cgit v1.2.3