Commit 48aead71c1ad2c93fffa182e798f1bcbb5f6dd9d

Authored by Suriyan Ramasami
Committed by Tom Rini
1 parent 8b923a56dc

fdt: Allow non-FDT kernels to boot when CONFIG_OF_LIBFDT is defined

The boot commands - bootz/bootm mandate a third argument which is the
address to the FDT blob. In cases where this argument is not specified,
boot fails with a message indicating a missing FDT.

This causes non-FDT kernels to fail to boot. This patch allows both FDT
and non-FDT kernels to boot by making the third parameter to the bootm/bootz
optional.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
[trini: Update again for covering appended DTB case after last revert in
this area]
Signed-off-by: Tom Rini <trini@ti.com>

Showing 1 changed file with 11 additions and 4 deletions Side-by-side Diff

... ... @@ -237,6 +237,7 @@
237 237 int fdt_noffset;
238 238 #endif
239 239 const char *select = NULL;
  240 + int ok_no_fdt = 0;
240 241  
241 242 *of_flat_tree = NULL;
242 243 *of_size = 0;
... ... @@ -309,7 +310,7 @@
309 310 fdt_addr);
310 311 fdt_hdr = image_get_fdt(fdt_addr);
311 312 if (!fdt_hdr)
312   - goto error;
  313 + goto no_fdt;
313 314  
314 315 /*
315 316 * move image data to the load address,
... ... @@ -379,7 +380,7 @@
379 380 break;
380 381 default:
381 382 puts("ERROR: Did not find a cmdline Flattened Device Tree\n");
382   - goto error;
  383 + goto no_fdt;
383 384 }
384 385  
385 386 printf(" Booting using the fdt blob at %#08lx\n", fdt_addr);
386 387  
... ... @@ -413,11 +414,11 @@
413 414 }
414 415 } else {
415 416 debug("## No Flattened Device Tree\n");
416   - return 0;
  417 + goto no_fdt;
417 418 }
418 419 } else {
419 420 debug("## No Flattened Device Tree\n");
420   - return 0;
  421 + goto no_fdt;
421 422 }
422 423  
423 424 *of_flat_tree = fdt_blob;
424 425  
... ... @@ -427,9 +428,15 @@
427 428  
428 429 return 0;
429 430  
  431 +no_fdt:
  432 + ok_no_fdt = 1;
430 433 error:
431 434 *of_flat_tree = NULL;
432 435 *of_size = 0;
  436 + if (!select && ok_no_fdt) {
  437 + debug("Continuing to boot without FDT\n");
  438 + return 0;
  439 + }
433 440 return 1;
434 441 }
435 442