summaryrefslogtreecommitdiff
path: root/lib_m68k/bootm.c
diff options
context:
space:
mode:
authorMarian Balakowicz <m8@semihalf.com>2008-01-31 13:55:39 +0100
committerWolfgang Denk <wd@denx.de>2008-02-07 01:12:59 +0100
commit5ad03eb3854c162684222a718b44c0716ea0db03 (patch)
tree4128cb8b65369a712b488c124d1297bc6c50dc67 /lib_m68k/bootm.c
parentd3c5eb6dd1f4ed3c3388386cf1d1bf82aa51d56b (diff)
downloadu-boot-imx-5ad03eb3854c162684222a718b44c0716ea0db03.zip
u-boot-imx-5ad03eb3854c162684222a718b44c0716ea0db03.tar.gz
u-boot-imx-5ad03eb3854c162684222a718b44c0716ea0db03.tar.bz2
[new uImage] Factor out common image_get_ramdisk() routine
Architecture specific do_bootm_linux() routines share common ramdisk image processing code. Move this code to a common helper routine. Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Diffstat (limited to 'lib_m68k/bootm.c')
-rw-r--r--lib_m68k/bootm.c89
1 files changed, 9 insertions, 80 deletions
diff --git a/lib_m68k/bootm.c b/lib_m68k/bootm.c
index b135556..dac5276 100644
--- a/lib_m68k/bootm.c
+++ b/lib_m68k/bootm.c
@@ -44,18 +44,15 @@ DECLARE_GLOBAL_DATA_PTR;
# define SHOW_BOOT_PROGRESS(arg)
#endif
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
-
void do_bootm_linux(cmd_tbl_t * cmdtp, int flag,
int argc, char *argv[],
image_header_t *hdr, int verify)
{
ulong sp;
- ulong rd_data, rd_len;
+ ulong rd_data_start, rd_data_end, rd_len;
ulong initrd_high;
ulong initrd_start, initrd_end;
- image_header_t *rd_hdr;
int initrd_copy_to_ram = 1;
ulong cmd_start, cmd_end;
@@ -132,82 +129,14 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag,
kernel =
(void (*)(bd_t *, ulong, ulong, ulong, ulong))image_get_ep (hdr);
- /*
- * Check if there is an initrd image
- */
-
- if (argc >= 3) {
- debug("Not skipping initrd\n");
- SHOW_BOOT_PROGRESS(9);
+ get_ramdisk (cmdtp, flag, argc, argv, hdr, verify,
+ IH_ARCH_M68K, &rd_data_start, &rd_data_end);
+ rd_len = rd_data_end - rd_data_start;
- rd_hdr = (image_header_t *)simple_strtoul (argv[2], NULL, 16);
- printf ("## Loading RAMDisk Image at %08lx ...\n", rd_hdr);
-
- if (!image_check_magic (rd_hdr)) {
- puts("Bad Magic Number\n");
- SHOW_BOOT_PROGRESS(-10);
- do_reset(cmdtp, flag, argc, argv);
- }
-
- if (!image_check_hcrc (rd_hdr)) {
- puts("Bad Header Checksum\n");
- SHOW_BOOT_PROGRESS(-11);
- do_reset(cmdtp, flag, argc, argv);
- }
-
- SHOW_BOOT_PROGRESS(10);
-
- print_image_hdr (rd_hdr);
-
- rd_data = image_get_data (rd_hdr);
- rd_len = image_get_data_size (rd_hdr);
-
- if (verify) {
- puts(" Verifying Checksum ... ");
- if (!image_check_dcrc_wd (rd_hdr, CHUNKSZ)) {
- puts("Bad Data CRC\n");
- SHOW_BOOT_PROGRESS(-12);
- do_reset(cmdtp, flag, argc, argv);
- }
- puts("OK\n");
- }
-
- SHOW_BOOT_PROGRESS(11);
-
- if (!image_check_os (rd_hdr, IH_OS_LINUX) ||
- !image_check_arch (rd_hdr, IH_ARCH_M68K) ||
- !image_check_type (rd_hdr, IH_TYPE_RAMDISK)) {
- puts("No Linux ColdFire Ramdisk Image\n");
- SHOW_BOOT_PROGRESS(-13);
- do_reset(cmdtp, flag, argc, argv);
- }
-
- /*
- * Now check if we have a multifile image
- */
- } else if (image_check_type (hdr, IH_TYPE_MULTI)) {
- /*
- * Get second entry data start address and len
- */
- SHOW_BOOT_PROGRESS (13);
- image_multi_getimg (hdr, 1, &rd_data, &rd_len);
- } else {
- /*
- * no initrd image
- */
- SHOW_BOOT_PROGRESS(14);
-
- rd_len = rd_data = 0;
- }
-
- if (!rd_data) {
- debug("No initrd\n");
- }
-
- if (rd_data) {
+ if (rd_data_start) {
if (!initrd_copy_to_ram) { /* zero-copy ramdisk support */
- initrd_start = rd_data;
- initrd_end = initrd_start + rd_len;
+ initrd_start = rd_data_start;
+ initrd_end = rd_data_end;
} else {
initrd_start = (ulong) kbd - rd_len;
initrd_start &= ~(4096 - 1); /* align on page */
@@ -245,14 +174,14 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag,
debug
("## initrd at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
- rd_data, rd_data + rd_len - 1, rd_len, rd_len);
+ rd_data_start, rd_data_end - 1, rd_len, rd_len);
initrd_end = initrd_start + rd_len;
printf(" Loading Ramdisk to %08lx, end %08lx ... ",
initrd_start, initrd_end);
memmove_wd((void *)initrd_start,
- (void *)rd_data, rd_len, CHUNKSZ);
+ (void *)rd_data_start, rd_len, CHUNKSZ);
puts("OK\n");
}