Problem in First-Patch-Tutorial

Alexander Kapshuk alexander.kapshuk at gmail.com
Sun Mar 19 09:23:42 EDT 2017


On Sun, Mar 19, 2017 at 10:53 AM, SIMRAN SINGHAL
<singhalsimran0 at gmail.com> wrote:
> # modinfo iio_dummy_evgen.ko
> filename:
> /home/simran/git/kernels/staging/drivers/iio/dummy/iio_dummy_evgen.ko
> license:        GPL v2
> description:    IIO dummy driver
> author:         Jonathan Cameron <jic23 at kernel.org>
> srcversion:     A8AC238EC07833E018CAF7B
> depends:        industrialio
> intree:         Y
> vermagic:       4.11.0-rc1+ SMP mod_unload modversions
>
>
> $ uname -r
> 4.10.0-rc3+
>
> So, this shows that I need to compile module iio_dummy_evgen.ko for
> kernel version 4.11.0-rc1, so for this I need to build system and
> source tree for this version.
>
> So, I am trying this:-
>  make -C /lib/modules/4.11.0-rc1+/build M=drivers/iio/dummy/ iio_dummy_evgen.ko
>
> But I don't know why I am getting this error:-
> make: Entering directory '/home/simran/git/kernels/staging'
> make[1]: *** No rule to make target 'iio_dummy_evgen.o'.  Stop.
> Makefile:1664: recipe for target 'iio_dummy_evgen.ko' failed
> make: *** [iio_dummy_evgen.ko] Error 2
> make: Leaving directory '/home/simran/git/kernels/staging'
>
>
> On Tue, Mar 14, 2017 at 12:19 AM,  <valdis.kletnieks at vt.edu> wrote:
>> On Mon, 13 Mar 2017 15:38:07 +0530, SIMRAN SINGHAL said:
>>
>>> >> # modinfo iio_dummy_evgen.ko
>>> >> filename:
>>
>>> >> vermagic:       4.11.0-rc1+ SMP mod_unload modversions
>>> >>
>>> >>
>>> >> $ uname -r
>>> >> 4.10.0-rc3+
>>
>>> Greg, I got that I have to build the module against the kernel I am using.
>>> But, How can I do this?
>>
>> You can do this in two different ways:
>>
>> 1) You're running a 4.10.0-rc3+ kernel.  Get the matching 4.10.0-rc3+ source
>> tree and build the module against that.
>>
>> 2) You built the module from a 4.11.0-rc1+ tree.  Build a kernel from that tree,
>> boot that, and then try to load the module.
>>
>>

You're running 4.10.0-rc3+.
Your module is 4.11.0-rc1+.
The command line you supplied shows you attempting to recompile your
module for 4.11.0-rc1+. Your module is already 4.11.0-rc1+.
As has been pointed out before, you need to either:
(a). recompile your module for 4.10.0-rc3+.
(b). or, install and boot into kernel 4.11.0-rc1+, and then try
loading your module.

As a side note, what kernel tree are you developing your driver
against? The location of your staging drivers directory seems
different from Linus' tree:
ls -ld torvalds/drivers/staging/iio/
drwxr-xr-x 14 sasha sasha 4096 Feb 13 21:24 torvalds/drivers/staging/iio/

Finally, please do not top-post.



More information about the Kernelnewbies mailing list