buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
* Re: [Buildroot] Common header files / code between packages
       [not found] <mailman.2621.1628148096.1752.buildroot@busybox.net>
@ 2021-08-05  8:01 ` Andreas Ziegler
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Ziegler @ 2021-08-05  8:01 UTC (permalink / raw)
  To: buildroot; +Cc: Jacques Samoun

Hi Jacques,

On 2021-08-05 07:21, Jacques Samoun <jacques.samoun33@gmail.com> wrote:

> Hello,
> 
> my development consists of a kernel driver and an companion user space
> layer.
> They are build each in 2 separate packages. Using external tree build.
> 
> The problem is, i would like to share some include files between both
> package (kernel driver and user space layer).

I would:

- build the kernel driver first,
- add an install step that installs common header files into 
$STAGING_DIR/usr/include/<add fancy name here>,
- add this include directory to the configure (if present) or build 
configuration of the user space package(s).

> So far, i solved that by adding a common folder containing the include
> files, and making it part of each package, so it builds OK.

The kernel driver exposes this interface, so should provide the only 
instance of these files.

Kind regards,
Andreas

> 
> Now, a third package, whose code is completely outside the first 2 is
> willing also to use this include file. The only way i found so far, is 
> to
> put explicit relative path referring from one package to the one other, 
> but
> this is ugly. Moreover, the path depends on the version of the 
> packages, so
> can break easily.
> There must be a better way (STAGING DIR ?)  but i couldn't find.
> 
> Can anybody give me an hint ?
> Thanks,
> Jacques
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] Common header files / code between packages
  2021-08-05 15:55     ` Arnout Vandecappelle
@ 2021-08-08  6:53       ` Jacques Samoun
  0 siblings, 0 replies; 5+ messages in thread
From: Jacques Samoun @ 2021-08-08  6:53 UTC (permalink / raw)
  To: Arnout Vandecappelle; +Cc: Buildroot Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 4224 bytes --]

Hi,
Thanks for the suggestion. I was also thinking to a library, as i didn't
like the "ugliness" of my first thought :(
Will go for that and populate the staging dir.

Thanks,
Jacques

On Thu, Aug 5, 2021 at 6:55 PM Arnout Vandecappelle <arnout@mind.be> wrote:

>  Hi Jacques,
>
>  Please reply with the list in Cc. The feedback may be useful for others
> as well.
>
>
> On 05/08/2021 14:46, Jacques Samoun wrote:
> > Thanks Arnout,
> >
> > this seems definitely a better way.
> >
> > Can i ask a subsidiary one: what if you want to share some code package.
> > For example, i crafted a specialized buffers package (1 C file + 1
> header file).
> >
> > Both the user space part and the  driver use this same code (as they
> share
> > buffers and handle them in a consumer/producer mode).
> > My current approach is just that each package gets a copy of this code,
> then it
> > is built.
> > Do you feel this is the right approach ?
>
>  Sharing code between packages is normally done by making it a library and
> installing it to STAGING_DIR. However, this is not possible for sharing
> code
> between the kernel (module) and userspace, because the compiler options for
> building it for the kernel are different from the ones used for userspace.
>
>  However, you could compile it twice as part of the kernel module build:
> once as
> part of the kernel module, and once more (probably in a different
> Makefile) to
> create the library. Then you install that library and it can be used by the
> userspace package.
>
>  It's not exactly trivial to do this (not really difficult either though).
> So if
> this is a private package, you may be better off just copying it, or
> sharing it
> through e.g. a git submodule. Or even just using it from the other's build
> directory, like you suggested before. Ugly but it works :-)
>
>  Regards,
>  Arnout
>
>
> >
> > Jacques
> >
> >
> > On Thu, Aug 5, 2021 at 1:15 PM Arnout Vandecappelle <arnout@mind.be
> > <mailto:arnout@mind.be>> wrote:
> >
> >
> >
> >     On 05/08/2021 09:15, Jacques Samoun wrote:
> >     > Hello,
> >     >
> >     > my development consists of a kernel driver and an companion user
> space layer.
> >     > They are build each in 2 separate packages. Using external tree
> build.
> >     >
> >     > The problem is, i would like to share some include files between
> both
> >     > package (kernel driver and user space layer).
> >     > So far, i solved that by adding a common folder containing the
> include files,
> >     > and making it part of each package, so it builds OK.
> >
> >      I think a more common way is for the kernel module package to also
> install the
> >     shared include files (to $(STAGING_DIR)/usr/include/linux).
> cryptodev-linux is
> >     an example of that.
> >
> >      It's even possible to make the kernel module package build the
> kernel module
> >     only if a kernel is built, and make it to install the headers
> regardless of
> >     whether a kernel is built. That way, you can have a buildroot
> configuration that
> >     only builds the userspace without kernel. fwts is an example of that
> (it doesn't
> >     install headers though).
> >
> >
> >
> >     >
> >     > Now, a third package, whose code is completely outside the first 2
> is willing
> >     > also to use this include file. The only way i found so far, is to
> put explicit
> >     > relative path referring from one package to the one other, but
> this is ugly.
> >     > Moreover, the path depends on the version of the packages, so can
> break
> >     easily.
> >     > There must be a better way (STAGING DIR ?)  but i couldn't find.
> >
> >      Install the headers to $(STAGING_DIR)/usr/include/linux (or
> /usr/include if
> >     that is more appropriate).
> >
> >
> >      Regards,
> >      Arnout
> >
> >     >
> >     > Can anybody give me an hint ?
> >     > Thanks,
> >     > Jacques
> >     >
> >     >
> >     >
> >     >
> >     >
> >     > _______________________________________________
> >     > buildroot mailing list
> >     > buildroot@busybox.net <mailto:buildroot@busybox.net>
> >     > http://lists.busybox.net/mailman/listinfo/buildroot
> >     <http://lists.busybox.net/mailman/listinfo/buildroot>
> >     >
> >
>

[-- Attachment #1.2: Type: text/html, Size: 5777 bytes --]

[-- Attachment #2: Type: text/plain, Size: 145 bytes --]

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] Common header files / code between packages
       [not found]   ` <CACaKL1wAxCZptaDqUxWdpx4VZTDisRRsOOvDC76HACjwg44kmA@mail.gmail.com>
@ 2021-08-05 15:55     ` Arnout Vandecappelle
  2021-08-08  6:53       ` Jacques Samoun
  0 siblings, 1 reply; 5+ messages in thread
From: Arnout Vandecappelle @ 2021-08-05 15:55 UTC (permalink / raw)
  To: Jacques Samoun, Buildroot Mailing List

 Hi Jacques,

 Please reply with the list in Cc. The feedback may be useful for others as well.


On 05/08/2021 14:46, Jacques Samoun wrote:
> Thanks Arnout,
> 
> this seems definitely a better way. 
> 
> Can i ask a subsidiary one: what if you want to share some code package.
> For example, i crafted a specialized buffers package (1 C file + 1 header file).
> 
> Both the user space part and the  driver use this same code (as they share
> buffers and handle them in a consumer/producer mode).
> My current approach is just that each package gets a copy of this code, then it
> is built.
> Do you feel this is the right approach ?

 Sharing code between packages is normally done by making it a library and
installing it to STAGING_DIR. However, this is not possible for sharing code
between the kernel (module) and userspace, because the compiler options for
building it for the kernel are different from the ones used for userspace.

 However, you could compile it twice as part of the kernel module build: once as
part of the kernel module, and once more (probably in a different Makefile) to
create the library. Then you install that library and it can be used by the
userspace package.

 It's not exactly trivial to do this (not really difficult either though). So if
this is a private package, you may be better off just copying it, or sharing it
through e.g. a git submodule. Or even just using it from the other's build
directory, like you suggested before. Ugly but it works :-)

 Regards,
 Arnout


> 
> Jacques
> 
> 
> On Thu, Aug 5, 2021 at 1:15 PM Arnout Vandecappelle <arnout@mind.be
> <mailto:arnout@mind.be>> wrote:
> 
> 
> 
>     On 05/08/2021 09:15, Jacques Samoun wrote:
>     > Hello,
>     >
>     > my development consists of a kernel driver and an companion user space layer.
>     > They are build each in 2 separate packages. Using external tree build.
>     >
>     > The problem is, i would like to share some include files between both
>     > package (kernel driver and user space layer).
>     > So far, i solved that by adding a common folder containing the include files,
>     > and making it part of each package, so it builds OK.
> 
>      I think a more common way is for the kernel module package to also install the
>     shared include files (to $(STAGING_DIR)/usr/include/linux). cryptodev-linux is
>     an example of that.
> 
>      It's even possible to make the kernel module package build the kernel module
>     only if a kernel is built, and make it to install the headers regardless of
>     whether a kernel is built. That way, you can have a buildroot configuration that
>     only builds the userspace without kernel. fwts is an example of that (it doesn't
>     install headers though).
> 
> 
> 
>     >
>     > Now, a third package, whose code is completely outside the first 2 is willing
>     > also to use this include file. The only way i found so far, is to put explicit
>     > relative path referring from one package to the one other, but this is ugly.
>     > Moreover, the path depends on the version of the packages, so can break
>     easily.
>     > There must be a better way (STAGING DIR ?)  but i couldn't find.
> 
>      Install the headers to $(STAGING_DIR)/usr/include/linux (or /usr/include if
>     that is more appropriate).
> 
> 
>      Regards,
>      Arnout
> 
>     >
>     > Can anybody give me an hint ?
>     > Thanks,
>     > Jacques
>     >
>     >
>     >
>     >
>     >
>     > _______________________________________________
>     > buildroot mailing list
>     > buildroot@busybox.net <mailto:buildroot@busybox.net>
>     > http://lists.busybox.net/mailman/listinfo/buildroot
>     <http://lists.busybox.net/mailman/listinfo/buildroot>
>     >
> 
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] Common header files / code between packages
  2021-08-05  7:15 Jacques Samoun
