Skip to contentSkip to conversation

uboot-tools: install libubootenv to staging

PATCH New Jörg Krause 2 participants 6 messages May 2, 2016 – May 7, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 uboot-tools: install libubootenv to staging

libubootenv is required by swupdate.

---
v3:
- install the library header file fw_env.h to staging, too
v2:
- install the static library to staging unconditionally (Thomas Petazzoni)

---
 package/uboot-tools/uboot-tools.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)
package/uboot-tools/uboot-tools.mk +10 -0
index f47b3db..bc8e7c1 100644
@@ -9,6 +9,7 @@ UBOOT_TOOLS_SOURCE = u-boot-$(UBOOT_TOOLS_VERSION).tar.bz2
 UBOOT_TOOLS_SITE = ftp://ftp.denx.de/pub/u-boot
 UBOOT_TOOLS_LICENSE = GPLv2+
 UBOOT_TOOLS_LICENSE_FILES = Licenses/gpl-2.0.txt
+UBOOT_TOOLS_INSTALL_STAGING = YES
 
 define UBOOT_TOOLS_CONFIGURE_CMDS
 	mkdir -p $(@D)/include/config
@@ -58,6 +59,15 @@ define UBOOT_TOOLS_INSTALL_DUMPIMAGE
 endef
 endif
 
+define UBOOT_TOOLS_INSTALL_LIBUBOOTENV
+	$(INSTALL) -D -m 0755 $(@D)/tools/env/lib.a $(STAGING_DIR)/usr/lib/libubootenv.a
+	$(INSTALL) -D -m 0644 $(@D)/tools/env/fw_env.h $(STAGING_DIR)/usr/include/fw_env.h
+endef
+
+define UBOOT_TOOLS_INSTALL_STAGING_CMDS
+	$(UBOOT_TOOLS_INSTALL_LIBUBOOTENV)
+endef
+
 define UBOOT_TOOLS_INSTALL_TARGET_CMDS
 	$(UBOOT_TOOLS_INSTALL_MKIMAGE)
 	$(UBOOT_TOOLS_INSTALL_MKENVIMAGE)
Signature · 1 line
2.8.2
#1 lore raw

PATCH v3 2/3 uboot-tools: add patch to fix linking with libubootenv

