summaryrefslogtreecommitdiff
path: root/lib_arm
diff options
context:
space:
mode:
authorZhang Jiejing <jiejing.zhang@freescale.com>2012-02-15 16:40:33 +0800
committerLily Zhang <r58066@freescale.com>2012-02-27 12:59:45 +0800
commitc530d9188dbf0d97cab4b38f0a53a28c56a6bd6c (patch)
tree8a6d3d2e45d4a6a7964e6ae110654aa341a8b576 /lib_arm
parent72e8b5a4858d802d5135ba0d4b41ea9554a8c987 (diff)
ENGR00174536-1 booti: add booti command support.
Support booti command which can boot from a boot.img boot.img is a zImage + ramdisk.img + bootargs + boot addr which include these info can be used to avoid mis match between kernel and ramdisk, also can avoid commit to chagne default bootargs. For example: > booti mmc1 command will read the boot.img from 1M offset, and then parser the bootargs and ramdisk then do the boot from that zImage. > booti mmc1 recovery will going to read the recovery's partition no and offset and boot from recovery image. this recovery image also a zImage + ramdisk bootargs: if uboot have define a env var 'bootargs', booti command will use this bootargs as kernel cmdline if you want use boot.img 's bootargs, just type: > setenv bootargs in uboot to clear the bootargs in uboot env. our default uboot env will be NULL in config file. also, android use boot.img to support OTA. Signed-off-by: Zhang Jiejing <jiejing.zhang@freescale.com>
Diffstat (limited to 'lib_arm')
-rw-r--r--lib_arm/bootm.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/lib_arm/bootm.c b/lib_arm/bootm.c
index 128b7e313c..f301edbe72 100644
--- a/lib_arm/bootm.c
+++ b/lib_arm/bootm.c
@@ -4,6 +4,7 @@
* Marius Groeger <mgroeger@sysgo.de>
*
* Copyright (C) 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,6 +28,8 @@
#include <u-boot/zlib.h>
#include <asm/byteorder.h>
+#include <bootimg.h>
+
DECLARE_GLOBAL_DATA_PTR;
#if defined (CONFIG_SETUP_MEMORY_TAGS) || \
@@ -131,6 +134,68 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
return 1;
}
+void do_booti_linux (boot_img_hdr *hdr)
+{
+ ulong initrd_start, initrd_end;
+ void (*theKernel)(int zero, int arch, uint params);
+ bd_t *bd = gd->bd;
+#ifdef CONFIG_CMDLINE_TAG
+ char *commandline = getenv("bootargs");
+
+ /* If no bootargs env, just use hdr command line */
+ if (!commandline)
+ commandline = hdr->cmdline;
+
+ /* XXX: in production, you should always use boot.img 's cmdline !!! */
+
+ printf("kernel cmdline: \n\tuse %s command line:\n\t%s \n",
+ getenv("bootargs") ? "uboot" : "boot.img",
+ commandline);
+#endif
+
+ theKernel = (void (*)(int, int, uint))(hdr->kernel_addr);
+
+ initrd_start = hdr->ramdisk_addr;
+ initrd_end = initrd_start + hdr->ramdisk_size;
+
+#if defined (CONFIG_SETUP_MEMORY_TAGS)
+ setup_start_tag(bd);
+#ifdef CONFIG_SERIAL_TAG
+ setup_serial_tag (&params);
+#endif
+#ifdef CONFIG_REVISION_TAG
+ setup_revision_tag (&params);
+#endif
+#ifdef CONFIG_SETUP_MEMORY_TAGS
+ setup_memory_tags (bd);
+#endif
+#ifdef CONFIG_CMDLINE_TAG
+ setup_commandline_tag (bd, commandline);
+#endif
+#ifdef CONFIG_INITRD_TAG
+ if (hdr->ramdisk_size)
+ setup_initrd_tag (bd, initrd_start, initrd_end);
+#endif
+#if defined (CONFIG_VFD) || defined (CONFIG_LCD)
+ setup_videolfb_tag ((gd_t *) gd);
+#endif
+ setup_end_tag (bd);
+#endif
+
+ /* we assume that the kernel is in place */
+ printf ("\nStarting kernel ...\n\n");
+
+#ifdef CONFIG_USB_DEVICE
+ {
+ extern void udc_disconnect (void);
+ udc_disconnect ();
+ }
+#endif
+
+ cleanup_before_linux ();
+
+ theKernel (0, bd->bi_arch_number, bd->bi_boot_params);
+}
#if defined (CONFIG_SETUP_MEMORY_TAGS) || \
defined (CONFIG_CMDLINE_TAG) || \
@@ -277,3 +342,4 @@ static void setup_end_tag (bd_t *bd)
}
#endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG */
+