linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools: iio: add ability to pass kernel headers
@ 2017-04-11 11:06 Sekhar Nori
  2017-04-14 14:42 ` Jonathan Cameron
  0 siblings, 1 reply; 7+ messages in thread
From: Sekhar Nori @ 2017-04-11 11:06 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio, linux-kernel

Very often, especially when cross compiling, there is a need
to pass kernel headers different from those installed on the
build machine.

Add support for doing this for iio utils by using the
'INSTALL_HDR_PATH' environment variable. This is supported by
'make headers_install' for installing kernel headers at a
user specified location. So you will do:

$ make headers_install ARCH=arm INSTALL_HDR_PATH=<absolute-path>
$ make -C tools/iio ARCH=arm INSTALL_HDR_PATH=<absolute-path>

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 tools/iio/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/iio/Makefile b/tools/iio/Makefile
index 5446d625e17d..75607043d6e2 100644
--- a/tools/iio/Makefile
+++ b/tools/iio/Makefile
@@ -1,5 +1,5 @@
 CC = $(CROSS_COMPILE)gcc
-CFLAGS += -Wall -g -D_GNU_SOURCE
+CFLAGS += -Wall -g -D_GNU_SOURCE -I$(INSTALL_HDR_PATH)/include
 
 BINDIR=usr/bin
 INSTALL_PROGRAM=install -m 755 -p
-- 
2.9.0

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

* Re: [PATCH] tools: iio: add ability to pass kernel headers
  2017-04-11 11:06 [PATCH] tools: iio: add ability to pass kernel headers Sekhar Nori
@ 2017-04-14 14:42 ` Jonathan Cameron
  2017-04-14 15:23   ` Randy Dunlap
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2017-04-14 14:42 UTC (permalink / raw)
  To: Sekhar Nori
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio, linux-kernel

On 11/04/17 12:06, Sekhar Nori wrote:
> Very often, especially when cross compiling, there is a need
> to pass kernel headers different from those installed on the
> build machine.
> 
> Add support for doing this for iio utils by using the
> 'INSTALL_HDR_PATH' environment variable. This is supported by
> 'make headers_install' for installing kernel headers at a
> user specified location. So you will do:
> 
> $ make headers_install ARCH=arm INSTALL_HDR_PATH=<absolute-path>
> $ make -C tools/iio ARCH=arm INSTALL_HDR_PATH=<absolute-path>
> 
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>

It's a bit of an oddity as that usually refers to where to put
the headers rather than where they are.

Is there a more general solution?  I couldn't find anything
particularly consistent in tools.
> ---
>  tools/iio/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/iio/Makefile b/tools/iio/Makefile
> index 5446d625e17d..75607043d6e2 100644
> --- a/tools/iio/Makefile
> +++ b/tools/iio/Makefile
> @@ -1,5 +1,5 @@
>  CC = $(CROSS_COMPILE)gcc
> -CFLAGS += -Wall -g -D_GNU_SOURCE
> +CFLAGS += -Wall -g -D_GNU_SOURCE -I$(INSTALL_HDR_PATH)/include
>  
>  BINDIR=usr/bin
>  INSTALL_PROGRAM=install -m 755 -p
> 

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

* Re: [PATCH] tools: iio: add ability to pass kernel headers
  2017-04-14 14:42 ` Jonathan Cameron
@ 2017-04-14 15:23   ` Randy Dunlap
  2017-04-14 15:23     ` Jonathan Cameron
  0 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2017-04-14 15:23 UTC (permalink / raw)
  To: Jonathan Cameron, Sekhar Nori
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio, linux-kernel

On 04/14/17 07:42, Jonathan Cameron wrote:
> On 11/04/17 12:06, Sekhar Nori wrote:
>> Very often, especially when cross compiling, there is a need
>> to pass kernel headers different from those installed on the
>> build machine.
>>
>> Add support for doing this for iio utils by using the
>> 'INSTALL_HDR_PATH' environment variable. This is supported by
>> 'make headers_install' for installing kernel headers at a
>> user specified location. So you will do:
>>
>> $ make headers_install ARCH=arm INSTALL_HDR_PATH=<absolute-path>
>> $ make -C tools/iio ARCH=arm INSTALL_HDR_PATH=<absolute-path>
>>
>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> 
> It's a bit of an oddity as that usually refers to where to put
> the headers rather than where they are.
> 
> Is there a more general solution?  I couldn't find anything
> particularly consistent in tools.

Whatever the solution is, it should be used for all tools/, not just iio.

>> ---
>>  tools/iio/Makefile | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)


-- 
~Randy

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

