[U-Boot] [PATCH] tools: imx8image: return SUCCESS when the required files not found

Peng Fan peng.fan at nxp.com
Wed Oct 24 05:09:18 UTC 2018


When the required files to build a bootable imx8 image are not
found, return EXIT_SUCCESS to avoid build CI system.
And if the files are missing, give a error message during the build.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 tools/imx8image.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/imx8image.c b/tools/imx8image.c
index e6b0a146b6..35409646f5 100644
--- a/tools/imx8image.c
+++ b/tools/imx8image.c
@@ -279,9 +279,9 @@ static void check_file(struct stat *sbuf, char *filename)
 	int tmp_fd  = open(filename, O_RDONLY | O_BINARY);
 
 	if (tmp_fd < 0) {
-		fprintf(stderr, "%s: Can't open: %s\n",
+		fprintf(stderr, "*** %s: Can't open: %s ***\n",
 			filename, strerror(errno));
-		exit(EXIT_FAILURE);
+		exit(EXIT_SUCCESS);
 	}
 
 	if (fstat(tmp_fd, sbuf) < 0) {
@@ -311,9 +311,9 @@ static void copy_file_aligned(int ifd, const char *datafile, int offset,
 
 	dfd = open(datafile, O_RDONLY | O_BINARY);
 	if (dfd < 0) {
-		fprintf(stderr, "Can't open %s: %s\n",
+		fprintf(stderr, "*** Can't open %s: %s ***\n",
 			datafile, strerror(errno));
-		exit(EXIT_FAILURE);
+		exit(EXIT_SUCCESS);
 	}
 
 	if (fstat(dfd, &sbuf) < 0) {
@@ -365,9 +365,9 @@ static void copy_file (int ifd, const char *datafile, int pad, int offset)
 
 	dfd = open(datafile, O_RDONLY | O_BINARY);
 	if (dfd < 0) {
-		fprintf(stderr, "Can't open %s: %s\n",
+		fprintf(stderr, "*** Can't open %s: %s ***\n",
 			datafile, strerror(errno));
-		exit(EXIT_FAILURE);
+		exit(EXIT_SUCCESS);
 	}
 
 	if (fstat(dfd, &sbuf) < 0) {
@@ -648,8 +648,8 @@ static int get_container_image_start_pos(image_t *image_stack, uint32_t align)
 		if (img_sp->option == APPEND) {
 			fd = fopen(img_sp->filename, "r");
 			if (!fd) {
-				fprintf(stderr, "Fail open first container file %s\n", img_sp->filename);
-				exit(EXIT_FAILURE);
+				fprintf(stderr, "*** Fail open first container file %s ***\n", img_sp->filename);
+				exit(EXIT_SUCCESS);
 			}
 
 			ret = fread(&header, sizeof(header), 1, fd);
-- 
2.14.1



More information about the U-Boot mailing list