diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 12 | ||||
-rw-r--r-- | common/Makefile | 2 | ||||
-rw-r--r-- | common/avb_verify.c | 9 | ||||
-rw-r--r-- | common/console.c | 9 | ||||
-rw-r--r-- | common/fdt_support.c | 13 | ||||
-rw-r--r-- | common/spl/spl.c | 12 | ||||
-rw-r--r-- | common/spl/spl_ymodem.c | 1 |
7 files changed, 40 insertions, 18 deletions
diff --git a/common/Kconfig b/common/Kconfig index 81e88ea77c..9f6a1622d1 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -125,6 +125,7 @@ config NOR_BOOT config NAND_BOOT bool "Support for booting from NAND flash" default n + imply NAND help Enabling this will make a U-Boot binary that is capable of being booted via NAND flash. This is not a must, some SoCs need this, @@ -133,6 +134,7 @@ config NAND_BOOT config ONENAND_BOOT bool "Support for booting from ONENAND" default n + imply NAND help Enabling this will make a U-Boot binary that is capable of being booted via ONENAND. This is not a must, some SoCs need this, @@ -635,6 +637,16 @@ config HASH and the algorithms it supports are defined in common/hash.c. See also CMD_HASH for command-line access. +config AVB_VERIFY + bool "Build Android Verified Boot operations" + depends on LIBAVB && FASTBOOT + help + This option enables compilation of bootloader-dependent operations, + used by Android Verified Boot 2.0 library (libavb). Includes: + * Helpers to process strings in order to build OS bootargs. + * Helpers to access MMC, similar to drivers/fastboot/fb_mmc.c. + * Helpers to alloc/init/free avb ops. + endmenu menu "Update support" diff --git a/common/Makefile b/common/Makefile index 66584f8f48..7100541ece 100644 --- a/common/Makefile +++ b/common/Makefile @@ -121,4 +121,4 @@ obj-$(CONFIG_$(SPL_)LOG_CONSOLE) += log_console.o obj-y += s_record.o obj-y += xyzModem.o -obj-$(CONFIG_LIBAVB) += avb_verify.o +obj-$(CONFIG_AVB_VERIFY) += avb_verify.o diff --git a/common/avb_verify.c b/common/avb_verify.c index f9a00f8871..20e35ade30 100644 --- a/common/avb_verify.c +++ b/common/avb_verify.c @@ -5,6 +5,7 @@ */ #include <avb_verify.h> +#include <blk.h> #include <fastboot.h> #include <image.h> #include <malloc.h> @@ -288,8 +289,8 @@ static unsigned long mmc_read_and_flush(struct mmc_part *part, tmp_buf = buffer; } - blks = part->mmc->block_dev.block_read(part->mmc_blk, - start, sectors, tmp_buf); + blks = blk_dread(part->mmc_blk, + start, sectors, tmp_buf); /* flush cache after read */ flush_cache((ulong)tmp_buf, sectors * part->info.blksz); @@ -327,8 +328,8 @@ static unsigned long mmc_write(struct mmc_part *part, lbaint_t start, tmp_buf = buffer; } - return part->mmc->block_dev.block_write(part->mmc_blk, - start, sectors, tmp_buf); + return blk_dwrite(part->mmc_blk, + start, sectors, tmp_buf); } static struct mmc_part *get_partition(AvbOps *ops, const char *partition) diff --git a/common/console.c b/common/console.c index 2ba33dc574..7aa58d0a63 100644 --- a/common/console.c +++ b/common/console.c @@ -196,20 +196,21 @@ static int console_tstc(int file) { int i, ret; struct stdio_dev *dev; + int prev; - disable_ctrlc(1); + prev = disable_ctrlc(1); for (i = 0; i < cd_count[file]; i++) { dev = console_devices[file][i]; if (dev->tstc != NULL) { ret = dev->tstc(dev); if (ret > 0) { tstcdev = dev; - disable_ctrlc(0); + disable_ctrlc(prev); return ret; } } } - disable_ctrlc(0); + disable_ctrlc(prev); return 0; } @@ -603,7 +604,6 @@ static int ctrlc_disabled = 0; /* see disable_ctrl() */ static int ctrlc_was_pressed = 0; int ctrlc(void) { -#ifndef CONFIG_SANDBOX if (!ctrlc_disabled && gd->have_console) { if (tstc()) { switch (getc()) { @@ -615,7 +615,6 @@ int ctrlc(void) } } } -#endif return 0; } diff --git a/common/fdt_support.c b/common/fdt_support.c index 812eca8173..3b31f3d7d5 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -893,9 +893,9 @@ err_prop: * * fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes)); */ -void fdt_fixup_mtdparts(void *blob, void *node_info, int node_info_size) +void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info, + int node_info_size) { - struct node_info *ni = node_info; struct mtd_device *dev; int i, idx; int noff; @@ -905,12 +905,13 @@ void fdt_fixup_mtdparts(void *blob, void *node_info, int node_info_size) for (i = 0; i < node_info_size; i++) { idx = 0; - noff = fdt_node_offset_by_compatible(blob, -1, ni[i].compat); + noff = fdt_node_offset_by_compatible(blob, -1, + node_info[i].compat); while (noff != -FDT_ERR_NOTFOUND) { debug("%s: %s, mtd dev type %d\n", fdt_get_name(blob, noff, 0), - ni[i].compat, ni[i].type); - dev = device_find(ni[i].type, idx++); + node_info[i].compat, node_info[i].type); + dev = device_find(node_info[i].type, idx++); if (dev) { if (fdt_node_set_part_info(blob, noff, dev)) return; /* return on error */ @@ -918,7 +919,7 @@ void fdt_fixup_mtdparts(void *blob, void *node_info, int node_info_size) /* Jump to next flash node */ noff = fdt_node_offset_by_compatible(blob, noff, - ni[i].compat); + node_info[i].compat); } } } diff --git a/common/spl/spl.c b/common/spl/spl.c index a09ada37d7..a1e7b9fa91 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -80,6 +80,11 @@ int __weak bootz_setup(ulong image, ulong *start, ulong *end) } #endif +/* Weak default function for arch/board-specific fixups to the spl_image_info */ +void __weak spl_perform_fixups(struct spl_image_info *spl_image) +{ +} + void spl_fixup_fdt(void) { #if defined(CONFIG_SPL_OF_LIBFDT) && defined(CONFIG_SYS_SPL_ARGS_ADDR) @@ -445,8 +450,10 @@ static int boot_from_devices(struct spl_image_info *spl_image, else puts("SPL: Unsupported Boot Device!\n"); #endif - if (loader && !spl_load_image(spl_image, loader)) + if (loader && !spl_load_image(spl_image, loader)) { + spl_image->boot_device = spl_boot_list[i]; return 0; + } } return -ENODEV; @@ -498,6 +505,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) #ifdef CONFIG_SYS_SPL_ARGS_ADDR spl_image.arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR; #endif + spl_image.boot_device = BOOT_DEVICE_NONE; board_boot_order(spl_boot_list); if (boot_from_devices(&spl_image, spl_boot_list, @@ -506,6 +514,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2) hang(); } + spl_perform_fixups(&spl_image); + #ifdef CONFIG_CPU_V7M spl_image.entry_point |= 0x1; #endif diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c index 35f8f80013..3b1bd71bda 100644 --- a/common/spl/spl_ymodem.c +++ b/common/spl/spl_ymodem.c @@ -12,7 +12,6 @@ #include <spl.h> #include <xyzModem.h> #include <asm/u-boot.h> -#include <asm/utils.h> #include <linux/libfdt.h> #define BUF_SIZE 1024 |