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] <list of devices>
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 <saravanak@google.com>
Link: https://lore.kernel.org/r/20200901224842.1787825-1-saravanak@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>