How can I obtain the kernel command line from a Linux kernel module?
This can be achieved by reading /proc/cmdline, but it seems like there must be an easier way to access the command line from a kernel module than to open and read a file.
Do you actually need to access the enture kernel command line, or just a few parameters?
You could prefix each salient parameter with your module's name.
my_module.my_variable=value
Then your kernel module can retrieve it using the module_param() macro, as described in Passing Command Line Arguments to a Module
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With