mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] template-src-linux-driver: Only install driver if selected
@ 2018-12-12 10:42 Ian Abbott
  2018-12-12 11:18 ` Michael Olbrich
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Abbott @ 2018-12-12 10:42 UTC (permalink / raw)
  To: ptxdist; +Cc: Ian Abbott

If a local package "foo-mod" for a Linux kernel module is selected by a
local tristate configuration option PTXCONF_FOO_MOD, then based on the
template for Linux drivers, it would include the following in its
foo-mod.make file:

ifdef PTXCONF_FOO_MOD
$(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
endif

However, this rule will be invoked even if the PTXCONF_FOO_MOD option
has been configured with the tristate option 'm' and has not been
changed to 'y' by a selected_collectionconfig.  This causes the Linux
kernel module to be built and installed unintentionally.  To prevent
that happening, the above lines in the foo-mod.make file can be changed
as follows (only the conditional test is changed):

ifeq ($(PTXCONF_FOO_MOD),y)
$(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
endif

This patch changes the template for Linux driver packages in accordance
with the above change.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 rules/templates/template-src-linux-driver-make | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rules/templates/template-src-linux-driver-make b/rules/templates/template-src-linux-driver-make
index e06a22497..c970c43d6 100644
--- a/rules/templates/template-src-linux-driver-make
+++ b/rules/templates/template-src-linux-driver-make
@@ -22,7 +22,7 @@ PACKAGES-$(PTXCONF_@PACKAGE@) += @package@
 @PACKAGE@_DIR		:= $(BUILDDIR)/$(@PACKAGE@)
 @PACKAGE@_LICENSE	:= unknown
 
-ifdef PTXCONF_@PACKAGE@
+ifeq ($(PTXCONF_@PACKAGE@),y)
 $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/@package@.targetinstall
 endif
 
-- 
2.19.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] template-src-linux-driver: Only install driver if selected
  2018-12-12 10:42 [ptxdist] [PATCH] template-src-linux-driver: Only install driver if selected Ian Abbott
@ 2018-12-12 11:18 ` Michael Olbrich
  2018-12-13 12:02   ` Ian Abbott
  2018-12-13 12:07   ` [ptxdist] [PATCH v2] " Ian Abbott
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Olbrich @ 2018-12-12 11:18 UTC (permalink / raw)
  To: ptxdist

On Wed, Dec 12, 2018 at 10:42:38AM +0000, Ian Abbott wrote:
> If a local package "foo-mod" for a Linux kernel module is selected by a
> local tristate configuration option PTXCONF_FOO_MOD, then based on the
> template for Linux drivers, it would include the following in its
> foo-mod.make file:
> 
> ifdef PTXCONF_FOO_MOD
> $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
> endif
> 
> However, this rule will be invoked even if the PTXCONF_FOO_MOD option
> has been configured with the tristate option 'm' and has not been
> changed to 'y' by a selected_collectionconfig.  This causes the Linux
> kernel module to be built and installed unintentionally.  To prevent
> that happening, the above lines in the foo-mod.make file can be changed
> as follows (only the conditional test is changed):
> 
> ifeq ($(PTXCONF_FOO_MOD),y)
> $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
> endif
> 
> This patch changes the template for Linux driver packages in accordance
> with the above change.

No, this break building if PTXCONF_FOO_MOD=m and no collection is selected.

Untested:

ifneq ($(filter foo-mod,$(PTX_PACKAGES_SELECTED)),)

Michael

> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> ---
>  rules/templates/template-src-linux-driver-make | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rules/templates/template-src-linux-driver-make b/rules/templates/template-src-linux-driver-make
> index e06a22497..c970c43d6 100644
> --- a/rules/templates/template-src-linux-driver-make
> +++ b/rules/templates/template-src-linux-driver-make
> @@ -22,7 +22,7 @@ PACKAGES-$(PTXCONF_@PACKAGE@) += @package@
>  @PACKAGE@_DIR		:= $(BUILDDIR)/$(@PACKAGE@)
>  @PACKAGE@_LICENSE	:= unknown
>  
> -ifdef PTXCONF_@PACKAGE@
> +ifeq ($(PTXCONF_@PACKAGE@),y)
>  $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/@package@.targetinstall
>  endif
>  
> -- 
> 2.19.2
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] template-src-linux-driver: Only install driver if selected
  2018-12-12 11:18 ` Michael Olbrich
@ 2018-12-13 12:02   ` Ian Abbott
  2018-12-13 12:07   ` [ptxdist] [PATCH v2] " Ian Abbott
  1 sibling, 0 replies; 8+ messages in thread
From: Ian Abbott @ 2018-12-13 12:02 UTC (permalink / raw)
  To: ptxdist

On 12/12/2018 11:18, Michael Olbrich wrote:
> On Wed, Dec 12, 2018 at 10:42:38AM +0000, Ian Abbott wrote:
>> If a local package "foo-mod" for a Linux kernel module is selected by a
>> local tristate configuration option PTXCONF_FOO_MOD, then based on the
>> template for Linux drivers, it would include the following in its
>> foo-mod.make file:
>>
>> ifdef PTXCONF_FOO_MOD
>> $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
>> endif
>>
>> However, this rule will be invoked even if the PTXCONF_FOO_MOD option
>> has been configured with the tristate option 'm' and has not been
>> changed to 'y' by a selected_collectionconfig.  This causes the Linux
>> kernel module to be built and installed unintentionally.  To prevent
>> that happening, the above lines in the foo-mod.make file can be changed
>> as follows (only the conditional test is changed):
>>
>> ifeq ($(PTXCONF_FOO_MOD),y)
>> $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
>> endif
>>
>> This patch changes the template for Linux driver packages in accordance
>> with the above change.
> 
> No, this break building if PTXCONF_FOO_MOD=m and no collection is selected.
> 
> Untested:
> 
> ifneq ($(filter foo-mod,$(PTX_PACKAGES_SELECTED)),)
> 
> Michael

Thanks Michael. I tested your change with and without a 
selected_collectionconfig and it works.  I'll submit a v2 patch 
incorporating your change.

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* [ptxdist] [PATCH v2] template-src-linux-driver: Only install driver if selected
  2018-12-12 11:18 ` Michael Olbrich
  2018-12-13 12:02   ` Ian Abbott
@ 2018-12-13 12:07   ` Ian Abbott
  2019-01-18 17:37     ` Ian Abbott
  1 sibling, 1 reply; 8+ messages in thread
From: Ian Abbott @ 2018-12-13 12:07 UTC (permalink / raw)
  To: ptxdist; +Cc: Ian Abbott, Michael Olbrich

If a local package "foo-mod" for a Linux kernel module is selected by a
local tristate configuration option PTXCONF_FOO_MOD, then based on the
template for Linux drivers, it would include the following in its
foo-mod.make file:

ifdef PTXCONF_FOO_MOD
$(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
endif

However, this rule will be invoked even if the PTXCONF_FOO_MOD option
has been configured with the tristate option 'm' and has not been
changed to 'y' by a selected_collectionconfig.  This causes the Linux
kernel module to be built and installed unintentionally.  To prevent
that happening, the above lines in the foo-mod.make file can be changed
as follows (using a conditional test suggested by Michael Olbrich):

ifneq ($(filter foo-mod,$(PTX_PACKAGES_SELECTED)),)
$(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
endif

This patch changes the template for Linux driver packages in accordance
with the above change.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Michael Olbrich <m.olbrich@pengutronix.de>
---
v2: Changed the conditional test to that suggested by Michael Olbrich in
Message-ID <20181212111846.zb3kxfs6jsc5rgef@pengutronix.de> to avoid
breaking the build if the package is configured using the tristate 'm'
option and no collection is selected.

 rules/templates/template-src-linux-driver-make | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rules/templates/template-src-linux-driver-make b/rules/templates/template-src-linux-driver-make
index e06a22497..c13857924 100644
--- a/rules/templates/template-src-linux-driver-make
+++ b/rules/templates/template-src-linux-driver-make
@@ -22,7 +22,7 @@ PACKAGES-$(PTXCONF_@PACKAGE@) += @package@
 @PACKAGE@_DIR		:= $(BUILDDIR)/$(@PACKAGE@)
 @PACKAGE@_LICENSE	:= unknown
 
-ifdef PTXCONF_@PACKAGE@
+ifneq ($(filter @package@,$(PTX_PACKAGES_SELECTED)),)
 $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/@package@.targetinstall
 endif
 
-- 
2.19.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH v2] template-src-linux-driver: Only install driver if selected
  2018-12-13 12:07   ` [ptxdist] [PATCH v2] " Ian Abbott
