Skip to contentSkip to conversation

Improve error messages, more informative.

PATCH In review Jerry Van Baren 2 participants 2 messages Jul 5, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 2/17 Improve error messages, more informative.

Print more than the raw libfdt error message strings. This is especially useful for cluing in the user when the bootm command aborts due to blob problems.

---
 common/fdt_support.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)
common/fdt_support.c +14 -13
index 69099c4..bcdc415 100644
@@ -67,7 +67,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 			return err;
 		}
 		if (used >= total) {
-			printf("fdt_chosen: no room in the reserved map (%d of %d)\n",
+			printf("WARNING fdt_chosen: no room in the reserved map (%d of %d)\n",
 				used, total);
 			return -1;
 		}
@@ -110,7 +110,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 		 */
 		nodeoffset = fdt_add_subnode(fdt, 0, "chosen");
 		if (nodeoffset < 0) {
-			printf("libfdt: %s\n", fdt_strerror(nodeoffset));
+			printf("WARNING fdt_chosen: could not create the \"/chosen node\" (libfdt error %s).\n", fdt_strerror(nodeoffset));
 			return nodeoffset;
 		}
 	}
@@ -122,22 +122,22 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 	if (str != NULL) {
 		err = fdt_setprop(fdt, nodeoffset, "bootargs", str, strlen(str)+1);
 		if (err < 0)
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("WARNING fdt_chosen: could not set \"bootargs\" (libfdt error %s).\n", fdt_strerror(err));
 	}
 	if (initrd_start && initrd_end) {
 		tmp = __cpu_to_be32(initrd_start);
 		err = fdt_setprop(fdt, nodeoffset, "linux,initrd-start", &tmp, sizeof(tmp));
 		if (err < 0)
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("WARNING fdt_chosen: could not set \"linux,initrd-start\" (libfdt error %s).\n", fdt_strerror(err));
 		tmp = __cpu_to_be32(initrd_end);
 		err = fdt_setprop(fdt, nodeoffset, "linux,initrd-end", &tmp, sizeof(tmp));
 		if (err < 0)
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("WARNING fdt_chosen: could not set \"linux,initrd-end\" (libfdt error %s).\n", fdt_strerror(err));
 	}
 #ifdef OF_STDOUT_PATH
 	err = fdt_setprop(fdt, nodeoffset, "linux,stdout-path", OF_STDOUT_PATH, strlen(OF_STDOUT_PATH)+1);
 	if (err < 0)
-		printf("libfdt: %s\n", fdt_strerror(err));
+		printf("WARNING fdt_chosen: could not set \"linux,stdout-path\" (libfdt error %s).\n", fdt_strerror(err));
 #endif
 
 	nodeoffset = fdt_path_offset (fdt, "/cpus");
@@ -145,7 +145,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 		clock = cpu_to_be32(bd->bi_intfreq);
 		err = fdt_setprop(fdt, nodeoffset, "clock-frequency", &clock, 4);
 		if (err < 0)
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("WARNING fdt_chosen: could not set \"clock-frequency\" (libfdt error %s).\n", fdt_strerror(err));
 	}
 #ifdef OF_TBCLK
 	nodeoffset = fdt_path_offset (fdt, "/cpus/" OF_CPU "/timebase-frequency");
@@ -153,7 +153,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 		clock = cpu_to_be32(OF_TBCLK);
 		err = fdt_setprop(fdt, nodeoffset, "clock-frequency", &clock, 4);
 		if (err < 0)
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("WARNING fdt_chosen: could not set \"clock-frequency\" (libfdt error %s).\n", fdt_strerror(err));
 	}
 #endif
 	return err;
@@ -198,7 +198,7 @@ int fdt_env(void *fdt)
 	 */
 	nodeoffset = fdt_add_subnode(fdt, 0, "u-boot-env");
 	if (nodeoffset < 0) {
-		printf("libfdt: %s\n", fdt_strerror(nodeoffset));
+		printf("WARNING fdt_env: could not create the \"/u-boot-env node\" (libfdt error %s).\n", fdt_strerror(nodeoffset));
 		return nodeoffset;
 	}
 
@@ -226,7 +226,7 @@ int fdt_env(void *fdt)
 			continue;
 		err = fdt_setprop(fdt, nodeoffset, lval, rval, strlen(rval)+1);
 		if (err < 0) {
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("WARNING fdt_env: could not set \"%s\" (libfdt error %s).\n", lval, fdt_strerror(err));
 			return err;
 		}
 	}
