Skip to content

Commit

Permalink
powerpc: Check flat device tree version at boot
Browse files Browse the repository at this point in the history
In commit e6a6928 "of/fdt: Convert FDT functions to use libfdt",
the kernel stopped supporting old flat device tree formats. The minimum
supported version is now 0x10.

There was a checking function added, early_init_dt_verify(), but it's
not called on powerpc.

The result is, if you boot with an old flat device tree, the kernel will
fail to parse it correctly, think you have no memory etc. and hilarity
ensues.

We can't really fix it, but we can at least catch the fact that the
device tree is in an unsupported format and panic(). We can't call
BUG(), it's too early.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Michael Ellerman committed Sep 25, 2014
1 parent d6a4f70 commit ad72a27
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/powerpc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,10 @@ void __init early_init_devtree(void *params)

DBG(" -> early_init_devtree(%p)\n", params);

/* Too early to BUG_ON(), do it by hand */
if (!early_init_dt_verify(params))
panic("BUG: Failed verifying flat device tree, bad version?");

/* Setup flat device-tree pointer */
initial_boot_params = params;

Expand Down

0 comments on commit ad72a27

Please sign in to comment.