@ 2019-01-18 17:37     ` Ian Abbott
  2019-01-18 20:18       ` Ian Abbott
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Abbott @ 2019-01-18 17:37 UTC (permalink / raw)
  To: ptxdist; +Cc: Michael Olbrich

On 13/12/2018 12:07, Ian Abbott wrote:
> If a local package "foo-mod" for a Linux kernel module is selected by a
> local tristate configuration option PTXCONF_FOO_MOD, then based on the
> template for Linux drivers, it would include the following in its
> foo-mod.make file:
> 
> ifdef PTXCONF_FOO_MOD
> $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
> endif
> 
> However, this rule will be invoked even if the PTXCONF_FOO_MOD option
> has been configured with the tristate option 'm' and has not been
> changed to 'y' by a selected_collectionconfig.  This causes the Linux
> kernel module to be built and installed unintentionally.  To prevent
> that happening, the above lines in the foo-mod.make file can be changed
> as follows (using a conditional test suggested by Michael Olbrich):
> 
> ifneq ($(filter foo-mod,$(PTX_PACKAGES_SELECTED)),)
> $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
> endif
> 
> This patch changes the template for Linux driver packages in accordance
> with the above change.
> 
> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> Cc: Michael Olbrich <m.olbrich@pengutronix.de>
> ---
> v2: Changed the conditional test to that suggested by Michael Olbrich in
> Message-ID <20181212111846.zb3kxfs6jsc5rgef@pengutronix.de> to avoid
> breaking the build if the package is configured using the tristate 'm'
> option and no collection is selected.
> 
>   rules/templates/template-src-linux-driver-make | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rules/templates/template-src-linux-driver-make b/rules/templates/template-src-linux-driver-make
> index e06a22497..c13857924 100644
> --- a/rules/templates/template-src-linux-driver-make
> +++ b/rules/templates/template-src-linux-driver-make
> @@ -22,7 +22,7 @@ PACKAGES-$(PTXCONF_@PACKAGE@) += @package@
>   @PACKAGE@_DIR		:= $(BUILDDIR)/$(@PACKAGE@)
>   @PACKAGE@_LICENSE	:= unknown
>   
> -ifdef PTXCONF_@PACKAGE@
> +ifneq ($(filter @package@,$(PTX_PACKAGES_SELECTED)),)
>   $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/@package@.targetinstall
>   endif
>   
> 

I know this is in 2019.01.0 now, but I don't think the new conditional 
test for adding this kernel.targetinstall.post dependency is actually 
working properly.  I've had a few `ptxdist go` commands running with the 
-j N option, and quite often the kernel.targetinstall.post completes 
before the @package@.targetinstall, meaning that the module does not get 
installed to the 
${PTXDIST_PLATFORMDIR}/root/lib/modules/$UNAME_RELEASE/extra as it 
should (where $UNAME_RELEASE is the kernel `uname -r` value).

The conditional test from v1 of the patch:

ifdef PTXCONF_@PACKAGE@)

still works for me, but will break the build for other people.

I'll try and work out why the new conditional test isn't working for me 
reliably (especially when building with parallel jobs), but I welcome 
any suggestions to try and fix it properly.

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH v2] template-src-linux-driver: Only install driver if selected
  2019-01-18 17:37     ` Ian Abbott
@ 2019-01-18 20:18       ` Ian Abbott
  2019-01-21  8:02         ` Michael Olbrich
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Abbott @ 2019-01-18 20:18 UTC (permalink / raw)
  To: ptxdist; +Cc: Michael Olbrich

On 18/01/2019 17:37, Ian Abbott wrote:
> On 13/12/2018 12:07, Ian Abbott wrote:
>> If a local package "foo-mod" for a Linux kernel module is selected by a
>> local tristate configuration option PTXCONF_FOO_MOD, then based on the
>> template for Linux drivers, it would include the following in its
>> foo-mod.make file:
>>
>> ifdef PTXCONF_FOO_MOD
>> $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
>> endif
>>
>> However, this rule will be invoked even if the PTXCONF_FOO_MOD option
>> has been configured with the tristate option 'm' and has not been
>> changed to 'y' by a selected_collectionconfig.  This causes the Linux
>> kernel module to be built and installed unintentionally.  To prevent
>> that happening, the above lines in the foo-mod.make file can be changed
>> as follows (using a conditional test suggested by Michael Olbrich):
>>
>> ifneq ($(filter foo-mod,$(PTX_PACKAGES_SELECTED)),)
>> $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
>> endif
>>
>> This patch changes the template for Linux driver packages in accordance
>> with the above change.
>>
>> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
>> Cc: Michael Olbrich <m.olbrich@pengutronix.de>
>> ---
>> v2: Changed the conditional test to that suggested by Michael Olbrich in
>> Message-ID <20181212111846.zb3kxfs6jsc5rgef@pengutronix.de> to avoid
>> breaking the build if the package is configured using the tristate 'm'
>> option and no collection is selected.
>>
>>   rules/templates/template-src-linux-driver-make | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/rules/templates/template-src-linux-driver-make 
>> b/rules/templates/template-src-linux-driver-make
>> index e06a22497..c13857924 100644
>> --- a/rules/templates/template-src-linux-driver-make
>> +++ b/rules/templates/template-src-linux-driver-make
>> @@ -22,7 +22,7 @@ PACKAGES-$(PTXCONF_@PACKAGE@) += @package@
>>   @PACKAGE@_DIR        := $(BUILDDIR)/$(@PACKAGE@)
>>   @PACKAGE@_LICENSE    := unknown
>> -ifdef PTXCONF_@PACKAGE@
>> +ifneq ($(filter @package@,$(PTX_PACKAGES_SELECTED)),)
>>   $(STATEDIR)/kernel.targetinstall.post: 
>> $(STATEDIR)/@package@.targetinstall
>>   endif
>>
> 
> I know this is in 2019.01.0 now, but I don't think the new conditional 
> test for adding this kernel.targetinstall.post dependency is actually 
> working properly.  I've had a few `ptxdist go` commands running with the 
> -j N option, and quite often the kernel.targetinstall.post completes 
> before the @package@.targetinstall, meaning that the module does not get 
> installed to the 
> ${PTXDIST_PLATFORMDIR}/root/lib/modules/$UNAME_RELEASE/extra as it 
> should (where $UNAME_RELEASE is the kernel `uname -r` value).
> 
> The conditional test from v1 of the patch:
> 
> ifdef PTXCONF_@PACKAGE@)
> 
> still works for me, but will break the build for other people.
> 
> I'll try and work out why the new conditional test isn't working for me 
> reliably (especially when building with parallel jobs), but I welcome 
> any suggestions to try and fix it properly.
> 

The following conditional test seems to work, but it's quite ugly:

ifeq ($(and $(PTXCONF_@PACKAGE@),$(if 
$(PTX_COLLECTION),$(PTXCONF_@PACKAGE@),y)),y)

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH v2] template-src-linux-driver: Only install driver if selected
  2019-01-18 20:18       ` Ian Abbott
@ 2019-01-21  8:02         ` Michael Olbrich
  2019-01-21 11:19           ` Ian Abbott
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Olbrich @ 2019-01-21  8:02 UTC (permalink / raw)
  To: ptxdist

