1/1] package/swupdate: new package
PATCH v2 1/1 1/1] package/swupdate: new package
From: J?rg Krause <[email protected]>
This patch is based on an WIP version submitted by Romain Naour, commented by Arnout Vandecappelle:
https://patchwork.ozlabs.org/patch/401270/
The package provides a default configuration which let the user initiate an update by using an update URL by using libcurl. The embedded webserver (a customized version of mongoose) and Lua support are both disabled by default.
---
Changes v1 -> v2:
- bump to latest commit d9f58b5a3263b1b00c6d011cd8cdd65e69890b46
- update Sob email address
--- package/Config.in | 1 + package/swupdate/Config.in | 93 +++++++++++++++ ...wupdate-0001-Add-missing-header-for-off_t.patch | 25 ++++ package/swupdate/swupdate.config | 82 +++++++++++++ package/swupdate/swupdate.mk | 127 +++++++++++++++++++++ 5 files changed, 328 insertions(+) create mode 100644 package/swupdate/Config.in create mode 100644 package/swupdate/swupdate-0001-Add-missing-header-for-off_t.patch create mode 100644 package/swupdate/swupdate.config create mode 100644 package/swupdate/swupdate.mk
package/Config.in +1 -0
@@ -1344,6 +1344,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS source "package/start-stop-daemon/Config.in" endif source "package/supervisor/Config.in" + source "package/swupdate/Config.in" if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS source "package/sysklogd/Config.in" endif
package/swupdate/Config.in new file +93 -0
93 lines not on this page · raw message
package/swupdate/swupdate-0001-Add-missing-header-for-off_t.patch new file +25 -0
@@ -0,0 +1,25 @@ +From 4e382373cad64ca7e183336e33b72c53cfeed340 Mon Sep 17 00:00:00 2001 +From: Romain Naour <[email protected]> +Date: Sun, 7 Sep 2014 17:31:09 +0200 +Subject: [PATCH 1/1] Add missing header for off_t + +Signed-off-by: Romain Naour <[email protected]> +--- + include/swupdate.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/swupdate.h b/include/swupdate.h +index 78b7f85..c193397 100644 +--- a/include/swupdate.h ++++ b/include/swupdate.h +@@ -23,6 +23,7 @@ + #ifndef _SWUPDATE_H + #define _SWUPDATE_H + ++#include <sys/types.h> + #include <sys/queue.h> + #include "flash.h" + #include "globals.h" +-- +1.9.3 +
package/swupdate/swupdate.config new file +82 -0
82 lines not on this page · raw message
package/swupdate/swupdate.mk new file +127 -0
127 lines not on this page · raw message
Signature · 1 line
2.3.3
PATCH v2 1/1 1/1] package/swupdate: new package
Hi Joerg,
Quoted 1 line · J?rg Krause
From: J?rg Krause <[email protected]>
Perhaps you should reset the author as well? Pass --reset-author to git commit
--amend.
Quoted 5 lines
This patch is based on an WIP version submitted by Romain Naour, commented by Arnout Vandecappelle:
https://patchwork.ozlabs.org/patch/401270/The package provides a default configuration which let the user initiate an
^^^lets
Quoted 4 lines
update by using an update URL by using libcurl. The embedded webserver (a customized version of mongoose) and Lua support are both disabled by default.
Signed-off-by J?rg Krause <[email protected]>
Since the original is from Romain, please add:
Quoted 39 lines
Tested-by Mike Williams <[email protected]>---
Changes v1 -> v2:
- bump to latest commitd9f58b5a3263b1b00c6d011cd8cdd65e69890b46
- update Sob email address--- package/Config.in | 1 + package/swupdate/Config.in | 93 +++++++++++++++ ...wupdate-0001-Add-missing-header-for-off_t.patch | 25 ++++ package/swupdate/swupdate.config | 82 +++++++++++++ package/swupdate/swupdate.mk | 127 +++++++++++++++++++++ 5 files changed, 328 insertions(+) create mode 100644 package/swupdate/Config.in create mode 100644 package/swupdate/swupdate-0001-Add-missing-header-for-off_t.patch create mode 100644 package/swupdate/swupdate.config create mode 100644 package/swupdate/swupdate.mkpackage/Config.in +1
-0@@ -1344,6 +1344,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS source "package/start-stop-daemon/Config.in" endif source "package/supervisor/Config.in" + source "package/swupdate/Config.in" if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS source "package/sysklogd/Config.in" endifpackage/swupdate/Config.in new file +4
-0@@ -0,0 +1,93 @@ +config BR2_PACKAGE_SWUPDATE + bool "swupdate" + select BR2_PACKAGE_ZLIB + select BR2_PACKAGE_MTD
package/swupdate/Config.in line 14
Quoted 10 lines
package/swupdate/Config.in new file +10
-0+ help + swupdate provides a reliable way to update the software on an embedded + system. + + https://github.com/sbabic/swupdate.git + +if BR2_PACKAGE_SWUPDATE + +config BR2_PACKAGE_SWUPDATE_CONFIG + string "swupdate configuration file to use?"
Remove the "to use?" bit.
package/swupdate/Config.in line 26
Quoted 12 lines
package/swupdate/Config.in new file +12
-0+ default "package/swupdate/swupdate.config" + help + Some people may wish to use their own modified swupdate configuration + file, and will specify their config file location with this option. + + Most people will just use the default swupdate configuration file. + This will enable swupdate with an image downloader, as well as image + handlers for UBI volumes, raw NAND or NOR flash, SD cards, shell + scripts, and the U-Boot bootloader environment. + +config BR2_PACKAGE_SWUPDATE_LIBCURL + bool "Enable image downloading"
All these options that update the .config file... The user can just make
swupdate-menuconfig, no? And IMHO it's very confusing for the user that they do
make swupdate-menuconfig
select libcurl
make
-> curl has vanished
On the other hand, it's also annoying for the user that they have to manually
enable all these dependencies... Hm, now I'm not so sure anymore :-(
If you would work this way, then the help text should clearly specify which
other packages are "interesting" for swupdate.
Quoted 22 lines
package/swupdate/Config.in new file +22
-0+ select BR2_PACKAGE_LIBCURL + default y + help + Enable update from image URL using libcurl. Files are downloaded ? + completely before installation begins. + +config BR2_PACKAGE_SWUPDATE_WEBSERVER + bool "Enable embedded webserver" + depends on BR2_TOOLCHAIN_HAS_THREADS + select BR2_PACKAGE_OPENSSL + help + Enable firmware update from a remote device using an embedded + webserver on the target. + +comment "Webserver support needs toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS + +if BR2_PACKAGE_SWUPDATE_WEBSERVER + +config BR2_PACKAGE_SWUPDATE_WEBSERVER_MONGOOSE_IPV6 + depends on BR2_INET_IPV6 + bool "Webserver with IPv6 support"
package/swupdate/Config.in line 58
Quoted 10 lines
package/swupdate/Config.in new file +10
-0+ help + Enable IPv6 support for the webserver. + +comment "IPv6 support for the webserver needs toolchain w/ IPv6" + depends on !BR2_INET_IPV6 + +config BR2_PACKAGE_SWUPDATE_WEBSERVER_MONGOOSE_SQL + bool "Webserver with SQL support" + depends on BR2_LARGEFILE + depends on BR2_PACKAGE_HAS_LUAINTERPRETER
Is SQL implemented in lua? Oh, yes, now I see it is. But shouldn't you selectBR2_PACKAGE_LUASQL_SQLITE3 then?
package/swupdate/Config.in line 69
Quoted 11 lines
package/swupdate/Config.in new file +11
-0+ depends on !BR2_PACKAGE_LUA_5_1 + help + Enable SQL support for the webserver. + +comment "Webservers Lua support needs a toolchain w/ largefile and a Lua 5.2 interpreter" + depends on !BR2_LARGEFILE || BR2_PACKAGE_LUA_5_1 || !BR2_PACKAGE_HAS_LUAINTERPRETER + +config BR2_PACKAGE_SWUPDATE_WEBSERVER_MONGOOSE_SSL + bool "Webserver with SSL support" + help + Enable SSL support for the webserver.
Missing select? IIRC mongoose works with openssl and polarssl.
Quoted 30 lines
package/swupdate/Config.in new file +24
-0+ +endif + +config BR2_PACKAGE_SWUPDATE_LIBCONFIG + bool "Enable libconfig parser" + select BR2_PACKAGE_LIBCONFIG + default y + help + Use libconfig to parse the configuration file. + This is the default parser. Unless you don't use your own + external parser written in Lua you'll need to say Y here. + +config BR2_PACKAGE_SWUPDATE_LUA_SUPPORT + depends on BR2_PACKAGE_HAS_LUAINTERPRETER + depends on !BR2_PACKAGE_LUA_5_1 + bool "Enable Lua support" + help + Enable Lua support. + Select this for using custom scripts written in Lua. + +comment "Lua support needs a Lua 5.2 interpreter" + depends on BR2_PACKAGE_LUA_5_1 || !BR2_PACKAGE_HAS_LUAINTERPRETER + +endifpackage/swupdate/swupdate-0001-Add-missing-header-for-off_t.patch new file +0
-0
package/swupdate/swupdate-0001-Add-missing-header-for-off_t.patch line 6
Quoted 6 lines
package/swupdate/swupdate-0001-Add-missing-header-for-off_t.patch new file +6
-0@@ -0,0 +1,25 @@ +From 4e382373cad64ca7e183336e33b72c53cfeed340 Mon Sep 17 00:00:00 2001 +From: Romain Naour <[email protected]> +Date: Sun, 7 Sep 2014 17:31:09 +0200 +Subject: [PATCH 1/1] Add missing header for off_t + +Signed-off-by: Romain Naour <[email protected]>
Romain, what's the upstream status for this patch?
Quoted 25 lines
package/swupdate/swupdate-0001-Add-missing-header-for-off_t.patch new file +19
-0+--- + include/swupdate.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/swupdate.h b/include/swupdate.h +index 78b7f85..c193397 100644 +--- a/include/swupdate.h ++++ b/include/swupdate.h +@@ -23,6 +23,7 @@ + #ifndef _SWUPDATE_H + #define _SWUPDATE_H + ++#include <sys/types.h> + #include <sys/queue.h> + #include "flash.h" + #include "globals.h" +-- +1.9.3 +package/swupdate/swupdate.config new file +0
-0
package/swupdate/swupdate.config line 2
Quoted 2 lines
package/swupdate/swupdate.config new file +2
-0@@ -0,0 +1,82 @@ +# +# Automatically generated make config: don't edit
Maybe convince upstream to add a savedefconfig target :-)
Quoted 2 lines
package/swupdate/swupdate.config new file +2
-0+# swupdate version: 2014.07.0 +# Thu Dec 18 10:00:56 2014
[snip]
Quoted 44 lines
package/swupdate/swupdate.mk new file +38
-0@@ -0,0 +1,127 @@ +################################################################################ +# +# swupdate +# +################################################################################ + +# Choose latest commit instead of release 2014.07 for getting bug fixes and +# image downloading feature +SWUPDATE_VERSION = d9f58b5a3263b1b00c6d011cd8cdd65e69890b46 +SWUPDATE_SITE = $(call github,sbabic,swupdate,$(SWUPDATE_VERSION)) +SWUPDATE_LICENSE = GPLv2+ +SWUPDATE_LICENSE_FILES = COPYING +SWUPDATE_DEPENDENCIES = zlib mtd + +SWUPDATE_BUILD_CONFIG = $(SWUPDATE_DIR)/.config + +SWUPDATE_KCONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_SWUPDATE_CONFIG)) +SWUPDATE_KCONFIG_EDITORS = menuconfig xconfig gconfig + +SWUPDATE_CFLAGS = \ + $(TARGET_CFLAGS) + +SWUPDATE_LDFLAGS = \ + $(TARGET_LDFLAGS) + +SWUPDATE_LDLIBS = + +# If we're using static libs do the same for swupdate +ifeq ($(BR2_PREFER_STATIC_LIB),y) +define SWUPDATE_PREFER_STATIC + $(call KCONFIG_ENABLE_OPT,CONFIG_STATIC,$(SWUPDATE_BUILD_CONFIG)) +endef +endif + +define SWUPDATE_BUILD_OPTIONS + $(call KCONFIG_SET_OPT,CONFIG_CROSS_COMPILER_PREFIX,"$(TARGET_CROSS)",$(SWUPDATE_BUILD_CONFIG)) + $(call KCONFIG_SET_OPT,CONFIG_SYSROOT,"$(SYSROOT_DIR)",$(SWUPDATE_BUILD_CONFIG)) + $(call KCONFIG_SET_OPT,CONFIG_EXTRA_CFLAGS,"$(SWUPDATE_CFLAGS)",$(SWUPDATE_BUILD_CONFIG))
package/swupdate/swupdate.mk line 48
Quoted 10 lines
package/swupdate/swupdate.mk new file +10
-0+ $(call KCONFIG_SET_OPT,CONFIG_EXTRA_LDFLAGS,"$(SWUPDATE_LDFLAGS)",$(SWUPDATE_BUILD_CONFIG)) + $(call KCONFIG_SET_OPT,CONFIG_EXTRA_LDLIBS,"$(SWUPDATE_LDLIBS)",$(SWUPDATE_BUILD_CONFIG)) +endef + +ifeq ($(BR2_PACKAGE_SWUPDATE_LIBCURL),y) +SWUPDATE_DEPENDENCIES += libcurl +else +define SWUPDATE_DOWNLOAD + $(call KCONFIG_DISABLE_OPT,CONFIG_DOWNLOAD,$(SWUPDATE_BUILD_CONFIG)) +endef
One way to handle this better is to convince upstream to add config options
passed through the environment that specify which dependencies are available. Then we could specify
ifeq ($(BR2_PACKAGE_LIBCURL),y)SWUPDATE_DEPENDENCIES += libcurlSWUPDATE_MAKE_ENV += LIBCURL_AVAILABLE=y
elseSWUPDATE_MAKE_ENV += LIBCURL_AVAILABLE=
endif
(note that kconfig-package takes into account $(2)_MAKE_ENV).
This way, the user can use swupdate's configure and he'll only see the options
that are really available.
package/swupdate/swupdate.mk line 53
Quoted 5 lines
package/swupdate/swupdate.mk new file +5
-0+endif + +# swupate bundles its own customized version of Mongoose with a Lua licence. +ifeq ($(BR2_PACKAGE_SWUPDATE_WEBSERVER),y) +SWUPDATE_DEPENDENCIES += openssl
Even if no SSL is selected it needs openssl?
package/swupdate/swupdate.mk line 65
Quoted 12 lines
package/swupdate/swupdate.mk new file +12
-0+SWUPDATE_LDLIBS += pthread crypto +define SWUPDATE_WEBSERVER_MONGOOSE + $(call KCONFIG_ENABLE_OPT,CONFIG_WEBSERVER,$(SWUPDATE_BUILD_CONFIG)) + $(call KCONFIG_ENABLE_OPT,CONFIG_MONGOOSE,$(SWUPDATE_BUILD_CONFIG)) + $(SWUPDATE_WEBSERVER_MONGOOSE_IPV6) + $(SWUPDATE_WEBSERVER_MONGOOSE_LUA) + $(SWUPDATE_WEBSERVER_MONGOOSE_SQL) + $(SWUPDATE_WEBSERVER_MONGOOSE_SSL) +endef +endif + +ifeq ($(BR2_PACKAGE_SWUPDATE_WEBSERVER_MONGOOSE_IPV6),y)
This could just be ifeq ($(BR2_INET_IPV6),y). The impact of IPv6 is really minor.
package/swupdate/swupdate.mk line 73
Quoted 8 lines
package/swupdate/swupdate.mk new file +8
-0+SWUPDATE_CFLAGS += -DUSE_IPV6 +define SWUPDATE_WEBSERVER_MONGOOSE_IPV6 + $(call KCONFIG_ENABLE_OPT,CONFIG_MONGOOSEIPV6,$(SWUPDATE_BUILD_CONFIG)) +endef +endif + +ifeq ($(BR2_PACKAGE_SWUPDATE_WEBSERVER_MONGOOSE_SQL),y) +SWUPDATE_CFLAGS += -DUSE_LUA_SQLITE3
_DEPENDENCIES?
Quoted 34 lines
package/swupdate/swupdate.mk new file +34
-0+define SWUPDATE_WEBSERVER_MONGOOSE_SQL + $(call KCONFIG_ENABLE_OPT,CONFIG_MONGOOSESQL,$(SWUPDATE_BUILD_CONFIG)) +endef +endif + +ifeq ($(BR2_PACKAGE_SWUPDATE_WEBSERVER_MONGOOSE_SSL),y) +SWUPDATE_CFLAGS += -DNO_SSL_DL +SWUPDATE_LDLIBS += ssl +define SWUPDATE_WEBSERVER_MONGOOSE_SSL + $(call KCONFIG_ENABLE_OPT,CONFIG_MONGOOSESSL,$(SWUPDATE_BUILD_CONFIG)) +endef +else +SWUPDATE_CFLAGS += -DNO_SSL +endif + +ifeq ($(BR2_PACKAGE_SWUPDATE_LIBCONFIG),y) +SWUPDATE_DEPENDENCIES += libconfig +else +define SWUPDATE_LIBCONFIG_PARSER + $(call KCONFIG_DISABLE_OPT,CONFIG_LIBCONFIG,$(SWUPDATE_BUILD_CONFIG)) +endef +endif + +ifeq ($(BR2_PACKAGE_SWUPDATE_LUA_SUPPORT),y) +SWUPDATE_DEPENDENCIES += lua +SWUPDATE_CFLAGS += -DUSE_LUA +SWUPDATE_LDLIBS += dl +define SWUPDATE_LUA + $(call KCONFIG_ENABLE_OPT,CONFIG_LUA,$(SWUPDATE_BUILD_CONFIG)) + $(call KCONFIG_ENABLE_OPT,CONFIG_LUASCRIPTHANDLER,$(SWUPDATE_BUILD_CONFIG)) + $(call KCONFIG_ENABLE_OPT,CONFIG_HANDLER_IN_LUA,$(SWUPDATE_BUILD_CONFIG)) + $(call KCONFIG_ENABLE_OPT,CONFIG_LUAEXTERNAL,$(SWUPDATE_BUILD_CONFIG)) + $(call KCONFIG_ENABLE_OPT,CONFIG_MONGOOSELUA,$(SWUPDATE_BUILD_CONFIG)) +endef
package/swupdate/swupdate.mk line 117
Quoted 10 lines
package/swupdate/swupdate.mk new file +10
-0+endif + +define SWUPDATE_KCONFIG_FIXUP_CMDS + $(SWUPDATE_PREFER_STATIC) + $(SWUPDATE_BUILD_OPTIONS) + $(SWUPDATE_DOWNLOAD) + $(SWUPDATE_WEBSERVER_MONGOOSE) + $(SWUPDATE_LIBCONFIG_PARSER) + $(SWUPDATE_LUA) +endef
To make all this configuration complexity a bit easier to grok, I propose to
start with a patch that adds swupdate with all of its dependencies enabled. So select openssl, lua, and libconfig. That gives the user complete freedom to configure things the way he likes. The next step would be to make the lua dependency optional, preferably by patching upstream to pass the availability of lua through the environment.
Regards,
Arnout
-
Quoted 11 lines
package/swupdate/swupdate.mk new file +10
-0+ +define SWUPDATE_BUILD_CMDS + $(MAKE) -C $(@D) +endef + +define SWUPDATE_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(@D)/swupdate $(TARGET_DIR)/usr/bin/swupdate +endef + +$(eval $(kconfig-package))
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
PATCH v2 1/1 1/1] package/swupdate: new package
In reply to Jörg KrauseDear J?rg Krause,
Quoted 6 lines · J?rg Krause
From: J?rg Krause <[email protected]>
This patch is based on an WIP version submitted by Romain Naour, commented by Arnout Vandecappelle:
https://patchwork.ozlabs.org/patch/401270/
Quoted 6 lines
The package provides a default configuration which let the user initiate an update by using an update URL by using libcurl. The embedded webserver (a customized version of mongoose) and Lua support are both disabled by default.
Signed-off-by J?rg Krause <[email protected]>Tested-by Mike Williams <[email protected]>
Jorg, Romain, this patch is from March 19, and Arnout made a number of comments on March 22. Can you resend an updated version ?
I'll mark your patch as Changes Requested in patchwork, so please remember to send a new version.
Thanks a lot!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/1 1/1] package/swupdate: new package
Dear Thomas,
Quoted 13 lines · Thomas Petazzoni
Dear J?rg Krause,
Quoted 10 lines · J?rg Krause
From: J?rg Krause <[email protected]>
This patch is based on an WIP version submitted by Romain Naour, commented by Arnout Vandecappelle:
https://patchwork.ozlabs.org/patch/401270/The package provides a default configuration which let the user initiate an update by using an update URL by using libcurl. The embedded webserver (a customized version of mongoose) and Lua support are both disabled by default.
Quoted 8 lines
Quoted 2 lines
Signed-off-by J?rg Krause <[email protected]>Tested-by Mike Williams <[email protected]>Jorg, Romain, this patch is from March 19, and Arnout made a number of comments on March 22. Can you resend an updated version ?
I'll mark your patch as Changes Requested in patchwork, so please remember to send a new version.
It's on my never-ending to do list :-)
Best regards
J?rg
PATCH v2 1/1 1/1] package/swupdate: new package
Hello,
Quoted 4 lines · J?rg Krause
Quoted 2 lines
I'll mark your patch as Changes Requested in patchwork, so please remember to send a new version.
It's on my never-ending to do list :-)
Great :-)
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com