All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mkimage : Fix generating multi and script images
@ 2015-12-03 22:11 Philippe De Swert
  2015-12-06 22:08 ` [U-Boot] " Tom Rini
  2015-12-07  4:31 ` [U-Boot] [PATCH] " Simon Glass
  0 siblings, 2 replies; 5+ messages in thread
From: Philippe De Swert @ 2015-12-03 22:11 UTC (permalink / raw)
  To: u-boot

Seems 92a655c3 broke creating multi and script type images.
Since the file1:file2:file3 string does not get split up,
it fails on trying to open an non-existing file. 

mkimage -A arm -O linux -T multi -C none -d zImage:splash.bmp:device.dtb uimage
tools/mkimage: Can't open zImage:splash.bmp:device.dtb: No such file or directory

Since the sizes of the different parts seem to get added in the actual 
routine that handles multi and script type images, we can probably skip the 
bit of the code that causes the failure for that type of images.

Signed-off-by: Philippe De Swert <philippedeswert@gmail.com>
---
 tools/mkimage.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index 8af9d50..ae01cb1 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -311,21 +311,26 @@ NXTARG:		;
 		exit (retval);
 	}
 
-	dfd = open(params.datafile, O_RDONLY | O_BINARY);
-	if (dfd < 0) {
-		fprintf(stderr, "%s: Can't open %s: %s\n",
-			params.cmdname, params.datafile, strerror(errno));
-		exit(EXIT_FAILURE);
-	}
+	if (!params.type == IH_TYPE_MULTI ||
+	    !params.type == IH_TYPE_SCRIPT) {
+		dfd = open(params.datafile, O_RDONLY | O_BINARY);
+		if (dfd < 0) {
+			fprintf(stderr, "%s: Can't open %s: %s\n",
+				params.cmdname, params.datafile,
+				strerror(errno));
+			exit(EXIT_FAILURE);
+		}
 
-	if (fstat(dfd, &sbuf) < 0) {
-		fprintf(stderr, "%s: Can't stat %s: %s\n",
-			params.cmdname, params.datafile, strerror(errno));
-		exit(EXIT_FAILURE);
-	}
+		if (fstat(dfd, &sbuf) < 0) {
+			fprintf(stderr, "%s: Can't stat %s: %s\n",
+				params.cmdname, params.datafile,
+				strerror(errno));
+			exit(EXIT_FAILURE);
+		}
 
-	params.file_size = sbuf.st_size + tparams->header_size;
-	close(dfd);
+		params.file_size = sbuf.st_size + tparams->header_size;
+		close(dfd);
+	}
 
 	/*
 	 * In case there an header with a variable
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] mkimage : Fix generating multi and script images
  2015-12-03 22:11 [U-Boot] [PATCH] mkimage : Fix generating multi and script images Philippe De Swert
@ 2015-12-06 22:08 ` Tom Rini
  2015-12-07  4:31 ` [U-Boot] [PATCH] " Simon Glass
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Rini @ 2015-12-06 22:08 UTC (permalink / raw)
  To: u-boot

On Fri, Dec 04, 2015 at 12:11:23AM +0200, Philippe De Swert wrote:

> Seems 92a655c3 broke creating multi and script type images.
> Since the file1:file2:file3 string does not get split up,
> it fails on trying to open an non-existing file. 
> 
> mkimage -A arm -O linux -T multi -C none -d zImage:splash.bmp:device.dtb uimage
> tools/mkimage: Can't open zImage:splash.bmp:device.dtb: No such file or directory
> 
> Since the sizes of the different parts seem to get added in the actual 
> routine that handles multi and script type images, we can probably skip the 
> bit of the code that causes the failure for that type of images.
> 
> Signed-off-by: Philippe De Swert <philippedeswert@gmail.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151206/de61ef1e/attachment.sig>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] mkimage : Fix generating multi and script images
  2015-12-03 22:11 [U-Boot] [PATCH] mkimage : Fix generating multi and script images Philippe De Swert
  2015-12-06 22:08 ` [U-Boot] " Tom Rini
@ 2015-12-07  4:31 ` Simon Glass
  2015-12-07  9:02   ` Philippe De Swert
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Glass @ 2015-12-07  4:31 UTC (permalink / raw)
  To: u-boot

Hi Philippe,

On 3 December 2015 at 14:11, Philippe De Swert
<philippedeswert@gmail.com> wrote:
> Seems 92a655c3 broke creating multi and script type images.
> Since the file1:file2:file3 string does not get split up,
> it fails on trying to open an non-existing file.
>
> mkimage -A arm -O linux -T multi -C none -d zImage:splash.bmp:device.dtb uimage
> tools/mkimage: Can't open zImage:splash.bmp:device.dtb: No such file or directory
>
> Since the sizes of the different parts seem to get added in the actual
> routine that handles multi and script type images, we can probably skip the
> bit of the code that causes the failure for that type of images.
>
> Signed-off-by: Philippe De Swert <philippedeswert@gmail.com>
> ---
>  tools/mkimage.c | 31 ++++++++++++++++++-------------
>  1 file changed, 18 insertions(+), 13 deletions(-)
>
> diff --git a/tools/mkimage.c b/tools/mkimage.c
> index 8af9d50..ae01cb1 100644
> --- a/tools/mkimage.c
> +++ b/tools/mkimage.c
> @@ -311,21 +311,26 @@ NXTARG:           ;
>                 exit (retval);
>         }
>
> -       dfd = open(params.datafile, O_RDONLY | O_BINARY);
> -       if (dfd < 0) {
> -               fprintf(stderr, "%s: Can't open %s: %s\n",
> -                       params.cmdname, params.datafile, strerror(errno));
> -               exit(EXIT_FAILURE);
> -       }
> +       if (!params.type == IH_TYPE_MULTI ||
> +           !params.type == IH_TYPE_SCRIPT) {

This breaks rockchip image generation. I'm not sure what the above two
lines are supposed to do, but if they are correct they are very
confusing. Can you please take a look? I'll send a revert in the
meantime.

> +               dfd = open(params.datafile, O_RDONLY | O_BINARY);
> +               if (dfd < 0) {
> +                       fprintf(stderr, "%s: Can't open %s: %s\n",
> +                               params.cmdname, params.datafile,
> +                               strerror(errno));
> +                       exit(EXIT_FAILURE);
> +               }
>
> -       if (fstat(dfd, &sbuf) < 0) {
> -               fprintf(stderr, "%s: Can't stat %s: %s\n",
> -                       params.cmdname, params.datafile, strerror(errno));
> -               exit(EXIT_FAILURE);
> -       }
> +               if (fstat(dfd, &sbuf) < 0) {
> +                       fprintf(stderr, "%s: Can't stat %s: %s\n",
> +                               params.cmdname, params.datafile,
> +                               strerror(errno));
> +                       exit(EXIT_FAILURE);
> +               }
>
> -       params.file_size = sbuf.st_size + tparams->header_size;
> -       close(dfd);
> +               params.file_size = sbuf.st_size + tparams->header_size;
> +               close(dfd);
> +       }
>
>         /*
>          * In case there an header with a variable
> --
> 2.1.4

Regards,
Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] mkimage : Fix generating multi and script images
  2015-12-07  4:31 ` [U-Boot] [PATCH] " Simon Glass
@ 2015-12-07  9:02   ` Philippe De Swert
  2015-12-07 13:06     ` Simon Glass
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe De Swert @ 2015-12-07  9:02 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On 07/12/15 06:31, Simon Glass wrote:
>
> -       dfd = open(params.datafile, O_RDONLY | O_BINARY);
> -       if (dfd < 0) {
> -               fprintf(stderr, "%s: Can't open %s: %s\n",
> -                       params.cmdname, params.datafile, strerror(errno));
> -               exit(EXIT_FAILURE);
> -       }
> +       if (!params.type == IH_TYPE_MULTI ||
> +           !params.type == IH_TYPE_SCRIPT) {
> This breaks rockchip image generation. I'm not sure what the above two
> lines are supposed to do, but if they are correct they are very
> confusing. Can you please take a look? I'll send a revert in the
> meantime.

Weird, those lines only do something if  -T multi or -T script. These 
seem have command lines that will
not work at all due to things not being expanded and the open below failing.
I have no idea what the used command line would be for rockchip though, 
so I would need more
info to avoid breaking that with a new patch. Are you btw sure this is 
the commit that breaks it?

>> +               dfd = open(params.datafile, O_RDONLY | O_BINARY);
>> +               if (dfd < 0) {
>> +                       fprintf(stderr, "%s: Can't open %s: %s\n",
>> +                               params.cmdname, params.datafile,
>> +                               strerror(errno));
>> +                       exit(EXIT_FAILURE);
>> +               }
>>
>>

Thanks,

Philippe

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] mkimage : Fix generating multi and script images
  2015-12-07  9:02   ` Philippe De Swert
@ 2015-12-07 13:06     ` Simon Glass
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2015-12-07 13:06 UTC (permalink / raw)
  To: u-boot

Hi Philippe,

On 7 December 2015 at 01:02, Philippe De Swert
<philippedeswert@gmail.com> wrote:
> Hi Simon,
>
> On 07/12/15 06:31, Simon Glass wrote:
>
>
> -       dfd = open(params.datafile, O_RDONLY | O_BINARY);
> -       if (dfd < 0) {
> -               fprintf(stderr, "%s: Can't open %s: %s\n",
> -                       params.cmdname, params.datafile, strerror(errno));
> -               exit(EXIT_FAILURE);
> -       }
> +       if (!params.type == IH_TYPE_MULTI ||
> +           !params.type == IH_TYPE_SCRIPT) {
>
> This breaks rockchip image generation. I'm not sure what the above two
> lines are supposed to do, but if they are correct they are very
> confusing. Can you please take a look? I'll send a revert in the
> meantime.
>
>
> Weird, those lines only do something if  -T multi or -T script. These seem
> have command lines that will
> not work at all due to things not being expanded and the open below failing.
> I have no idea what the used command line would be for rockchip though, so I
> would need more
> info to avoid breaking that with a new patch. Are you btw sure this is the
> commit that breaks it?

Not as written they don't. Do you mean this:

if (params.type != IH_TYPE_MULTI && params.type != IH_TYPE_SCRIPT)

or should the ! have brackets after it?

You can build firefly-rk3288 and then run the mkimage command under
'Booting from an SD card' in README.rockchip:

./firefly-rk3288/tools/mkimage -T rksd -d \
firefly-rk3288/spl/u-boot-spl-dtb.bin out

assuming you built it with O=firefly-rk3288

>
> +               dfd = open(params.datafile, O_RDONLY | O_BINARY);
> +               if (dfd < 0) {
> +                       fprintf(stderr, "%s: Can't open %s: %s\n",
> +                               params.cmdname, params.datafile,
> +                               strerror(errno));
> +                       exit(EXIT_FAILURE);
> +               }

Regards,
Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-07 13:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-03 22:11 [U-Boot] [PATCH] mkimage : Fix generating multi and script images Philippe De Swert
2015-12-06 22:08 ` [U-Boot] " Tom Rini
2015-12-07  4:31 ` [U-Boot] [PATCH] " Simon Glass
2015-12-07  9:02   ` Philippe De Swert
2015-12-07 13:06     ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.