[U-Boot-Users] [PATCH 0/7] [new uImage] final fixes and cleanups

Hi,
This patch series consists of final fixes and cleanups of the new uImage work: - fix style issue in previously posted patch - update to doc/uImage.FIT/ - fixes to autoscr and mxtract commands - preparation for merge with the master - disable debugging output - disable new format support by default - example of enabling new format support for a board (pcs440ep)
The patchset is available on the new-image branch of the u-boot-testing repository, which now contains complete new uImage support (including MD5).
The new-image branch will soon be merged to the mainline U-Boot, and I'd like to again encourage people to help with testing. To repeat: reports on test results of the following areas not tested due to hardware unavailability will be greatly appreciated: - boards other that ppc - booting from dataflash - U-Boot commands: - diskboot - docboot - fdcboot - fpga - nboot - scsiboot - usbboot
Note that new format is not enabled by default -- to try it out, you must define the following in the board config file: #define CONFIG_FIT 1 #define CONFIG_OF_LIBFDT 1 and optionally: #define CONFIG_FIT_VERBOSE 1
Compiling support for the new image format increases the size of U-Boot, so depending on your Flash sector layout, adjustments to CFG_MONITOR_LEN might be necessary.
Finally, reading doc/uImage.FIT/howto.txt should be sufficient to get you started with the new format.
Comments and questions are welcome.
Regards, Bartlomiej
Bartlomiej Sieka (7): [new uImage] Enable new uImage support for the pcs440ep board. [new uImage] Do not compile new uImage format support by default [new uImage] Disable debuging output in preparation for merge with master [new uImage] Compilation and new uImage handling fixes for imxtract [new uImage] Fix autoscr command used with new uImage format [new uImage] Fix *.its files location in documentation [new uImage] Style fix

