Skip to contentSkip to conversation

tools: plbimage support generate rcw file

PATCH New yuan linyu 4 participants 6 messages Feb 26, 2017 – Mar 28, 2017

lore
Share & tools
lore

yuan linyu

author
#0 lore raw

PATCH v2 1/1 tools: plbimage support generate rcw file

From: yuan linyu <[email protected]>

some system will not generate pbl format u-boot, but require rcw.

---
 tools/pblimage.c | 48 +++++++++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 21 deletions(-)
tools/pblimage.c +27 -21
index 16d94c98c6..30055a9463 100644
@@ -194,17 +194,20 @@ void pbl_load_uboot(int ifd, struct image_tool_params *params)
 	pbl_parser(params->imagename);
 
 	/* parse the pbi.cfg file. */
-	pbl_parser(params->imagename2);
+	if (params->imagename2[0] != '\0')
+		pbl_parser(params->imagename2);
+
+	if (params->datafile) {
+		fp_uboot = fopen(params->datafile, "r");
+		if (fp_uboot == NULL) {
+			printf("Error: %s open failed\n", params->datafile);
+			exit(EXIT_FAILURE);
+		}
 
-	fp_uboot = fopen(params->datafile, "r");
-	if (fp_uboot == NULL) {
-		printf("Error: %s open failed\n", params->datafile);
-		exit(EXIT_FAILURE);
+		load_uboot(fp_uboot);
+		fclose(fp_uboot);
 	}
-
-	load_uboot(fp_uboot);
 	add_end_cmd();
-	fclose(fp_uboot);
 	lseek(ifd, 0, SEEK_SET);
 
 	size = pbl_size;
@@ -265,21 +268,24 @@ int pblimage_check_params(struct image_tool_params *params)
 	if (!params)
 		return EXIT_FAILURE;
 
-	fp_uboot = fopen(params->datafile, "r");
-	if (fp_uboot == NULL) {
-		printf("Error: %s open failed\n", params->datafile);
-		exit(EXIT_FAILURE);
-	}
-	fd = fileno(fp_uboot);
+	if (params->datafile) {
+		fp_uboot = fopen(params->datafile, "r");
+		if (fp_uboot == NULL) {
+			printf("Error: %s open failed\n", params->datafile);
+			exit(EXIT_FAILURE);
+		}
+		fd = fileno(fp_uboot);
 
-	if (fstat(fd, &st) == -1) {
-		printf("Error: Could not determine u-boot image size. %s\n",
-		       strerror(errno));
-		exit(EXIT_FAILURE);
-	}
+		if (fstat(fd, &st) == -1) {
+			printf("Error: Could not determine u-boot image size. %s\n",
+				   strerror(errno));
+			exit(EXIT_FAILURE);
+		}
 
-	/* For the variable size, we need to pad it to 64 byte boundary */
-	uboot_size = roundup(st.st_size, 64);
+		/* For the variable size, we need to pad it to 64 byte boundary */
+		uboot_size = roundup(st.st_size, 64);
+		fclose(fp_uboot);
+	}
 
 	if (params->arch == IH_ARCH_ARM) {
 		arch_flag = IH_ARCH_ARM;
Signature · 1 line
2.11.1
#1 lore raw

PATCH v2 1/1 tools: plbimage support generate rcw file

Quoted 9 lines · yuan linyu

From: yuan linyu <[email protected]>

some system will not generate pbl format u-boot, but require rcw.

---
 tools/pblimage.c | 48 +++++++++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 21 deletions(-)

Alison,

This patch looks OK to me. Would you confirm?

York

#2 lore raw

PATCH v2 1/1 tools: plbimage support generate rcw file

Quoted 8 lines · yuan linyu
Quoted 7 lines

From: yuan linyu <[email protected]>

some system will not generate pbl format u-boot, but require rcw.

---
 tools/pblimage.c | 48 +++++++++++++++++++++++++++-------------------
Quoted 8 lines

--

Quoted 2 lines
 1 file changed, 27 insertions(+), 21 deletions(-)

Alison,

This patch looks OK to me. Would you confirm?

[Alison Wang] This patch looks OK to me too.

Best Regards,
Alison Wang

#3 lore raw

PATCH v2 1/1 tools: plbimage support generate rcw file

In reply to yuan linyu
Quoted 13 lines · yuan linyu

From: yuan linyu <[email protected]>

some system will not generate pbl format u-boot, but require rcw.

---
 tools/pblimage.c | 48 +++++++++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 21 deletions(-)
tools/pblimage.c +0 -0
index 16d94c98c6..30055a9463 100644

<snip>

tools/pblimage.c int pblimage_check_params(struct image_tool_params *params) · line 281

Quoted 5 lines
tools/pblimage.c +3 -2
-		exit(EXIT_FAILURE);
-	}
+		if (fstat(fd, &st) == -1) {
+			printf("Error: Could not determine u-boot image size. %s\n",
+				   strerror(errno));

Alignment mismatch.

tools/pblimage.c int pblimage_check_params(struct image_tool_params *params) · line 285

Quoted 6 lines
tools/pblimage.c +3 -2
+			exit(EXIT_FAILURE);
+		}
 
-	/* For the variable size, we need to pad it to 64 byte boundary */
-	uboot_size = roundup(st.st_size, 64);
+		/* For the variable size, we need to pad it to 64 byte boundary */

Line too long.

tools/pblimage.c int pblimage_check_params(struct image_tool_params *params) · line 291

Quoted 7 lines
tools/pblimage.c +3 -0
+		uboot_size = roundup(st.st_size, 64);
+		fclose(fp_uboot);
+	}
 
 	if (params->arch == IH_ARCH_ARM) {
 		arch_flag = IH_ARCH_ARM;

Only minor cosmetic issues. I will fix them for you this time if no issue found during further testing.

York

#4 lore raw

PATCH v2 1/1 tools: plbimage support generate rcw file

Quoted 10 lines

-----Original Message-----
From: york sun [mailto:york.sun at nxp.com]
Sent: Monday, March 27, 2017 2:44 AM
To: yuan linyu; u-boot at lists.denx.de
Cc: YUAN Linyu
Subject: Re: [PATCHV2] tools: plbimage support generate rcw file

Quoted 3 lines

Only minor cosmetic issues. I will fix them for you this time if no issue found during further testing.

thanks.

Quoted 1 line

York