From: Jaehoon Chung Date: Wed, 22 Nov 2017 06:46:52 +0000 (+0900) Subject: misc: sig_header: support the artik530 board X-Git-Tag: submit/tizen/20190213.074817~53 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=37853001bcc68189e90d53db7c15156d66508f1d;p=profile%2Fcommon%2Fplatform%2Fkernel%2Fu-boot-artik7.git misc: sig_header: support the artik530 board Add the bootloader name about "bootloader.img" as artik530 bootloader. ARTIK530 board has its own nexell header, so it needs to calculate the extra size. This patch is to avoid the risk that the wrong OS version of bootloader is flashed. Change-Id: I50d816f135543f897bc012519e8e8cd744b0f012 Signed-off-by: Jaehoon Chung --- diff --git a/drivers/misc/sig_header.c b/drivers/misc/sig_header.c index 9d62c14479..940abafba1 100644 --- a/drivers/misc/sig_header.c +++ b/drivers/misc/sig_header.c @@ -21,13 +21,18 @@ int check_board_signature(char *fname, phys_addr_t dn_addr, phys_size_t size) struct sig_header bh_addr; int ret; - /* u-boot-mmc.bin */ - if (strncmp(fname, "u-boot-mmc.bin", 14)) + /* + * Bootloader names according to boards : + * - Exynos Boards : u-boot-mmc.bin + * - ARTIK530 : bootloader.img + */ + if (strncmp(fname, "u-boot-mmc.bin", 14) && + strncmp(fname, "bootloader.img", 14)) return 0; /* can't found signature in target - download continue */ ret = get_image_signature(&bh_target, (phys_addr_t)CONFIG_SYS_TEXT_BASE, - CONFIG_SIG_IMAGE_SIZE); + CONFIG_SIG_IMAGE_SIZE - CONFIG_EXTRA_SIZE); if (ret) return 0; @@ -55,5 +60,15 @@ int check_board_signature(char *fname, phys_addr_t dn_addr, phys_size_t size) } printf("OK!\n"); + +#ifdef CONFIG_MACH_S5P4418 + printf("Target version : %s\n", bh_target.version); + printf("Image version : %s\n", bh_addr.version); + + if (strncmp(bh_target.version, bh_addr.version, 1)) { + printf("Invalid version!!!\n"); + return - EPERM; + } +#endif return 0; } diff --git a/include/samsung/sighdr.h b/include/samsung/sighdr.h index f97f51d776..8158557102 100644 --- a/include/samsung/sighdr.h +++ b/include/samsung/sighdr.h @@ -8,6 +8,10 @@ /* Size of u-boot-mmc.bin - should be always padded to 1MB */ #define CONFIG_SIG_IMAGE_SIZE SZ_1M +#ifndef CONFIG_EXTRA_SIZE +#define CONFIG_EXTRA_SIZE 0 +#endif + /* HDR_SIZE - 512 */ struct sig_header { uint32_t magic; /* image magic number */