Fix style issue spotted by Wolfgang Denk wd@denx.org
Signed-off-by: Bartlomiej Sieka tur@semihalf.com ---
board/trab/auto_update.c | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/board/trab/auto_update.c b/board/trab/auto_update.c index 5311e12..46110cc 100644 --- a/board/trab/auto_update.c +++ b/board/trab/auto_update.c @@ -218,14 +218,12 @@ au_check_cksum_valid(int idx, long nbytes) } #endif
- if (nbytes != image_get_image_size (hdr)) - { + if (nbytes != image_get_image_size (hdr)) { printf ("Image %s bad total SIZE\n", aufile[idx]); return -1; } /* check the data CRC */ - if (!image_check_dcrc (hdr)) - { + if (!image_check_dcrc (hdr)) { printf ("Image %s bad data checksum\n", aufile[idx]); return -1; } @@ -255,13 +253,11 @@ au_check_header_valid(int idx, long nbytes) printf("size %#x %#lx ", image_get_data_size (hdr), nbytes); printf("type %#x %#x ", image_get_type (hdr), IH_TYPE_KERNEL); #endif - if (nbytes < image_get_header_size ()) - { + if (nbytes < image_get_header_size ()) { printf ("Image %s bad header SIZE\n", aufile[idx]); return -1; } - if (!image_check_magic (hdr) || !image_check_arch (hdr, IH_ARCH_ARM)) - { + if (!image_check_magic (hdr) || !image_check_arch (hdr, IH_ARCH_ARM)) { printf ("Image %s bad MAGIC or ARCH\n", aufile[idx]); return -1; } @@ -271,7 +267,8 @@ au_check_header_valid(int idx, long nbytes) return -1; } /* check the type - could do this all in one gigantic if() */ - if ((idx == IDX_FIRMWARE) && !image_check_type (hdr, IH_TYPE_FIRMWARE)) { + if ((idx == IDX_FIRMWARE) && + !image_check_type (hdr, IH_TYPE_FIRMWARE)) { printf ("Image %s wrong type\n", aufile[idx]); return -1; } @@ -289,8 +286,7 @@ au_check_header_valid(int idx, long nbytes) return -1; } if ((idx == IDX_PREPARE || idx == IDX_PREINST || idx == IDX_POSTINST) - && !image_check_type (hdr, IH_TYPE_SCRIPT)) - { + && !image_check_type (hdr, IH_TYPE_SCRIPT)) { printf ("Image %s wrong type\n", aufile[idx]); return -1; }

Signed-off-by: Bartlomiej Sieka tur@semihalf.com ---
doc/uImage.FIT/howto.txt | 19 ++++++++++--------- doc/uImage.FIT/source_file_format.txt | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/doc/uImage.FIT/howto.txt b/doc/uImage.FIT/howto.txt index 35ab97d..4ae5303 100644 --- a/doc/uImage.FIT/howto.txt +++ b/doc/uImage.FIT/howto.txt @@ -49,10 +49,11 @@ Consider a simple scenario, where a PPC Linux kernel built from sources on the development host is to be booted old-style (non-FDT) by U-Boot on an embedded target. Assume that the outcome of the build is vmlinux.bin.gz, a file which contains a gzip-compressed PPC Linux kernel (the only data file in this case). -The uImage can be produced using the image source file examples/kernel.its -(note that kernel.its assumes that vmlinux.bin.gz is in the current working -directory; if desired, an alternative path can be specified in the kernel.its -file). Here's how to create the image and inspect its contents: +The uImage can be produced using the image source file +doc/uImage.FIT/kernel.its (note that kernel.its assumes that vmlinux.bin.gz is +in the current working directory; if desired, an alternative path can be +specified in the kernel.its file). Here's how to create the image and inspect +its contents:
[on the host system] $ mkimage -f kernel.its kernel.itb @@ -159,10 +160,10 @@ Example 2 -- new-style (FDT) kernel booting Consider another simple scenario, where a PPC Linux kernel is to be booted new-style, i.e., with a FDT blob. In this case there are two prerequisite data files: vmlinux.bin.gz (Linux kernel) and target.dtb (FDT blob). The uImage can -be produced using image source file examples/kernel_fdt.its like this (note -again, that both prerequisite data files are assumed to be present in the -current working directory -- image source file kernel_fdt.its can be modified -to take the files from some other location if needed): +be produced using image source file doc/uImage.FIT/kernel_fdt.its like this +(note again, that both prerequisite data files are assumed to be present in +the current working directory -- image source file kernel_fdt.its can be +modified to take the files from some other location if needed):
[on the host system] $ mkimage -f kernel_fdt.its kernel_fdt.itb @@ -292,5 +293,5 @@ Bytes transferred = 1109776 (10ef10 hex) Example 3 -- advanced booting -----------------------------
-Refer to examples/multi.its for an image source file that allows more +Refer to doc/uImage.FIT/multi.its for an image source file that allows more sophisticated booting scenarios (multiple kernels, ramdisks and fdt blobs). diff --git a/doc/uImage.FIT/source_file_format.txt b/doc/uImage.FIT/source_file_format.txt index 3f7104f..1d75458 100644 --- a/doc/uImage.FIT/source_file_format.txt +++ b/doc/uImage.FIT/source_file_format.txt @@ -259,4 +259,4 @@ not* be specified in a configuration node. 8) Examples -----------
-Please see examples/*.its for actual image source files. +Please see doc/uImage.FIT/*.its for actual image source files.

Signed-off-by: Bartlomiej Sieka tur@semihalf.com ---
common/cmd_autoscript.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/common/cmd_autoscript.c b/common/cmd_autoscript.c index 5163d57..1a37b90 100644 --- a/common/cmd_autoscript.c +++ b/common/cmd_autoscript.c @@ -100,6 +100,13 @@ autoscript (ulong addr, const char *fit_uname) puts ("Empty Script\n"); return 1; } + + /* + * scripts are just multi-image files with one component, seek + * past the zero-terminated sequence of image lengths to get + * to the actual image data + */ + while (*data++); break; #if defined(CONFIG_FIT) case IMAGE_FORMAT_FIT: @@ -155,8 +162,6 @@ autoscript (ulong addr, const char *fit_uname) return 1; }
- while (*data++); - /* make sure cmd is null terminated */ memmove (cmd, (char *)data, len); *(cmd + len) = 0;

Fix imxtract command not being compiled-in despite CONFIG_CMD_XIMG being in include/config_cmd_default.h. Fix few warnings and handling of new format images.
Signed-off-by: Bartlomiej Sieka tur@semihalf.com ---
common/cmd_ximg.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c index 77f68c4..7916fc1 100644 --- a/common/cmd_ximg.c +++ b/common/cmd_ximg.c @@ -24,7 +24,6 @@ * MA 02111-1307 USA */
-#if defined(CONFIG_CMD_XIMG)
/* * Multi Image extract @@ -40,13 +39,12 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) ulong addr = load_addr; ulong dest = 0; ulong data, len, count; - int i, verify; + int verify; int part = 0; char pbuf[10]; - char *s; image_header_t *hdr; #if defined(CONFIG_FIT) - const char *uname; + const char *uname = NULL; const void* fit_hdr; int noffset; const void *fit_data; @@ -134,7 +132,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) }
/* get subimage node offset */ - noffset = fit_image_get_node (fit_hdr, fit_uname); + noffset = fit_image_get_node (fit_hdr, uname); if (noffset < 0) { printf ("Can't find '%s' FIT subimage\n", uname); return 1; @@ -160,7 +158,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return 1; }
- data = (ulong *)fit_data; + data = (ulong)fit_data; len = (ulong)fit_len; break; #endif @@ -190,5 +188,3 @@ U_BOOT_CMD(imxtract, 4, 1, do_imgextract, " - extract <uname> subimage from FIT image at <addr> and copy to <dest>\n" #endif ); - -#endif

Signed-off-by: Bartlomiej Sieka tur@semihalf.com ---
common/cmd_bootm.c | 1 - common/image.c | 1 - lib_ppc/bootm.c | 1 - 3 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 2f232e7..789ee03 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -21,7 +21,6 @@ * MA 02111-1307 USA */
-#define DEBUG
/* * Boot support diff --git a/common/image.c b/common/image.c index 6508df9..f04826a 100644 --- a/common/image.c +++ b/common/image.c @@ -23,7 +23,6 @@ * MA 02111-1307 USA */
-#define DEBUG
#ifndef USE_HOSTCC #include <common.h> diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c index 8cdace2..89463e3 100644 --- a/lib_ppc/bootm.c +++ b/lib_ppc/bootm.c @@ -23,7 +23,6 @@ * MA 02111-1307 USA */
-#define DEBUG
#include <common.h> #include <watchdog.h>

Disable default building of new uImage format support in preparation for merge with the master. Support for new format can be enabled on a per-board basis, by defining the following in the board's config file:
#define CONFIG_FIT 1 #define CONFIG_OF_LIBFDT 1
This can be optionally defined to give more verbose output:
#define CONFIG_FIT_VERBOSE 1 /* enable fit_format_{error,warning}() */
Signed-off-by: Bartlomiej Sieka tur@semihalf.com ---
include/image.h | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/include/image.h b/include/image.h index f22dafd..36143e2 100644 --- a/include/image.h +++ b/include/image.h @@ -41,12 +41,6 @@ #include <linux/string.h> #include <asm/u-boot.h>
-/* new uImage format support enabled on target - * To be moved to board configuration file */ -#define CONFIG_FIT 1 -#define CONFIG_OF_LIBFDT 1 -#define CONFIG_FIT_VERBOSE 1 /* enable fit_format_{error,warning}() */ - #else
/* new uImage format support enabled on host */

Signed-off-by: Bartlomiej Sieka tur@semihalf.com ---
include/configs/pcs440ep.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/include/configs/pcs440ep.h b/include/configs/pcs440ep.h index 893924b..ba6d932 100644 --- a/include/configs/pcs440ep.h +++ b/include/configs/pcs440ep.h @@ -27,6 +27,12 @@ #ifndef __CONFIG_H #define __CONFIG_H
+ +/* new uImage format support */ +#define CONFIG_FIT 1 +#define CONFIG_OF_LIBFDT 1 +#define CONFIG_FIT_VERBOSE 1 /* enable fit_format_{error,warning}() */ + /*----------------------------------------------------------------------- * High Level Configuration Options *----------------------------------------------------------------------*/
participants (1)
-
Bartlomiej Sieka