diff mbox series

[meta-swupdate] swupdate: Set build flags

Message ID 20200710135008.9085-1-JPEWhacker@gmail.com
State Changes Requested
Headers show
Series [meta-swupdate] swupdate: Set build flags | expand

Commit Message

Joshua Watt July 10, 2020, 1:50 p.m. UTC
Sets the recipe build flags in the default configuration file. This
ensures that swupdate is correctly compiled with the flags that are set
by build, for example ensuring that debug symbols are present.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 recipes-support/swupdate/swupdate.inc | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Joshua Watt July 17, 2020, 1:39 p.m. UTC | #1
Ping?

On 7/10/20 8:50 AM, Joshua Watt wrote:
> Sets the recipe build flags in the default configuration file. This
> ensures that swupdate is correctly compiled with the flags that are set
> by build, for example ensuring that debug symbols are present.
>
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>   recipes-support/swupdate/swupdate.inc | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/recipes-support/swupdate/swupdate.inc b/recipes-support/swupdate/swupdate.inc
> index b65fb86..750b942 100644
> --- a/recipes-support/swupdate/swupdate.inc
> +++ b/recipes-support/swupdate/swupdate.inc
> @@ -192,6 +192,12 @@ python () {
>   
>   do_configure () {
>       cp ${WORKDIR}/defconfig ${WORKDIR}/.config
> +
> +    cat >> ${WORKDIR}/.config <<HEREDOC
> +CONFIG_EXTRA_CFLAGS="${CFLAGS}"
> +CONFIG_EXTRA_LDFLAGS="${LDFLAGS}"
> +HEREDOC
> +
>       merge_config.sh -O ${B} -m ${WORKDIR}/.config ${@" ".join(find_cfgs(d))}
>       (cd ${S} && cml1_do_configure)
>   }
Stefano Babic July 17, 2020, 5:28 p.m. UTC | #2
Hi Joshua,

On 17.07.20 15:39, Joshua Watt wrote:
> Ping?
> 
> On 7/10/20 8:50 AM, Joshua Watt wrote:
>> Sets the recipe build flags in the default configuration file. This
>> ensures that swupdate is correctly compiled with the flags that are set
>> by build, for example ensuring that debug symbols are present.
>>
>> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
>> ---
>>   recipes-support/swupdate/swupdate.inc | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/recipes-support/swupdate/swupdate.inc
>> b/recipes-support/swupdate/swupdate.inc
>> index b65fb86..750b942 100644
>> --- a/recipes-support/swupdate/swupdate.inc
>> +++ b/recipes-support/swupdate/swupdate.inc
>> @@ -192,6 +192,12 @@ python () {
>>     do_configure () {
>>       cp ${WORKDIR}/defconfig ${WORKDIR}/.config
>> +
>> +    cat >> ${WORKDIR}/.config <<HEREDOC
>> +CONFIG_EXTRA_CFLAGS="${CFLAGS}"
>> +CONFIG_EXTRA_LDFLAGS="${LDFLAGS}"
>> +HEREDOC
>> +
>>       m

I do not understand why we need them. CONFIG_EXTRA_CFLAGS and
CONFIG_EXTRA_LDFLAGS are as all other CONFIG_, and they are set if
defconfig or fragments contain them. Why do we need them ?



erge_config.sh -O ${B} -m ${WORKDIR}/.config ${@"
>> ".join(find_cfgs(d))}
>>       (cd ${S} && cml1_do_configure)
>>   }
> 

Best regards,
Stefano
Joshua Watt July 17, 2020, 5:38 p.m. UTC | #3
On 7/17/20 12:28 PM, Stefano Babic wrote:
> Hi Joshua,
>
> On 17.07.20 15:39, Joshua Watt wrote:
>> Ping?
>>
>> On 7/10/20 8:50 AM, Joshua Watt wrote:
>>> Sets the recipe build flags in the default configuration file. This
>>> ensures that swupdate is correctly compiled with the flags that are set
>>> by build, for example ensuring that debug symbols are present.
>>>
>>> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
>>> ---
>>>    recipes-support/swupdate/swupdate.inc | 6 ++++++
>>>    1 file changed, 6 insertions(+)
>>>
>>> diff --git a/recipes-support/swupdate/swupdate.inc
>>> b/recipes-support/swupdate/swupdate.inc
>>> index b65fb86..750b942 100644
>>> --- a/recipes-support/swupdate/swupdate.inc
>>> +++ b/recipes-support/swupdate/swupdate.inc
>>> @@ -192,6 +192,12 @@ python () {
>>>      do_configure () {
>>>        cp ${WORKDIR}/defconfig ${WORKDIR}/.config
>>> +
>>> +    cat >> ${WORKDIR}/.config <<HEREDOC
>>> +CONFIG_EXTRA_CFLAGS="${CFLAGS}"
>>> +CONFIG_EXTRA_LDFLAGS="${LDFLAGS}"
>>> +HEREDOC
>>> +
>>>        m
> I do not understand why we need them. CONFIG_EXTRA_CFLAGS and
> CONFIG_EXTRA_LDFLAGS are as all other CONFIG_, and they are set if
> defconfig or fragments contain them. Why do we need them ?

This makes it follow the same rules as other recipes with respect to 
debugging flags and such. I found this because I was attempting to debug 
a crash in swupdate but the symbols were unexpectedly missing from the 
-dbg package because these flags were not passed along. There are also a 
lot of other flags besides "-g" that are passed in CFLAGS that most 
users want to be respected, such as prefix mapping for reproducible builds.


It would seem a little strange to me to have to specify that sort of 
thing independently in swupdate when all other recipes behave the same, 
and there's no feasible way to get the same behavior as the CFLAGS 
provided by bitbake with a static assignment because many of them are 
based on the build path or other information only known to the recipe. 
Even so, if you still want that behavior, I can prepend the flags to 
defconfig so that if the user really wants to override them for some 
reason in defconfig or a config fragment they can.


>
>
>
> erge_config.sh -O ${B} -m ${WORKDIR}/.config ${@"
>>> ".join(find_cfgs(d))}
>>>        (cd ${S} && cml1_do_configure)
>>>    }
> Best regards,
> Stefano
>
Stefano Babic July 20, 2020, 7:26 a.m. UTC | #4
Hi Joshua,

On 17.07.20 19:38, Joshua Watt wrote:
> 
> On 7/17/20 12:28 PM, Stefano Babic wrote:
>> Hi Joshua,
>>
>> On 17.07.20 15:39, Joshua Watt wrote:
>>> Ping?
>>>
>>> On 7/10/20 8:50 AM, Joshua Watt wrote:
>>>> Sets the recipe build flags in the default configuration file. This
>>>> ensures that swupdate is correctly compiled with the flags that are set
>>>> by build, for example ensuring that debug symbols are present.
>>>>
>>>> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
>>>> ---
>>>>    recipes-support/swupdate/swupdate.inc | 6 ++++++
>>>>    1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/recipes-support/swupdate/swupdate.inc
>>>> b/recipes-support/swupdate/swupdate.inc
>>>> index b65fb86..750b942 100644
>>>> --- a/recipes-support/swupdate/swupdate.inc
>>>> +++ b/recipes-support/swupdate/swupdate.inc
>>>> @@ -192,6 +192,12 @@ python () {
>>>>      do_configure () {
>>>>        cp ${WORKDIR}/defconfig ${WORKDIR}/.config
>>>> +
>>>> +    cat >> ${WORKDIR}/.config <<HEREDOC
>>>> +CONFIG_EXTRA_CFLAGS="${CFLAGS}"
>>>> +CONFIG_EXTRA_LDFLAGS="${LDFLAGS}"
>>>> +HEREDOC
>>>> +
>>>>        m
>> I do not understand why we need them. CONFIG_EXTRA_CFLAGS and
>> CONFIG_EXTRA_LDFLAGS are as all other CONFIG_, and they are set if
>> defconfig or fragments contain them. Why do we need them ?
> 
> This makes it follow the same rules as other recipes with respect to
> debugging flags and such.

Even busybox ?

One thing is that OE is one of the buildsystems, not the one. On OE it
makes more sense to let EXTRA_CFLAGS out, but I am not sure when it is
built for other systems.

> I found this because I was attempting to debug
> a crash in swupdate but the symbols were unexpectedly missing from the
> -dbg package because these flags were not passed along.

Yes, reason is clear to me.

> There are also a
> lot of other flags besides "-g" that are passed in CFLAGS that most
> users want to be respected, such as prefix mapping for reproducible builds.
> 
> 
> It would seem a little strange to me to have to specify that sort of
> thing independently in swupdate when all other recipes behave the same,
> and there's no feasible way to get the same behavior as the CFLAGS
> provided by bitbake with a static assignment because many of them are
> based on the build path or other information only known to the recipe.

But then, we cannot have both way to set the flags. If we rely on flags
passed by OE, EXTRA_CFLAGS should be dropped by CONFIG_, right ?

> Even so, if you still want that behavior, I can prepend the flags to
> defconfig so that if the user really wants to override them for some
> reason in defconfig or a config fragment they can.

It sounds weird - if someone wants to overwrite them, he should do this
in a own .bbappend (for example, as EXTRA_OEMAKE). We can safe drop the
use case with CFLAGS in defconfig.

Best regards,
Stefano

> 
> 
>>
>>
>>
>> erge_config.sh -O ${B} -m ${WORKDIR}/.config ${@"
>>>> ".join(find_cfgs(d))}
>>>>        (cd ${S} && cml1_do_configure)
>>>>    }
>> Best regards,
>> Stefano
>>
>
diff mbox series

Patch

diff --git a/recipes-support/swupdate/swupdate.inc b/recipes-support/swupdate/swupdate.inc
index b65fb86..750b942 100644
--- a/recipes-support/swupdate/swupdate.inc
+++ b/recipes-support/swupdate/swupdate.inc
@@ -192,6 +192,12 @@  python () {
 
 do_configure () {
     cp ${WORKDIR}/defconfig ${WORKDIR}/.config
+
+    cat >> ${WORKDIR}/.config <<HEREDOC
+CONFIG_EXTRA_CFLAGS="${CFLAGS}"
+CONFIG_EXTRA_LDFLAGS="${LDFLAGS}"
+HEREDOC
+
     merge_config.sh -O ${B} -m ${WORKDIR}/.config ${@" ".join(find_cfgs(d))}
     (cd ${S} && cml1_do_configure)
 }