代码拉取完成,页面将自动刷新
After running make
command, there will be two modules:
The fist module is basic helloworld driver, the second one is the same, but accepts some parameters, and print these in the kernel debug messages. After loading the first module, two entries will be added in kernel debug message:
# insmod ./helloworld.ko
#dmesg
[...]
[38535.487568] Hello world!
[38542.391099] End of the world
For the second module, one loads it with:
# insmod ./helloworld-params.ko
If no parameters are provided, the defaults will be used:
$ dmesg
[...]
[37858.595126] Hello world with parameters!
[37858.595129] The *mystr* parameter: hello
[37858.595130] The *myint* parameter: 1
[37858.595131] The *myarr* parameter: 0, 1, 2
[37887.232643] End of the world
When parameters are provided, the will be printed
# insmod ./helloworld-params.ko mystr="packtpub" myint=255 myarr=23,4,7
# dmesg
[...]
[37892.417968] Hello world with parameters!
[37892.417970] The *mystr* parameter: packtpub
[37892.417971] The *myint* parameter: 255
[37892.417972] The *myarr* parameter: 23, 4, 7
[37895.222808] End of the world
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。