From 948e55bde969d8f815370adf8c348db443ee34e3 Mon Sep 17 00:00:00 2001 From: Gabriel Valcazar Date: Tue, 27 Feb 2024 11:28:56 +0100 Subject: [PATCH] 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 --- ...the-fly-build-configuration-variable.patch | 47 ------------------- ...etwork_thread-always-allow-selection.patch | 27 +++++++++++ .../swupdate/swupdate/defconfig | 1 - .../swupdate/swupdate_%.bbappend | 4 +- 4 files changed, 29 insertions(+), 50 deletions(-) delete mode 100644 meta-digi-dey/recipes-support/swupdate/swupdate/0002-config-add-on-the-fly-build-configuration-variable.patch create mode 100644 meta-digi-dey/recipes-support/swupdate/swupdate/0002-network_thread-always-allow-selection.patch diff --git a/meta-digi-dey/recipes-support/swupdate/swupdate/0002-config-add-on-the-fly-build-configuration-variable.patch b/meta-digi-dey/recipes-support/swupdate/swupdate/0002-config-add-on-the-fly-build-configuration-variable.patch deleted file mode 100644 index 75805e89b..000000000 --- a/meta-digi-dey/recipes-support/swupdate/swupdate/0002-config-add-on-the-fly-build-configuration-variable.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Mike Engel -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 ---- - 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 diff --git a/meta-digi-dey/recipes-support/swupdate/swupdate/0002-network_thread-always-allow-selection.patch b/meta-digi-dey/recipes-support/swupdate/swupdate/0002-network_thread-always-allow-selection.patch new file mode 100644 index 000000000..0cb91e49a --- /dev/null +++ b/meta-digi-dey/recipes-support/swupdate/swupdate/0002-network_thread-always-allow-selection.patch @@ -0,0 +1,27 @@ +From: Mike Engel +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 +Signed-off-by: Gabriel Valcazar +--- + 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 diff --git a/meta-digi-dey/recipes-support/swupdate/swupdate/defconfig b/meta-digi-dey/recipes-support/swupdate/swupdate/defconfig index 464fe703f..7c980d1de 100644 --- a/meta-digi-dey/recipes-support/swupdate/swupdate/defconfig +++ b/meta-digi-dey/recipes-support/swupdate/swupdate/defconfig @@ -27,7 +27,6 @@ CONFIG_SOCKET_PROGRESS_PATH="" # CONFIG_MTD is not set # CONFIG_LUA is not set # CONFIG_FEATURE_SYSLOG is not set -CONFIG_DIGI_ON_THE_FLY="n" # # Build Options diff --git a/meta-digi-dey/recipes-support/swupdate/swupdate_%.bbappend b/meta-digi-dey/recipes-support/swupdate/swupdate_%.bbappend index 2e3b33e6c..26cbd2c2c 100644 --- a/meta-digi-dey/recipes-support/swupdate/swupdate_%.bbappend +++ b/meta-digi-dey/recipes-support/swupdate/swupdate_%.bbappend @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2023 Digi International Inc. +# Copyright (C) 2016-2024 Digi International Inc. FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" @@ -7,7 +7,7 @@ RDEPENDS:${PN} += "libgcc" SRC_URI += " \ 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 \ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'file://systemd.cfg', '', d)} \ ${@bb.utils.contains('STORAGE_MEDIA', 'mtd', 'file://mtd.cfg', '', d)} \