For this target the default emulation of ld is not the correct one resulting in
a relocation error:
/usr/bin/i686-pc-linux-gnu-ld: Relocatable linking with relocations from
format elf64-x86-64 (core/swupdate.o) to format elf32-i386 (core/built-in.o)
is not supported.
As there is no need to have `built-in.o` files for core and handlers we can
easily allow swupdate to be built with these toolchains by compiling the source
files in core and handlers with the `lib-target` target as it is done for the
other subdirectories.
The `lib-target` compiles a set of object files into an archive file. With this
target we avoid using the ld linker and use the ar archiver instead.
[1] http://autobuild.buildroot.net/results/d9e/d9e8298898da6355f6b46a032f951b4ca196d103/build-end.log
Signed-off-by: Jörg Krause <joerg....@embedded.rocks>
---
Makefile | 3 +--
core/Makefile | 2 +-
handlers/Makefile | 14 +++++++-------
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
index 3d6a7b7..2dd8c03 100644
--- a/Makefile
+++ b/Makefile
@@ -339,8 +339,7 @@ include $(srctree)/Makefile.flags
# Defaults to vmlinux, but the arch makefile usually adds further targets
all: swupdate
-objs-y := core handlers
-libs-y := archival corelib ipc mongoose parser
+libs-y := archival core corelib handlers ipc mongoose parser
swupdate-dirs := $(objs-y) $(libs-y)
swupdate-objs := $(patsubst %,%/built-in.o, $(objs-y))
diff --git a/core/Makefile b/core/Makefile
index c48e3ee..6302da7 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -8,7 +8,7 @@
#
# Licensed under GPLv2, see file LICENSE in this source tree.
-obj-y += swupdate.o \
+lib-y += swupdate.o \
cpio_utils.o \
gpio.o \
notifier.o \
diff --git a/handlers/Makefile b/handlers/Makefile
index 2ea369c..8bd7ea1 100644
--- a/handlers/Makefile
+++ b/handlers/Makefile
@@ -3,10 +3,10 @@
# not drop the handler if it is not called.
# Handler can be called dinamically based
# on the received image type
-obj-$(CONFIG_CFI) += flash_handler.o
-obj-$(CONFIG_RAW) += raw_handler.o
-obj-$(CONFIG_UBIVOL) += ubivol_handler.o
-obj-$(CONFIG_LUASCRIPTHANDLER) += lua_scripthandler.o
-obj-$(CONFIG_SHELLSCRIPTHANDLER) += shell_scripthandler.o
-obj-$(CONFIG_RAW) += raw_handler.o
-obj-$(CONFIG_UBOOT) += uboot_handler.o fw_env.o
+lib-$(CONFIG_CFI) += flash_handler.o
+lib-$(CONFIG_RAW) += raw_handler.o
+lib-$(CONFIG_UBIVOL) += ubivol_handler.o
+lib-$(CONFIG_LUASCRIPTHANDLER) += lua_scripthandler.o
+lib-$(CONFIG_SHELLSCRIPTHANDLER) += shell_scripthandler.o
+lib-$(CONFIG_RAW) += raw_handler.o
+lib-$(CONFIG_UBOOT) += uboot_handler.o fw_env.o
--
2.6.1
[1] https://github.com/sbabic/swupdate/commit/cf495e23ad117f4cae9c429e80714fe9c18f2d6a
Reported-by: Romain Naour <romain...@openwide.fr>
Signed-off-by: Jörg Krause <joerg....@embedded.rocks>
---
handlers/Config.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/handlers/Config.in b/handlers/Config.in
index fb32c44..f5187a5 100644
--- a/handlers/Config.in
+++ b/handlers/Config.in
@@ -81,6 +81,7 @@ config HANDLER_IN_LUA
config UBOOT
bool "uboot"
+ depends on HAVE_ZLIB
default n
help
Enable it to change U-Boot environment
--
2.6.1
Build systems like Buildroot handle dependencies for a package. When running
menuconfig for swupdate the user only sees the config options where dependencies
are met. This implies that config options may be hided by the user.
Fix this by adding a comment for unmet dependencies.
Signed-off-by: Jörg Krause <joerg....@embedded.rocks>
---
Kconfig | 9 +++++++++
archival/Config.in | 3 +++
handlers/Config.in | 6 ++++++
mongoose/Config.in | 4 ++++
parser/Config.in | 6 ++++++
5 files changed, 28 insertions(+)
diff --git a/Kconfig b/Kconfig
index 7a0f960..a91cb21 100644
--- a/Kconfig
+++ b/Kconfig
@@ -85,6 +85,9 @@ config MTD
help
Enable MTD support.
+comment "MTD support needs libmtd"
+ depends on !HAVE_LIBMTD
+
config LUA
bool "lua"
default y
@@ -92,6 +95,9 @@ config LUA
help
Enable LUA interpreter.
+comment "Lua support needs a Lua 5.2 interpreter"
+ depends on !HAVE_LUA
+
# These are auto-selected by other options
config FEATURE_SYSLOG
@@ -218,6 +224,9 @@ config DOWNLOAD
Enable update from image URL using libcurl. Files are downloaded
completely before installation begins.
+comment "Image downloading support needs libcurl"
+ depends on !HAVE_LIBCURL
+
config WEBSERVER
bool "Enable webserver"
default n
diff --git a/archival/Config.in b/archival/Config.in
index fe70d48..cf360dc 100644
--- a/archival/Config.in
+++ b/archival/Config.in
@@ -28,4 +28,7 @@ config GUNZIP
You can use the `-t' option to test the integrity of
an archive, without decompressing it.
+comment "gunzip support needs libz"
+ depends on !HAVE_ZLIB
+
endmenu
diff --git a/handlers/Config.in b/handlers/Config.in
index f5187a5..3677f3e 100644
--- a/handlers/Config.in
+++ b/handlers/Config.in
@@ -15,6 +15,9 @@ config UBIVOL
Say Y if you have NAND or you use UBI on
your system.
+comment "ubivol support needs libubi"
+ depends on !HAVE_LIBUBI
+
config UBIBLACKLIST
string "List of MTD devices to be excluded for UBI"
depends on UBIVOL
@@ -87,6 +90,9 @@ config UBOOT
Enable it to change U-Boot environment
during the installation process.
+comment "uboot support needs libz"
+ depends on !HAVE_ZLIB
+
config UBOOT_FWENV
string "U-Boot Environment Configuration file"
depends on UBOOT
diff --git a/mongoose/Config.in b/mongoose/Config.in
index 64f3b21..515ee3a 100644
--- a/mongoose/Config.in
+++ b/mongoose/Config.in
@@ -36,6 +36,10 @@ config MONGOOSESSL
depends on HAVE_LIBCRYPTO
help
It enables SSL support into mongoose
+
+comment "SSL support needs libcrypto, libssl"
+ depends on !HAVE_LIBSSL || !HAVE_LIBCRYPTO
+
endmenu
endmenu
diff --git a/parser/Config.in b/parser/Config.in
index e7b1cf7..f439111 100644
--- a/parser/Config.in
+++ b/parser/Config.in
@@ -8,6 +8,9 @@ config LIBCONFIG
Use libconfig to parse the configuration file.
This is the default parser.
+comment "Default config parser support needs libconfig"
+ depends on !HAVE_LIBCONFIG
+
config LIBCONFIGROOT
string "Name of root node"
depends on LIBCONFIG
@@ -23,6 +26,9 @@ config JSON
help
Use json-c to parse the configuration file.
+comment "JSON config parser support needs json-c"
+ depends on !HAVE_JSON_C
+
config LUAEXTERNAL
bool "lua"
depends on LUA
--
2.6.1
Hi Bjorn,
On 24/10/2015 11:45, bjorn....@gmail.com wrote:
> lørdag 24. oktober 2015 11.43.23 UTC+2 skrev bjorn....@gmail.com følgende:
>> søndag 18. oktober 2015 15.55.35 UTC+2 skrev Jörg Krause følgende:
>>> Some toolchains used in Buildroot (x86-64 and mips64) [1] have a problem to
>>> compile a set of object files into one object file as done for the
>>> `builtin-target`. This targets collects all object files from each subdirectory
>>> declared with `objs-dir`: core and handlers.
>>
>> AFAICT, this patch has the unfortunate side-effect of breaking handler registration. It seems __attribute__ ((constructor)) no longer has any effect.
>>
>> I tried to revert this patch (c3467290925b2a833, "Kbuild: fix build issue with some toolchains") and then the handlers appeared again.
>
> Tested in Buildroot with ARM + uclibc and glibc toolchain, and also on my desktop system.
Yes, confirmed. The behavior is anyway well explained. We cannot use the
(constructor) in static libraries, because that code is dropped by the
linker why there is no code to reference to it.
I push the revert on TOT to make things working again.