All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] libubootenv: exclude from world build if no u-boot config
@ 2021-07-06 15:55 Peter Bergin
  2021-07-08  6:16 ` Anuj Mittal
  2021-07-08  7:07 ` Richard Purdie
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Bergin @ 2021-07-06 15:55 UTC (permalink / raw)
  To: openembedded-core; +Cc: anuj.mittal, richard.purdie, otavio, Peter Bergin

As a fix for failing the world build for targets not using u-boot
as boot loader libubootenv is excluded from world builds if
both UBOOT_MACHINE and UBOOT_CONFIG variables are empty.

Signed-off-by: Peter Bergin <peter@berginkonsult.se>
---
 meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb b/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb
index 306296922c..6774290ea5 100644
--- a/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb
+++ b/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb
@@ -28,3 +28,6 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 RRECOMMENDS_${PN}-bin_append_class-target = " u-boot-default-env"
 
 BBCLASSEXTEND = "native"
+
+# Exclude this package from world build if there is no config for u-boot
+EXCLUDE_FROM_WORLD = "${@'1' if not d.getVar('UBOOT_MACHINE') and not (d.getVar('UBOOT_CONFIG') or '').split() else '0'}"
-- 
2.25.1


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

* Re: [RFC][PATCH] libubootenv: exclude from world build if no u-boot config
  2021-07-06 15:55 [RFC][PATCH] libubootenv: exclude from world build if no u-boot config Peter Bergin
@ 2021-07-08  6:16 ` Anuj Mittal
  2021-07-08  7:07 ` Richard Purdie
  1 sibling, 0 replies; 4+ messages in thread
From: Anuj Mittal @ 2021-07-08  6:16 UTC (permalink / raw)
  To: openembedded-core, peter; +Cc: richard.purdie, otavio

On Tue, 2021-07-06 at 17:55 +0200, Peter Bergin wrote:
> As a fix for failing the world build for targets not using u-boot
> as boot loader libubootenv is excluded from world builds if
> both UBOOT_MACHINE and UBOOT_CONFIG variables are empty.
> 
> Signed-off-by: Peter Bergin <peter@berginkonsult.se>
> ---
>  meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb
> b/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb
> index 306296922c..6774290ea5 100644
> --- a/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb
> +++ b/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb
> @@ -28,3 +28,6 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
>  RRECOMMENDS_${PN}-bin_append_class-target = " u-boot-default-env"
>  
>  BBCLASSEXTEND = "native"
> +
> +# Exclude this package from world build if there is no config for u-
> boot
> +EXCLUDE_FROM_WORLD = "${@'1' if not d.getVar('UBOOT_MACHINE') and
> not (d.getVar('UBOOT_CONFIG') or '').split() else '0'}"

This looks good to me. This recipe was being skipped in world builds
for such targets anyway before we removed the uboot-config inherit.

Thanks,

Anuj

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

* Re: [RFC][PATCH] libubootenv: exclude from world build if no u-boot config
  2021-07-06 15:55 [RFC][PATCH] libubootenv: exclude from world build if no u-boot config Peter Bergin
  2021-07-08  6:16 ` Anuj Mittal
@ 2021-07-08  7:07 ` Richard Purdie
  2021-07-08  9:43   ` [OE-core] " Peter Bergin
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2021-07-08  7:07 UTC (permalink / raw)
  To: Peter Bergin, openembedded-core; +Cc: anuj.mittal, otavio

On Tue, 2021-07-06 at 17:55 +0200, Peter Bergin wrote:
> As a fix for failing the world build for targets not using u-boot
> as boot loader libubootenv is excluded from world builds if
> both UBOOT_MACHINE and UBOOT_CONFIG variables are empty.
> 
> Signed-off-by: Peter Bergin <peter@berginkonsult.se>
> ---
>  meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb b/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb
> index 306296922c..6774290ea5 100644
> --- a/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb
> +++ b/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb
> @@ -28,3 +28,6 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
>  RRECOMMENDS_${PN}-bin_append_class-target = " u-boot-default-env"
>  
> 
> 
> 
>  BBCLASSEXTEND = "native"
> +
> +# Exclude this package from world build if there is no config for u-boot
> +EXCLUDE_FROM_WORLD = "${@'1' if not d.getVar('UBOOT_MACHINE') and not (d.getVar('UBOOT_CONFIG') or '').split() else '0'}"

To be honest I'm still struggling to understand the problem here.
(I'm also not sure we need the split() above)

You previously said "If you just want to build libubootenv you should be 
able to do it for any machine, with or without u-boot support as there is 
no build dependency between libubootenv and u-boot." which does make sense 
to me but the above doesn't seem to be much better than the original
inherit?

Perhaps we should be doing something like:

python () {
    if d.getVar('UBOOT_MACHINE') or d.getVar('UBOOT_CONFIG'):
        d.setVar('RRECOMMENDS_${PN}-bin_append_class-target', " u-boot-default-env")
}

since the recipe is marked as machine specific (which I worry about in 
itself).

Cheers,

Richard


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

* Re: [OE-core] [RFC][PATCH] libubootenv: exclude from world build if no u-boot config
  2021-07-08  7:07 ` Richard Purdie
