summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarian Balakowicz <m8@semihalf.com>2008-02-29 14:58:34 +0100
committerMarian Balakowicz <m8@semihalf.com>2008-02-29 14:58:34 +0100
commit9a4daad0a35eb5143037eea9f786a3e9d672bdd6 (patch)
tree69650696145431c6b48d0792b4d6bdf8b714d37a
parente18489e8c27e843e337258fb00f2652ff0f43b92 (diff)
downloadu-boot-9a4daad0a35eb5143037eea9f786a3e9d672bdd6.tar.gz
u-boot-9a4daad0a35eb5143037eea9f786a3e9d672bdd6.tar.xz
u-boot-9a4daad0a35eb5143037eea9f786a3e9d672bdd6.zip
[new uImage] Update naming convention for bootm/uImage related code
This patch introduces the following prefix convention for the image format handling and bootm related code: genimg_ - dual format shared code image_ - legacy uImage format specific code fit_ - new uImage format specific code boot_ - booting process related code Related routines are renamed and a few pieces of code are moved around and re-grouped. Signed-off-by: Marian Balakowicz <m8@semihalf.com>
-rw-r--r--board/cray/L1/L1.c2
-rw-r--r--board/esd/common/auto_update.c6
-rw-r--r--board/mcc200/auto_update.c6
-rw-r--r--board/mpl/common/common_util.c4
-rw-r--r--board/siemens/common/fpga.c4
-rw-r--r--board/trab/auto_update.c8
-rw-r--r--common/cmd_autoscript.c4
-rw-r--r--common/cmd_bootm.c36
-rw-r--r--common/cmd_doc.c2
-rw-r--r--common/cmd_fdc.c2
-rw-r--r--common/cmd_fpga.c2
-rw-r--r--common/cmd_ide.c2
-rw-r--r--common/cmd_nand.c4
-rw-r--r--common/cmd_scsi.c2
-rw-r--r--common/cmd_usb.c2
-rw-r--r--common/cmd_ximg.c6
-rw-r--r--common/image.c429
-rw-r--r--include/image.h72
-rw-r--r--lib_arm/bootm.c2
-rw-r--r--lib_avr32/bootm.c2
-rw-r--r--lib_i386/bootm.c2
-rw-r--r--lib_m68k/bootm.c9
-rw-r--r--lib_mips/bootm.c2
-rw-r--r--lib_ppc/bootm.c24
-rw-r--r--tools/mkimage.c4
25 files changed, 326 insertions, 312 deletions
diff --git a/board/cray/L1/L1.c b/board/cray/L1/L1.c
index c00acc87ae..77f7f48a6e 100644
--- a/board/cray/L1/L1.c
+++ b/board/cray/L1/L1.c
@@ -141,7 +141,7 @@ int misc_init_r (void)
hdr = (image_header_t *) (CFG_MONITOR_BASE - image_get_header_size ());
#if defined(CONFIG_FIT)
- if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+ if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
puts ("Non legacy image format not supported\n");
return -1;
}
diff --git a/board/esd/common/auto_update.c b/board/esd/common/auto_update.c
index 976707dfe6..1bf81c699c 100644
--- a/board/esd/common/auto_update.c
+++ b/board/esd/common/auto_update.c
@@ -92,7 +92,7 @@ int au_check_cksum_valid(int i, long nbytes)
hdr = (image_header_t *)LOAD_ADDR;
#if defined(CONFIG_FIT)
- if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+ if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
puts ("Non legacy image format not supported\n");
return -1;
}
@@ -125,7 +125,7 @@ int au_check_header_valid(int i, long nbytes)
hdr = (image_header_t *)LOAD_ADDR;
#if defined(CONFIG_FIT)
- if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+ if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
puts ("Non legacy image format not supported\n");
return -1;
}
@@ -197,7 +197,7 @@ int au_do_update(int i, long sz)
hdr = (image_header_t *)LOAD_ADDR;
#if defined(CONFIG_FIT)
- if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+ if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
puts ("Non legacy image format not supported\n");
return -1;
}
diff --git a/board/mcc200/auto_update.c b/board/mcc200/auto_update.c
index fcae35aaf8..5580c11887 100644
--- a/board/mcc200/auto_update.c
+++ b/board/mcc200/auto_update.c
@@ -144,7 +144,7 @@ int au_check_cksum_valid(int idx, long nbytes)
hdr = (image_header_t *)LOAD_ADDR;
#if defined(CONFIG_FIT)
- if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+ if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
puts ("Non legacy image format not supported\n");
return -1;
}
@@ -169,7 +169,7 @@ int au_check_header_valid(int idx, long nbytes)
hdr = (image_header_t *)LOAD_ADDR;
#if defined(CONFIG_FIT)
- if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+ if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
puts ("Non legacy image format not supported\n");
return -1;
}
@@ -247,7 +247,7 @@ int au_do_update(int idx, long sz)
hdr = (image_header_t *)LOAD_ADDR;
#if defined(CONFIG_FIT)
- if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+ if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
puts ("Non legacy image format not supported\n");
return -1;
}
diff --git a/board/mpl/common/common_util.c b/board/mpl/common/common_util.c
index fffd25c2be..785d204696 100644
--- a/board/mpl/common/common_util.c
+++ b/board/mpl/common/common_util.c
@@ -74,7 +74,7 @@ mpl_prg(uchar *src, ulong size)
info = &flash_info[0];
#if defined(CONFIG_PIP405) || defined(CONFIG_MIP405) || defined(CONFIG_PATI)
- if (image_to_cpu (magic[0]) != IH_MAGIC) {
+ if (uimage_to_cpu (magic[0]) != IH_MAGIC) {
puts("Bad Magic number\n");
return -1;
}
@@ -182,7 +182,7 @@ mpl_prg_image(uchar *ld_addr)
int rc;
#if defined(CONFIG_FIT)
- if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+ if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
puts ("Non legacy image format not supported\n");
return -1;
}
diff --git a/board/siemens/common/fpga.c b/board/siemens/common/fpga.c
index a9a6dfed69..48c185082f 100644
--- a/board/siemens/common/fpga.c
+++ b/board/siemens/common/fpga.c
@@ -138,7 +138,7 @@ static int fpga_load (fpga_t* fpga, ulong addr, int checkall)
int verify, i;
#if defined(CONFIG_FIT)
- if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+ if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
puts ("Non legacy image format not supported\n");
return -1;
}
@@ -341,7 +341,7 @@ int fpga_init (void)
hdr = (image_header_t *)addr;
#if defined(CONFIG_FIT)
- if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+ if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
puts ("Non legacy image format not supported\n");
return -1;
}
diff --git a/board/trab/auto_update.c b/board/trab/auto_update.c
index 8f6753592b..fa08bffecd 100644
--- a/board/trab/auto_update.c
+++ b/board/trab/auto_update.c
@@ -212,7 +212,7 @@ au_check_cksum_valid(int idx, long nbytes)
hdr = (image_header_t *)LOAD_ADDR;
#if defined(CONFIG_FIT)
- if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+ if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
puts ("Non legacy image format not supported\n");
return -1;
}
@@ -241,7 +241,7 @@ au_check_header_valid(int idx, long nbytes)
hdr = (image_header_t *)LOAD_ADDR;
#if defined(CONFIG_FIT)
- if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+ if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
puts ("Non legacy image format not supported\n");
return -1;
}
@@ -341,7 +341,7 @@ au_do_update(int idx, long sz)
hdr = (image_header_t *)LOAD_ADDR;
#if defined(CONFIG_FIT)
- if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+ if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
puts ("Non legacy image format not supported\n");
return -1;
}
@@ -437,7 +437,7 @@ au_update_eeprom(int idx)
hdr = (image_header_t *)LOAD_ADDR;
#if defined(CONFIG_FIT)
- if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+ if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
puts ("Non legacy image format not supported\n");
return -1;
}
diff --git a/common/cmd_autoscript.c b/common/cmd_autoscript.c
index f9ab1d9a13..60ffc7dbce 100644
--- a/common/cmd_autoscript.c
+++ b/common/cmd_autoscript.c
@@ -61,7 +61,7 @@ autoscript (ulong addr)
verify = getenv_verify ();
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
@@ -90,7 +90,7 @@ autoscript (ulong addr)
/* get length of script */
data = (ulong *)image_get_data (hdr);
- if ((len = image_to_cpu (*data)) == 0) {
+ if ((len = uimage_to_cpu (*data)) == 0) {
puts ("Empty Script\n");
return 1;
}
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 8595ef6889..10403aa0fa 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -66,7 +66,7 @@ static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
static void fixup_silent_linux (void);
#endif
-static void *get_kernel (cmd_tbl_t *cmdtp, int flag,int argc, char *argv[],
+static void *boot_get_kernel (cmd_tbl_t *cmdtp, int flag,int argc, char *argv[],
bootm_headers_t *images, ulong *os_data, ulong *os_len);
extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
@@ -143,7 +143,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
board_lmb_reserve(&lmb);
/* get kernel image header, start address and length */
- os_hdr = get_kernel (cmdtp, flag, argc, argv,
+ os_hdr = boot_get_kernel (cmdtp, flag, argc, argv,
&images, &os_data, &os_len);
if (os_len == 0)
return 1;
@@ -151,7 +151,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
show_boot_progress (6);
/* get image parameters */
- switch (gen_image_get_format (os_hdr)) {
+ switch (genimg_get_format (os_hdr)) {
case IMAGE_FORMAT_LEGACY:
type = image_get_type (os_hdr);
comp = image_get_comp (os_hdr);
@@ -172,7 +172,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
image_start = (ulong)os_hdr;
load_end = 0;
- type_name = image_get_type_name (type);
+ type_name = genimg_get_type_name (type);
/*
* We have reached the point of no return: we are going to
@@ -309,16 +309,16 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
/**
- * get_kernel - find kernel image
- * @os_data: pointer to a ulong variable, will hold os data start address
- * @os_len: pointer to a ulong variable, will hold os data length
+ * image_get_kernel - verify legacy format kernel image
+ * @img_addr: in RAM address of the legacy format image to be verified
+ * @verify: data CRC verification flag
*
- * get_kernel() tries to find a kernel image, verifies its integrity
- * and locates kernel data.
+ * image_get_kernel() verifies legacy image integrity and returns pointer to
+ * legacy image header if image verification was completed successfully.
*
* returns:
- * pointer to image header if valid image was found, plus kernel start
- * address and length, otherwise NULL
+ * pointer to a legacy image header if valid image was found
+ * otherwise return NULL
*/
static image_header_t *image_get_kernel (ulong img_addr, int verify)
{
@@ -360,18 +360,18 @@ static image_header_t *image_get_kernel (ulong img_addr, int verify)
}
/**
- * get_kernel - find kernel image
+ * boot_get_kernel - find kernel image
* @os_data: pointer to a ulong variable, will hold os data start address
* @os_len: pointer to a ulong variable, will hold os data length
*
- * get_kernel() tries to find a kernel image, verifies its integrity
+ * boot_get_kernel() tries to find a kernel image, verifies its integrity
* and locates kernel data.
*
* returns:
* pointer to image header if valid image was found, plus kernel start
* address and length, otherwise NULL
*/
-static void *get_kernel (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
+static void *boot_get_kernel (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
bootm_headers_t *images, ulong *os_data, ulong *os_len)
{
image_header_t *hdr;
@@ -406,10 +406,10 @@ static void *get_kernel (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
printf ("## Booting kernel image at %08lx ...\n", img_addr);
/* copy from dataflash if needed */
- img_addr = gen_get_image (img_addr);
+ img_addr = genimg_get_image (img_addr);
/* check image type, for FIT images get FIT kernel node */
- switch (gen_image_get_format ((void *)img_addr)) {
+ switch (genimg_get_format ((void *)img_addr)) {
case IMAGE_FORMAT_LEGACY:
debug ("* kernel: legacy format image\n");
@@ -531,7 +531,7 @@ static int image_info (ulong addr)
printf ("\n## Checking Image at %08lx ...\n", addr);
- switch (gen_image_get_format (hdr)) {
+ switch (genimg_get_format (hdr)) {
case IMAGE_FORMAT_LEGACY:
puts (" Legacy image found\n");
if (!image_check_magic (hdr)) {
@@ -599,7 +599,7 @@ int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (!hdr)
goto next_sector;
- switch (gen_image_get_format (hdr)) {
+ switch (genimg_get_format (hdr)) {
case IMAGE_FORMAT_LEGACY:
if (!image_check_magic (hdr))
goto next_sector;
diff --git a/common/cmd_doc.c b/common/cmd_doc.c
index 3358b04622..293b1aa674 100644
--- a/common/cmd_doc.c
+++ b/common/cmd_doc.c
@@ -261,7 +261,7 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
show_boot_progress (38);
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c
index b6e023a5da..80301b9d52 100644
--- a/common/cmd_fdc.c
+++ b/common/cmd_fdc.c
@@ -836,7 +836,7 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 1;
}
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
if (!image_check_magic (hdr)) {
diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c
index 10199f59d4..0bb82f68a8 100644
--- a/common/cmd_fpga.c
+++ b/common/cmd_fpga.c
@@ -216,7 +216,7 @@ int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
break;
case FPGA_LOADMK:
- switch (gen_image_get_format (fpga_data)) {
+ switch (genimg_get_format (fpga_data)) {
case IMAGE_FORMAT_LEGACY:
{
image_header_t *hdr = (image_header_t *)fpga_data;
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index bef04db4f6..79b7dfb7fc 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -446,7 +446,7 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
show_boot_progress (48);
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index b099afeca0..86959dc2c0 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -512,7 +512,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
}
show_boot_progress (56);
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
@@ -994,7 +994,7 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
show_boot_progress (56);
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index 42b3072984..786880521b 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -273,7 +273,7 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 1;
}
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index ad3873c2cb..8ee7d27675 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -386,7 +386,7 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 1;
}
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c
index 4dadc3709d..360b05e1b3 100644
--- a/common/cmd_ximg.c
+++ b/common/cmd_ximg.c
@@ -57,7 +57,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
}
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
printf("## Copying from legacy image at %08lx ...\n", addr);
@@ -104,7 +104,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
data += 4;
if (argc > 2 && part > i) {
u_long tail;
- len = image_to_cpu (len_ptr[i]);
+ len = uimage_to_cpu (len_ptr[i]);
tail = len % 4;
data += len;
if (tail) {
@@ -116,7 +116,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
printf("Bad Image Part\n");
return 1;
}
- len = image_to_cpu (len_ptr[part]);
+ len = uimage_to_cpu (len_ptr[part]);
#if defined(CONFIG_FIT)
case IMAGE_FORMAT_FIT:
fit_unsupported ("imxtract");
diff --git a/common/image.c b/common/image.c
index 9e446faa73..99ed3b8aa8 100644
--- a/common/image.c
+++ b/common/image.c
@@ -68,6 +68,9 @@ static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
unsigned long crc32 (unsigned long, const unsigned char *, unsigned int);
+/*****************************************************************************/
+/* Legacy format routines */
+/*****************************************************************************/
int image_check_hcrc (image_header_t *hdr)
{
ulong hcrc;
@@ -120,61 +123,6 @@ int image_check_dcrc_wd (image_header_t *hdr, ulong chunksz)
return (dcrc == image_get_dcrc (hdr));
}
-int getenv_verify (void)
-{
- char *s = getenv ("verify");
- return (s && (*s == 'n')) ? 0 : 1;
-}
-
-int getenv_autostart (void)
-{
- char *s = getenv ("autostart");
- return (s && (*s == 'n')) ? 0 : 1;
-}
-
-ulong getenv_bootm_low(void)
-{
- char *s = getenv ("bootm_low");
- if (s) {
- ulong tmp = simple_strtoul (s, NULL, 16);
- return tmp;
- }
-
-#ifdef CFG_SDRAM_BASE
- return CFG_SDRAM_BASE;
-#else
- return 0;
-#endif
-}
-
-ulong getenv_bootm_size(void)
-{
- char *s = getenv ("bootm_size");
- if (s) {
- ulong tmp = simple_strtoul (s, NULL, 16);
- return tmp;
- }
-
- return gd->bd->bi_memsize;
-}
-
-void memmove_wd (void *to, void *from, size_t len, ulong chunksz)
-{
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
- while (len > 0) {
- size_t tail = (len > chunksz) ? chunksz : len;
- WATCHDOG_RESET ();
- memmove (to, from, tail);
- to += tail;
- from += tail;
- len -= tail;
- }
-#else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
- memmove (to, from, len);
-#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
-}
-#endif /* USE_HOSTCC */
-
/**
* image_multi_count - get component (sub-image) count
* @hdr: pointer to the header of the multi component image
@@ -262,7 +210,185 @@ void image_multi_getimg (image_header_t *hdr, ulong idx,
}
#ifndef USE_HOSTCC
-const char* image_get_os_name (uint8_t os)
+static void image_print_type (image_header_t *hdr)
+{
+ const char *os, *arch, *type, *comp;
+
+ os = genimg_get_os_name (image_get_os (hdr));
+ arch = genimg_get_arch_name (image_get_arch (hdr));
+ type = genimg_get_type_name (image_get_type (hdr));
+ comp = genimg_get_comp_name (image_get_comp (hdr));
+
+ printf ("%s %s %s (%s)", arch, os, type, comp);
+}
+
+void image_print_contents (image_header_t *hdr)
+{
+#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
+ time_t timestamp = (time_t)image_get_time (hdr);
+ struct rtc_time tm;
+#endif
+
+ printf (" Image Name: %.*s\n", IH_NMLEN, image_get_name (hdr));
+
+#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
+ to_tm (timestamp, &tm);
+ printf (" Created: %4d-%02d-%02d %2d:%02d:%02d UTC\n",
+ tm.tm_year, tm.tm_mon, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec);
+#endif
+ puts (" Image Type: ");
+ image_print_type (hdr);
+
+ printf ("\n Data Size: %d Bytes = ", image_get_data_size (hdr));
+ print_size (image_get_data_size (hdr), "\n");
+ printf (" Load Address: %08x\n"
+ " Entry Point: %08x\n",
+ image_get_load (hdr), image_get_ep (hdr));
+
+ if (image_check_type (hdr, IH_TYPE_MULTI)) {
+ int i;
+ ulong data, len;
+ ulong count = image_multi_count (hdr);
+
+ puts (" Contents:\n");
+ for (i = 0; i < count; i++) {
+ image_multi_getimg (hdr, i, &data, &len);
+ printf (" Image %d: %8ld Bytes = ", i, len);
+ print_size (len, "\n");
+ }
+ }
+}
+
+/**
+ * image_get_ramdisk - get and verify ramdisk image
+ * @cmdtp: command table pointer
+ * @flag: command flag
+ * @argc: command argument count
+ * @argv: command argument list
+ * @rd_addr: ramdisk image start address
+ * @arch: expected ramdisk architecture
+ * @verify: checksum verification flag
+ *
+ * image_get_ramdisk() returns a pointer to the verified ramdisk image
+ * header. Routine receives image start address and expected architecture
+ * flag. Verification done covers data and header integrity and os/type/arch
+ * fields checking.
+ *
+ * If dataflash support is enabled routine checks for dataflash addresses
+ * and handles required dataflash reads.
+ *
+ * returns:
+ * pointer to a ramdisk image header, if image was found and valid
+ * otherwise, return NULL
+ */
+static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
+ int argc, char *argv[],
+ ulong rd_addr, uint8_t arch, int verify)
+{
+ image_header_t *rd_hdr;
+
+ show_boot_progress (9);
+ rd_hdr = (image_header_t *)rd_addr;
+
+ if (!image_check_magic (rd_hdr)) {
+ puts ("Bad Magic Number\n");
+ show_boot_progress (-10);
+ return NULL;
+ }
+
+ if (!image_check_hcrc (rd_hdr)) {
+ puts ("Bad Header Checksum\n");
+ show_boot_progress (-11);
+ return NULL;
+ }
+
+ show_boot_progress (10);
+ image_print_contents (rd_hdr);
+
+ if (verify) {
+ puts(" Verifying Checksum ... ");
+ if (!image_check_dcrc_wd (rd_hdr, CHUNKSZ)) {
+ puts ("Bad Data CRC\n");
+ show_boot_progress (-12);
+ return NULL;
+ }
+ puts("OK\n");
+ }
+
+ show_boot_progress (11);
+
+ if (!image_check_os (rd_hdr, IH_OS_LINUX) ||
+ !image_check_arch (rd_hdr, arch) ||
+ !image_check_type (rd_hdr, IH_TYPE_RAMDISK)) {
+ printf ("No Linux %s Ramdisk Image\n",
+ genimg_get_arch_name(arch));
+ show_boot_progress (-13);
+ return NULL;
+ }
+
+ return rd_hdr;
+}
+
+/*****************************************************************************/
+/* Shared dual-format routines */
+/*****************************************************************************/
+int getenv_verify (void)
+{
+ char *s = getenv ("verify");
+ return (s && (*s == 'n')) ? 0 : 1;
+}
+
+int getenv_autostart (void)
+{
+ char *s = getenv ("autostart");
+ return (s && (*s == 'n')) ? 0 : 1;
+}
+
+ulong getenv_bootm_low(void)
+{
+ char *s = getenv ("bootm_low");
+ if (s) {
+ ulong tmp = simple_strtoul (s, NULL, 16);
+ return tmp;
+ }
+
+#ifdef CFG_SDRAM_BASE
+ return CFG_SDRAM_BASE;
+#else
+ return 0;
+#endif
+}
+
+ulong getenv_bootm_size(void)
+{
+ char *s = getenv ("bootm_size");
+ if (s) {
+ ulong tmp = simple_strtoul (s, NULL, 16);
+ return tmp;
+ }
+
+ return gd->bd->bi_memsize;
+}
+
+void memmove_wd (void *to, void *from, size_t len, ulong chunksz)
+{
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+ while (len > 0) {
+ size_t tail = (len > chunksz) ? chunksz : len;
+ WATCHDOG_RESET ();
+ memmove (to, from, tail);
+ to += tail;
+ from += tail;
+ len -= tail;
+ }
+#else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
+ memmove (to, from, len);
+#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
+}
+#endif /* USE_HOSTCC */
+
+const char* genimg_get_os_name (uint8_t os)
{
const char *name;
@@ -286,7 +412,7 @@ const char* image_get_os_name (uint8_t os)
return name;
}
-const char* image_get_arch_name (uint8_t arch)
+const char* genimg_get_arch_name (uint8_t arch)
{
const char *name;
@@ -315,7 +441,7 @@ const char* image_get_arch_name (uint8_t arch)
return name;
}
-const char* image_get_type_name (uint8_t type)
+const char* genimg_get_type_name (uint8_t type)
{
const char *name;
@@ -334,7 +460,7 @@ const char* image_get_type_name (uint8_t type)
return name;
}
-const char* image_get_comp_name (uint8_t comp)
+const char* genimg_get_comp_name (uint8_t comp)
{
const char *name;
@@ -348,71 +474,21 @@ const char* image_get_comp_name (uint8_t comp)
return name;
}
-static void image_print_type (image_header_t *hdr)
-{
- const char *os, *arch, *type, *comp;
-
- os = image_get_os_name (image_get_os (hdr));
- arch = image_get_arch_name (image_get_arch (hdr));
- type = image_get_type_name (image_get_type (hdr));
- comp = image_get_comp_name (image_get_comp (hdr));
-
- printf ("%s %s %s (%s)", arch, os, type, comp);
-}
-
-void image_print_contents (image_header_t *hdr)
-{
-#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
- time_t timestamp = (time_t)image_get_time (hdr);
- struct rtc_time tm;
-#endif
-
- printf (" Image Name: %.*s\n", IH_NMLEN, image_get_name (hdr));
-
-#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
- to_tm (timestamp, &tm);
- printf (" Created: %4d-%02d-%02d %2d:%02d:%02d UTC\n",
- tm.tm_year, tm.tm_mon, tm.tm_mday,
- tm.tm_hour, tm.tm_min, tm.tm_sec);
-#endif
- puts (" Image Type: ");
- image_print_type (hdr);
-
- printf ("\n Data Size: %d Bytes = ", image_get_data_size (hdr));
- print_size (image_get_data_size (hdr), "\n");
- printf (" Load Address: %08x\n"
- " Entry Point: %08x\n",
- image_get_load (hdr), image_get_ep (hdr));
-
- if (image_check_type (hdr, IH_TYPE_MULTI)) {
- int i;
- ulong data, len;
- ulong count = image_multi_count (hdr);
-
- puts (" Contents:\n");
- for (i = 0; i < count; i++) {
- image_multi_getimg (hdr, i, &data, &len);
- printf (" Image %d: %8ld Bytes = ", i, len);
- print_size (len, "\n");
- }
- }
-}
-
/**
- * gen_image_get_format - get image format type
+ * genimg_get_format - get image format type
* @img_addr: image start address
*
- * gen_image_get_format() checks whether provided address points to a valid
+ * genimg_get_format() checks whether provided address points to a valid
* legacy or FIT image.
*
* New uImage format and FDT blob are based on a libfdt. FDT blob
* may be passed directly or embedded in a FIT image. In both situations
- * gen_image_get_format() must be able to dectect libfdt header.
+ * genimg_get_format() must be able to dectect libfdt header.
*
* returns:
* image format type or IMAGE_FORMAT_INVALID if no image is present
*/
-int gen_image_get_format (void *img_addr)
+int genimg_get_format (void *img_addr)
{
ulong format = IMAGE_FORMAT_INVALID;
image_header_t *hdr;
@@ -435,16 +511,16 @@ int gen_image_get_format (void *img_addr)
}
/**
- * gen_get_image - get image from special storage (if necessary)
+ * genimg_get_image - get image from special storage (if necessary)
* @img_addr: image start address
*
- * gen_get_image() checks if provided image start adddress is located
+ * genimg_get_image() checks if provided image start adddress is located
* in a dataflash storage. If so, image is moved to a system RAM memory.
*
* returns:
* image start address after possible relocation from special storage
*/
-ulong gen_get_image (ulong img_addr)
+ulong genimg_get_image (ulong img_addr)
{
ulong ram_addr = img_addr;
@@ -469,7 +545,7 @@ ulong gen_get_image (ulong img_addr)
read_dataflash (img_addr, h_size, (char *)ram_addr);
/* get data size */
- switch (gen_image_get_format ((void *)ram_addr)) {
+ switch (genimg_get_format ((void *)ram_addr)) {
case IMAGE_FORMAT_LEGACY:
d_size = image_get_data_size ((image_header_t *)ram_addr);
debug (" Legacy format image found at 0x%08lx, size 0x%08lx\n",
@@ -502,77 +578,7 @@ ulong gen_get_image (ulong img_addr)
}
/**
- * image_get_ramdisk - get and verify ramdisk image
- * @cmdtp: command table pointer
- * @flag: command flag
- * @argc: command argument count
- * @argv: command argument list
- * @rd_addr: ramdisk image start address
- * @arch: expected ramdisk architecture
- * @verify: checksum verification flag
- *
- * image_get_ramdisk() returns a pointer to the verified ramdisk image
- * header. Routine receives image start address and expected architecture
- * flag. Verification done covers data and header integrity and os/type/arch
- * fields checking.
- *
- * If dataflash support is enabled routine checks for dataflash addresses
- * and handles required dataflash reads.
- *
- * returns:
- * pointer to a ramdisk image header, if image was found and valid
- * otherwise, return NULL
- */
-static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
- int argc, char *argv[],
- ulong rd_addr, uint8_t arch, int verify)
-{
- image_header_t *rd_hdr;
-
- show_boot_progress (9);
- rd_hdr = (image_header_t *)rd_addr;
-
- if (!image_check_magic (rd_hdr)) {
- puts ("Bad Magic Number\n");
- show_boot_progress (-10);
- return NULL;
- }
-
- if (!image_check_hcrc (rd_hdr)) {
- puts ("Bad Header Checksum\n");
- show_boot_progress (-11);
- return NULL;
- }
-
- show_boot_progress (10);
- image_print_contents (rd_hdr);
-
- if (verify) {
- puts(" Verifying Checksum ... ");
- if (!image_check_dcrc_wd (rd_hdr, CHUNKSZ)) {
- puts ("Bad Data CRC\n");
- show_boot_progress (-12);
- return NULL;
- }
- puts("OK\n");
- }
-
- show_boot_progress (11);
-
- if (!image_check_os (rd_hdr, IH_OS_LINUX) ||
- !image_check_arch (rd_hdr, arch) ||
- !image_check_type (rd_hdr, IH_TYPE_RAMDISK)) {
- printf ("No Linux %s Ramdisk Image\n",
- image_get_arch_name(arch));
- show_boot_progress (-13);
- return NULL;
- }
-
- return rd_hdr;
-}
-
-/**
- * get_ramdisk - main ramdisk handling routine
+ * boot_get_ramdisk - main ramdisk handling routine
* @cmdtp: command table pointer
* @flag: command flag
* @argc: command argument count
@@ -582,7 +588,7 @@ static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
* @rd_start: pointer to a ulong variable, will hold ramdisk start address
* @rd_end: pointer to a ulong variable, will hold ramdisk end
*
- * get_ramdisk() is responsible for finding a valid ramdisk image.
+ * boot_get_ramdisk() is responsible for finding a valid ramdisk image.
* Curently supported are the following ramdisk sources:
* - multicomponent kernel/ramdisk image,
* - commandline provided address of decicated ramdisk image.
@@ -593,7 +599,7 @@ static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
* rd_start and rd_end are set to 0 if no ramdisk exists
* return 1 if ramdisk image is found but corrupted
*/
-int get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
+int boot_get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
bootm_headers_t *images, uint8_t arch,
ulong *rd_start, ulong *rd_end)
{
@@ -645,14 +651,14 @@ int get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
/* copy from dataflash if needed */
printf ("## Loading init Ramdisk Image at %08lx ...\n",
rd_addr);
- rd_addr = gen_get_image (rd_addr);
+ rd_addr = genimg_get_image (rd_addr);
/*
* Check if there is an initrd image at the
* address provided in the second bootm argument
* check image type, for FIT images get FIT node.
*/
- switch (gen_image_get_format ((void *)rd_addr)) {
+ switch (genimg_get_format ((void *)rd_addr)) {
case IMAGE_FORMAT_LEGACY:
debug ("* ramdisk: legacy format image\n");
@@ -729,7 +735,7 @@ int get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
/**
- * ramdisk_high - relocate init ramdisk
+ * boot_ramdisk_high - relocate init ramdisk
* @lmb: pointer to lmb handle, will be used for memory mgmt
* @rd_data: ramdisk data start address
* @rd_len: ramdisk data length
@@ -738,18 +744,18 @@ int get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
* @initrd_end: pointer to a ulong variable, will hold final init ramdisk
* end address (after possible relocation)
*
- * ramdisk_high() takes a relocation hint from "initrd_high" environement
+ * boot_ramdisk_high() takes a relocation hint from "initrd_high" environement
* variable and if requested ramdisk data is moved to a specified location.
*
+ * Initrd_start and initrd_end are set to final (after relocation) ramdisk
+ * start/end addresses if ramdisk image start and len were provided,
+ * otherwise set initrd_start and initrd_end set to zeros.
+ *
* returns:
- * - initrd_start and initrd_end are set to final (after relocation) ramdisk
- * start/end addresses if ramdisk image start and len were provided
- * otherwise set initrd_start and initrd_end set to zeros
- * - returns:
- * 0 - success
- * -1 - failure
+ * 0 - success
+ * -1 - failure
*/
-int ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
+int boot_ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
ulong *initrd_start, ulong *initrd_end)
{
char *s;
@@ -779,12 +785,12 @@ int ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
lmb_reserve(lmb, rd_data, rd_len);
} else {
if (initrd_high)
- *initrd_start = lmb_alloc_base(lmb, rd_len, 0x1000, initrd_high);
+ *initrd_start = lmb_alloc_base (lmb, rd_len, 0x1000, initrd_high);
else
- *initrd_start = lmb_alloc(lmb, rd_len, 0x1000);
+ *initrd_start = lmb_alloc (lmb, rd_len, 0x1000);
if (*initrd_start == 0) {
- puts("ramdisk - allocation error\n");
+ puts ("ramdisk - allocation error\n");
goto error;
}
show_boot_progress (12);
@@ -793,7 +799,7 @@ int ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
printf (" Loading Ramdisk to %08lx, end %08lx ... ",
*initrd_start, *initrd_end);
- memmove_wd((void *)*initrd_start,
+ memmove_wd ((void *)*initrd_start,
(void *)rd_data, rd_len, CHUNKSZ);
puts ("OK\n");
@@ -804,6 +810,7 @@ int ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
}
debug (" ramdisk load start = 0x%08lx, ramdisk load end = 0x%08lx\n",
*initrd_start, *initrd_end);
+
return 0;
error:
@@ -811,14 +818,14 @@ error:
}
/**
- * get_boot_cmdline - allocate and initialize kernel cmdline
+ * boot_get_cmdline - allocate and initialize kernel cmdline
* @lmb: pointer to lmb handle, will be used for memory mgmt
* @cmd_start: pointer to a ulong variable, will hold cmdline start
* @cmd_end: pointer to a ulong variable, will hold cmdline end
* @bootmap_base: ulong variable, holds offset in physical memory to
* base of bootmap
*
- * get_boot_cmdline() allocates space for kernel command line below
+ * boot_get_cmdline() allocates space for kernel command line below
* BOOTMAPSZ + bootmap_base address. If "bootargs" U-boot environemnt
* variable is present its contents is copied to allocated kernel
* command line.
@@ -827,7 +834,7 @@ error:
* 0 - success
* -1 - failure
*/
-int get_boot_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
+int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
ulong bootmap_base)
{
char *cmdline;
@@ -853,13 +860,13 @@ int get_boot_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
}
/**
- * get_boot_kbd - allocate and initialize kernel copy of board info
+ * boot_get_kbd - allocate and initialize kernel copy of board info
* @lmb: pointer to lmb handle, will be used for memory mgmt
* @kbd: double pointer to board info data
* @bootmap_base: ulong variable, holds offset in physical memory to
* base of bootmap
*
- * get_boot_kbd() allocates space for kernel copy of board info data below
+ * boot_get_kbd() allocates space for kernel copy of board info data below
* BOOTMAPSZ + bootmap_base address and kernel board info is initialized with
* the current u-boot board info data.
*
@@ -867,7 +874,7 @@ int get_boot_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
* 0 - success
* -1 - failure
*/
-int get_boot_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base)
+int boot_get_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base)
{
*kbd = (bd_t *)lmb_alloc_base(lmb, sizeof(bd_t), 0xf,
CFG_BOOTMAPSZ + bootmap_base);
diff --git a/include/image.h b/include/image.h
index ee692ac607..b520691ca1 100644
--- a/include/image.h
+++ b/include/image.h
@@ -161,9 +161,9 @@
#define IH_NMLEN 32 /* Image Name Length */
/*
- * all data in network byte order (aka natural aka bigendian)
+ * Legacy format image header,
+ * all data in network byte order (aka natural aka bigendian).
*/
-
typedef struct image_header {
uint32_t ih_magic; /* Image Header Magic Number */
uint32_t ih_hcrc; /* Image Header CRC Checksum */
@@ -186,7 +186,7 @@ typedef struct image_header {
typedef struct bootm_headers {
/*
* Legacy os image header, if it is a multi component image
- * then get_ramdisk() and get_fdt() will attempt to get
+ * then boot_get_ramdisk() and get_fdt() will attempt to get
* data from second and third component accordingly.
*/
image_header_t *legacy_hdr_os;
@@ -216,9 +216,40 @@ typedef struct bootm_headers {
*/
#define CHUNKSZ (64 * 1024)
-#define image_to_cpu(x) ntohl(x)
-#define cpu_to_image(x) htonl(x)
+#define uimage_to_cpu(x) ntohl(x)
+#define cpu_to_uimage(x) htonl(x)
+
+#ifndef USE_HOSTCC
+/* Image format types, returned by _get_format() routine */
+#define IMAGE_FORMAT_INVALID 0x00
+#define IMAGE_FORMAT_LEGACY 0x01 /* legacy image_header based format */
+#define IMAGE_FORMAT_FIT 0x02 /* new, libfdt based format */
+
+int genimg_get_format (void *img_addr);
+ulong genimg_get_image (ulong img_addr);
+
+const char* genimg_get_os_name (uint8_t os);
+const char* genimg_get_arch_name (uint8_t arch);
+const char* genimg_get_type_name (uint8_t type);
+const char* genimg_get_comp_name (uint8_t comp);
+
+int boot_get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
+ bootm_headers_t *images, uint8_t arch,
+ ulong *rd_start, ulong *rd_end);
+
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
+int boot_ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
+ ulong *initrd_start, ulong *initrd_end);
+
+int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
+ ulong bootmap_base);
+int boot_get_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base);
+#endif /* CONFIG_PPC || CONFIG_M68K */
+#endif /* USE_HOSTCC */
+/*******************************************************************/
+/* Legacy format specific code (prefixed with image_) */
+/*******************************************************************/
static inline uint32_t image_get_header_size (void)
{
return (sizeof (image_header_t));
@@ -227,7 +258,7 @@ static inline uint32_t image_get_header_size (void)
#define image_get_hdr_l(f) \
static inline uint32_t image_get_##f(image_header_t *hdr) \
{ \
- return image_to_cpu (hdr->ih_##f); \
+ return uimage_to_cpu (hdr->ih_##f); \
}
image_get_hdr_l (magic);
image_get_hdr_l (hcrc);
@@ -285,7 +316,7 @@ static inline ulong image_get_image_end (image_header_t *hdr)
#define image_set_hdr_l(f) \
static inline void image_set_##f(image_header_t *hdr, uint32_t val) \
{ \
- hdr->ih_##f = cpu_to_image (val); \
+ hdr->ih_##f = cpu_to_uimage (val); \
}
image_set_hdr_l (magic);
image_set_hdr_l (hcrc);
@@ -375,33 +406,10 @@ static inline int image_check_target_arch (image_header_t *hdr)
return 1;
}
-const char* image_get_os_name (uint8_t os);
-const char* image_get_arch_name (uint8_t arch);
-const char* image_get_type_name (uint8_t type);
-const char* image_get_comp_name (uint8_t comp);
void image_print_contents (image_header_t *hdr);
-#define IMAGE_FORMAT_INVALID 0x00
-#define IMAGE_FORMAT_LEGACY 0x01 /* legacy image_header based format */
-#define IMAGE_FORMAT_FIT 0x02 /* new, libfdt based format */
-
-int gen_image_get_format (void *img_addr);
-ulong gen_get_image (ulong img_addr);
-
-int get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
- bootm_headers_t *images, uint8_t arch,
- ulong *rd_start, ulong *rd_end);
-
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
-int ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
- ulong *initrd_start, ulong *initrd_end);
-int get_boot_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
- ulong bootmap_base);
-int get_boot_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base);
-#endif /* CONFIG_PPC || CONFIG_M68K */
-
/*******************************************************************/
-/* New uImage format */
+/* New uImage format specific code (prefixed with fit_) */
/*******************************************************************/
#if defined(CONFIG_FIT)
inline int fit_parse_conf (const char *spec, ulong addr_curr,
@@ -422,9 +430,7 @@ inline int fit_parse_subimage (const char *spec, ulong addr_curr,
#define fit_unsupported(msg)
#define fit_unsupported_reset(msg)
#endif /* CONFIG_FIT_VERBOSE */
-
#endif /* CONFIG_FIT */
-
#endif /* USE_HOSTCC */
#endif /* __IMAGE_H__ */
diff --git a/lib_arm/bootm.c b/lib_arm/bootm.c
index 77d35fcc65..865e711e91 100644
--- a/lib_arm/bootm.c
+++ b/lib_arm/bootm.c
@@ -95,7 +95,7 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
printf ("Using machid 0x%x from environment\n", machid);
}
- get_ramdisk (cmdtp, flag, argc, argv, images,
+ boot_get_ramdisk (cmdtp, flag, argc, argv, images,
IH_ARCH_ARM, &initrd_start, &initrd_end);
show_boot_progress (15);
diff --git a/lib_avr32/bootm.c b/lib_avr32/bootm.c
index 918e4cfadf..e8e537a2ce 100644
--- a/lib_avr32/bootm.c
+++ b/lib_avr32/bootm.c
@@ -196,7 +196,7 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
}
theKernel = (void *)ep;
- get_ramdisk (cmdtp, flag, argc, argv, images,
+ boot_get_ramdisk (cmdtp, flag, argc, argv, images,
IH_ARCH_AVR32, &initrd_start, &initrd_end);
show_boot_progress (15);
diff --git a/lib_i386/bootm.c b/lib_i386/bootm.c
index 89a423c243..76bcf6cd85 100644
--- a/lib_i386/bootm.c
+++ b/lib_i386/bootm.c
@@ -40,7 +40,7 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ulong ep;
image_header_t *hdr;
- get_ramdisk (cmdtp, flag, argc, argv, images,
+ boot_get_ramdisk (cmdtp, flag, argc, argv, images,
IH_ARCH_I386, &initrd_start, &initrd_end);
if (images->legacy_hdr_valid) {
diff --git a/lib_m68k/bootm.c b/lib_m68k/bootm.c
index e12d1d4aad..fba7499090 100644
--- a/lib_m68k/bootm.c
+++ b/lib_m68k/bootm.c
@@ -82,14 +82,14 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag,
lmb_reserve(lmb, sp, (CFG_SDRAM_BASE + gd->ram_size - sp));
/* allocate space and init command line */
- ret = get_boot_cmdline (lmb, &cmd_start, &cmd_end, bootmap_base);
+ ret = boot_get_cmdline (lmb, &cmd_start, &cmd_end, bootmap_base);
if (ret) {
puts("ERROR with allocation of cmdline\n");
goto error;
}
/* allocate space for kernel copy of board info */
- ret = get_boot_kbd (lmb, &kbd, bootmap_base);
+ ret = boot_get_kbd (lmb, &kbd, bootmap_base);
if (ret) {
puts("ERROR with allocation of kernel bd\n");
goto error;
@@ -111,14 +111,15 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag,
kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))ep;
/* find ramdisk */
- ret = get_ramdisk (cmdtp, flag, argc, argv, images,
+ ret = boot_get_ramdisk (cmdtp, flag, argc, argv, images,
IH_ARCH_M68K, &rd_data_start, &rd_data_end);
if (ret)
goto error;
rd_len = rd_data_end - rd_data_start;
- ret = ramdisk_high (lmb, rd_data_start, rd_len, &initrd_start, &initrd_end);
+ ret = boot_ramdisk_high (lmb, rd_data_start, rd_len,
+ &initrd_start, &initrd_end);
if (ret)
goto error;
diff --git a/lib_mips/bootm.c b/lib_mips/bootm.c
index 39869c1800..b336a36498 100644
--- a/lib_mips/bootm.c
+++ b/lib_mips/bootm.c
@@ -68,7 +68,7 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
}
theKernel = (void (*)(int, char **, char **, int *))ep;
- get_ramdisk (cmdtp, flag, argc, argv, images,
+ boot_get_ramdisk (cmdtp, flag, argc, argv, images,
IH_ARCH_MIPS, &initrd_start, &initrd_end);
show_boot_progress (15);
diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
index 1afef46df7..8974ccd81c 100644
--- a/lib_ppc/bootm.c
+++ b/lib_ppc/bootm.c
@@ -41,9 +41,9 @@
#include <fdt_support.h>
static void fdt_error (const char *msg);
-static int get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
+static int boot_get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
bootm_headers_t *images, char **of_flat_tree, ulong *of_size);
-static int fdt_relocate (struct lmb *lmb, ulong bootmap_base,
+static int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base,
cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
char **of_flat_tree, ulong *of_size);
#endif
@@ -122,7 +122,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
#if defined(CONFIG_OF_LIBFDT)
/* find flattened device tree */
- ret = get_fdt (cmdtp, flag, argc, argv, images, &of_flat_tree, &of_size);
+ ret = boot_get_fdt (cmdtp, flag, argc, argv, images, &of_flat_tree, &of_size);
if (ret)
goto error;
@@ -130,14 +130,14 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
if (!of_size) {
/* allocate space and init command line */
- ret = get_boot_cmdline (lmb, &cmd_start, &cmd_end, bootmap_base);
+ ret = boot_get_cmdline (lmb, &cmd_start, &cmd_end, bootmap_base);
if (ret) {
puts("ERROR with allocation of cmdline\n");
goto error;
}
/* allocate space for kernel copy of board info */
- ret = get_boot_kbd (lmb, &kbd, bootmap_base);
+ ret = boot_get_kbd (lmb, &kbd, bootmap_base);
if (ret) {
puts("ERROR with allocation of kernel bd\n");
goto error;
@@ -160,7 +160,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))ep;
/* find ramdisk */
- ret = get_ramdisk (cmdtp, flag, argc, argv, images,
+ ret = boot_get_ramdisk (cmdtp, flag, argc, argv, images,
IH_ARCH_PPC, &rd_data_start, &rd_data_end);
if (ret)
@@ -169,7 +169,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
rd_len = rd_data_end - rd_data_start;
#if defined(CONFIG_OF_LIBFDT)
- ret = fdt_relocate (lmb, bootmap_base,
+ ret = boot_relocate_fdt (lmb, bootmap_base,
cmdtp, flag, argc, argv, &of_flat_tree, &of_size);
/*
@@ -201,7 +201,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
}
#endif /* CONFIG_OF_LIBFDT */
- ret = ramdisk_high (lmb, rd_data_start, rd_len, &initrd_start, &initrd_end);
+ ret = boot_ramdisk_high (lmb, rd_data_start, rd_len, &initrd_start, &initrd_end);
if (ret)
goto error;
@@ -354,7 +354,7 @@ static image_header_t *image_get_fdt (ulong fdt_addr)
return fdt_hdr;
}
-static int get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
+static int boot_get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
bootm_headers_t *images, char **of_flat_tree, ulong *of_size)
{
ulong fdt_addr;
@@ -403,14 +403,14 @@ static int get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
fdt_addr);
/* copy from dataflash if needed */
- fdt_addr = gen_get_image (fdt_addr);
+ fdt_addr = genimg_get_image (fdt_addr);
/*
* Check if there is an FDT image at the
* address provided in the second bootm argument
* check image type, for FIT images get a FIT node.
*/
- switch (gen_image_get_format ((void *)fdt_addr)) {
+ switch (genimg_get_format ((void *)fdt_addr)) {
case IMAGE_FORMAT_LEGACY:
debug ("* fdt: legacy format image\n");
@@ -527,7 +527,7 @@ error:
return 1;
}
-static int fdt_relocate (struct lmb *lmb, ulong bootmap_base,
+static int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base,
cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
char **of_flat_tree, ulong *of_size)
{
diff --git a/tools/mkimage.c b/tools/mkimage.c
index 8ced9709a6..5119bc7843 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -361,7 +361,7 @@ NXTARG: ;
cmdname, file, strerror(errno));
exit (EXIT_FAILURE);
}
- size = cpu_to_image (sbuf.st_size);
+ size = cpu_to_uimage (sbuf.st_size);
} else {
size = 0;
}
@@ -604,7 +604,7 @@ print_header (image_header_t *hdr)
pos = image_get_header_size () + ptrs * sizeof(long);
printf ("Contents:\n");
for (i=0; len_ptr[i]; ++i) {
- size = image_to_cpu (len_ptr[i]);
+ size = uimage_to_cpu (len_ptr[i]);
printf (" Image %d: %8d Bytes = %4d kB = %d MB\n",
i, size, size>>10, size>>20);