* Re: [PATCH] tools: iio: add ability to pass kernel headers
  2017-04-14 15:23   ` Randy Dunlap
@ 2017-04-14 15:23     ` Jonathan Cameron
  2017-04-18 10:12       ` Sekhar Nori
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2017-04-14 15:23 UTC (permalink / raw)
  To: Randy Dunlap, Sekhar Nori
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio, linux-kernel

On 14/04/17 16:23, Randy Dunlap wrote:
> On 04/14/17 07:42, Jonathan Cameron wrote:
>> On 11/04/17 12:06, Sekhar Nori wrote:
>>> Very often, especially when cross compiling, there is a need
>>> to pass kernel headers different from those installed on the
>>> build machine.
>>>
>>> Add support for doing this for iio utils by using the
>>> 'INSTALL_HDR_PATH' environment variable. This is supported by
>>> 'make headers_install' for installing kernel headers at a
>>> user specified location. So you will do:
>>>
>>> $ make headers_install ARCH=arm INSTALL_HDR_PATH=<absolute-path>
>>> $ make -C tools/iio ARCH=arm INSTALL_HDR_PATH=<absolute-path>
>>>
>>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>>
>> It's a bit of an oddity as that usually refers to where to put
>> the headers rather than where they are.
>>
>> Is there a more general solution?  I couldn't find anything
>> particularly consistent in tools.
> 
> Whatever the solution is, it should be used for all tools/, not just iio.
> 
Agreed!
>>> ---
>>>  tools/iio/Makefile | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 

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

* Re: [PATCH] tools: iio: add ability to pass kernel headers
  2017-04-14 15:23     ` Jonathan Cameron
@ 2017-04-18 10:12       ` Sekhar Nori
  2017-04-20 13:53         ` Sekhar Nori
  0 siblings, 1 reply; 7+ messages in thread
From: Sekhar Nori @ 2017-04-18 10:12 UTC (permalink / raw)
  To: Jonathan Cameron, Randy Dunlap
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio, linux-kernel

Hi Jonathan, Randy,

On Friday 14 April 2017 08:53 PM, Jonathan Cameron wrote:
> On 14/04/17 16:23, Randy Dunlap wrote:
>> On 04/14/17 07:42, Jonathan Cameron wrote:
>>> On 11/04/17 12:06, Sekhar Nori wrote:
>>>> Very often, especially when cross compiling, there is a need
>>>> to pass kernel headers different from those installed on the
>>>> build machine.
>>>>
>>>> Add support for doing this for iio utils by using the
>>>> 'INSTALL_HDR_PATH' environment variable. This is supported by
>>>> 'make headers_install' for installing kernel headers at a
>>>> user specified location. So you will do:
>>>>
>>>> $ make headers_install ARCH=arm INSTALL_HDR_PATH=<absolute-path>
>>>> $ make -C tools/iio ARCH=arm INSTALL_HDR_PATH=<absolute-path>
>>>>
>>>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>>>
>>> It's a bit of an oddity as that usually refers to where to put
>>> the headers rather than where they are.
>>>
>>> Is there a more general solution?  I couldn't find anything
>>> particularly consistent in tools.
>>
>> Whatever the solution is, it should be used for all tools/, not just iio.
>>
> Agreed!

Alright, I will try to come up with something more generic and post
another version.

Thanks,
Sekhar

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

* Re: [PATCH] tools: iio: add ability to pass kernel headers
  2017-04-18 10:12       ` Sekhar Nori
@ 2017-04-20 13:53         ` Sekhar Nori
  2017-04-20 15:27           ` Randy Dunlap
  0 siblings, 1 reply; 7+ messages in thread
From: Sekhar Nori @ 2017-04-20 13:53 UTC (permalink / raw)
  To: Jonathan Cameron, Randy Dunlap
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio, linux-kernel

On Tuesday 18 April 2017 03:42 PM, Sekhar Nori wrote:
> Hi Jonathan, Randy,
> 
> On Friday 14 April 2017 08:53 PM, Jonathan Cameron wrote:
>> On 14/04/17 16:23, Randy Dunlap wrote:
>>> On 04/14/17 07:42, Jonathan Cameron wrote:
>>>> On 11/04/17 12:06, Sekhar Nori wrote:
>>>>> Very often, especially when cross compiling, there is a need
>>>>> to pass kernel headers different from those installed on the
>>>>> build machine.
>>>>>
>>>>> Add support for doing this for iio utils by using the
>>>>> 'INSTALL_HDR_PATH' environment variable. This is supported by
>>>>> 'make headers_install' for installing kernel headers at a
>>>>> user specified location. So you will do:
>>>>>
>>>>> $ make headers_install ARCH=arm INSTALL_HDR_PATH=<absolute-path>
>>>>> $ make -C tools/iio ARCH=arm INSTALL_HDR_PATH=<absolute-path>
>>>>>
>>>>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>>>>
>>>> It's a bit of an oddity as that usually refers to where to put
>>>> the headers rather than where they are.
>>>>
>>>> Is there a more general solution?  I couldn't find anything
>>>> particularly consistent in tools.
>>>
>>> Whatever the solution is, it should be used for all tools/, not just iio.
>>>
>> Agreed!
> 
> Alright, I will try to come up with something more generic and post
> another version.

I have been looking at this, and coming up with something generic is
more complicated than I thought. The problem is the flexibility thats
allowed in building many of the tools. For example, you can build the
led tools using any of these three methods:

$ make -C <kernelsrcdir> tools/leds
$ make -C <kernelsrcdir>/tools leds
$ make -C <kernelsrcdir>/tools/leds

The last one is specifically complicated because it totally bypasses all
top level makefiles. I think adding dependency with a top level makefile
will be a step backwards at least for leds.

Currently the leds makefile adds '-I../../include/uapi' to CFLAGS to
access the latest kernel headers. Something similar is done for some
other tools too. This makes it work for all the build cases above. I
propose we do something similar for iio too.

Thanks,
Sekhar

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

* Re: [PATCH] tools: iio: add ability to pass kernel headers
  2017-04-20 13:53         ` Sekhar Nori
