diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-06-30 14:40:34 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-07-05 14:10:10 +0200 |
commit | 74a67615fb1a2cd3a249e4a6e8871bf7393f0456 (patch) | |
tree | f838e330a88c7fffc1c81fe82119444d1c93a1d8 /commands/Kconfig | |
parent | 75fd6522fbf3095ea5dae2bc54bbd44187ff134a (diff) | |
download | barebox-74a67615fb1a2cd3a249e4a6e8871bf7393f0456.tar.gz |
commands: implement devlookup to find device behind device file
For OF-enabled platforms with aliases, device file naming is pretty much
solved: If there is mmc2 = &something, then we have a mmc2 device and
a /dev/mmc2 device file. For other platforms like x86, EFI-provided
devices are harder to get ahold of. Add a command to make this
straight-forward to do in scripts. The main use of this is probably to
access parameters like nt_signature or guid:
devlookup /dev/disk0 guid
This would print to console, but we have no output capture yet, so add
an optional -v VARIABLE parameter as well to allow easy use from
scripts.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220630124035.4019644-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/Kconfig')
-rw-r--r-- | commands/Kconfig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/commands/Kconfig b/commands/Kconfig index 86e4714849..69d76a9c80 100644 --- a/commands/Kconfig +++ b/commands/Kconfig @@ -75,6 +75,19 @@ config CMD_DEVINFO If called with a device path being the argument, devinfo shows more default information about this device and its parameters. +config CMD_DEVLOOKUP + tristate + prompt "devlookup" + help + Look up device behind device file and its parameters + + devlookup [-v VAR] /dev/DEVICE [parameter] + + Detects the device behind a device file and outputs it, + unless a second argument is given. In that case the device + parameter with that name is looked up. Specifying -v VARIABLE + will write output to VARIABLE instead of printing it. + config CMD_DEVUNBIND tristate prompt "devunbind" |