On Fri, Jan 18, 2019 at 08:18:39PM +0000, Ian Abbott wrote:
> On 18/01/2019 17:37, Ian Abbott wrote:
> > On 13/12/2018 12:07, Ian Abbott wrote:
> > > If a local package "foo-mod" for a Linux kernel module is selected by a
> > > local tristate configuration option PTXCONF_FOO_MOD, then based on the
> > > template for Linux drivers, it would include the following in its
> > > foo-mod.make file:
> > > 
> > > ifdef PTXCONF_FOO_MOD
> > > $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
> > > endif
> > > 
> > > However, this rule will be invoked even if the PTXCONF_FOO_MOD option
> > > has been configured with the tristate option 'm' and has not been
> > > changed to 'y' by a selected_collectionconfig.  This causes the Linux
> > > kernel module to be built and installed unintentionally.  To prevent
> > > that happening, the above lines in the foo-mod.make file can be changed
> > > as follows (using a conditional test suggested by Michael Olbrich):
> > > 
> > > ifneq ($(filter foo-mod,$(PTX_PACKAGES_SELECTED)),)
> > > $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
> > > endif
> > > 
> > > This patch changes the template for Linux driver packages in accordance
> > > with the above change.
> > > 
> > > Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> > > Cc: Michael Olbrich <m.olbrich@pengutronix.de>
> > > ---
> > > v2: Changed the conditional test to that suggested by Michael Olbrich in
> > > Message-ID <20181212111846.zb3kxfs6jsc5rgef@pengutronix.de> to avoid
> > > breaking the build if the package is configured using the tristate 'm'
> > > option and no collection is selected.
> > > 
> > >   rules/templates/template-src-linux-driver-make | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/rules/templates/template-src-linux-driver-make
> > > b/rules/templates/template-src-linux-driver-make
> > > index e06a22497..c13857924 100644
> > > --- a/rules/templates/template-src-linux-driver-make
> > > +++ b/rules/templates/template-src-linux-driver-make
> > > @@ -22,7 +22,7 @@ PACKAGES-$(PTXCONF_@PACKAGE@) += @package@
> > >   @PACKAGE@_DIR        := $(BUILDDIR)/$(@PACKAGE@)
> > >   @PACKAGE@_LICENSE    := unknown
> > > -ifdef PTXCONF_@PACKAGE@
> > > +ifneq ($(filter @package@,$(PTX_PACKAGES_SELECTED)),)
> > >   $(STATEDIR)/kernel.targetinstall.post:
> > > $(STATEDIR)/@package@.targetinstall
> > >   endif
> > > 
> > 
> > I know this is in 2019.01.0 now, but I don't think the new conditional
> > test for adding this kernel.targetinstall.post dependency is actually
> > working properly.  I've had a few `ptxdist go` commands running with the
> > -j N option, and quite often the kernel.targetinstall.post completes
> > before the @package@.targetinstall, meaning that the module does not get
> > installed to the
> > ${PTXDIST_PLATFORMDIR}/root/lib/modules/$UNAME_RELEASE/extra as it
> > should (where $UNAME_RELEASE is the kernel `uname -r` value).

Yes, this is broken. PTX_PACKAGES_SELECTED cannot be used here like this.
The expression is correct, but it only works like this in rules/post/
because it is evaluated immediately so PTX_PACKAGES_SELECTED is always
empty.

> > The conditional test from v1 of the patch:
> > 
> > ifdef PTXCONF_@PACKAGE@)
> > 
> > still works for me, but will break the build for other people.
> > 
> > I'll try and work out why the new conditional test isn't working for me
> > reliably (especially when building with parallel jobs), but I welcome
> > any suggestions to try and fix it properly.
> > 
> 
> The following conditional test seems to work, but it's quite ugly:
> 
> ifeq ($(and $(PTXCONF_@PACKAGE@),$(if
> $(PTX_COLLECTION),$(PTXCONF_@PACKAGE@),y)),y)

ifneq ($(filter $(if $(PTX_COLLECTION),y,y m),$(PTXCONF_@PACKAGE@)),)

This should work. I think the intention is a bit clearer like this.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH v2] template-src-linux-driver: Only install driver if selected
  2019-01-21  8:02         ` Michael Olbrich
@ 2019-01-21 11:19           ` Ian Abbott
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Abbott @ 2019-01-21 11:19 UTC (permalink / raw)
  To: ptxdist

