mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-07-23 23:33:01 +00:00
bootm: make use of legacy image format configurable
make the use of legacy image format configurable through the config define CONFIG_IMAGE_FORMAT_LEGACY. When relying on signed FIT images with required signature check the legacy image format should be disabled. Therefore introduce this new define and enable legacy image format if CONFIG_FIT_SIGNATURE is not set. If CONFIG_FIT_SIGNATURE is set disable per default the legacy image format. Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Lars Steubesand <lars.steubesand@philips.com> Cc: Mike Pearce <mike@kaew.be> Cc: Wolfgang Denk <wd@denx.de> Cc: Tom Rini <trini@ti.com> Cc: Michal Simek <monstr@monstr.eu> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
5f65826b1b
commit
21d29f7f9f
14 changed files with 97 additions and 11 deletions
|
@ -230,6 +230,7 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
|
|||
|
||||
/* get image parameters */
|
||||
switch (genimg_get_format(os_hdr)) {
|
||||
#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
|
||||
case IMAGE_FORMAT_LEGACY:
|
||||
images.os.type = image_get_type(os_hdr);
|
||||
images.os.comp = image_get_comp(os_hdr);
|
||||
|
@ -238,6 +239,7 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
|
|||
images.os.end = image_get_image_end(os_hdr);
|
||||
images.os.load = image_get_load(os_hdr);
|
||||
break;
|
||||
#endif
|
||||
#if defined(CONFIG_FIT)
|
||||
case IMAGE_FORMAT_FIT:
|
||||
if (fit_image_get_type(images.fit_hdr_os,
|
||||
|
@ -847,6 +849,7 @@ int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
|
||||
/**
|
||||
* image_get_kernel - verify legacy format kernel image
|
||||
* @img_addr: in RAM address of the legacy format image to be verified
|
||||
|
@ -897,6 +900,7 @@ static image_header_t *image_get_kernel(ulong img_addr, int verify)
|
|||
}
|
||||
return hdr;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* boot_get_kernel - find kernel image
|
||||
|
@ -914,7 +918,9 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
|
|||
char * const argv[], bootm_headers_t *images, ulong *os_data,
|
||||
ulong *os_len)
|
||||
{
|
||||
#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
|
||||
image_header_t *hdr;
|
||||
#endif
|
||||
ulong img_addr;
|
||||
const void *buf;
|
||||
#if defined(CONFIG_FIT)
|
||||
|
@ -952,6 +958,7 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
|
|||
*os_data = *os_len = 0;
|
||||
buf = map_sysmem(img_addr, 0);
|
||||
switch (genimg_get_format(buf)) {
|
||||
#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
|
||||
case IMAGE_FORMAT_LEGACY:
|
||||
printf("## Booting kernel from Legacy Image at %08lx ...\n",
|
||||
img_addr);
|
||||
|
@ -994,6 +1001,7 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
|
|||
images->legacy_hdr_valid = 1;
|
||||
bootstage_mark(BOOTSTAGE_ID_DECOMP_IMAGE);
|
||||
break;
|
||||
#endif
|
||||
#if defined(CONFIG_FIT)
|
||||
case IMAGE_FORMAT_FIT:
|
||||
os_noffset = fit_image_load(images, FIT_KERNEL_PROP,
|
||||
|
@ -1131,6 +1139,7 @@ static int image_info(ulong addr)
|
|||
printf("\n## Checking Image at %08lx ...\n", addr);
|
||||
|
||||
switch (genimg_get_format(hdr)) {
|
||||
#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
|
||||
case IMAGE_FORMAT_LEGACY:
|
||||
puts(" Legacy image found\n");
|
||||
if (!image_check_magic(hdr)) {
|
||||
|
@ -1152,6 +1161,7 @@ static int image_info(ulong addr)
|
|||
}
|
||||
puts("OK\n");
|
||||
return 0;
|
||||
#endif
|
||||
#if defined(CONFIG_FIT)
|
||||
case IMAGE_FORMAT_FIT:
|
||||
puts(" FIT image found\n");
|
||||
|
@ -1211,6 +1221,7 @@ static int do_imls_nor(void)
|
|||
goto next_sector;
|
||||
|
||||
switch (genimg_get_format(hdr)) {
|
||||
#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
|
||||
case IMAGE_FORMAT_LEGACY:
|
||||
if (!image_check_hcrc(hdr))
|
||||
goto next_sector;
|
||||
|
@ -1225,6 +1236,7 @@ static int do_imls_nor(void)
|
|||
puts("OK\n");
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if defined(CONFIG_FIT)
|
||||
case IMAGE_FORMAT_FIT:
|
||||
if (!fit_check_format(hdr))
|
||||
|
@ -1359,12 +1371,14 @@ static int do_imls_nand(void)
|
|||
}
|
||||
|
||||
switch (genimg_get_format(buffer)) {
|
||||
#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
|
||||
case IMAGE_FORMAT_LEGACY:
|
||||
header = (const image_header_t *)buffer;
|
||||
|
||||
len = image_get_image_size(header);
|
||||
nand_imls_legacyimage(nand, nand_dev, off, len);
|
||||
break;
|
||||
#endif
|
||||
#if defined(CONFIG_FIT)
|
||||
case IMAGE_FORMAT_FIT:
|
||||
len = fit_get_size(buffer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue