Re: [PATCH 2/5] of/fdt: add kernel command line option for dtb_compat string

Previous thread: [PATCH 1/5] of: Add support for linking device tree blobs into vmlinux by dirk.brandewie on Tuesday, November 16, 2010 - 3:41 pm. (9 messages)

Next thread: [PATCH 4/5] of/powerpc: Move build to use generic dts->dtb rule by dirk.brandewie on Tuesday, November 16, 2010 - 3:41 pm. (3 messages)
From: dirk.brandewie
Date: Tuesday, November 16, 2010 - 3:41 pm

From: Dirk Brandewie <dirk.brandewie@gmail.com>

Adds a kernel command line option "dtb_compat=<string>" and functions
for architecture/platform specific code to retrieve the command line
string and locate the compatible DTB linked into the kernel

of_flat_dt_get_dtb_compatible_string() returns a pointer string passed
from the command line or a pointer to an empty string.

of_flat_dt_find_compatible_dtb() returns a pointer to a DTB that is
compatible with the "compatible" string or a NULL pointer if no
matching DTB is present.

Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
---
 Documentation/kernel-parameters.txt |    7 +++++
 drivers/of/fdt.c                    |   52 +++++++++++++++++++++++++++++++++++
 include/linux/of_fdt.h              |    4 +++
 3 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index ed45e98..f9b77fa 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -655,6 +655,13 @@ and is between 256 and 4096 characters. It is defined in the file
 
 	dscc4.setup=	[NET]
 
+	dtb_compat=	[KNL]
+			Specify the "compatible" string for the device
+			tree blob present in the kernel image.  This
+			string will be used to select the first device
+			tree blob whose compatible property matches
+			the string passed on the kernel commandline.
+
 	dynamic_printk	Enables pr_debug()/dev_dbg() calls if
 			CONFIG_DYNAMIC_PRINTK_DEBUG has been enabled.
 			These can also be switched on/off via
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index c1360e0..c0858ce 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -15,6 +15,8 @@
 #include <linux/of_fdt.h>
 #include <linux/string.h>
 #include <linux/errno.h>
+#include <asm-generic/vmlinux.lds.h>
+
 
 #ifdef CONFIG_PPC
 #include <asm/machdep.h>
@@ -604,3 +606,53 @@ void __init unflatten_device_tree(void)
 
 	pr_debug(" <- unflatten_device_tree()\n");
 }
+
+#define ...
From: Grant Likely
Date: Tuesday, November 16, 2010 - 5:16 pm

The kernel needs to complain *loudly* if this occurs because it
represents a bug.  I'm tempted to say use BUG, but that would halt the
kernel and prevent any possibility of kernel log output.  WARN_ON() is
probably best.

g.
--

Previous thread: [PATCH 1/5] of: Add support for linking device tree blobs into vmlinux by dirk.brandewie on Tuesday, November 16, 2010 - 3:41 pm. (9 messages)

Next thread: [PATCH 4/5] of/powerpc: Move build to use generic dts->dtb rule by dirk.brandewie on Tuesday, November 16, 2010 - 3:41 pm. (3 messages)