@ 2021-07-08  9:43   ` Peter Bergin
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Bergin @ 2021-07-08  9:43 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core; +Cc: anuj.mittal, otavio

On 2021-07-08 09:07, Richard Purdie wrote:
> On Tue, 2021-07-06 at 17:55 +0200, Peter Bergin wrote:
>> As a fix for failing the world build for targets not using u-boot
>> as boot loader libubootenv is excluded from world builds if
>> both UBOOT_MACHINE and UBOOT_CONFIG variables are empty.
>>
>> Signed-off-by: Peter Bergin <peter@berginkonsult.se>
>> ---
>>   meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb b/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb
>> index 306296922c..6774290ea5 100644
>> --- a/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb
>> +++ b/meta/recipes-bsp/u-boot/libubootenv_0.3.2.bb
>> @@ -28,3 +28,6 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
>>   RRECOMMENDS_${PN}-bin_append_class-target = " u-boot-default-env"
>>   
>>
>>
>>
>>   BBCLASSEXTEND = "native"
>> +
>> +# Exclude this package from world build if there is no config for u-boot
>> +EXCLUDE_FROM_WORLD = "${@'1' if not d.getVar('UBOOT_MACHINE') and not (d.getVar('UBOOT_CONFIG') or '').split() else '0'}"
> To be honest I'm still struggling to understand the problem here.
> (I'm also not sure we need the split() above)
I am also trying to understand the root of this and relate to other 
packages and dependencies in oe-core. Haven't found anything similar 
yet. The closest but not really related constructions is for 
'RDEPENDS_${PN} = "kernel-module-*"'  that (as far as I understand) 
ignored in build process and assumed provided. Otherwise I guess 
constructions similar to this are handled with COMPATIBLE_MACHINE but 
this is not related to MACHINE but to bootloader and we don't have a 
config for that.
> You previously said "If you just want to build libubootenv you should be
> able to do it for any machine, with or without u-boot support as there is
> no build dependency between libubootenv and u-boot." which does make sense
> to me but the above doesn't seem to be much better than the original
> inherit?

llibubootenv can be built for all targets independent of bootloader. If 
libubootenv should be useful on target it should have configuration 
files in filesystem which are produced by u-boot as the source of 
information is there. So for me the general question is how we handle 
the case where package A needs (a config file from) package B to work 
properly on target but package B is not possible to build for this 
configuration?

Agree that it is possibly small improvement with this and still a 
workaround (as inherit uboot-config was). The improvement for 
meta-freescale is to avoid another workaround for this. In 
meta-freescale the variables UBOOT_MACHINE and UBOOT_CONFIG is in some 
cases set per recipe as configuration names for one machine differs 
between forks of u-boot.

>
> Perhaps we should be doing something like:
>
> python () {
>      if d.getVar('UBOOT_MACHINE') or d.getVar('UBOOT_CONFIG'):
>          d.setVar('RRECOMMENDS_${PN}-bin_append_class-target', " u-boot-default-env")
> }
>
> since the recipe is marked as machine specific (which I worry about in
> itself).

The reason for machine specific setting of this package from commit 
(02d55cd35aa) message:

     "...Also add u-boot-default-env to RRECOMMENDS since
     /etc/u-boot-initial-env is being referred in libubootenv source, and
     turns libubootenv's PACKAGE_ARCH to be MACHINE_ARCH since
     u-boot-default-env is a machine-arch package."

So it turns out we make the recipe of libubootenv machine specific 
because we need a config file from another machine specific recipe.

The files /etc/fw_env.config and/etc/u-boot-initial-env is referenced in 
libubbotenv as the default paths to configuration. The programs tries to 
read and parse those files and if not found the programs exit out with 
error code and a clear message to the user. I agree with Otavios comment 
in the other mail thread that RDEPENDS is a too strong dependency 
between libubootenv-bin and u-boot-default-env.

This is probably a small issue and I'm a bit unsure how much more effort 
to spend on this? We should solve the issue with failing world build for 
'non-u-boot' configs caused by my initial revert. Is the way forward to 
make a conditional RDEPENDS as suggested? To keep it simple I would 
suggest to either:

1) removing RDEPENDS
2) change RDEPENDS->RSUGGESTS which seems to fix the build issue

In both cases above I think we can make libubootenv non-machine specific 
again. What do you think?

Best regards,

/Peter


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

end of thread, other threads:[~2021-07-08  9:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 15:55 [RFC][PATCH] libubootenv: exclude from world build if no u-boot config Peter Bergin
2021-07-08  6:16 ` Anuj Mittal
2021-07-08  7:07 ` Richard Purdie
2021-07-08  9:43   ` [OE-core] " Peter Bergin

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.