@@ -2,7 +2,7 @@
obj-y = base.o device.o platform.o property.o
obj-$(CONFIG_OF_KOBJ) += kobj.o
obj-$(CONFIG_OF_DYNAMIC) += dynamic.o
-obj-$(CONFIG_OF_FLATTREE) += fdt.o
+obj-$(CONFIG_OF_FLATTREE) += fdt.o fdt_default.dtb.o
obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o
obj-$(CONFIG_OF_PROMTREE) += pdt.o
obj-$(CONFIG_OF_ADDRESS) += address.o
@@ -481,6 +481,26 @@ void *of_fdt_unflatten_tree(const unsigned long *blob,
}
EXPORT_SYMBOL_GPL(of_fdt_unflatten_tree);
+static int __init of_fdt_root_init(void)
+{
+ struct device_node *np;
+
+ if (of_root)
+ return 0;
+
+ if (!of_fdt_unflatten_tree((const unsigned long *)__dtb_fdt_default_begin,
+ NULL, &of_root)) {
+ pr_warn("%s: unflatten default tree failed\n", __func__);
+ return -ENODATA;
+ }
+
+ for_each_of_allnodes(np)
+ __of_attach_node_sysfs(np);
+
+ return 0;
+}
+late_initcall(of_fdt_root_init);
+
/* Everything below here references initial_boot_params directly. */
int __initdata dt_root_addr_cells;
int __initdata dt_root_size_cells;
new file mode 100644
@@ -0,0 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+/ {
+};
@@ -41,6 +41,11 @@ extern struct mutex of_mutex;
extern struct list_head aliases_lookup;
extern struct kset *of_kset;
+#if defined(CONFIG_OF_FLATTREE)
+extern u8 __dtb_fdt_default_begin[];
+extern u8 __dtb_fdt_default_end[];
+#endif
+
#if defined(CONFIG_OF_DYNAMIC)
extern int of_property_notify(int action, struct device_node *np,
struct property *prop, struct property *old_prop);