Problem in First-Patch-Tutorial
Alexander Kapshuk
alexander.kapshuk at gmail.com
Sun Mar 12 14:35:13 EDT 2017
On Sun, Mar 12, 2017 at 8:20 PM, SIMRAN SINGHAL
<singhalsimran0 at gmail.com> wrote:
> On Sun, Mar 12, 2017 at 10:15 PM, Alexander Kapshuk
> <alexander.kapshuk at gmail.com> wrote:
>> On Sun, Mar 12, 2017 at 5:34 PM, <valdis.kletnieks at vt.edu> wrote:
>>> On Sun, 12 Mar 2017 15:49:31 +0200, Alexander Kapshuk said:
>>>
>>>> Are these drivers, drivers/iio/dummy/{iio_dummy_evgen,iio_dummy}.ko,
>>>> something of your own making, as I'm not seeing them in the kernel
>>>> source tree?
>>>>
>>>> The 'modules_install' make target installs drivers that have been
>>>> compiled as modules as opposed to those compiled into the kernel, into
>>>> /lib/modules/`uname -r`. For your own modules added to the kernel
>>>> source tree, or built out-of-tree, that would involve putting
>>>> appropriate entries into Kconfig and/or Makefiles.
>>>>
>>>> Modeprobe expects your module to be found in /lib/modules/`uname -r`.
>>>> Otherwise, your module won't get loaded.
>>>
>>> One other thing to remember is that although 'make modules_install' will
>>> take all the .ko files from in-tree modules and put them in their proper
>>> place in /lib/modules/`uname-r` and then run 'depmod', many out-of-tree
>>> Makefiles manage to forget to do that last step.
>>>
>>> modprobe is a wrapper around insmod - and the file produced by 'depmod'
>>> are what the wrapper uses to find the module.
>>
>> Thanks for elaborating on that.
>
> Still not working
>
> First I executed following commands:-
>
> $ make drivers/iio/dummy/iio_dummy_evgen.ko
> $ make drivers/iio/dummy/iio_dummy.ko
>
> Above commands executed successfully
>
> Then I run following command:
> $ insmod iio_dummy_evgen.ko
>
> Getting following error:
> insmod: ERROR: could not load module iio_dummy_evgen.ko: No such file
> or directory
>
> And, then I try executing them from driver/staging/dummy and then I
> got this error:
> insmod: ERROR: could not insert module iio_dummy_evgen.ko: Operation
> not permitted
You have to run insmod as user root. Either specify the full path to
your module, or cd into the directory where the module is and run
insmod from there.
More information about the Kernelnewbies
mailing list