swupdate: integrate support from meta-digi-dual boot layer

One patch adds support for building the library statically and the other is a
fix for performing firmware update on the fly. These patches have been moved
from the meta-digi-dualboot layer

https://onedigi.atlassian.net/browse/DEL-7903

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
(cherry picked from commit 94018f7402586b916c5c7836eb355a19a78a9c51)
This commit is contained in:
Arturo Buzarra 2022-05-30 16:16:21 +02:00
parent 9458c4a25b
commit be061507f9
3 changed files with 139 additions and 0 deletions

View File

@ -0,0 +1,86 @@
From: Mike Engel <Mike.Engel@digi.com>
Date: Mon, 28 Jun 2021 18:45:20 +0200
Subject: [PATCH 1/2] Makefile: change Makefile to build swupdate library
statically
Signed-off-by: Mike Engel <Mike.Engel@digi.com>
---
Makefile | 5 +++--
ipc-static/Makefile | 6 ++++++
ipc-static/network_ipc-if.c | 1 +
ipc-static/network_ipc.c | 1 +
ipc-static/progress_ipc.c | 1 +
5 files changed, 12 insertions(+), 2 deletions(-)
create mode 100644 ipc-static/Makefile
create mode 120000 ipc-static/network_ipc-if.c
create mode 120000 ipc-static/network_ipc.c
create mode 120000 ipc-static/progress_ipc.c
diff --git a/Makefile b/Makefile
index aa7d556..f905efa 100644
--- a/Makefile
+++ b/Makefile
@@ -363,7 +363,7 @@ include $(srctree)/Makefile.flags
# Defaults to vmlinux, but the arch makefile usually adds further targets
objs-y := core handlers
-libs-y := corelib mongoose parser suricatta bootloader fs
+libs-y := corelib ipc-static mongoose parser suricatta bootloader fs
bindings-y := bindings
tools-y := tools
@@ -437,7 +437,7 @@ quiet_cmd_shared = LD $@
"-shared -Wl,-soname,$@" \
"$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
"$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(objtree)" \
- "$(2)" \
+ "$(2) ipc-static/lib.a" \
"" \
"$(LDLIBS)"
@@ -481,6 +481,7 @@ install: all
install -m 0644 $(srctree)/include/progress_ipc.h ${DESTDIR}/${INCLUDEDIR}
install -m 0755 $(objtree)/${swupdate-ipc-lib} ${DESTDIR}/${LIBDIR}
ln -sfr ${DESTDIR}/${LIBDIR}/${swupdate-ipc-lib} ${DESTDIR}/${LIBDIR}/libswupdate.so
+ install -m 0755 ipc-static/lib.a ${DESTDIR}/${LIBDIR}/libswupdate.a
if [ $(HAVE_LUA) = y ]; then \
install -d ${DESTDIR}/${LIBDIR}/lua/$(LUAVER); \
install -m 0755 ${lua_swupdate} $(DESTDIR)/${LIBDIR}/lua/$(LUAVER); \
diff --git a/ipc-static/Makefile b/ipc-static/Makefile
new file mode 100644
index 0000000..99cce6c
--- /dev/null
+++ b/ipc-static/Makefile
@@ -0,0 +1,6 @@
+# Copyright (C) 2021 Digi International Inc.
+#
+# SPDX-License-Identifier: GPL-2.0-only
+lib-y += network_ipc.o network_ipc-if.o progress_ipc.o
+
+EXTRA_CFLAGS += -fPIC
diff --git a/ipc-static/network_ipc-if.c b/ipc-static/network_ipc-if.c
new file mode 120000
index 0000000..37894e2
--- /dev/null
+++ b/ipc-static/network_ipc-if.c
@@ -0,0 +1 @@
+../ipc/network_ipc-if.c
\ No newline at end of file
diff --git a/ipc-static/network_ipc.c b/ipc-static/network_ipc.c
new file mode 120000
index 0000000..0640077
--- /dev/null
+++ b/ipc-static/network_ipc.c
@@ -0,0 +1 @@
+../ipc/network_ipc.c
\ No newline at end of file
diff --git a/ipc-static/progress_ipc.c b/ipc-static/progress_ipc.c
new file mode 120000
index 0000000..7c6622c
--- /dev/null
+++ b/ipc-static/progress_ipc.c
@@ -0,0 +1 @@
+../ipc/progress_ipc.c
\ No newline at end of file
--

View File

@ -0,0 +1,48 @@
From: Mike Engel <Mike.Engel@digi.com>
Date: Wed, 23 Jun 2021 15:11:12 +0200
Subject: [PATCH 2/2] 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 3862285..525c157 100644
--- a/Kconfig
+++ b/Kconfig
@@ -241,6 +241,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 b21d983..3edda1e 100644
--- a/core/network_thread.c
+++ b/core/network_thread.c
@@ -97,7 +97,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

@ -5,6 +5,11 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
# Without libgcc, swupdate generates an error signal when terminating
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 \
"
do_configure_append() {
# If Trustfence is enabled, enable the signing support in the
# '.config' file.