[OpenWrt-Devel] kernel module runtime configuration

Florian Fainelli florian at openwrt.org
Thu Aug 14 20:43:47 EDT 2014


Hello Brent,

On 08/14/2014 03:45 PM, Brent Thomson wrote:
> Hey all. I'm working on my first Linux kernel module. It's an
> adaptation of an hd44780-over-GPIO driver. You can see it here:
> 
>     https://github.com/brnt/openwrt-hd44780
> 
> The driver is working fine, but I'd like to allow the user to
> configure which GPIOs are used by the driver. Rather than hard-coding
> the values in the C file (as they're currently done) I'd prefer to
> read values from a config file (or the equivalent). Is there a best
> practice for doing this at the kernel level module? In my googling,
> I've seen comments indicating that reading from files at the kernel
> level is a no-no? I'd prefer not to have to pass commands to insmod
> and instead allow a static file (potentially managed by uci). What's
> the right way to do this?

I believe configfs is the prefered interface for specifying such a
configuration. You could take a look at
target/linux/generic/patches-3.10/863-gpiommc.patch to see how you can
leverage this.
--
Florian
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list