开发者

how can I change a variable I added to the kernel from an LKM?

开发者 https://www.devze.com 2023-02-19 00:17 出处:网络
I am starting learning with a very basic \"hello world\" LKM, plus I have added functionality to the kernel and successfully recompiled and it works.

I am starting learning with a very basic "hello world" LKM, plus I have added functionality to the kernel and successfully recompiled and it works. What I like to do now is add a variable to the compiled kernel code, then from my LKM be able to change that variable when I load and unload module. This way I can s开发者_运维技巧tart and stop the kernel functionality without recompile. any suggestion?

thank you


Two solutions :
1) expose the variable to userspace via proc/sysfs (preferred way)
2) use a character device driver to send an ioctl.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号