From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031820AbdDTNyU (ORCPT ); Thu, 20 Apr 2017 09:54:20 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:54752 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031660AbdDTNyO (ORCPT ); Thu, 20 Apr 2017 09:54:14 -0400 Subject: Re: [PATCH] tools: iio: add ability to pass kernel headers To: Jonathan Cameron , Randy Dunlap References: <1f009aa7-f1c0-cf7b-344b-fe83f3b4b7b9@kernel.org> <6104d595-462b-c154-5b6a-73ed33d0b258@infradead.org> CC: Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , , From: Sekhar Nori Message-ID: Date: Thu, 20 Apr 2017 19:23:11 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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= >>>>> $ make -C tools/iio ARCH=arm INSTALL_HDR_PATH= >>>>> >>>>> Signed-off-by: Sekhar Nori >>>> >>>> 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 tools/leds $ make -C /tools leds $ make -C /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