Skip to contentSkip to conversation

Remove empty /proc/device-tree when no openfirmware exists.

PATCH Dave Jones 2 participants 2 messages May 14, 2012 – Dec 17, 2013 Proc filesystem

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

distribution kernels might want to build in support for /proc/device-tree for kernels that might end up running on hardware that doesn't support openfirmware. This results in an empty /proc/device-tree existing.
Remove it if the OFW root node doesn't exist.

[This situation actually confuses grub2, resulting in install failures.
grub2 sees the /proc/device-tree and picks the wrong install target
cf. http://bzr.savannah.gnu.org/lh/grub/trunk/grub/annotate/4300/util/grub-install.in#L311
grub should be more robust, but still, leaving an empty proc dir seems pointless. ]

fs/proc/proc_devtree.c +1 -0
index 927cbd1..f060f28 100644
@@ -233,6 +233,7 @@ void __init proc_device_tree_init(void)
 		return;
 	root = of_find_node_by_path("/");
 	if (root == NULL) {
+		remove_proc_entry("device-tree", NULL);
 		pr_debug("/proc/device-tree: can't find root\n");
 		return;
 	}
#1 lore raw
Quoted 11 lines · Dave Jones

distribution kernels might want to build in support for /proc/device-tree for kernels that might end up running on hardware that doesn't support openfirmware. This results in an empty /proc/device-tree existing.
Remove it if the OFW root node doesn't exist.

[This situation actually confuses grub2, resulting in install failures.
grub2 sees the /proc/device-tree and picks the wrong install target
cf. http://bzr.savannah.gnu.org/lh/grub/trunk/grub/annotate/4300/util/grub-install.in#L311
grub should be more robust, but still, leaving an empty proc dir seems pointless. ]

We're still carrying this in Fedora for
https://bugzilla.redhat.com/show_bug.cgi?id=818378 . Can we get this upstream sometime soon?

josh

Quoted 17 lines
fs/proc/proc_devtree.c +1 -1
index 927cbd1..f060f28 100644
@@ -233,6 +233,7 @@ void __init proc_device_tree_init(void)
                return;
        root = of_find_node_by_path("/");
        if (root == NULL) {
+               remove_proc_entry("device-tree", NULL);
                pr_debug("/proc/device-tree: can't find root\n");
                return;
        }
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/