Backport a patch from upstream [1] to fix linking with libubootenv:

	fw_env.c:(.text+0x94): undefined reference to `common_args'

[1] http://git.denx.de/?p=u-boot.git;a=commit;h=43cb65b7a00e4759427a6e4b8a02039e43dab5a5

---
 ...ug-config-structs-must-be-defined-in-tool.patch | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 package/uboot-tools/0003-tools-env-bug-config-structs-must-be-defined-in-tool.patch
package/uboot-tools/0003-tools-env-bug-config-structs-must-be-defined-in-tool.patch new file +58 -0
new file mode 100644
index 0000000..380e8cc
@@ -0,0 +1,58 @@
+From 43cb65b7a00e4759427a6e4b8a02039e43dab5a5 Mon Sep 17 00:00:00 2001
+From: Andreas Fenkart <[email protected]>
+Date: Fri, 25 Mar 2016 14:52:19 +0100
+Subject: [PATCH] tools: env: bug: config structs must be defined in tools
+ library
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+fw_senten/fw_printenv can be compiled as a tools library, excluding the
+fw_env_main object.
+
+Fixes build error when linking with libubootenv:
+	fw_env.c:(.text+0x94): undefined reference to `common_args'
+
+Backported from: 43cb65b7a00e4759427a6e4b8a02039e43dab5a5
+
+Reported-by: Stefano Babic <[email protected]>
+Signed-off-by: Andreas Fenkart <[email protected]>
+Signed-off-by: J?rg Krause <[email protected]>
+---
+ tools/env/fw_env.c      | 4 ++++
+ tools/env/fw_env_main.c | 4 ----
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
+index 5c7505c..1420ac5 100644
+--- a/tools/env/fw_env.c
++++ b/tools/env/fw_env.c
+@@ -35,6 +35,10 @@
+ 
+ #include "fw_env.h"
+ 
++struct common_args common_args;
++struct printenv_args printenv_args;
++struct setenv_args setenv_args;
++
+ #define DIV_ROUND_UP(n, d)	(((n) + (d) - 1) / (d))
+ 
+ #define min(x, y) ({				\
+diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c
+index 3bec5b9..3706d8f 100644
+--- a/tools/env/fw_env_main.c
++++ b/tools/env/fw_env_main.c
+@@ -49,10 +49,6 @@ static struct option long_options[] = {
+ 	{NULL, 0, NULL, 0}
+ };
+ 
+-struct common_args common_args;
+-struct printenv_args printenv_args;
+-struct setenv_args setenv_args;
+-
+ void usage_printenv(void)
+ {
+ 
+-- 
+2.8.2
+
Signature · 1 line
2.8.2
#2 lore raw

PATCH v3 2/3 uboot-tools: add patch to fix linking with libubootenv

Hello,

Quoted 10 lines · J?rg Krause

Backport a patch from upstream [1] to fix linking with libubootenv:

	fw_env.c:(.text+0x94): undefined reference to `common_args'

[1] http://git.denx.de/?p=u-boot.git;a=commit;h=43cb65b7a00e4759427a6e4b8a02039e43dab5a5

---
 ...ug-config-structs-must-be-defined-in-tool.patch | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 package/uboot-tools/0003-tools-env-bug-config-structs-must-be-defined-in-tool.patch

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH v3 3/3 swupdate: bump to version 2016.04

In reply to Jörg Krause

Also:
* Update the .config file
* Update the help text:
- Lua support is not restricted to Lua 5.2
- U-Boot supports needs now BR2_PACKAGE_UBOOT_TOOLS additionally
* Remove comment about bundled lsqlite3, it has been removed.
* Remove upstream patches:
- "Kbuild: Fix link error for CONFIG_UBOUT and missing libz" [1]
- "Kbuild: Link with GCC instead of LD" [2]
* Add patch from upstream:
- "Fix build without MTD support" [3]
* Add optional dependency for libarchive
* Add optional dependency for uboot-tools

[1] https://github.com/sbabic/swupdate/commit/5a5ef5909f5da5b2070d58ffaee924bb8e6a51e1
[2] https://github.com/sbabic/swupdate/commit/f26577423eb65728fcd10f78f9978dd07d51dcb9
[3] https://github.com/sbabic/swupdate/commit/69c0e66994f01ce1bf2299fbce86aee7a1baa37b

---
v3:
- none

v2 (Thomas Petazzoni):
- do not touch project name
- U-Boot support needs only BR2_PACKAGE_UBOOT_TOOLS additionally instead of BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV

---
 package/swupdate/Config.in       |  4 +++-
 package/swupdate/swupdate.config | 36 +++++++++++++++++++++++++++++++++++-
 package/swupdate/swupdate.hash   |  5 ++---
 package/swupdate/swupdate.mk     | 27 ++++++++++++++++++++-------
 4 files changed, 60 insertions(+), 12 deletions(-)
package/swupdate/Config.in +3 -1
index f475b85..1d14a7c 100644
@@ -18,7 +18,7 @@ config BR2_PACKAGE_SWUPDATE
 	  use your own modified configuration, you have to select the
 	  necessary packages manually:
 
-	  * Select BR2_PACKAGE_LUA_5_2 if you want to have Lua support.
+	  * Select BR2_PACKAGE_LUA if you want to have Lua support.
 	  * Select BR2_LIBCURL if you want to use the download feature.
 	  * Select BR2_PACKAGE_OPENSSL is you want to add encryptions support
 	    to the webserver.
@@ -26,6 +26,8 @@ config BR2_PACKAGE_SWUPDATE
 	    partitions.
 	  * Select BR2_PACKAGE_ZLIB if you want to deal with gzip compressed
 	    archives.
+	  * Select BR2_PACKAGE_UBOOT_TOOLS and BR2_PACKAGE_ZLIB to add support
+	    for setting the U-Boot environment.
 
 	  https://sbabic.github.io/swupdate
 
package/swupdate/swupdate.config +35 -1
index bac7a58..b5180ee 100644
@@ -13,6 +13,15 @@ CONFIG_HAVE_DOT_CONFIG=y
 #
 CONFIG_SCRIPTS=y
 # CONFIG_HW_COMPATIBILITY is not set
+CONFIG_SW_VERSIONS_FILE="/etc/sw-versions"
+
+#
+# MTD support needs libmtd
+#
+
+#
+# Lua support needs a Lua interpreter
+#
 # CONFIG_FEATURE_SYSLOG is not set
 
 #
@@ -31,6 +40,10 @@ CONFIG_EXTRA_LDLIBS=""
 # CONFIG_DEBUG is not set
 # CONFIG_WERROR is not set
 # CONFIG_NOCLEANUP is not set
+
+#
+# Image downloading support needs libcurl
+#
 CONFIG_WEBSERVER=y
 
 #
@@ -44,18 +57,39 @@ CONFIG_MONGOOSE=y
 CONFIG_MONGOOSEIPV6=y
 
 #
+# SSL support needs libcrypto, libssl
+#
+
+#
 # Archival Features
 #
 CONFIG_CPIO=y
 
 #
+# gunzip support needs libz
+#
+
+#
 # Parser Features
 #
+CONFIG_LIBCONFIG=y
+CONFIG_LIBCONFIGROOT=""
+
+#
+# JSON config parser support needs json-c
+#
 # CONFIG_SETSWDESCRIPTION is not set
 
 #
 # Image Handlers
 #
+
+#
+# ubivol support needs libubi
+#
 CONFIG_RAW=y
 # CONFIG_SHELLSCRIPTHANDLER is not set
-# CONFIG_UBOOT is not set
+
+#
+# uboot support needs libz
+#
package/swupdate/swupdate.hash +2 -3
index c57ab89..70299a9 100644
@@ -1,4 +1,3 @@
 # Locally calculated
-sha256	1410f8967aad0f4d3b4561110dbfb2c1f8e337bdc332f6b120f4995762c8bf6b  swupdate-2015.07.tar.gz
-sha256	6cffe115cad73c0d1095f7880b6d2b97fc12b7f7871f532e5b33717e863f03d7  5a5ef5909f5da5b2070d58ffaee924bb8e6a51e1.patch
-sha256	b97a107a0e4625337485b9bb118bc9a33fa0f2bfcb80475cff017940b5261238  f26577423eb65728fcd10f78f9978dd07d51dcb9.patch
+sha256  534342ecb89e004edf641945afb49ae185e2599fd93dbcba8dbf1ba77e507f46  swupdate-2016.04.tar.gz
+sha256  089393b0c8aec626078bc66f759474fa3d1bb7c48c7ae3c493d981514248fed5  69c0e66994f01ce1bf2299fbce86aee7a1baa37b.patch
package/swupdate/swupdate.mk +20 -7
index e22bc08..7e2dc39 100644
@@ -4,16 +4,15 @@
 #
 ################################################################################
 
-SWUPDATE_VERSION = 2015.07
+SWUPDATE_VERSION = 2016.04
 SWUPDATE_SITE = $(call github,sbabic,swupdate,$(SWUPDATE_VERSION))
 SWUPDATE_LICENSE = GPLv2+, MIT, Public Domain
 SWUPDATE_LICENSE_FILES = COPYING
-SWUPDATE_PATCH = \
-	https://github.com/sbabic/swupdate/commit/5a5ef5909f5da5b2070d58ffaee924bb8e6a51e1.patch \
-	https://github.com/sbabic/swupdate/commit/f26577423eb65728fcd10f78f9978dd07d51dcb9.patch
 
-# swupdate bundles its own version of mongoose (version 3.8) and
-# lsqlite3 (version 0.8)
+# Upstream patch to fix build without MTD support
+SWUPDATE_PATCH = https://github.com/sbabic/swupdate/commit/69c0e66994f01ce1bf2299fbce86aee7a1baa37b.patch
+
+# swupdate bundles its own version of mongoose (version 3.8)
 
 ifeq ($(BR2_PACKAGE_JSON_C),y)
 SWUPDATE_DEPENDENCIES += json-c
@@ -22,6 +21,13 @@ else
 SWUPDATE_MAKE_ENV += HAVE_JSON_C=n
 endif
 
+ifeq ($(BR2_PACKAGE_LIBARCHIVE),y)
+SWUPDATE_DEPENDENCIES += libarchive
+SWUPDATE_MAKE_ENV += HAVE_LIBARCHIVE=y
+else
+SWUPDATE_MAKE_ENV += HAVE_LIBARCHIVE=n
+endif
+
 ifeq ($(BR2_PACKAGE_LIBCONFIG),y)
 SWUPDATE_DEPENDENCIES += libconfig
 SWUPDATE_MAKE_ENV += HAVE_LIBCONFIG=y
@@ -36,7 +42,7 @@ else
 SWUPDATE_MAKE_ENV += HAVE_LIBCURL=n
 endif
 
-ifeq ($(BR2_PACKAGE_LUA_5_2),y)
+ifeq ($(BR2_PACKAGE_LUA),y)
 SWUPDATE_DEPENDENCIES += lua
 SWUPDATE_MAKE_ENV += HAVE_LUA=y
 else
@@ -61,6 +67,13 @@ SWUPDATE_MAKE_ENV += HAVE_LIBSSL=n
 SWUPDATE_MAKE_ENV += HAVE_LIBCRYPTO=n
 endif
 
+ifeq ($(BR2_PACKAGE_UBOOT_TOOLS),y)
+SWUPDATE_DEPENDENCIES += uboot-tools
+SWUPDATE_MAKE_ENV += HAVE_LIBUBOOTENV=y
+else
+SWUPDATE_MAKE_ENV += HAVE_LIBUBOOTENV=n
+endif
+
 ifeq ($(BR2_PACKAGE_ZLIB),y)
 SWUPDATE_DEPENDENCIES += zlib
 SWUPDATE_MAKE_ENV += HAVE_ZLIB=y
Signature · 1 line
2.8.2
#4 lore raw

PATCH v3 3/3 swupdate: bump to version 2016.04

Hello,

package/swupdate/swupdate.mk else · line 46

Quoted 3 lines · J?rg Krause
package/swupdate/swupdate.mk +1 -1
-ifeq ($(BR2_PACKAGE_LUA_5_2),y)
+ifeq ($(BR2_PACKAGE_LUA),y)
 SWUPDATE_DEPENDENCIES += lua

pkg-config is used by the swupdate to find the Lua linker/compiler flags. It seems to default to values that happen to work, but with some error messages:

Quoted 1 line
Quoted 1 line
Quoted 1 line

swupdate 2016.04 Building

[...]
scripts/kconfig/conf --silentoldconfig Kconfig Package lua was not found in the pkg-config search path. Perhaps you should add the directory containing `lua.pc' to the PKG_CONFIG_PATH environment variable
No package 'lua' found
Package lua was not found in the pkg-config search path. Perhaps you should add the directory containing `lua.pc' to the PKG_CONFIG_PATH environment variable
No package 'lua' found

So I've added host-pkgconf in the dependencies here.

And then I've applied. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH v3 1/3 uboot-tools: install libubootenv to staging

In reply to Jörg Krause

Hello,

Quoted 1 line · J?rg Krause

+define UBOOT_TOOLS_INSTALL_LIBUBOOTENV

I've dropped this variable, and simply done the installation directly in UBOOT_TOOLS_INSTALL_STAGING_CMDS.

package/uboot-tools/uboot-tools.mk define UBOOT_TOOLS_INSTALL_DUMPIMAGE · line 69

Quoted 7 lines
package/uboot-tools/uboot-tools.mk +7 -0
+	$(INSTALL) -D -m 0755 $(@D)/tools/env/lib.a $(STAGING_DIR)/usr/lib/libubootenv.a
+	$(INSTALL) -D -m 0644 $(@D)/tools/env/fw_env.h $(STAGING_DIR)/usr/include/fw_env.h
+endef
+
+define UBOOT_TOOLS_INSTALL_STAGING_CMDS
+	$(UBOOT_TOOLS_INSTALL_LIBUBOOTENV)
+endef

Applied with this change. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com