Re: [U-Boot] [PATCH v4 1/4] bootm: make use of legacy image format configurable
Hello Simon, Am 24.05.2014 02:04, schrieb Simon Glass: Hi Heiko, On 19 May 2014 20:49, Heiko Schocherh...@denx.de wrote: 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 Schocherh...@denx.de Cc: Simon Glasss...@chromium.org Cc: Lars Steubesandlars.steubes...@philips.com Cc: Mike Pearcem...@kaew.be Cc: Wolfgang Denkw...@denx.de Cc: Tom Rinitr...@ti.com Cc: Michal Simekmon...@monstr.eu --- - changes for v2: - make the legacy image format configurable through the define CONFIG_IMAGE_FORMAT_LEGACY. Default: if not CONFIG_FIT_SIGNATURE is defined it is enabled, else disabled. Disable it with CONFIG_DISABLE_IMAGE_LEGACY if CONFIG_FIT_SIGNATURE is not defined. - changes for v3: - enable legacy image format for zync as default, as Michak suggested. - changes for v4: move changes for default settings in include/config_defaults.h to include/config_fallbacks.h, so board settings are considered as Lars Steubesand suggested. --- README| 18 ++ common/cmd_bootm.c| 14 ++ common/cmd_disk.c | 4 common/cmd_fdc.c | 4 common/cmd_fpga.c | 2 ++ common/cmd_nand.c | 4 common/cmd_source.c | 4 common/cmd_ximg.c | 7 ++- common/image-fdt.c| 10 -- common/image.c| 23 --- doc/uImage.FIT/signature.txt | 3 +++ include/config_fallbacks.h| 8 include/configs/zynq-common.h | 1 + include/image.h | 2 ++ 14 files changed, 94 insertions(+), 10 deletions(-) It all looks good to me except for one nit below. diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c index 65a8319..813543a 100644 --- a/common/cmd_ximg.c +++ b/common/cmd_ximg.c @@ -32,10 +32,13 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { ulong addr = load_addr; ulong dest = 0; - ulong data, len, count; + ulong data, len; int verify; int part = 0; +#if defined(CONFIG_IMAGE_FORMAT_LEGACY) + ulong count; image_header_t *hdr = NULL; This is also used with CONFIG_BZIP2 (see lower in this function). This change causes a build error in sandbox, for example. Fixed, thanks! I notice also that it causes a useful reduction in U-Boot size. Yes. bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v4 1/4] bootm: make use of legacy image format configurable
Hi Heiko, On 19 May 2014 20:49, Heiko Schocher h...@denx.de wrote: 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 h...@denx.de Cc: Simon Glass s...@chromium.org Cc: Lars Steubesand lars.steubes...@philips.com Cc: Mike Pearce m...@kaew.be Cc: Wolfgang Denk w...@denx.de Cc: Tom Rini tr...@ti.com Cc: Michal Simek mon...@monstr.eu --- - changes for v2: - make the legacy image format configurable through the define CONFIG_IMAGE_FORMAT_LEGACY. Default: if not CONFIG_FIT_SIGNATURE is defined it is enabled, else disabled. Disable it with CONFIG_DISABLE_IMAGE_LEGACY if CONFIG_FIT_SIGNATURE is not defined. - changes for v3: - enable legacy image format for zync as default, as Michak suggested. - changes for v4: move changes for default settings in include/config_defaults.h to include/config_fallbacks.h, so board settings are considered as Lars Steubesand suggested. --- README| 18 ++ common/cmd_bootm.c| 14 ++ common/cmd_disk.c | 4 common/cmd_fdc.c | 4 common/cmd_fpga.c | 2 ++ common/cmd_nand.c | 4 common/cmd_source.c | 4 common/cmd_ximg.c | 7 ++- common/image-fdt.c| 10 -- common/image.c| 23 --- doc/uImage.FIT/signature.txt | 3 +++ include/config_fallbacks.h| 8 include/configs/zynq-common.h | 1 + include/image.h | 2 ++ 14 files changed, 94 insertions(+), 10 deletions(-) It all looks good to me except for one nit below. diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c index 65a8319..813543a 100644 --- a/common/cmd_ximg.c +++ b/common/cmd_ximg.c @@ -32,10 +32,13 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { ulong addr = load_addr; ulong dest = 0; - ulong data, len, count; + ulong data, len; int verify; int part = 0; +#if defined(CONFIG_IMAGE_FORMAT_LEGACY) + ulong count; image_header_t *hdr = NULL; This is also used with CONFIG_BZIP2 (see lower in this function). This change causes a build error in sandbox, for example. I notice also that it causes a useful reduction in U-Boot size. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v4 1/4] 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 h...@denx.de Cc: Simon Glass s...@chromium.org Cc: Lars Steubesand lars.steubes...@philips.com Cc: Mike Pearce m...@kaew.be Cc: Wolfgang Denk w...@denx.de Cc: Tom Rini tr...@ti.com Cc: Michal Simek mon...@monstr.eu --- - changes for v2: - make the legacy image format configurable through the define CONFIG_IMAGE_FORMAT_LEGACY. Default: if not CONFIG_FIT_SIGNATURE is defined it is enabled, else disabled. Disable it with CONFIG_DISABLE_IMAGE_LEGACY if CONFIG_FIT_SIGNATURE is not defined. - changes for v3: - enable legacy image format for zync as default, as Michak suggested. - changes for v4: move changes for default settings in include/config_defaults.h to include/config_fallbacks.h, so board settings are considered as Lars Steubesand suggested. --- README| 18 ++ common/cmd_bootm.c| 14 ++ common/cmd_disk.c | 4 common/cmd_fdc.c | 4 common/cmd_fpga.c | 2 ++ common/cmd_nand.c | 4 common/cmd_source.c | 4 common/cmd_ximg.c | 7 ++- common/image-fdt.c| 10 -- common/image.c| 23 --- doc/uImage.FIT/signature.txt | 3 +++ include/config_fallbacks.h| 8 include/configs/zynq-common.h | 1 + include/image.h | 2 ++ 14 files changed, 94 insertions(+), 10 deletions(-) diff --git a/README b/README index ace7091..795486d 100644 --- a/README +++ b/README @@ -3157,6 +3157,19 @@ FIT uImage format: -150 common/cmd_nand.c Incorrect FIT image format 151 common/cmd_nand.c FIT image format OK +- legacy image format: + CONFIG_IMAGE_FORMAT_LEGACY + enables the legacy image format support in U-Boot. + + Default: + enabled if CONFIG_FIT_SIGNATURE is not defined. + + CONFIG_DISABLE_IMAGE_LEGACY + disable the legacy image format + + This define is introduced, as the legacy image format is + enabled per default for backward compatibility. + - FIT image support: CONFIG_FIT Enable support for the FIT uImage format. @@ -3173,6 +3186,11 @@ FIT uImage format: using a hash signed and verified using RSA. See doc/uImage.FIT/signature.txt for more details. + WARNING: When relying on signed FIT images with required + signature check the legacy image format is default + disabled. If a board need legacy image format support + enable this through CONFIG_IMAGE_FORMAT_LEGACY + - Standalone program support: CONFIG_STANDALONE_LOAD_ADDR diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index e683af3..21d0234 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -233,6 +233,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); @@ -241,6 +242,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, @@ -838,6 +840,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 @@ -888,6 +891,7 @@ static image_header_t *image_get_kernel(ulong img_addr, int verify) } return hdr; } +#endif /** * boot_get_kernel - find kernel image @@ -905,7 +909,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) @@ -943,6 +949,7 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, *os_data