swupdate: replace on-the-fly patch with a clearer, equivalent one

The patch we were using comes from the time during dualboot support development
where said feature was selectable at build time. The patch adds a new build
option, giving the impression that it only gets enabled under certain
circumstances, when in reality:

    * The option is never enabled anywhere in our code
    * It's a string option that is treated like a boolean, meaning its
      respective conditional compilation is always getting compiled even when
      disabled

Our current dualboot support is enabled at runtime, so it doesn't make sense to
have a build-time option related to it, especially one that's broken. Replace
the patch with a functionally equivalent one that is less confusing. Also,
remove the related config option from our defconfig.

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2024-02-27 11:28:56 +01:00
parent b2d9d33cf9
commit 948e55bde9
4 changed files with 29 additions and 50 deletions

View File

@ -1,47 +0,0 @@
From: Mike Engel <Mike.Engel@digi.com>
Date: Wed, 23 Jun 2021 15:11:12 +0200
Subject: [PATCH] config: add on the fly build configuration variable
This commit adds on the fly configuration to the swupdate
build system to correct an issue when using sw-description
files that support different images and installation locations.
Signed-off-by: Mike Engel <Mike.Engel@digi.com>
---
Kconfig | 7 +++++++
core/network_thread.c | 4 +++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/Kconfig b/Kconfig
index 5a3dc9a..17fa27c 100644
--- a/Kconfig
+++ b/Kconfig
@@ -262,6 +262,13 @@ config FEATURE_SYSLOG
# This option is auto-selected when you select any applet which may
# send its output to syslog. You do not need to select it manually.
+config DIGI_ON_THE_FLY
+ string "Add Digi on the fly support"
+ default n
+ #help
+ # This option is used in on the fly support to skip selection
+ # verification.
+
endmenu
menu 'Build Options'
diff --git a/core/network_thread.c b/core/network_thread.c
index ca23908..c539d27 100644
--- a/core/network_thread.c
+++ b/core/network_thread.c
@@ -102,7 +102,9 @@ static bool is_selection_allowed(const char *software_set, char *running_mode,
}
free(swset);
}
-
+#ifdef CONFIG_DIGI_ON_THE_FLY
+ allowed = true;
+#endif
if (allowed) {
INFO("Accepted selection %s,%s", software_set, running_mode);
}else

View File

@ -0,0 +1,27 @@
From: Mike Engel <Mike.Engel@digi.com>
Date: Wed, 23 Jun 2021 15:11:12 +0200
Subject: [PATCH] network_thread: always allow selection
This is needed for on-the-fly updates to avoid errors when using sw-description
files with multiple image/installation sets. Make sure to keep returning
"false" in case of an OOM error.
Signed-off-by: Mike Engel <Mike.Engel@digi.com>
Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
---
core/network_thread.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/network_thread.c b/core/network_thread.c
index ca23908d..b0767ab2 100644
--- a/core/network_thread.c
+++ b/core/network_thread.c
@@ -80,7 +80,7 @@ static bool is_selection_allowed(const char *software_set, char *running_mode,
char *swset = NULL;
struct dict_list *sets;
struct dict_list_elem *selection;
- bool allowed = false;
+ bool allowed = true;
/*
* No attempt to change software set

View File

@ -27,7 +27,6 @@ CONFIG_SOCKET_PROGRESS_PATH=""
# CONFIG_MTD is not set # CONFIG_MTD is not set
# CONFIG_LUA is not set # CONFIG_LUA is not set
# CONFIG_FEATURE_SYSLOG is not set # CONFIG_FEATURE_SYSLOG is not set
CONFIG_DIGI_ON_THE_FLY="n"
# #
# Build Options # Build Options

View File

@ -1,4 +1,4 @@
# Copyright (C) 2016-2023 Digi International Inc. # Copyright (C) 2016-2024 Digi International Inc.
FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
@ -7,7 +7,7 @@ RDEPENDS:${PN} += "libgcc"
SRC_URI += " \ SRC_URI += " \
file://0001-Makefile-change-Makefile-to-build-swupdate-library-s.patch \ file://0001-Makefile-change-Makefile-to-build-swupdate-library-s.patch \
file://0002-config-add-on-the-fly-build-configuration-variable.patch \ file://0002-network_thread-always-allow-selection.patch \
file://0003-handlers-rdiff-handler-for-applying-librsync-s-rdiff.patch \ file://0003-handlers-rdiff-handler-for-applying-librsync-s-rdiff.patch \
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'file://systemd.cfg', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'file://systemd.cfg', '', d)} \
${@bb.utils.contains('STORAGE_MEDIA', 'mtd', 'file://mtd.cfg', '', d)} \ ${@bb.utils.contains('STORAGE_MEDIA', 'mtd', 'file://mtd.cfg', '', d)} \