[U-Boot-Users] [PATCH 07/13] [new uImage] Remove I386 uImage fake_header() routine

Marian Balakowicz
2008-01-11T14:29:28Z

I386 targets are not using a uImage format, instead fake header
is added to ram image before it is further processed by bootm.

Remove this fixup and force proper uImage use for I386.

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
---

common/cmd_bootm.c | 16 ---------------
include/asm-i386/zimage.h | 1 -
lib_i386/i386_linux.c | 12 -----------
lib_i386/zimage.c | 48 ---------------------------------------------
4 files changed, 0 insertions(+), 77 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 4b2ea3f..40df9b0 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -79,10 +79,6 @@ static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);

static void print_type (image_header_t *hdr);

-#ifdef __I386__
-image_header_t *fake_header(image_header_t *hdr, void *ptr, int size);
-#endif
-
/*
* Continue booting an OS image; caller already has:
* - copied image header to global variable `header'
@@ -158,21 +154,9 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
memmove (&header, (char *)addr, image_get_header_size());

if (!image_check_magic(hdr)) {
-#ifdef __I386__ /* correct image format not implemented yet - fake it */
- if (fake_header(hdr, (void*)addr, -1) != NULL) {
- /* to compensate for the addition below */
- addr -= image_get_header_size();
- /* turnof verify,
- * fake_header() does not fake the data crc
- */
- verify = 0;
- } else
-#endif /* __I386__ */
- {
puts ("Bad Magic Number\n");
show_boot_progress (-1);
return 1;
- }
}
show_boot_progress (2);

diff --git a/include/asm-i386/zimage.h b/include/asm-i386/zimage.h
index c7103b1..b6266e4 100644
--- a/include/asm-i386/zimage.h
+++ b/include/asm-i386/zimage.h
@@ -70,6 +70,5 @@ void *load_zimage(char *image, unsigned long kernel_size,
int auto_boot);

void boot_zimage(void *setup_base);
-image_header_t *fake_zimage_header(image_header_t *hdr, void *ptr, int size);

#endif
diff --git a/lib_i386/i386_linux.c b/lib_i386/i386_linux.c
index d8ae4fc..8792d84 100644
--- a/lib_i386/i386_linux.c
+++ b/lib_i386/i386_linux.c
@@ -33,18 +33,6 @@ extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);

extern image_header_t header; /* from cmd_bootm.c */

-
-image_header_t *fake_header(image_header_t *hdr, void *ptr, int size)
-{
- /* try each supported image type in order */
- if (NULL != fake_zimage_header(hdr, ptr, size)) {
- return hdr;
- }
-
- return NULL;
-}
-
-
void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ulong addr, ulong *len_ptr, int verify)
{
diff --git a/lib_i386/zimage.c b/lib_i386/zimage.c
index abe0a25..a998f6f 100644
--- a/lib_i386/zimage.c
+++ b/lib_i386/zimage.c
@@ -224,51 +224,3 @@ void boot_zimage(void *setup_base)
regs.eflags = 0;
enter_realmode(((u32)setup_base+SETUP_START_OFFSET)>>4, 0, &regs, &regs);
}
-
-
-image_header_t *fake_zimage_header(image_header_t *hdr, void *ptr, int size)
-{
- /* There is no way to know the size of a zImage ... *
- * so we assume that 2MB will be enough for now */
-#define ZIMAGE_SIZE 0x200000
-
- /* load a 1MB, the loaded will have to be moved to its final
- * position again later... */
-#define ZIMAGE_LOAD 0x100000
-
- ulong checksum;
-
- if (KERNEL_MAGIC != *(u16*)(ptr + BOOT_FLAG_OFF)) {
- /* not a zImage or bzImage */
- return NULL;
- }
-
- if (-1 == size) {
- size = ZIMAGE_SIZE;
- }
-#if 0
- checksum = crc32 (0, ptr, size);
-#else
- checksum = 0;
-#endif
- memset(hdr, 0, image_get_header_size());
-
- /* Build new header */
- image_set_magic(hdr, IH_MAGIC);
- image_set_time(hdr, 0);
- image_set_size(hdr, size);
- image_set_load(hdr, ZIMAGE_LOAD);
- image_set_ep(hdr, 0);
- image_set_dcrc(hdr, checksum);
- image_set_os(hdr, IH_OS_LINUX);
- image_set_arch(hdr, IH_ARCH_I386);
- image_set_type(hdr, IH_TYPE_KERNEL);
- image_set_comp(hdr, IH_COMP_NONE);
-
- image_set_name(hdr, "(none)");
-
- checksum = crc32(0, (const char *)hdr, image_get_header_size());
- image_set_hcrc(hdr, checksum);
-
- return hdr;
-}