Jeyaram
Jeyaram

Reputation: 9474

Passing an array as command line argument for linux kernel module

I would like to pass an array of data to the Linux kernel module.

In the kernel:

 int a[5]; 
 int count;
 module_param_array(a, int, &count, 0);

But I've no idea how to pass values from the command line. If it is a just variable I will use:

insmod k1.ko a=10 

Upvotes: 8

Views: 7574

Answers (1)

dwalter
dwalter

Reputation: 7468

You can pass arrays via

 insmod k1.ko a=10,20,30,40

see Linux Kernel Module Programming for more information and examples.

Upvotes: 15

Related Questions