* [PATCH v2] scripts: kwbimage: fix imagebuild on 32bit host system
@ 2014-01-26 17:12 Michael Grzeschik
2014-01-26 17:51 ` Sebastian Hesselbarth
2014-01-27 8:13 ` Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Michael Grzeschik @ 2014-01-26 17:12 UTC (permalink / raw)
To: barebox
We have to use strtoul to run the tool working on 32bit systems.
Otherwise it will generate signed numbers for strings representing
values with the 32nd bit set.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
scripts/kwbimage.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index 82cf21c..cd87456 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -1024,20 +1024,20 @@ static int image_create_config_parse_oneline(char *line,
} else if (!strcmp(keyword, "DESTADDR")) {
char *value = strtok_r(NULL, " ", &saveptr);
el->type = IMAGE_CFG_DEST_ADDR;
- el->dstaddr = strtol(value, NULL, 16);
+ el->dstaddr = strtoul(value, NULL, 16);
} else if (!strcmp(keyword, "EXECADDR")) {
char *value = strtok_r(NULL, " ", &saveptr);
el->type = IMAGE_CFG_EXEC_ADDR;
- el->execaddr = strtol(value, NULL, 16);
+ el->execaddr = strtoul(value, NULL, 16);
} else if (!strcmp(keyword, "NAND_BLKSZ")) {
char *value = strtok_r(NULL, " ", &saveptr);
el->type = IMAGE_CFG_NAND_BLKSZ;
- el->nandblksz = strtol(value, NULL, 16);
+ el->nandblksz = strtoul(value, NULL, 16);
} else if (!strcmp(keyword, "NAND_BADBLK_LOCATION")) {
char *value = strtok_r(NULL, " ", &saveptr);
el->type = IMAGE_CFG_NAND_BADBLK_LOCATION;
el->nandbadblklocation =
- strtol(value, NULL, 16);
+ strtoul(value, NULL, 16);
} else if (!strcmp(keyword, "NAND_ECCMODE")) {
char *value = strtok_r(NULL, " ", &saveptr);
el->type = IMAGE_CFG_NAND_ECC_MODE;
@@ -1050,7 +1050,7 @@ static int image_create_config_parse_oneline(char *line,
} else if (!strcmp(keyword, "NAND_PAGESZ")) {
char *value = strtok_r(NULL, " ", &saveptr);
el->type = IMAGE_CFG_NAND_PAGESZ;
- el->nandpagesz = strtol(value, NULL, 16);
+ el->nandpagesz = strtoul(value, NULL, 16);
} else if (!strcmp(keyword, "BINARY")) {
char *value = strtok_r(NULL, " ", &saveptr);
int argi = 0;
@@ -1061,7 +1061,7 @@ static int image_create_config_parse_oneline(char *line,
value = strtok_r(NULL, " ", &saveptr);
if (!value)
break;
- el->binary.args[argi] = strtol(value, NULL, 16);
+ el->binary.args[argi] = strtoul(value, NULL, 16);
argi++;
if (argi >= BINARY_MAX_ARGS) {
fprintf(stderr,
@@ -1080,8 +1080,8 @@ static int image_create_config_parse_oneline(char *line,
}
el->type = IMAGE_CFG_DATA;
- el->regdata.raddr = strtol(value1, NULL, 16);
- el->regdata.rdata = strtol(value2, NULL, 16);
+ el->regdata.raddr = strtoul(value1, NULL, 16);
+ el->regdata.rdata = strtoul(value2, NULL, 16);
} else if (!strcmp(keyword, "PAYLOAD")) {
char *value = strtok_r(NULL, " ", &saveptr);
el->type = IMAGE_CFG_PAYLOAD;
--
1.8.5.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] scripts: kwbimage: fix imagebuild on 32bit host system
2014-01-26 17:12 [PATCH v2] scripts: kwbimage: fix imagebuild on 32bit host system Michael Grzeschik
@ 2014-01-26 17:51 ` Sebastian Hesselbarth
2014-01-27 8:13 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Hesselbarth @ 2014-01-26 17:51 UTC (permalink / raw)
To: Michael Grzeschik, barebox
On 01/26/2014 06:12 PM, Michael Grzeschik wrote:
> We have to use strtoul to run the tool working on 32bit systems.
> Otherwise it will generate signed numbers for strings representing
> values with the 32nd bit set.
>
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Great catch,
Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] scripts: kwbimage: fix imagebuild on 32bit host system
2014-01-26 17:12 [PATCH v2] scripts: kwbimage: fix imagebuild on 32bit host system Michael Grzeschik
2014-01-26 17:51 ` Sebastian Hesselbarth
@ 2014-01-27 8:13 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2014-01-27 8:13 UTC (permalink / raw)
To: Michael Grzeschik; +Cc: barebox
On Sun, Jan 26, 2014 at 06:12:21PM +0100, Michael Grzeschik wrote:
> We have to use strtoul to run the tool working on 32bit systems.
> Otherwise it will generate signed numbers for strings representing
> values with the 32nd bit set.
>
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Applied, thanks
Sascha
> ---
> scripts/kwbimage.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
> index 82cf21c..cd87456 100644
> --- a/scripts/kwbimage.c
> +++ b/scripts/kwbimage.c
> @@ -1024,20 +1024,20 @@ static int image_create_config_parse_oneline(char *line,
> } else if (!strcmp(keyword, "DESTADDR")) {
> char *value = strtok_r(NULL, " ", &saveptr);
> el->type = IMAGE_CFG_DEST_ADDR;
> - el->dstaddr = strtol(value, NULL, 16);
> + el->dstaddr = strtoul(value, NULL, 16);
> } else if (!strcmp(keyword, "EXECADDR")) {
> char *value = strtok_r(NULL, " ", &saveptr);
> el->type = IMAGE_CFG_EXEC_ADDR;
> - el->execaddr = strtol(value, NULL, 16);
> + el->execaddr = strtoul(value, NULL, 16);
> } else if (!strcmp(keyword, "NAND_BLKSZ")) {
> char *value = strtok_r(NULL, " ", &saveptr);
> el->type = IMAGE_CFG_NAND_BLKSZ;
> - el->nandblksz = strtol(value, NULL, 16);
> + el->nandblksz = strtoul(value, NULL, 16);
> } else if (!strcmp(keyword, "NAND_BADBLK_LOCATION")) {
> char *value = strtok_r(NULL, " ", &saveptr);
> el->type = IMAGE_CFG_NAND_BADBLK_LOCATION;
> el->nandbadblklocation =
> - strtol(value, NULL, 16);
> + strtoul(value, NULL, 16);
> } else if (!strcmp(keyword, "NAND_ECCMODE")) {
> char *value = strtok_r(NULL, " ", &saveptr);
> el->type = IMAGE_CFG_NAND_ECC_MODE;
> @@ -1050,7 +1050,7 @@ static int image_create_config_parse_oneline(char *line,
> } else if (!strcmp(keyword, "NAND_PAGESZ")) {
> char *value = strtok_r(NULL, " ", &saveptr);
> el->type = IMAGE_CFG_NAND_PAGESZ;
> - el->nandpagesz = strtol(value, NULL, 16);
> + el->nandpagesz = strtoul(value, NULL, 16);
> } else if (!strcmp(keyword, "BINARY")) {
> char *value = strtok_r(NULL, " ", &saveptr);
> int argi = 0;
> @@ -1061,7 +1061,7 @@ static int image_create_config_parse_oneline(char *line,
> value = strtok_r(NULL, " ", &saveptr);
> if (!value)
> break;
> - el->binary.args[argi] = strtol(value, NULL, 16);
> + el->binary.args[argi] = strtoul(value, NULL, 16);
> argi++;
> if (argi >= BINARY_MAX_ARGS) {
> fprintf(stderr,
> @@ -1080,8 +1080,8 @@ static int image_create_config_parse_oneline(char *line,
> }
>
> el->type = IMAGE_CFG_DATA;
> - el->regdata.raddr = strtol(value1, NULL, 16);
> - el->regdata.rdata = strtol(value2, NULL, 16);
> + el->regdata.raddr = strtoul(value1, NULL, 16);
> + el->regdata.rdata = strtoul(value2, NULL, 16);
> } else if (!strcmp(keyword, "PAYLOAD")) {
> char *value = strtok_r(NULL, " ", &saveptr);
> el->type = IMAGE_CFG_PAYLOAD;
> --
> 1.8.5.2
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-27 8:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-26 17:12 [PATCH v2] scripts: kwbimage: fix imagebuild on 32bit host system Michael Grzeschik
2014-01-26 17:51 ` Sebastian Hesselbarth
2014-01-27 8:13 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox