]> git.sur5r.net Git - u-boot/blobdiff - lib_ppc/bootm.c
[new uImage] Disable debuging output in preparation for merge with master
[u-boot] / lib_ppc / bootm.c
index 4d8ef355260d761762e190e65a50f3fe291e0565..89463e342f0f4accb4175ed1f67961986b397205 100644 (file)
@@ -23,7 +23,6 @@
  * MA 02111-1307 USA
  */
 
-#define DEBUG
 
 #include <common.h>
 #include <watchdog.h>
@@ -150,8 +149,12 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
                ep = image_get_ep (images->legacy_hdr_os);
 #if defined(CONFIG_FIT)
        } else if (images->fit_uname_os) {
-               fit_unsupported_reset ("PPC linux bootm");
-               goto error;
+               ret = fit_image_get_entry (images->fit_hdr_os,
+                               images->fit_noffset_os, &ep);
+               if (ret) {
+                       puts ("Can't get entry point property!\n");
+                       goto error;
+               }
 #endif
        } else {
                puts ("Could not find kernel entry point!\n");
@@ -411,7 +414,7 @@ static int boot_get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
         const char      *fit_uname_config = NULL;
         const char      *fit_uname_fdt = NULL;
        ulong           default_addr;
-       int             conf_noffset;
+       int             cfg_noffset;
        int             fdt_noffset;
        const void      *data;
        size_t          size;
@@ -420,35 +423,67 @@ static int boot_get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
        *of_flat_tree = NULL;
        *of_size = 0;
 
-       if (argc > 3) {
+       if (argc > 3 || genimg_has_config (images)) {
 #if defined(CONFIG_FIT)
-               /*
-                * If the FDT blob comes from the FIT image and the FIT image
-                * address is omitted in the command line argument, try to use
-                * ramdisk or os FIT image address or default load address.
-                */
-               if (images->fit_uname_rd)
-                       default_addr = (ulong)images->fit_hdr_rd;
-               else if (images->fit_uname_os)
-                       default_addr = (ulong)images->fit_hdr_os;
-               else
-                       default_addr = load_addr;
-
-               if (fit_parse_conf (argv[3], default_addr,
-                                       &fdt_addr, &fit_uname_config)) {
-                       debug ("*  fdt: config '%s' from image at 0x%08lx\n",
-                                       fit_uname_config, fdt_addr);
-               } else if (fit_parse_subimage (argv[3], default_addr,
-                                       &fdt_addr, &fit_uname_fdt)) {
-                       debug ("*  fdt: subimage '%s' from image at 0x%08lx\n",
-                                       fit_uname_fdt, fdt_addr);
-               } else
+               if (argc > 3) {
+                       /*
+                        * If the FDT blob comes from the FIT image and the
+                        * FIT image address is omitted in the command line
+                        * argument, try to use ramdisk or os FIT image
+                        * address or default load address.
+                        */
+                       if (images->fit_uname_rd)
+                               default_addr = (ulong)images->fit_hdr_rd;
+                       else if (images->fit_uname_os)
+                               default_addr = (ulong)images->fit_hdr_os;
+                       else
+                               default_addr = load_addr;
+
+                       if (fit_parse_conf (argv[3], default_addr,
+                                               &fdt_addr, &fit_uname_config)) {
+                               debug ("*  fdt: config '%s' from image at 0x%08lx\n",
+                                               fit_uname_config, fdt_addr);
+                       } else if (fit_parse_subimage (argv[3], default_addr,
+                                               &fdt_addr, &fit_uname_fdt)) {
+                               debug ("*  fdt: subimage '%s' from image at 0x%08lx\n",
+                                               fit_uname_fdt, fdt_addr);
+                       } else
 #endif
-               {
-                       fdt_addr = simple_strtoul(argv[3], NULL, 16);
-                       debug ("*  fdt: cmdline image address = 0x%08lx\n",
-                                       fdt_addr);
+                       {
+                               fdt_addr = simple_strtoul(argv[3], NULL, 16);
+                               debug ("*  fdt: cmdline image address = 0x%08lx\n",
+                                               fdt_addr);
+                       }
+#if defined(CONFIG_FIT)
+               } else {
+                       /* use FIT configuration provided in first bootm
+                        * command argument
+                        */
+                       fdt_addr = (ulong)images->fit_hdr_os;
+                       fit_uname_config = images->fit_uname_cfg;
+                       debug ("*  fdt: using config '%s' from image at 0x%08lx\n",
+                                       fit_uname_config, fdt_addr);
+
+                       /*
+                        * Check whether configuration has FDT blob defined,
+                        * if not quit silently.
+                        */
+                       fit_hdr = (void *)fdt_addr;
+                       cfg_noffset = fit_conf_get_node (fit_hdr,
+                                       fit_uname_config);
+                       if (cfg_noffset < 0) {
+                               debug ("*  fdt: no such config\n");
+                               return 0;
+                       }
+
+                       fdt_noffset = fit_conf_get_fdt_node (fit_hdr,
+                                       cfg_noffset);
+                       if (fdt_noffset < 0) {
+                               debug ("*  fdt: no fdt in config\n");
+                               return 0;
+                       }
                }
+#endif
 
                debug ("## Checking for 'FDT'/'FDT Image' at %08lx\n",
                                fdt_addr);
@@ -518,13 +553,21 @@ static int boot_get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
                                         * fit_conf_get_node() will try to
                                         * find default config node
                                         */
-                                       conf_noffset = fit_conf_get_node (fit_hdr,
+                                       cfg_noffset = fit_conf_get_node (fit_hdr,
                                                        fit_uname_config);
-                                       if (conf_noffset < 0)
+
+                                       if (cfg_noffset < 0) {
+                                               fdt_error ("Could not find configuration node\n");
                                                goto error;
+                                       }
+
+                                       fit_uname_config = fdt_get_name (fit_hdr,
+                                                       cfg_noffset, NULL);
+                                       printf ("   Using '%s' configuration\n",
+                                                       fit_uname_config);
 
                                        fdt_noffset = fit_conf_get_fdt_node (fit_hdr,
-                                                       conf_noffset);
+                                                       cfg_noffset);
                                        fit_uname_fdt = fit_get_name (fit_hdr,
                                                        fdt_noffset, NULL);
                                } else {
@@ -532,8 +575,10 @@ static int boot_get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
                                        fdt_noffset = fit_image_get_node (fit_hdr,
                                                        fit_uname_fdt);
                                }
-                               if (fdt_noffset < 0)
+                               if (fdt_noffset < 0) {
+                                       fdt_error ("Could not find subimage node\n");
                                        goto error;
+                               }
 
                                printf ("   Trying '%s' FDT blob subimage\n",
                                                fit_uname_fdt);