@ 2017-04-20 15:27           ` Randy Dunlap
  0 siblings, 0 replies; 7+ messages in thread
From: Randy Dunlap @ 2017-04-20 15:27 UTC (permalink / raw)
  To: Sekhar Nori, Jonathan Cameron
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio, linux-kernel

On 04/20/17 06:53, Sekhar Nori wrote:
> On Tuesday 18 April 2017 03:42 PM, Sekhar Nori wrote:
>> Hi Jonathan, Randy,
>>
>> On Friday 14 April 2017 08:53 PM, Jonathan Cameron wrote:
>>> On 14/04/17 16:23, Randy Dunlap wrote:
>>>> On 04/14/17 07:42, Jonathan Cameron wrote:
>>>>> On 11/04/17 12:06, Sekhar Nori wrote:
>>>>>> Very often, especially when cross compiling, there is a need
>>>>>> to pass kernel headers different from those installed on the
>>>>>> build machine.
>>>>>>
>>>>>> Add support for doing this for iio utils by using the
>>>>>> 'INSTALL_HDR_PATH' environment variable. This is supported by
>>>>>> 'make headers_install' for installing kernel headers at a
>>>>>> user specified location. So you will do:
>>>>>>
>>>>>> $ make headers_install ARCH=arm INSTALL_HDR_PATH=<absolute-path>
>>>>>> $ make -C tools/iio ARCH=arm INSTALL_HDR_PATH=<absolute-path>
>>>>>>
>>>>>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>>>>>
>>>>> It's a bit of an oddity as that usually refers to where to put
>>>>> the headers rather than where they are.
>>>>>
>>>>> Is there a more general solution?  I couldn't find anything
>>>>> particularly consistent in tools.
>>>>
>>>> Whatever the solution is, it should be used for all tools/, not just iio.
>>>>
>>> Agreed!
>>
>> Alright, I will try to come up with something more generic and post
>> another version.
> 
> I have been looking at this, and coming up with something generic is
> more complicated than I thought. The problem is the flexibility thats
> allowed in building many of the tools. For example, you can build the
> led tools using any of these three methods:
> 
> $ make -C <kernelsrcdir> tools/leds
> $ make -C <kernelsrcdir>/tools leds
> $ make -C <kernelsrcdir>/tools/leds
> 
> The last one is specifically complicated because it totally bypasses all
> top level makefiles. I think adding dependency with a top level makefile
> will be a step backwards at least for leds.
> 
> Currently the leds makefile adds '-I../../include/uapi' to CFLAGS to
> access the latest kernel headers. Something similar is done for some
> other tools too. This makes it work for all the build cases above. I
> propose we do something similar for iio too.

Thanks for diving into all of that.  I am not surprised at
what you have found.

I believe that you can go ahead with your iio proposal.


-- 
~Randy

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

end of thread, other threads:[~2017-04-20 15:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-11 11:06 [PATCH] tools: iio: add ability to pass kernel headers Sekhar Nori
2017-04-14 14:42 ` Jonathan Cameron
2017-04-14 15:23   ` Randy Dunlap
2017-04-14 15:23     ` Jonathan Cameron
2017-04-18 10:12       ` Sekhar Nori
2017-04-20 13:53         ` Sekhar Nori
2017-04-20 15:27           ` Randy Dunlap

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).