On 21/01/2019 08:02, Michael Olbrich wrote:
> On Fri, Jan 18, 2019 at 08:18:39PM +0000, Ian Abbott wrote:
>> On 18/01/2019 17:37, Ian Abbott wrote:
>>> On 13/12/2018 12:07, Ian Abbott wrote:
>>>> If a local package "foo-mod" for a Linux kernel module is selected by a
>>>> local tristate configuration option PTXCONF_FOO_MOD, then based on the
>>>> template for Linux drivers, it would include the following in its
>>>> foo-mod.make file:
>>>>
>>>> ifdef PTXCONF_FOO_MOD
>>>> $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
>>>> endif
>>>>
>>>> However, this rule will be invoked even if the PTXCONF_FOO_MOD option
>>>> has been configured with the tristate option 'm' and has not been
>>>> changed to 'y' by a selected_collectionconfig.  This causes the Linux
>>>> kernel module to be built and installed unintentionally.  To prevent
>>>> that happening, the above lines in the foo-mod.make file can be changed
>>>> as follows (using a conditional test suggested by Michael Olbrich):
>>>>
>>>> ifneq ($(filter foo-mod,$(PTX_PACKAGES_SELECTED)),)
>>>> $(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/foo-mod.targetinstall
>>>> endif
>>>>
>>>> This patch changes the template for Linux driver packages in accordance
>>>> with the above change.
>>>>
>>>> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
>>>> Cc: Michael Olbrich <m.olbrich@pengutronix.de>
>>>> ---
>>>> v2: Changed the conditional test to that suggested by Michael Olbrich in
>>>> Message-ID <20181212111846.zb3kxfs6jsc5rgef@pengutronix.de> to avoid
>>>> breaking the build if the package is configured using the tristate 'm'
>>>> option and no collection is selected.
>>>>
>>>>    rules/templates/template-src-linux-driver-make | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/rules/templates/template-src-linux-driver-make
>>>> b/rules/templates/template-src-linux-driver-make
>>>> index e06a22497..c13857924 100644
>>>> --- a/rules/templates/template-src-linux-driver-make
>>>> +++ b/rules/templates/template-src-linux-driver-make
>>>> @@ -22,7 +22,7 @@ PACKAGES-$(PTXCONF_@PACKAGE@) += @package@
>>>>    @PACKAGE@_DIR        := $(BUILDDIR)/$(@PACKAGE@)
>>>>    @PACKAGE@_LICENSE    := unknown
>>>> -ifdef PTXCONF_@PACKAGE@
>>>> +ifneq ($(filter @package@,$(PTX_PACKAGES_SELECTED)),)
>>>>    $(STATEDIR)/kernel.targetinstall.post:
>>>> $(STATEDIR)/@package@.targetinstall
>>>>    endif
>>>>
>>>
>>> I know this is in 2019.01.0 now, but I don't think the new conditional
>>> test for adding this kernel.targetinstall.post dependency is actually
>>> working properly.  I've had a few `ptxdist go` commands running with the
>>> -j N option, and quite often the kernel.targetinstall.post completes
>>> before the @package@.targetinstall, meaning that the module does not get
>>> installed to the
>>> ${PTXDIST_PLATFORMDIR}/root/lib/modules/$UNAME_RELEASE/extra as it
>>> should (where $UNAME_RELEASE is the kernel `uname -r` value).
> 
> Yes, this is broken. PTX_PACKAGES_SELECTED cannot be used here like this.
> The expression is correct, but it only works like this in rules/post/
> because it is evaluated immediately so PTX_PACKAGES_SELECTED is always
> empty.
> 
>>> The conditional test from v1 of the patch:
>>>
>>> ifdef PTXCONF_@PACKAGE@)
>>>
>>> still works for me, but will break the build for other people.
>>>
>>> I'll try and work out why the new conditional test isn't working for me
>>> reliably (especially when building with parallel jobs), but I welcome
>>> any suggestions to try and fix it properly.
>>>
>>
>> The following conditional test seems to work, but it's quite ugly:
>>
>> ifeq ($(and $(PTXCONF_@PACKAGE@),$(if
>> $(PTX_COLLECTION),$(PTXCONF_@PACKAGE@),y)),y)
> 
> ifneq ($(filter $(if $(PTX_COLLECTION),y,y m),$(PTXCONF_@PACKAGE@)),)
> 
> This should work. I think the intention is a bit clearer like this.

Thanks.  That works and is less ugly than the one I came up with!

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

end of thread, other threads:[~2019-01-21 11:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-12 10:42 [ptxdist] [PATCH] template-src-linux-driver: Only install driver if selected Ian Abbott
2018-12-12 11:18 ` Michael Olbrich
2018-12-13 12:02   ` Ian Abbott
2018-12-13 12:07   ` [ptxdist] [PATCH v2] " Ian Abbott
2019-01-18 17:37     ` Ian Abbott
2019-01-18 20:18       ` Ian Abbott
2019-01-21  8:02         ` Michael Olbrich
2019-01-21 11:19           ` Ian Abbott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox