summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChe-Liang Chiou <clchiou@chromium.org>2011-07-29 15:44:16 +0800
committerSimon Glass <sjg@chromium.org>2011-08-29 10:59:21 -0700
commit744345a6dcf4864d86a20f26993234b02ab0d30c (patch)
treea0ec2fabdfaa52b3a83f87eaa2c9d75918d7c0d4
parent5dad067ac97e48cfccb2306e0ec69156b167f10a (diff)
CHROMIUM: avoid using printf %s on long strings
The U-Boot printf() implementation has an output buffer limitation on output, and so cannot be used for very long output. Instead, puts() has no such limitation. BUG=chromium-os:18351 TEST=run on Aebl Change-Id: I3f3e3b81968f5169a2fe1f581924fa19c3dc1a43 Reviewed-on: http://gerrit.chromium.org/gerrit/4990 Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org>
-rw-r--r--include/chromeos/common.h11
-rw-r--r--lib/chromeos/boot_kernel.c8
2 files changed, 17 insertions, 2 deletions
diff --git a/include/chromeos/common.h b/include/chromeos/common.h
index 95924b0c9b..5c02c717e5 100644
--- a/include/chromeos/common.h
+++ b/include/chromeos/common.h
@@ -20,6 +20,17 @@
#define VBDEBUG(fmt, args...)
#endif
+/*
+ * VBDEBUG(), which indirectly calls printf(), has an internal buffer on output
+ * string, and so cannot output very long string. Thus, if you want to print a
+ * very long string, please use VBDEBUG_PUTS(), which calls puts().
+ */
+#if defined VBOOT_DEBUG || defined DEBUG
+#define VBDEBUG_PUTS(str) puts(str)
+#else
+#define VBDEBUG_PUTS(str)
+#endif
+
/* this function is implemented along with vboot_api */
int display_clear(void);
diff --git a/lib/chromeos/boot_kernel.c b/lib/chromeos/boot_kernel.c
index 8eebf3fbc7..a296c4ccd3 100644
--- a/lib/chromeos/boot_kernel.c
+++ b/lib/chromeos/boot_kernel.c
@@ -234,7 +234,9 @@ int boot_kernel(VbSelectAndLoadKernelParams *kparams, crossystem_data_t *cdata)
*/
strncat(cmdline_buf, cmdline, CROS_CONFIG_SIZE);
- VBDEBUG(PREFIX "cmdline before update: %s\n", cmdline_buf);
+ VBDEBUG(PREFIX "cmdline before update: ");
+ VBDEBUG_PUTS(cmdline_buf);
+ VBDEBUG_PUTS("\n");
if (update_cmdline(cmdline_buf,
get_dev_num(kparams->disk_handle),
@@ -246,7 +248,9 @@ int boot_kernel(VbSelectAndLoadKernelParams *kparams, crossystem_data_t *cdata)
}
setenv("bootargs", cmdline_out);
- VBDEBUG(PREFIX "cmdline after update: %s\n", getenv("bootargs"));
+ VBDEBUG(PREFIX "cmdline after update: ");
+ VBDEBUG_PUTS(getenv("bootargs"));
+ VBDEBUG_PUTS("\n");
g_crossystem_data = cdata;