@@ -318,6 +318,7 @@ int fdt_bd_t(void *fdt)
 	 */
 	nodeoffset = fdt_add_subnode(fdt, 0, "bd_t");
 	if (nodeoffset < 0) {
+		printf("WARNING fdt_bd_t: could not create the \"/bd_t node\" (libfdt error %s).\n", fdt_strerror(nodeoffset));
 		printf("libfdt: %s\n", fdt_strerror(nodeoffset));
 		return nodeoffset;
 	}
@@ -328,17 +329,17 @@ int fdt_bd_t(void *fdt)
 		tmp = cpu_to_be32(getenv("bootargs"));
 		err = fdt_setprop(fdt, nodeoffset, bd_map[i].name, &tmp, sizeof(tmp));
 		if (err < 0)
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("WARNING fdt_bd_t: could not set \"%s\" (libfdt error %s).\n", bd_map[i].name, fdt_strerror(err));
 	}
 	/*
 	 * Add a couple of oddball entries...
 	 */
 	err = fdt_setprop(fdt, nodeoffset, "enetaddr", &bd->bi_enetaddr, 6);
 	if (err < 0)
-		printf("libfdt: %s\n", fdt_strerror(err));
+		printf("WARNING fdt_bd_t: could not set \"enetaddr\" (libfdt error %s).\n", fdt_strerror(err));
 	err = fdt_setprop(fdt, nodeoffset, "ethspeed", &bd->bi_ethspeed, 4);
 	if (err < 0)
-		printf("libfdt: %s\n", fdt_strerror(err));
+		printf("WARNING fdt_bd_t: could not set \"ethspeed\" (libfdt error %s).\n", fdt_strerror(err));
 
 	return 0;
 }
Signature · 1 line
1.4.4.4
#1 lore raw

PATCH 2/17 Improve error messages, more informative.

Quoted 5 lines · Jerry Van Baren

Print more than the raw libfdt error message strings. This is especially useful for cluing in the user when the bootm command aborts due to blob problems.

Quoted 132 lines
---
 common/fdt_support.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)
common/fdt_support.c +14 -14
index 69099c4..bcdc415 100644
@@ -67,7 +67,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
                        return err;
                }
                if (used >= total) {
-                       printf("fdt_chosen: no room in the reserved map (%d of %d)\n",
+                       printf("WARNING fdt_chosen: no room in the reserved map (%d of %d)\n",
                                used, total);
                        return -1;
                }
@@ -110,7 +110,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
                 */
                nodeoffset = fdt_add_subnode(fdt, 0, "chosen");
                if (nodeoffset < 0) {
-                       printf("libfdt: %s\n", fdt_strerror(nodeoffset));
+                       printf("WARNING fdt_chosen: could not create the \"/chosen node\" (libfdt error %s).\n", fdt_strerror(nodeoffset));
                        return nodeoffset;
                }
        }
@@ -122,22 +122,22 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
        if (str != NULL) {
                err = fdt_setprop(fdt, nodeoffset, "bootargs", str, strlen(str)+1);
                if (err < 0)
-                       printf("libfdt: %s\n", fdt_strerror(err));
+                       printf("WARNING fdt_chosen: could not set \"bootargs\" (libfdt error %s).\n", fdt_strerror(err));
        }
        if (initrd_start && initrd_end) {
                tmp = __cpu_to_be32(initrd_start);
                err = fdt_setprop(fdt, nodeoffset, "linux,initrd-start", &tmp, sizeof(tmp));
                if (err < 0)
-                       printf("libfdt: %s\n", fdt_strerror(err));
+                       printf("WARNING fdt_chosen: could not set \"linux,initrd-start\" (libfdt error %s).\n", fdt_strerror(err));
                tmp = __cpu_to_be32(initrd_end);
                err = fdt_setprop(fdt, nodeoffset, "linux,initrd-end", &tmp, sizeof(tmp));
                if (err < 0)
-                       printf("libfdt: %s\n", fdt_strerror(err));
+                       printf("WARNING fdt_chosen: could not set \"linux,initrd-end\" (libfdt error %s).\n", fdt_strerror(err));
        }
 #ifdef OF_STDOUT_PATH
        err = fdt_setprop(fdt, nodeoffset, "linux,stdout-path", OF_STDOUT_PATH, strlen(OF_STDOUT_PATH)+1);
        if (err < 0)
