On 12/28/05, Fawad Lateef <fawadlateef@xxxxxxxxx> wrote:
On 12/28/05, Badari Prasad <h.badari@xxxxxxxxx> wrote:
> On 12/28/05, Fawad Lateef <fawadlateef@xxxxxxxxx > wrote:
> > On 12/28/05, Badari Prasad < h.badari@xxxxxxxxx> wrote:
> > > Hello ,
> > > I am learning linux kernel module programming in linux kernel
> 2.6.5 (
> > > fedora core 2 ), i have encountered a problem in passing command line
> > > parameters to a module, this is the programme in which i encountered a
> > > problem,
> > >
> > <snip>
> > >
> > >
> > > Im refering to this site for kernel module programming
> > >
> > > http://www.tldp.org/LDP/lkmpg/2.6/html/index.html
> > > The problem is given in chapter 2.6 in hte above site
> > >
> > > Please do help me in this regard, thanks in advance.
> > >
> >
> > What specific problem you are facing? you havn't mentioned about the
> > problem because this code looks fine to me and its same as example
> > code of the link you mentioned.
> >
> This is the error which i got when i tired to compile the code
> hello-5.c , the same code which i mentioned to day morning,
>
> [root in lkmpg-examples-2.6: 14:04:06]#make
> make -C /lib/modules/2.6.5-1.358/build M=/root/WORK/lkmpg-examples-2.6
> modules
> make[1]: Entering directory `/lib/modules/2.6.5-1.358/build'
> CC [M] /root/WORK/lkmpg- examples-2.6/hello-5.o
> /root/WORK/lkmpg-examples-2.6/hello-5.c:14: error: stray '\342' in program
> /root/WORK/lkmpg-examples-2.6/hello-5.c:14: error: stray '\210' in program
> /root/WORK/lkmpg-examples-2.6 /hello-5.c:14: error: stray '\222' in program
> /root/WORK/lkmpg-examples-2.6/hello-5.c:14: error: stray '\342' in program
> /root/WORK/lkmpg-examples-2.6/hello-5.c:14: error: stray '\210' in program
> /root/WORK/lkmpg- examples-2.6/hello-5.c:14: error: stray '\222' in program
> /root/WORK/lkmpg-examples-2.6/hello-5.c:29: error: invalid lvalue in unary
> `&'
> /root/WORK/lkmpg-examples-2.6/hello-5.c:29: error: initializer element is
> not constant
> /root/WORK/lkmpg-examples-2.6/hello-5.c:29: error: (near initialization for
> `__param_arr_myintArray.num')
> make[2]: *** [/root/WORK/lkmpg-examples-2.6/hello-5.o] Error 1
> make[1]: *** [/root/WORK/lkmpg- examples-2.6] Error 2
> make[1]: Leaving directory `/lib/modules/2.6.5-1.358/build'
> make: *** [all] Error 2
>
> and one more doubt in the code , i did not find <linux/moduleparam.h> file
> in the source code and in the /usr/include/linux directory. Instead of
> moduleparam.h file i found param.h file, can i include it ,
>
The code is working I tested that on kernel 2.6.12 .... You just have
to remove & (address of operator) from this line:
module_param_array(myintArray, int, &arr_argc, 0000); and also check
your makefile !
--
Fawad Lateef
Hi Fawad,
the code does not work on 2.6.5, it works on 2.6.12, what should i do for it to work on 2.6.5
Regards,
Badari.