Merge branch 'mpc86xx'
[platform/kernel/u-boot.git] / common / cmd_bootm.c
index aeb7842..f1c0eb4 100644 (file)
@@ -38,6 +38,8 @@
 #include <ft_build.h>
 #endif
 
+DECLARE_GLOBAL_DATA_PTR;
+
  /*cmd_boot.c*/
  extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 
@@ -463,13 +465,19 @@ U_BOOT_CMD(
        "[addr [arg ...]]\n    - boot application image stored in memory\n"
        "\tpassing arguments 'arg ...'; when booting a Linux kernel,\n"
        "\t'arg' can be the address of an initrd image\n"
+#ifdef CONFIG_OF_FLAT_TREE
+       "\tWhen booting a Linux kernel which requires a flat device-tree\n"
+       "\ta third argument is required which is the address of the of the\n"
+       "\tdevice-tree blob. To boot that kernel without an initrd image,\n"
+       "\tuse a '-' for the second argument. If you do not pass a third\n"
+       "\ta bd_info struct will be passed instead\n"
+#endif
 );
 
 #ifdef CONFIG_SILENT_CONSOLE
 static void
 fixup_silent_linux ()
 {
-       DECLARE_GLOBAL_DATA_PTR;
        char buf[256], *start, *end;
        char *cmdline = getenv ("bootargs");
 
@@ -499,11 +507,6 @@ fixup_silent_linux ()
 }
 #endif /* CONFIG_SILENT_CONSOLE */
 
-#ifdef CONFIG_OF_FLAT_TREE
-extern const unsigned char oftree_dtb[];
-extern const unsigned int oftree_dtb_len;
-#endif
-
 #ifdef CONFIG_PPC
 static void
 do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
@@ -512,8 +515,6 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
                ulong   *len_ptr,
                int     verify)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        ulong   sp;
        ulong   len, checksum;
        ulong   initrd_start, initrd_end;
@@ -617,7 +618,17 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
        /*
         * Check if there is an initrd image
         */
+
+#ifdef CONFIG_OF_FLAT_TREE
+       /* Look for a '-' which indicates to ignore the ramdisk argument */
+       if (argc >= 3 && strcmp(argv[2], "-") ==  0) {
+                       debug ("Skipping initrd\n");
+                       data = 0;
+               }
+       else
+#endif
        if (argc >= 3) {
+               debug ("Not skipping initrd\n");
                SHOW_BOOT_PROGRESS (9);
 
                addr = simple_strtoul(argv[2], NULL, 16);
@@ -725,6 +736,15 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
                len = data = 0;
        }
 
+#ifdef CONFIG_OF_FLAT_TREE
+       if (argc >= 3)
+       {
+               of_flat_tree = (char *) simple_strtoul(argv[3], NULL, 16);
+               printf ("Booting using flat device tree at 0x%x\n",
+                               of_flat_tree);
+       }
+#endif
+
        if (!data) {
                debug ("No initrd\n");
        }
@@ -794,15 +814,6 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
                initrd_end = 0;
        }
 
-#ifdef CONFIG_OF_FLAT_TREE
-       if (initrd_start == 0)
-               of_flat_tree = (char *)(((ulong)kbd - OF_FLAT_TREE_MAX_SIZE -
-                                       sizeof(bd_t)) & ~0xF);
-       else
-               of_flat_tree = (char *)((initrd_start - OF_FLAT_TREE_MAX_SIZE -
-                                       sizeof(bd_t)) & ~0xF);
-#endif
-
        debug ("## Transferring control to Linux (at address %08lx) ...\n",
                (ulong)kernel);
 
@@ -825,7 +836,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
        (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
 
 #else
-       ft_setup(of_flat_tree, OF_FLAT_TREE_MAX_SIZE, kbd, initrd_start, initrd_end);
+       ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
        /* ft_dump_blob(of_flat_tree); */
 
 #if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
@@ -856,8 +867,6 @@ do_bootm_netbsd (cmd_tbl_t *cmdtp, int flag,
                ulong   *len_ptr,
                int     verify)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        image_header_t *hdr = &header;
 
        void    (*loader)(bd_t *, image_header_t *, char *, char *);
@@ -941,7 +950,6 @@ do_bootm_artos (cmd_tbl_t *cmdtp, int flag,
                ulong   *len_ptr,
                int     verify)
 {
-       DECLARE_GLOBAL_DATA_PTR;
        ulong top;
        char *s, *cmdline;
        char **fwenv, **ss;
@@ -1370,7 +1378,6 @@ static void
 do_bootm_rtems (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
                ulong addr, ulong *len_ptr, int verify)
 {
-       DECLARE_GLOBAL_DATA_PTR;
        image_header_t *hdr = &header;
        void    (*entry_point)(bd_t *);