diff options
author | Tom Rini <trini@konsulko.com> | 2019-08-07 23:13:35 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-08-07 23:13:35 -0400 |
commit | db857dcbbfe993c21781524e44404f9800db87c7 (patch) | |
tree | 6f94410d22fa9bffc0c44feb11241ef8e012edfd /common | |
parent | 7127151d538d878bd073ca6d6cca630a4b35b76f (diff) | |
parent | 0b6febfdb3cf9b4a51fa65fbd94f9ab2d7738f32 (diff) |
Merge branch '2019-08-07-master-imports'
- Misc Android / AVB bugfixes (including updating the header from
Android).
- MediaTek updates
- Other assorted bugfixes.
Diffstat (limited to 'common')
-rw-r--r-- | common/autoboot.c | 15 | ||||
-rw-r--r-- | common/avb_verify.c | 3 | ||||
-rw-r--r-- | common/console.c | 47 | ||||
-rw-r--r-- | common/image-android-dt.c | 11 | ||||
-rw-r--r-- | common/image-fit.c | 13 |
5 files changed, 69 insertions, 20 deletions
diff --git a/common/autoboot.c b/common/autoboot.c index 42fbd7614a..7a91736a00 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -11,6 +11,7 @@ #include <console.h> #include <fdtdec.h> #include <hash.h> +#include <memalign.h> #include <menu.h> #include <post.h> #include <u-boot/sha256.h> @@ -71,8 +72,8 @@ static int passwd_abort_sha256(uint64_t etime) { const char *sha_env_str = env_get("bootstopkeysha256"); u8 sha_env[SHA256_SUM_LEN]; - u8 sha[SHA256_SUM_LEN]; - char presskey[MAX_DELAY_STOP_STR]; + u8 *sha; + char *presskey; const char *algo_name = "sha256"; u_int presskey_len = 0; int abort = 0; @@ -93,6 +94,9 @@ static int passwd_abort_sha256(uint64_t etime) return 0; } + presskey = malloc_cache_aligned(MAX_DELAY_STOP_STR); + sha = malloc_cache_aligned(SHA256_SUM_LEN); + size = SHA256_SUM_LEN; /* * We don't know how long the stop-string is, so we need to * generate the sha256 hash upon each input character and @@ -101,8 +105,11 @@ static int passwd_abort_sha256(uint64_t etime) do { if (tstc()) { /* Check for input string overflow */ - if (presskey_len >= MAX_DELAY_STOP_STR) + if (presskey_len >= MAX_DELAY_STOP_STR) { + free(presskey); + free(sha); return 0; + } presskey[presskey_len++] = getc(); @@ -116,6 +123,8 @@ static int passwd_abort_sha256(uint64_t etime) } } while (!abort && get_ticks() <= etime); + free(presskey); + free(sha); return abort; } diff --git a/common/avb_verify.c b/common/avb_verify.c index 32034d927c..36898a610f 100644 --- a/common/avb_verify.c +++ b/common/avb_verify.c @@ -851,6 +851,7 @@ static AvbIOResult get_size_of_partition(AvbOps *ops, return AVB_IO_RESULT_OK; } +#ifdef CONFIG_OPTEE_TA_AVB static AvbIOResult read_persistent_value(AvbOps *ops, const char *name, size_t buffer_size, @@ -968,6 +969,8 @@ free_name: return rc; } +#endif + /** * ============================================================================ * AVB2.0 AvbOps alloc/initialisation/free diff --git a/common/console.c b/common/console.c index 0b0dd76256..d086feabb1 100644 --- a/common/console.c +++ b/common/console.c @@ -463,6 +463,11 @@ static void print_pre_console_buffer(int flushpoint) char buf_out[CONFIG_PRE_CON_BUF_SZ + 1]; char *buf_in; +#ifdef CONFIG_SILENT_CONSOLE + if (gd->flags & GD_FLG_SILENT) + return; +#endif + buf_in = map_sysmem(CONFIG_PRE_CON_BUF_ADDR, CONFIG_PRE_CON_BUF_SZ); if (gd->precon_buf_idx > CONFIG_PRE_CON_BUF_SZ) in = gd->precon_buf_idx - CONFIG_PRE_CON_BUF_SZ; @@ -511,8 +516,11 @@ void putc(const char c) membuff_putbyte(&gd->console_out, c); #endif #ifdef CONFIG_SILENT_CONSOLE - if (gd->flags & GD_FLG_SILENT) + if (gd->flags & GD_FLG_SILENT) { + if (!(gd->flags & GD_FLG_DEVINIT)) + pre_console_putc(c); return; + } #endif #ifdef CONFIG_DISABLE_CONSOLE @@ -559,8 +567,11 @@ void puts(const char *s) membuff_put(&gd->console_out, s, strlen(s)); #endif #ifdef CONFIG_SILENT_CONSOLE - if (gd->flags & GD_FLG_SILENT) + if (gd->flags & GD_FLG_SILENT) { + if (!(gd->flags & GD_FLG_DEVINIT)) + pre_console_puts(s); return; + } #endif #ifdef CONFIG_DISABLE_CONSOLE @@ -720,14 +731,22 @@ int console_assign(int file, const char *devname) return -1; } -static void console_update_silent(void) +/* return true if the 'silent' flag is removed */ +static bool console_update_silent(void) { #ifdef CONFIG_SILENT_CONSOLE - if (env_get("silent") != NULL) + if (env_get("silent")) { gd->flags |= GD_FLG_SILENT; - else + } else { + unsigned long flags = gd->flags; + gd->flags &= ~GD_FLG_SILENT; + + return !!(flags & GD_FLG_SILENT); + } #endif + + return false; } int console_announce_r(void) @@ -792,6 +811,13 @@ int console_init_r(void) #if CONFIG_IS_ENABLED(CONSOLE_MUX) int iomux_err = 0; #endif + int flushpoint; + + /* update silent for env loaded from flash (initr_env) */ + if (console_update_silent()) + flushpoint = PRE_CONSOLE_FLUSHPOINT1_SERIAL; + else + flushpoint = PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL; /* set default handlers at first */ gd->jt->getc = serial_getc; @@ -869,7 +895,7 @@ done: if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL)) return 0; #endif - print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL); + print_pre_console_buffer(flushpoint); return 0; } @@ -883,8 +909,13 @@ int console_init_r(void) struct list_head *list = stdio_get_list(); struct list_head *pos; struct stdio_dev *dev; + int flushpoint; - console_update_silent(); + /* update silent for env loaded from flash (initr_env) */ + if (console_update_silent()) + flushpoint = PRE_CONSOLE_FLUSHPOINT1_SERIAL; + else + flushpoint = PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL; #ifdef CONFIG_SPLASH_SCREEN /* @@ -947,7 +978,7 @@ int console_init_r(void) if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL)) return 0; #endif - print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL); + print_pre_console_buffer(flushpoint); return 0; } diff --git a/common/image-android-dt.c b/common/image-android-dt.c index 6916826179..a2d52df4a2 100644 --- a/common/image-android-dt.c +++ b/common/image-android-dt.c @@ -78,17 +78,18 @@ static void android_dt_print_fdt_info(const struct fdt_header *fdt) { u32 fdt_size; int root_node_off; - const char *compatible = NULL; + const char *compatible; - fdt_size = fdt_totalsize(fdt); root_node_off = fdt_path_offset(fdt, "/"); if (root_node_off < 0) { printf("Error: Root node not found\n"); - } else { - compatible = fdt_getprop(fdt, root_node_off, "compatible", - NULL); + return; } + fdt_size = fdt_totalsize(fdt); + compatible = fdt_getprop(fdt, root_node_off, "compatible", + NULL); + printf(" (FDT)size = %d\n", fdt_size); printf(" (FDT)compatible = %s\n", compatible ? compatible : "(unknown)"); diff --git a/common/image-fit.c b/common/image-fit.c index e346fed550..5c63c769de 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -1998,10 +1998,11 @@ int fit_image_load(bootm_headers_t *images, ulong addr, comp = IH_COMP_NONE; loadbuf = buf; /* Kernel images get decompressed later in bootm_load_os(). */ - if (!(image_type == IH_TYPE_KERNEL || - image_type == IH_TYPE_KERNEL_NOLOAD) && - !fit_image_get_comp(fit, noffset, &comp) && - comp != IH_COMP_NONE) { + if (!fit_image_get_comp(fit, noffset, &comp) && + comp != IH_COMP_NONE && + !(image_type == IH_TYPE_KERNEL || + image_type == IH_TYPE_KERNEL_NOLOAD || + image_type == IH_TYPE_RAMDISK)) { ulong max_decomp_len = len * 20; if (load == data) { loadbuf = malloc(max_decomp_len); @@ -2021,6 +2022,10 @@ int fit_image_load(bootm_headers_t *images, ulong addr, memcpy(loadbuf, buf, len); } + if (image_type == IH_TYPE_RAMDISK && comp != IH_COMP_NONE) + puts("WARNING: 'compression' nodes for ramdisks are deprecated," + " please fix your .its file!\n"); + /* verify that image data is a proper FDT blob */ if (image_type == IH_TYPE_FLATDT && fdt_check_header(loadbuf)) { puts("Subimage data is not a FDT"); |