tools/mkimage: Assume FDT image type for FIT images
PATCH 1/3 tools/mkimage: Assume FDT image type for FIT images
When building a Flattened Image Tree (FIT) the image type needs to be "flat_dt". Commit 89a4d6b12fd6394898b8a454cbabeaf1cd59bae5 introduced a regression which caused the user to need to specify the "-T flat_dt" parameter on the command line when building a FIT image. The "-T flat_dt" parameter should not be needed and is at odds with the current FIT image documentation.
---
Ideally this patch would make it into the upcoming release as its a regression. I don't really care when 2/3 and 3/3 are applied, they aren't really bug fixes.
tools/mkimage.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
tools/mkimage.c +6 -0
@@ -231,6 +231,12 @@ main (int argc, char **argv)usage (); params.datafile = *++argv; params.fflag =1 ; + +/* +* The flattened image tree (FIT) format +* requires a flattened device tree image type +*/ + params.type =IH_TYPE_FLATDT ; goto NXTARG;case 'n' :if (--argc <=0 )
Signature · 1 line
1.6.2.1
PATCH 2/3 tools/fit_image.c: Remove unused fit_set_header()
The FIT fit_set_header() function was copied from the standard uImage's image_set_header() function during mkimage reorganization. However, the fit_set_header() function is not used since FIT images use a standard device tree blob header.
--- tools/fit_image.c | 34 +--------------------------------- 1 files changed, 1 insertions(+), 33 deletions(-)
tools/fit_image.c +1 -33
@@ -155,38 +155,6 @@ static int fit_handle_file (struct mkimage_params *params)return (EXIT_SUCCESS ); } -static void fit_set_header (void *ptr,struct stat *sbuf,int ifd, -struct mkimage_params *params) -{ -uint32_t checksum; - -image_header_t * hdr = (image_header_t *)ptr; - - checksum =crc32 (0 , - (const unsigned char *)(ptr + -sizeof (image_header_t)), - sbuf->st_size -sizeof (image_header_t)); - -/* Build new header */ -image_set_magic (hdr,IH_MAGIC ); -image_set_time (hdr, sbuf->st_mtime); -image_set_size (hdr, sbuf->st_size -sizeof (image_header_t)); -image_set_load (hdr, params->addr); -image_set_ep (hdr, params->ep); -image_set_dcrc (hdr, checksum); -image_set_os (hdr, params->os); -image_set_arch (hdr, params->arch); -image_set_type (hdr, params->type); -image_set_comp (hdr, params->comp); - -image_set_name (hdr, params->imagename); - - checksum =crc32 (0 , (const unsigned char *)hdr, -sizeof (image_header_t)); - -image_set_hcrc (hdr, checksum); -} -static int fit_check_params (struct mkimage_params *params) { return ((params->dflag && (params->fflag || params->lflag)) ||
@@ -202,7 +170,7 @@ static struct image_type_params fitimage_params = { .print_header = fit_print_contents, .check_image_type = fit_check_image_types, .fflag_handle = fit_handle_file, - .set_header = fit_set_header, + .set_header = NULL, /* FIT images use DTB header */ .check_params = fit_check_params, };
Signature · 1 line
1.6.2.1
Wolfgang Denk
AppliedPATCH 2/3 tools/fit_image.c: Remove unused fit_set_header()
Dear Peter Tyser,
Quoted 9 lines · In message <[email protected]> you wrote:
The FIT
fit_set_header()function was copied from the standard uImage'simage_set_header()function during mkimage reorganization. However, thefit_set_header()function is not used since FIT images use a standard device tree blob header.Signed-off-by Peter Tyser <[email protected]>--- tools/fit_image.c | 34 +--------------------------------- 1 files changed, 1 insertions(+), 33 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Those who hate and fight must stop themselves -- otherwise it is not stopped. -- Spock, "Day of the Dove", stardate unknown
PATCH 3/3 tools/mkimage: Print FIT image contents after creation
In reply to Peter TyserPreviously, there was no indication to the user that a FIT image was successfully created after executing mkimage. For example:
$ mkimage -f uImage.its uImage.itb DTC: dts->dtb on file "uImage.its"
Adding some additional output after creating a FIT image lets the user know exactly what is contained in their image, eg:
$ mkimage -f uImage.its uImage.itb
DTC: dts->dtb on file "uImage.its"
FIT description: Linux kernel 2.6.32-rc7-00201-g7550d6f-dirty
Created: Tue Nov 24 15:43:01 2009
Image 0 (kernel at 1)
Description: Linux Kernel 2.6.32-rc7-00201-g7550d6f-dirty
Type: Kernel Image
Compression: gzip compressed
Data Size: 2707311 Bytes = 2643.86 kB = 2.58 MB
Architecture: PowerPC
OS: Linux
Load Address: 0x00000000
Entry Point: 0x00000000
Hash algo: crc32
Hash value: efe0798b
Hash algo: sha1
Hash value: ecafba8c95684f2c8fec67e33c41ec88df1534d7
Image 1 (fdt at 1)
Description: Flattened Device Tree blob
Type: Flat Device Tree
Compression: uncompressed
Data Size: 12288 Bytes = 12.00 kB = 0.01 MB
Architecture: PowerPC
Hash algo: crc32
Hash value: a5cab676
Hash algo: sha1
Hash value: 168722b13e305283cfd6603dfe8248cc329adea6
Default Configuration: 'config at 1'
Configuration 0 (config at 1)
Description: Default Linux kernel
Kernel: kernel at 1
FDT: fdt at 1This brings the behavior of creating a FIT image in line with creating a standard uImage, which also prints out the uImage contents after creation.
--- tools/mkimage.c | 51 ++++++++++++++++++++++++++------------------------- 1 files changed, 26 insertions(+), 25 deletions(-)
tools/mkimage.c +26 -25
@@ -298,23 +298,35 @@ NXTARG: ; params.imagefile = *argv; -if (!params.fflag){ -if (params.lflag) { - ifd =open (params.imagefile,O_RDONLY |O_BINARY ); - }else { - ifd =open (params.imagefile, -O_RDWR |O_CREAT |O_TRUNC |O_BINARY ,0666 ); - } +if (params.fflag){ +if (tparams->fflag_handle) +/* +* in some cases, some additional processing needs +* to be done if fflag is defined +* +* For ex. fit_handle_file for Fit file support +*/ + retval = tparams->fflag_handle (¶ms); -if (ifd <0 ) { -fprintf (stderr,"%s: Can't open %s: %s\n" , - params.cmdname, params.imagefile, -strerror (errno)); -exit (EXIT_FAILURE ); - } +if (retval !=EXIT_SUCCESS ) +exit (retval); + } + +if (params.lflag || params.fflag) { + ifd =open (params.imagefile,O_RDONLY |O_BINARY ); + }else { + ifd =open (params.imagefile, +O_RDWR |O_CREAT |O_TRUNC |O_BINARY ,0666 ); + } + +if (ifd <0 ) { +fprintf (stderr,"%s: Can't open %s: %s\n" , + params.cmdname, params.imagefile, +strerror (errno)); +exit (EXIT_FAILURE ); } -if (params.lflag) { +if (params.lflag || params.fflag) {/* * list header information of existing image */
@@ -352,17 +364,6 @@ NXTARG: ; (void )close (ifd);exit (retval); - }else if (params.fflag) { -if (tparams->fflag_handle) -/* -* in some cases, some additional processing needs -* to be done if fflag is defined -* -* For ex. fit_handle_file for Fit file support -*/ - retval = tparams->fflag_handle (¶ms); - -exit (retval); }/*
Signature · 1 line
1.6.2.1
Wolfgang Denk
AppliedPATCH 3/3 tools/mkimage: Print FIT image contents after creation
Dear Peter Tyser,
Quoted 42 lines · In message <[email protected]> you wrote:
Previously, there was no indication to the user that a FIT image was successfully created after executing mkimage. For example:
$ mkimage -f uImage.its uImage.itb DTC: dts->dtb on file "uImage.its"Adding some additional output after creating a FIT image lets the user know exactly what is contained in their image, eg:
$ mkimage -f uImage.its uImage.itb DTC: dts->dtb on file "uImage.its" FIT description: Linux kernel 2.6.32-rc7-00201-g7550d6f-dirty Created: Tue Nov 24 15:43:01 2009 Image 0 (kernel at 1) Description: Linux Kernel 2.6.32-rc7-00201-g7550d6f-dirty Type: Kernel Image Compression: gzip compressed Data Size: 2707311 Bytes = 2643.86 kB = 2.58 MB Architecture: PowerPC OS: Linux Load Address: 0x00000000 Entry Point: 0x00000000 Hash algo: crc32 Hash value: efe0798b Hash algo: sha1 Hash value: ecafba8c95684f2c8fec67e33c41ec88df1534d7 Image 1 (fdt at 1) Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Size: 12288 Bytes = 12.00 kB = 0.01 MB Architecture: PowerPC Hash algo: crc32 Hash value: a5cab676 Hash algo: sha1 Hash value: 168722b13e305283cfd6603dfe8248cc329adea6 Default Configuration: 'config at 1' Configuration 0 (config at 1) Description: Default Linux kernel Kernel: kernel at 1 FDT: fdt at 1
Quoted 8 lines
This brings the behavior of creating a FIT image in line with creating a standard uImage, which also prints out the uImage contents after creation.
Signed-off-by Peter Tyser <[email protected]>--- tools/mkimage.c | 51 ++++++++++++++++++++++++++------------------------- 1 files changed, 26 insertions(+), 25 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Some programming languages manage to absorb change, but withstand progress. -- Epigrams in Programming, ACM SIGPLAN Sept. 1982
PATCH 1/3 tools/mkimage: Assume FDT image type for FIT images
In reply to Peter TyserQuoted 6 lines · Peter Tyser
When building a Flattened Image Tree (FIT) the image type needs to be "
flat_dt". Commit89a4d6b12fd6394898b8a454cbabeaf1cd59bae5introduced a regression which caused the user to need to specify the "-Tflat_dt" parameter on the command line when building a FIT image. The "-Tflat_dt" parameter should not be needed and is at odds with the current FIT image documentation.
I have found that recent commit 6a590c5f5fd12cdd27f3153522acfac3854590e7 has already fix this issue.
Regards,
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
Wolfgang Denk
AppliedPATCH 1/3 tools/mkimage: Assume FDT image type for FIT images
In reply to Peter TyserDear Peter Tyser,
Quoted 7 lines · In message <[email protected]> you wrote:
When building a Flattened Image Tree (FIT) the image type needs to be "
flat_dt". Commit89a4d6b12fd6394898b8a454cbabeaf1cd59bae5introduced a regression which caused the user to need to specify the "-Tflat_dt" parameter on the command line when building a FIT image. The "-Tflat_dt" parameter should not be needed and is at odds with the current FIT image documentation.
Quoted 5 lines
Signed-off-by Peter Tyser <[email protected]>---
Ideally this patch would make it into the upcoming release as its a regression. I don't really care when 2/3 and 3/3 are applied, they aren't really bug fixes.
Not really, but a nice cleanup is as good as a fix :-)
Quoted 2 lines
tools/mkimage.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Never underestimate the power of human stupidity when it comes to using technology they don't understand.
PATCH 1/3 tools/mkimage: Assume FDT image type for FIT images
Quoted 18 lines · Wolfgang Denk
Dear Peter Tyser,
Quoted 7 lines · In message <[email protected]> you wrote:
When building a Flattened Image Tree (FIT) the image type needs to be "
flat_dt". Commit89a4d6b12fd6394898b8a454cbabeaf1cd59bae5introduced a regression which caused the user to need to specify the "-Tflat_dt" parameter on the command line when building a FIT image. The "-Tflat_dt" parameter should not be needed and is at odds with the current FIT image documentation.Quoted 5 lines
Signed-off-by Peter Tyser <[email protected]>---
Ideally this patch would make it into the upcoming release as its a regression. I don't really care when 2/3 and 3/3 are applied, they aren't really bug fixes.Not really, but a nice cleanup is as good as a fix :-)
Quoted 9 lines
Quoted 2 lines
tools/mkimage.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)Applied, thanks.
Best regards,
Wolfgang Denk
Hi Wolfgang,
Thanks for applying patches 2 and 3. Stefano Babic noticed that this change was already submitted by Remy and was merged in 6a590c5f5fd12cdd27f3153522acfac3854590e7, so 1/3 shouldn't be necessary. My fix was nearly identical to Remy's I'm a bit surprised mine would apply cleanly...
Thanks!
Peter
PATCH 1/3 tools/mkimage: Assume FDT image type for FIT images
Dear Peter Tyser,
Quoted 6 lines · In message <[email protected]> you wrote:
Thanks for applying patches 2 and 3. Stefano Babic noticed that this change was already submitted by Remy and was merged in
6a590c5f5fd12cdd27f3153522acfac3854590e7, so 1/3 shouldn't be necessary. My fix was nearly identical to Remy's I'm a bit surprised mine would apply cleanly...
Git seems to be clever :-)
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The human race has one really effective weapon, and that is laughter.
- Mark Twain