sudo modprobe someDriver Param1=123 Param2=456
OR sudo insmod ./someDriver.ko Param1=123 Param2=456
//.......
static int Param1= 0;
static int Param2 = 1;
module_param( Param1, int, 0 );
module_param( Param2, int, 0 );
//.........
static int __init test_init(void)
{
printk(KERN_INFO "Param1 = %d \n", Param1);
printk(KERN_INFO "Param2 = %d \n", Param2);
printk(KERN_INFO "Kernel Module Loaded Successfully...\n");
return 0;
}
static void __exit test_exit(void)
{
printk(KERN_INFO "Kernel Module Removed Successfully...\n");
}
module_init(test_init);
module_exit(test_exit);
sudo modprobe someDriver Param1=123 Param2=456
Param1=123
Param2=456
Kernel Module Loaded Successfully...
My understanding is that the macro module_param( variable_name, type, permission ) handles this ...
For permission you used 0. I think that's your problem. Try it like this:Code: [Select]module_param( Param1, int, 0 );
module_param( Param2, int, 0 );
module_param( Param1, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP );
module_param( Param2, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP );
1 GHz DMP Vortex86DX3 Processor (Dual core) CPU |
2 GB DDR3-LV System RAM |
Low Power |
10 Year Availability |
Rugged Design for Demanding Environments |
-40°C to +85°C Operating Temperature Range |
PC/104-Plus Small Form Factor |
Shock and Vibration Tested |
Connectivity and I/O for Embedded Systems |
Dual Ethernet (1x Fast Ethernet, 1x Gigabit) |
4x USB 2.0 |
24x GPIO 5V with Event Sense |
4x Serial Ports (2x RS-232, 2x RS-232/422/485) |
Parallel Port LPT |
Audio |
Graphics Support |
Dual video output (VGA, LVDS with digital backlight dimmer) |
int Param1, Param2;
to this:static int Param1=10;
static int Param2=20;
static int Param1=10;
static int Param2=20;
make
sudo make install
sudo modprobe test Param1=345 Param2=759
sudo insmod ./test.ko Param1=345 Param2=567
Param1=345
Param2=567
... Case Closed...Not so fast. Now that I know the problem wasn't the code, but a problem with the busybox loaders, I decided to
options hello-5 myint=7
Then I ran:modprobe hello-5
Checking dmesg showed that myint had been changed from 1 to 7. So the busybox version of modprobe checks... modprobe looks through the kernel command line (/proc/cmdline) and
collects module parameters when it loads a module ...
hello-5.myint=7
sudo modprobe ipv6 disable_ipv6=1
cat /sys/module/ipv6/parameters/disable_ipv6
1
tc@box:~$ sudo modprobe usblp
tc@box:~$ cat /sys/module/usblp/parameters/proto_bias
-1
tc@box:~$ sudo modprobe -r usblp
tc@box:~$ sudo modprobe usblp proto_bias=1
tc@box:~$ cat /sys/module/usblp/parameters/proto_bias
-1
tc@box:~$
# /etc/modprobe.conf: Modeprobe config file.
#
options test Param1=345 Param2=789
#orignal
DEFAULT core
LABEL core
KERNEL /tce/boot/vmlinuz
INITRD /tce/boot/coregz
APPEND quiet syslog waitsub=5:UUID="some long guid" tce=UUID="some long guid"
#new
DEFAULT core
LABEL core
KERNEL /tce/boot/vmlinuz
INITRD /tce/boot/coregz
APPEND quiet syslog test.Param1=111 test.Param2=222 waitsub=5:UUID="some long guid" tce=UUID="some long guid"
#run as root
modeprobe test
#run as root
insmod ./test.ko
insmod dose not use the bootcode nor dose it use modprobe.conf, the values in dmesg were the default value for the test module program