-               printf("libfdt: %s\n", fdt_strerror(err));
+               printf("WARNING fdt_chosen: could not set \"linux,stdout-path\" (libfdt error %s).\n", fdt_strerror(err));
 #endif
 
        nodeoffset = fdt_path_offset (fdt, "/cpus");
@@ -145,7 +145,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
                clock = cpu_to_be32(bd->bi_intfreq);
                err = fdt_setprop(fdt, nodeoffset, "clock-frequency", &clock, 4);
                if (err < 0)
-                       printf("libfdt: %s\n", fdt_strerror(err));
+                       printf("WARNING fdt_chosen: could not set \"clock-frequency\" (libfdt error %s).\n", fdt_strerror(err));
        }
 #ifdef OF_TBCLK
        nodeoffset = fdt_path_offset (fdt, "/cpus/" OF_CPU "/timebase-frequency");
@@ -153,7 +153,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
                clock = cpu_to_be32(OF_TBCLK);
                err = fdt_setprop(fdt, nodeoffset, "clock-frequency", &clock, 4);
                if (err < 0)
-                       printf("libfdt: %s\n", fdt_strerror(err));
+                       printf("WARNING fdt_chosen: could not set \"clock-frequency\" (libfdt error %s).\n", fdt_strerror(err));
        }
 #endif
        return err;
@@ -198,7 +198,7 @@ int fdt_env(void *fdt)
         */
        nodeoffset = fdt_add_subnode(fdt, 0, "u-boot-env");
        if (nodeoffset < 0) {
-               printf("libfdt: %s\n", fdt_strerror(nodeoffset));
+               printf("WARNING fdt_env: could not create the \"/u-boot-env node\" (libfdt error %s).\n", fdt_strerror(nodeoffset));
                return nodeoffset;
        }
 
@@ -226,7 +226,7 @@ int fdt_env(void *fdt)
                        continue;
                err = fdt_setprop(fdt, nodeoffset, lval, rval, strlen(rval)+1);
                if (err < 0) {
-                       printf("libfdt: %s\n", fdt_strerror(err));
+                       printf("WARNING fdt_env: could not set \"%s\" (libfdt error %s).\n", lval, fdt_strerror(err));
                        return err;
                }
        }
@@ -318,6 +318,7 @@ int fdt_bd_t(void *fdt)
         */
        nodeoffset = fdt_add_subnode(fdt, 0, "bd_t");
        if (nodeoffset < 0) {
+               printf("WARNING fdt_bd_t: could not create the \"/bd_t node\" (libfdt error %s).\n", fdt_strerror(nodeoffset));
                printf("libfdt: %s\n", fdt_strerror(nodeoffset));
                return nodeoffset;
        }
@@ -328,17 +329,17 @@ int fdt_bd_t(void *fdt)
                tmp = cpu_to_be32(getenv("bootargs"));
                err = fdt_setprop(fdt, nodeoffset, bd_map[i].name, &tmp, sizeof(tmp));
                if (err < 0)
-                       printf("libfdt: %s\n", fdt_strerror(err));
+                       printf("WARNING fdt_bd_t: could not set \"%s\" (libfdt error %s).\n", bd_map[i].name, fdt_strerror(err));
        }
        /*
         * Add a couple of oddball entries...
         */
        err = fdt_setprop(fdt, nodeoffset, "enetaddr", &bd->bi_enetaddr, 6);
        if (err < 0)
-               printf("libfdt: %s\n", fdt_strerror(err));
+               printf("WARNING fdt_bd_t: could not set \"enetaddr\" (libfdt error %s).\n", fdt_strerror(err));
        err = fdt_setprop(fdt, nodeoffset, "ethspeed", &bd->bi_ethspeed, 4);
        if (err < 0)
-               printf("libfdt: %s\n", fdt_strerror(err));
+               printf("WARNING fdt_bd_t: could not set \"ethspeed\" (libfdt error %s).\n", fdt_strerror(err));
 
        return 0;
 }
--

1.4.4.4

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Signature · 4 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely at secretlab.ca
(403) 399-0195