From 51fae39bd5018e4f6d3e65a1a1a8ad40b5ee3662 Mon Sep 17 00:00:00 2001 From: Saravana Kannan Date: Tue, 1 Sep 2020 15:48:42 -0700 Subject: scripts/dev-needs: Add script to list device dependencies This script can be useful for: - Figuring out the list of modules you need to pack in initrd - Figuring out the list of drivers you need to modularize for a device to be fully functional without building in any dependencies. - Figuring out which drivers to enable first, when porting drivers between kernels (say, to upstream). - Plotting graphs of system dependencies, etc. Usage: dev-needs.sh [-c|-d|-m|-f] [filter options] This script needs to be run on the target device once it has booted to a shell. The script takes as input a list of one or more device directories under /sys/devices and then lists the probe dependency chain (suppliers and parents) of these devices. It does a breadth first search of the dependency chain, so the last entry in the output is close to the root of the dependency chain. By default it lists the full path to the devices under /sys/devices. It also takes an optional modifier flag as the first parameter to change what information is listed in the output. If the requested information is not available, the device name is printed. -c lists the compatible string of the dependencies -d lists the driver name of the dependencies that have probed -m lists the module name of the dependencies that have a module -f list the firmware node path of the dependencies -g list the dependencies as edges and nodes for graphviz -t list the dependencies as edges for tsort The filter options provide a way to filter out some dependencies: --allow-no-driver By default dependencies that don't have a driver attached are ignored. This is to avoid following device links to "class" devices that are created when the consumer probes (as in, not a probe dependency). If you want to follow these links anyway, use this flag. --exclude-devlinks Don't follow device links when tracking probe dependencies. --exclude-parents Don't follow parent devices when tracking probe dependencies. Signed-off-by: Saravana Kannan Link: https://lore.kernel.org/r/20200901224842.1787825-1-saravanak@google.com Signed-off-by: Greg Kroah-Hartman --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'MAINTAINERS') diff --git a/MAINTAINERS b/MAINTAINERS index f0068bceeb61..4e4d9e3f9986 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4994,6 +4994,12 @@ S: Maintained F: drivers/base/devcoredump.c F: include/linux/devcoredump.h +DEVICE DEPENDENCY HELPER SCRIPT +M: Saravana Kannan +L: linux-kernel@vger.kernel.org +S: Maintained +F: scripts/dev-needs.sh + DEVICE DIRECT ACCESS (DAX) M: Dan Williams M: Vishal Verma -- cgit v1.2.3