* [Buildroot] [PATCH] package/swupdate: workaround runtime update failure
@ 2023-11-23 17:39 Giulio Benetti
2023-11-24 21:59 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 4+ messages in thread
From: Giulio Benetti @ 2023-11-23 17:39 UTC (permalink / raw)
To: buildroot
Cc: Giulio Benetti, Jim Reinhart, Matthew Maron, James Autry,
Giulio Benetti
From: Giulio Benetti <giulio.benetti+tekvox@benettiengineering.com>
If SWUpdate is built using -Os optimization it will fail to update using
Mongoose webserver randomly and always while using option
installed-directly in .swu file generation. So let's workaround the bug
by building with -O3.
Reported upstream:
https://groups.google.com/g/swupdate/c/oHMihNw8ZHA
Cc: Jim Reinhart <jimr@tekvox.com>
Cc: James Autry <jautry@tekvox.com>
Cc: Matthew Maron <matthewm@tekvox.com>
Signed-off-by: Giulio Benetti <giulio.benetti+tekvox@benettiengineering.com>
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
package/swupdate/swupdate.mk | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/package/swupdate/swupdate.mk b/package/swupdate/swupdate.mk
index ea4a5a62e5..7801be07ce 100644
--- a/package/swupdate/swupdate.mk
+++ b/package/swupdate/swupdate.mk
@@ -217,10 +217,19 @@ endif
SWUPDATE_KCONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_SWUPDATE_CONFIG))
SWUPDATE_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
+SWUPDATE_CFLAGS = $(TARGET_CFLAGS)
+
+# Workaround update failure showing up with -Os
+# Reported here:
+# https://groups.google.com/g/swupdate/c/oHMihNw8ZHA
+ifeq ($(BR2_OPTIMIZE_S),y)
+SWUPDATE_CFLAGS += -O3
+endif
+
SWUPDATE_MAKE_OPTS = \
SWU_VER="$(SWUPDATE_VERSION) (Buildroot $(BR2_VERSION_FULL))" \
CROSS_COMPILE="$(TARGET_CROSS)" \
- CONFIG_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
+ CONFIG_EXTRA_CFLAGS="$(SWUPDATE_CFLAGS)" \
CONFIG_EXTRA_LDFLAGS="$(TARGET_LDFLAGS)"
define SWUPDATE_KCONFIG_FIXUP_CMDS
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH] package/swupdate: workaround runtime update failure
2023-11-23 17:39 [Buildroot] [PATCH] package/swupdate: workaround runtime update failure Giulio Benetti
@ 2023-11-24 21:59 ` Thomas Petazzoni via buildroot
2023-11-25 0:24 ` Giulio Benetti
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-11-24 21:59 UTC (permalink / raw)
To: Giulio Benetti
Cc: Giulio Benetti, James Autry, Jim Reinhart, Matthew Maron,
buildroot
On Thu, 23 Nov 2023 18:39:57 +0100
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> +SWUPDATE_CFLAGS = $(TARGET_CFLAGS)
> +
> +# Workaround update failure showing up with -Os
> +# Reported here:
> +# https://groups.google.com/g/swupdate/c/oHMihNw8ZHA
> +ifeq ($(BR2_OPTIMIZE_S),y)
> +SWUPDATE_CFLAGS += -O3
> +endif
This looks really horrible to me. Is there a compiler bug? Or a bug in
the swupdate code base, such as some undefined behavior that causes an
incorrect behavior when built -Os, but not -O3 ?
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH] package/swupdate: workaround runtime update failure
2023-11-24 21:59 ` Thomas Petazzoni via buildroot
@ 2023-11-25 0:24 ` Giulio Benetti
2023-11-29 21:38 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 4+ messages in thread
From: Giulio Benetti @ 2023-11-25 0:24 UTC (permalink / raw)
To: Thomas Petazzoni
Cc: Giulio Benetti, James Autry, Jim Reinhart, Matthew Maron,
buildroot
Hi Thomas,
On 24/11/23 22:59, Thomas Petazzoni wrote:
> On Thu, 23 Nov 2023 18:39:57 +0100
> Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
>
>> +SWUPDATE_CFLAGS = $(TARGET_CFLAGS)
>> +
>> +# Workaround update failure showing up with -Os
>> +# Reported here:
>> +# https://groups.google.com/g/swupdate/c/oHMihNw8ZHA
>> +ifeq ($(BR2_OPTIMIZE_S),y)
>> +SWUPDATE_CFLAGS += -O3
>> +endif
>
> This looks really horrible to me.
You're right,
> Is there a compiler bug? Or a bug in
> the swupdate code base, such as some undefined behavior that causes an
> incorrect behavior when built -Os, but not -O3 ?
An undefined behavior showing up when built with -Os, but I'm currently
trying to work it out and also to give a test case to SWUpdate
Maintainer using qemu-arm.
So I think it's better I get to the root cause, I fix it and later
provide a local patch to fix the problem.
I've already set the patch as Rejected on Patchwork, sorry for the
noise.
Best regards
--
Giulio Benetti
CEO&CTO@Benetti Engineering sas
> Thomas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH] package/swupdate: workaround runtime update failure
2023-11-25 0:24 ` Giulio Benetti
@ 2023-11-29 21:38 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-11-29 21:38 UTC (permalink / raw)
To: Giulio Benetti
Cc: Giulio Benetti, James Autry, Jim Reinhart, Matthew Maron,
buildroot
Hello Giulio,
On Sat, 25 Nov 2023 01:24:45 +0100
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> > Is there a compiler bug? Or a bug in
> > the swupdate code base, such as some undefined behavior that causes an
> > incorrect behavior when built -Os, but not -O3 ?
>
> An undefined behavior showing up when built with -Os, but I'm currently
> trying to work it out and also to give a test case to SWUpdate
> Maintainer using qemu-arm.
>
> So I think it's better I get to the root cause, I fix it and later
> provide a local patch to fix the problem.
Sounds good, thanks for the effort.
> I've already set the patch as Rejected on Patchwork, sorry for the
> noise.
No worries at all!
Best regards,
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-11-29 21:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-23 17:39 [Buildroot] [PATCH] package/swupdate: workaround runtime update failure Giulio Benetti
2023-11-24 21:59 ` Thomas Petazzoni via buildroot
2023-11-25 0:24 ` Giulio Benetti
2023-11-29 21:38 ` Thomas Petazzoni via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox