All of lore.kernel.org
 help / color / mirror / Atom feed
* Exporting ioctls from out-of-tree module to userspace
@ 2014-07-16 18:57 Daniel Hilst Selli
  2014-07-17  7:06 ` Anupam Kapoor
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Hilst Selli @ 2014-07-16 18:57 UTC (permalink / raw)
  To: kernelnewbies

I write an out-of-tree module and now want to export its ioctls to 
userspace by installing a header that my modules includes, I was looking 
for how to do it but can't get it..

I was trying header-y from 
https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt but got: 
make[1]: *** No rule to make target 'headers_install'.  Stop.

Here is what I'm trying: https://gist.github.com/gkos/b0bc4e29a3147b0e6d3b

I see on kernel that usually the exported headers go in 
include/uapi/SOMETHING and are declared on include/uapi/Kbuild.. but 
have no idea if this may work for out-of-tree modules, the 
headers_install exists on linux Makefile so the 'No rule to make target 
'headers_install'' doesn't make sense to me ..

I try follow headers_install target on kernel's Makefile but only got 
frustraded :(

Any idea?

ps: I compiled the module but don't loaded it, so it may have mistakes

Thanks in advance!
Cheers!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Exporting ioctls from out-of-tree module to userspace
  2014-07-16 18:57 Exporting ioctls from out-of-tree module to userspace Daniel Hilst Selli
@ 2014-07-17  7:06 ` Anupam Kapoor
  2014-07-17 17:18   ` Daniel Hilst Selli
  0 siblings, 1 reply; 3+ messages in thread
From: Anupam Kapoor @ 2014-07-17  7:06 UTC (permalink / raw)
  To: kernelnewbies

hi,

in the older kernels (anything before the commit id mentioned below),
there is include/Kbuild, where you can do something like this:

header-y += ../../quick-hacks/kernel-modules/mymodule/

and then do a  'make headers_install' from the *source* tree, which
seems to do the right thing.

in newer kernels, due to 10b63956fce7f369cc37fd4d994f09bd5203efe4, you
need to do the same thing in include/uapi/Kbuild...

kind regards
anupam


On Thu, Jul 17, 2014 at 12:27 AM, Daniel Hilst Selli
<danielhilst@gmail.com> wrote:
> I write an out-of-tree module and now want to export its ioctls to
> userspace by installing a header that my modules includes, I was looking
> for how to do it but can't get it..
>
> I was trying header-y from
> https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt but got:
> make[1]: *** No rule to make target 'headers_install'.  Stop.
>
> Here is what I'm trying: https://gist.github.com/gkos/b0bc4e29a3147b0e6d3b
>
> I see on kernel that usually the exported headers go in
> include/uapi/SOMETHING and are declared on include/uapi/Kbuild.. but
> have no idea if this may work for out-of-tree modules, the
> headers_install exists on linux Makefile so the 'No rule to make target
> 'headers_install'' doesn't make sense to me ..
>
> I try follow headers_install target on kernel's Makefile but only got
> frustraded :(
>
> Any idea?
>
> ps: I compiled the module but don't loaded it, so it may have mistakes
>
> Thanks in advance!
> Cheers!
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



-- 
In the beginning was the lambda, and the lambda was with Emacs, and
Emacs was the lambda.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Exporting ioctls from out-of-tree module to userspace
  2014-07-17  7:06 ` Anupam Kapoor
@ 2014-07-17 17:18   ` Daniel Hilst Selli
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Hilst Selli @ 2014-07-17 17:18 UTC (permalink / raw)
  To: kernelnewbies

On 07/17/2014 04:06 AM, Anupam Kapoor wrote:
> hi,
>
> in the older kernels (anything before the commit id mentioned below),
> there is include/Kbuild, where you can do something like this:
>
> header-y += ../../quick-hacks/kernel-modules/mymodule/
>
> and then do a  'make headers_install' from the *source* tree, which
> seems to do the right thing.
>
> in newer kernels, due to 10b63956fce7f369cc37fd4d994f09bd5203efe4, you
> need to do the same thing in include/uapi/Kbuild...
>
> kind regards
> anupam
>
>
> On Thu, Jul 17, 2014 at 12:27 AM, Daniel Hilst Selli
> <danielhilst@gmail.com> wrote:
>> I write an out-of-tree module and now want to export its ioctls to
>> userspace by installing a header that my modules includes, I was looking
>> for how to do it but can't get it..
>>
>> I was trying header-y from
>> https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt but got:
>> make[1]: *** No rule to make target 'headers_install'.  Stop.
>>
>> Here is what I'm trying: https://gist.github.com/gkos/b0bc4e29a3147b0e6d3b
>>
>> I see on kernel that usually the exported headers go in
>> include/uapi/SOMETHING and are declared on include/uapi/Kbuild.. but
>> have no idea if this may work for out-of-tree modules, the
>> headers_install exists on linux Makefile so the 'No rule to make target
>> 'headers_install'' doesn't make sense to me ..
>>
>> I try follow headers_install target on kernel's Makefile but only got
>> frustraded :(
>>
>> Any idea?
>>
>> ps: I compiled the module but don't loaded it, so it may have mistakes
>>
>> Thanks in advance!
>> Cheers!
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>

Thanks Anupam,

I put the line
header-y += ../../../module/
on include/uapi/Kbuild

But a nasty thing happens... running `make V=1 headers_install' from 
kernel source gives me this output for my module, which I indented: 
http://pastebin.com/Ev6WcsjR

On second line the nasty thing happens, the scripts/headers_install.sh 
takes two arguments, OUTDIR and SRCDIR. On this line is possible see 
that both are the same, so the header is installed on where it comes from,

Since I have to patch kernel (include/uapi/Kbuild) to add my uapi 
header, I can patch kernel to add my module inside tree intead of using 
out-of-tree modules... Summing up, I'll use sysfs interface which is 
easier to document and use than ioctl :-) and doesn't need uapi headers...

Thanks again Anupam
Cheers,

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-17 17:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-16 18:57 Exporting ioctls from out-of-tree module to userspace Daniel Hilst Selli
2014-07-17  7:06 ` Anupam Kapoor
2014-07-17 17:18   ` Daniel Hilst Selli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.