@ 2021-08-05 10:15 ` Arnout Vandecappelle
       [not found]   ` <CACaKL1wAxCZptaDqUxWdpx4VZTDisRRsOOvDC76HACjwg44kmA@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Arnout Vandecappelle @ 2021-08-05 10:15 UTC (permalink / raw)
  To: Jacques Samoun, buildroot



On 05/08/2021 09:15, Jacques Samoun wrote:
> Hello,
> 
> my development consists of a kernel driver and an companion user space layer.
> They are build each in 2 separate packages. Using external tree build.
> 
> The problem is, i would like to share some include files between both
> package (kernel driver and user space layer).
> So far, i solved that by adding a common folder containing the include files,
> and making it part of each package, so it builds OK.

 I think a more common way is for the kernel module package to also install the
shared include files (to $(STAGING_DIR)/usr/include/linux). cryptodev-linux is
an example of that.

 It's even possible to make the kernel module package build the kernel module
only if a kernel is built, and make it to install the headers regardless of
whether a kernel is built. That way, you can have a buildroot configuration that
only builds the userspace without kernel. fwts is an example of that (it doesn't
install headers though).



> 
> Now, a third package, whose code is completely outside the first 2 is willing
> also to use this include file. The only way i found so far, is to put explicit
> relative path referring from one package to the one other, but this is ugly.
> Moreover, the path depends on the version of the packages, so can break easily.
> There must be a better way (STAGING DIR ?)  but i couldn't find.

 Install the headers to $(STAGING_DIR)/usr/include/linux (or /usr/include if
that is more appropriate).


 Regards,
 Arnout

> 
> Can anybody give me an hint ?
> Thanks,
> Jacques
> 
> 
> 
> 
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
> 
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* [Buildroot] Common header files / code between packages
@ 2021-08-05  7:15 Jacques Samoun
  2021-08-05 10:15 ` Arnout Vandecappelle
  0 siblings, 1 reply; 5+ messages in thread
From: Jacques Samoun @ 2021-08-05  7:15 UTC (permalink / raw)
  To: buildroot


[-- Attachment #1.1: Type: text/plain, Size: 832 bytes --]

Hello,

my development consists of a kernel driver and an companion user space
layer.
They are build each in 2 separate packages. Using external tree build.

The problem is, i would like to share some include files between both
package (kernel driver and user space layer).
So far, i solved that by adding a common folder containing the include
files, and making it part of each package, so it builds OK.

Now, a third package, whose code is completely outside the first 2 is
willing also to use this include file. The only way i found so far, is to
put explicit relative path referring from one package to the one other, but
this is ugly. Moreover, the path depends on the version of the packages, so
can break easily.
There must be a better way (STAGING DIR ?)  but i couldn't find.

Can anybody give me an hint ?
Thanks,
Jacques

[-- Attachment #1.2: Type: text/html, Size: 1072 bytes --]

[-- Attachment #2: Type: text/plain, Size: 145 bytes --]

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

end of thread, other threads:[~2021-08-08  6:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.2621.1628148096.1752.buildroot@busybox.net>
2021-08-05  8:01 ` [Buildroot] Common header files / code between packages Andreas Ziegler
2021-08-05  7:15 Jacques Samoun
2021-08-05 10:15 ` Arnout Vandecappelle
     [not found]   ` <CACaKL1wAxCZptaDqUxWdpx4VZTDisRRsOOvDC76HACjwg44kmA@mail.gmail.com>
2021-08-05 15:55     ` Arnout Vandecappelle
2021-08-08  6:53       ` Jacques Samoun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).