Signed-off-by: Andy Green <[EMAIL PROTECTED]>
---

 include/qi.h |    1 +
 src/phase2.c |    7 ++++---
 src/utils.c  |   21 +++++++++++++++++++++
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/include/qi.h b/include/qi.h
index 17fafe7..ea0382b 100644
--- a/include/qi.h
+++ b/include/qi.h
@@ -82,6 +82,7 @@ int puts(const char *string);
 void printhex(unsigned char v);
 void print8(unsigned char u);
 void print32(unsigned int u);
+void printdec(int n);
 void hexdump(unsigned char *start, int len);
 unsigned int _ntohl(unsigned int n);
 unsigned long crc32(unsigned long crc, const unsigned char *buf,
diff --git a/src/phase2.c b/src/phase2.c
index 826e90e..b2ad6a9 100644
--- a/src/phase2.c
+++ b/src/phase2.c
@@ -93,8 +93,9 @@ void bootloader_second_phase(void)
 
                        puts("        Found: ");
                        puts((const char *)hdr->ih_name);
-                       puts("\n         Size: 0x");
-                       print32(_ntohl(hdr->ih_size));
+                       puts("\n         Size: ");
+                       printdec(_ntohl(hdr->ih_size) >> 10);
+                       puts(" KiB\n");
 
                        if (nand_read_ll(kernel_dram,
                                this_board->kernel_source[kernel].
@@ -107,7 +108,7 @@ void bootloader_second_phase(void)
                        }
                }
 
-               puts("\n      Cmdline: ");
+               puts("      Cmdline: ");
                puts(p);
                puts("\n");
 
diff --git a/src/utils.c b/src/utils.c
index 5f183bc..11b1675 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -102,6 +102,27 @@ void hexdump(unsigned char *start, int len)
        }
 }
 
+void printdec(int n)
+{
+       int d = 1 * 1000 * 1000 * 1000;
+       int flag = 0;
+
+       if (n < 0) {
+               this_board->putc('-');
+               n = -n;
+       }
+
+       while (d) {
+               int r = n / d;
+               if (r || flag || (d == 1)) {
+                       this_board->putc('0' + r);
+                       flag = 1;
+               }
+               n -= r * d;
+               d = d / 10;
+       }
+}
+
 /* original copyright notice for this crc code  (it is from U-Boot) --> */
 /*
  * This file is derived from crc32.c from the zlib-1.1.3 distribution


Reply via email to