Add buildroot 2018-02

This commit is contained in:
Pascal Vizeli
2018-03-17 23:47:00 +00:00
parent 3776c47f83
commit 67742041ad
10007 changed files with 405098 additions and 0 deletions

View File

@@ -0,0 +1,87 @@
From 9867a9d6a21e6b0b9bcba57c3e2398fe671cea17 Mon Sep 17 00:00:00 2001
From: Christian Storm <christian.storm@siemens.com>
Date: Tue, 16 Jan 2018 10:34:52 +0100
Subject: [PATCH] compat.h: introduce compatibility header
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Introduce a compat.h housing compatibility definitions
and macros along the lines of commit 7b49b8d having
introduced a compatibility mechanism for Lua.
First use case (and motivation) is the support for
musl (https://www.musl-libc.org/) which doesn't
bother to provide
char *strndupa(const char *s, size_t n)
Backported from: 9867a9d6a21e6b0b9bcba57c3e2398fe671cea17
Reviewed-by: Stefano Babic <sbabic@denx.de>
Reported-by: Jörg Krause <joerg.krause@embedded.rocks>
Signed-off-by: Christian Storm <christian.storm@siemens.com>
Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
---
include/compat.h | 24 ++++++++++++++++++++++++
include/util.h | 1 +
ipc/network_ipc.c | 1 +
3 files changed, 26 insertions(+)
create mode 100644 include/compat.h
diff --git a/include/compat.h b/include/compat.h
new file mode 100644
index 0000000..29d7af1
--- /dev/null
+++ b/include/compat.h
@@ -0,0 +1,24 @@
+/*
+ * Author: Christian Storm
+ * Copyright (C) 2018, Siemens AG
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#pragma once
+
+#ifndef strndupa
+/*
+ * Define char *strndupa(const char *s, size_t n)
+ * for, e.g., musl (https://www.musl-libc.org/)
+ * which does not bother to implement this function.
+ */
+#define strndupa(s, n) \
+ (__extension__({ \
+ const char *__in = (s); \
+ size_t __len = strnlen(__in, (n)) + 1; \
+ char *__out = (char *)alloca(__len); \
+ __out[__len - 1] = '\0'; \
+ (char *)memcpy(__out, __in, __len - 1); \
+ }))
+#endif
diff --git a/include/util.h b/include/util.h
index bec2975..d43cd8c 100644
--- a/include/util.h
+++ b/include/util.h
@@ -12,6 +12,7 @@
#include <string.h>
#include "swupdate.h"
#include "swupdate_status.h"
+#include "compat.h"
#define NOTIFY_BUF_SIZE 2048
#define ENOMEM_ASPRINTF -1
diff --git a/ipc/network_ipc.c b/ipc/network_ipc.c
index 3f197c7..48f6fcc 100644
--- a/ipc/network_ipc.c
+++ b/ipc/network_ipc.c
@@ -27,6 +27,7 @@
#include <pthread.h>
#include "network_ipc.h"
+#include "compat.h"
#ifdef CONFIG_SOCKET_CTRL_PATH
static char* SOCKET_CTRL_PATH = (char*)CONFIG_SOCKET_CTRL_PATH;
--
2.15.1

View File

@@ -0,0 +1,107 @@
From 37a6666a532e9cbc42b56301f27919ae7c00d2eb Mon Sep 17 00:00:00 2001
From: Stefano Babic <sbabic@denx.de>
Date: Tue, 23 Jan 2018 16:52:32 +0100
Subject: [PATCH] Fix build if DOWNLOAD is set, but no JSON
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The downloader does not require JSON, but channel_curl is built
even if not called. Build fails with the error:
corelib/channel_curl.c:27:10: fatal error: json-c/json.h: No such file or directory
Add a CONFIG_CHANNEL_CURL that is automatically set by the modules
reuiring it (suricatta and swuforwarder).
Backported from: 37a6666a532e9cbc42b56301f27919ae7c00d2eb
Signed-off-by: Stefano Babic <sbabic@denx.de>
Reported-by: Jörg Krause <joerg.krause@embedded.rocks>
Acked-by: Jörg Krause <joerg.krause@embedded.rocks>
Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
---
Kconfig | 7 +++++++
corelib/Makefile | 2 +-
handlers/Config.in | 8 +++++---
suricatta/Config.in | 3 +--
4 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/Kconfig b/Kconfig
index 4469096..e344572 100644
--- a/Kconfig
+++ b/Kconfig
@@ -294,6 +294,13 @@ config DOWNLOAD
comment "Image downloading support needs libcurl"
depends on !HAVE_LIBCURL
+config CHANNEL_CURL
+ bool
+ depends on HAVE_LIBCURL
+ depends on HAVE_JSON_C
+ select CURL
+ select JSON
+
config HASH_VERIFY
bool "Allow to add sha256 hash to each image"
depends on HAVE_LIBSSL
diff --git a/corelib/Makefile b/corelib/Makefile
index 282bffd..4b30f9c 100644
--- a/corelib/Makefile
+++ b/corelib/Makefile
@@ -17,4 +17,4 @@ lib-$(CONFIG_ENCRYPTED_IMAGES) += swupdate_decrypt.o
lib-$(CONFIG_LIBCONFIG) += swupdate_settings.o \
parsing_library_libconfig.o
lib-$(CONFIG_JSON) += parsing_library_libjson.o
-lib-$(CONFIG_CURL) += channel_curl.o
+lib-$(CONFIG_CHANNEL_CURL) += channel_curl.o
diff --git a/handlers/Config.in b/handlers/Config.in
index 596f069..6226b59 100644
--- a/handlers/Config.in
+++ b/handlers/Config.in
@@ -54,7 +54,6 @@ config UBIVIDOFFSET
if your NAND driver incorrectly reports that it can handle
sub-page accesses when it should not.
-
config CFI
bool "cfi"
depends on MTD
@@ -164,8 +163,8 @@ comment "remote handler needs zeromq"
config SWUFORWARDER_HANDLER
bool "SWU forwarder"
depends on HAVE_LIBCURL
- select CURL
- select JSON
+ depends on HAVE_JSON_C
+ select CHANNEL_CURL
default n
help
This allows to build a chain of updater. A
@@ -174,6 +173,9 @@ config SWUFORWARDER_HANDLER
embedded SWU to the other devices using the
Webserver REST API.
+comment "swuforward handler needs json-c and curl"
+ depends on !HAVE_JSON_C || !HAVE_LIBCURL
+
comment "SWU forwarder requires libcurl"
depends on !HAVE_LIBCURL
diff --git a/suricatta/Config.in b/suricatta/Config.in
index 62e448a..2586169 100644
--- a/suricatta/Config.in
+++ b/suricatta/Config.in
@@ -71,8 +71,7 @@ config SURICATTA_HAWKBIT
bool "hawkBit support"
depends on HAVE_LIBCURL
depends on HAVE_JSON_C
- select JSON
- select CURL
+ select CHANNEL_CURL
help
Support for hawkBit server.
https://projects.eclipse.org/projects/iot.hawkbit
--
2.16.1

View File

@@ -0,0 +1,64 @@
config BR2_PACKAGE_SWUPDATE
bool "swupdate"
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_USE_MMU # fork()
# swupdate requires a parser and uses libconfig as default
select BR2_PACKAGE_LIBCONFIG if !BR2_PACKAGE_JSON_C && \
!BR2_PACKAGE_HAS_LUAINTERPRETER
help
swupdate provides a reliable way to update the software on
an embedded system.
swupdate is highly configurable to fit the targets
requirements and to minimize the footprint. The provided
default configuration file BR2_PACKAGE_SWUPDATE_CONFIG will
enable swupdate with an embedded webserver, a parser and a
handler for raw NAND or NOR flash.
The default configuration file builds a reasonable firmware
update system with minimal external dependencies in mind.
If you like to use your own modified configuration,
you have to select the necessary packages manually:
* Select BR2_PACKAGE_LUA or BR2_PACKAGE_LUAJIT if you want
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 encryption
support.
* Select BR2_PACKAGE_MTD if you want to use swupdate with
UBI 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.
* Select BR2_PACKAGE_ZEROMQ to add support for using a
remote handler.
https://sbabic.github.io/swupdate
if BR2_PACKAGE_SWUPDATE
config BR2_PACKAGE_SWUPDATE_CONFIG
string "swupdate configuration file"
default "package/swupdate/swupdate.config"
help
Path to the swupdate configuration file.
I you wish to use your own modified swupdate configuration
file specify the config file location with this option.
config BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE
bool "install default website"
default y
help
Install the provided website to /var/www/swupdate.
This is necessary if you want to run swupdate with the
embedded webserver and do not provide an own website to be
installed to /var/www/swupdate.
endif
comment "swupdate needs a toolchain w/ threads"
depends on BR2_USE_MMU
depends on !BR2_TOOLCHAIN_HAS_THREADS

View File

@@ -0,0 +1,130 @@
#
# Automatically generated file; DO NOT EDIT.
# Swupdate Configuration
#
CONFIG_HAVE_DOT_CONFIG=y
#
# Swupdate Settings
#
#
# General Configuration
#
# CONFIG_CURL is not set
# CONFIG_SYSTEMD is not set
CONFIG_SCRIPTS=y
# CONFIG_HW_COMPATIBILITY is not set
CONFIG_SW_VERSIONS_FILE="/etc/sw-versions"
#
# Socket Paths
#
CONFIG_SOCKET_CTRL_PATH="/tmp/sockinstctrl"
CONFIG_SOCKET_PROGRESS_PATH="/tmp/swupdateprog"
CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY="/tmp/"
#
# MTD support needs libmtd
#
#
# Lua support needs a Lua interpreter
#
# CONFIG_FEATURE_SYSLOG is not set
#
# Build Options
#
CONFIG_CROSS_COMPILE=""
CONFIG_SYSROOT=""
CONFIG_EXTRA_CFLAGS=""
CONFIG_EXTRA_LDFLAGS=""
CONFIG_EXTRA_LDLIBS=""
#
# Debugging Options
#
# CONFIG_DEBUG is not set
# CONFIG_WERROR is not set
# CONFIG_NOCLEANUP is not set
#
# U-Boot support needs libubootenv, libz
#
CONFIG_BOOTLOADER_NONE=y
# CONFIG_BOOTLOADER_GRUB is not set
#
# Image downloading support needs libcurl
#
#
# Hash verification needs libssl
#
#
# Image verification (signed images) needs libssl
#
#
# Image encryption needs libssl
#
# CONFIG_SURICATTA is not set
CONFIG_WEBSERVER=y
#
# Webserver Features
#
CONFIG_MONGOOSE=y
#
# Mongoose Feature
#
CONFIG_MONGOOSEIPV6=y
#
# SSL support needs libcrypto, libssl
#
#
# Archival Features
#
#
# gunzip support needs libz
#
#
# Parser Features
#
CONFIG_LIBCONFIG=y
CONFIG_PARSERROOT=""
#
# 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
#
# archive support needs libarchive
#
#
# remote handler needs zeromq
#
#
# SWU forwarder requires libcurl
#
# CONFIG_BOOTLOADERHANDLER is not set

View File

@@ -0,0 +1,2 @@
# Locally calculated
sha256 1e15d9675cf7e23886dca7ea058498282c35679a555845dbc85ffe688f2cc681 swupdate-2017.11.tar.gz

View File

@@ -0,0 +1,139 @@
################################################################################
#
# swupdate
#
################################################################################
SWUPDATE_VERSION = 2017.11
SWUPDATE_SITE = $(call github,sbabic,swupdate,$(SWUPDATE_VERSION))
SWUPDATE_LICENSE = GPL-2.0+, MIT, Public Domain
SWUPDATE_LICENSE_FILES = COPYING
# swupdate bundles its own version of mongoose (version 3.8)
ifeq ($(BR2_PACKAGE_JSON_C),y)
SWUPDATE_DEPENDENCIES += json-c
SWUPDATE_MAKE_ENV += HAVE_JSON_C=y
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
else
SWUPDATE_MAKE_ENV += HAVE_LIBCONFIG=n
endif
ifeq ($(BR2_PACKAGE_LIBCURL),y)
SWUPDATE_DEPENDENCIES += libcurl
SWUPDATE_MAKE_ENV += HAVE_LIBCURL=y
else
SWUPDATE_MAKE_ENV += HAVE_LIBCURL=n
endif
ifeq ($(BR2_PACKAGE_HAS_LUAINTERPRETER),y)
SWUPDATE_DEPENDENCIES += luainterpreter host-pkgconf
# defines the base name for the pkg-config file ("lua" or "luajit")
define SWUPDATE_SET_LUA_VERSION
$(call KCONFIG_SET_OPT,CONFIG_LUAPKG,$(BR2_PACKAGE_PROVIDES_LUAINTERPRETER),$(SWUPDATE_BUILD_CONFIG))
endef
SWUPDATE_MAKE_ENV += HAVE_LUA=y
else
SWUPDATE_MAKE_ENV += HAVE_LUA=n
endif
ifeq ($(BR2_PACKAGE_MTD),y)
SWUPDATE_DEPENDENCIES += mtd
SWUPDATE_MAKE_ENV += HAVE_LIBMTD=y
SWUPDATE_MAKE_ENV += HAVE_LIBUBI=y
else
SWUPDATE_MAKE_ENV += HAVE_LIBMTD=n
SWUPDATE_MAKE_ENV += HAVE_LIBUBI=n
endif
ifeq ($(BR2_PACKAGE_OPENSSL),y)
SWUPDATE_DEPENDENCIES += openssl
SWUPDATE_MAKE_ENV += HAVE_LIBSSL=y
SWUPDATE_MAKE_ENV += HAVE_LIBCRYPTO=y
else
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_ZEROMQ),y)
SWUPDATE_DEPENDENCIES += zeromq
SWUPDATE_MAKE_ENV += HAVE_LIBZEROMQ=y
else
SWUPDATE_MAKE_ENV += HAVE_LIBZEROMQ=n
endif
ifeq ($(BR2_PACKAGE_ZLIB),y)
SWUPDATE_DEPENDENCIES += zlib
SWUPDATE_MAKE_ENV += HAVE_ZLIB=y
else
SWUPDATE_MAKE_ENV += HAVE_ZLIB=n
endif
SWUPDATE_BUILD_CONFIG = $(@D)/.config
SWUPDATE_KCONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_SWUPDATE_CONFIG))
SWUPDATE_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
ifeq ($(BR2_STATIC_LIBS),y)
define SWUPDATE_PREFER_STATIC
$(call KCONFIG_ENABLE_OPT,CONFIG_STATIC,$(SWUPDATE_BUILD_CONFIG))
endef
endif
define SWUPDATE_SET_BUILD_OPTIONS
$(call KCONFIG_SET_OPT,CONFIG_CROSS_COMPILE,"$(TARGET_CROSS)", \
$(SWUPDATE_BUILD_CONFIG))
$(call KCONFIG_SET_OPT,CONFIG_SYSROOT,"$(STAGING_DIR)", \
$(SWUPDATE_BUILD_CONFIG))
$(call KCONFIG_SET_OPT,CONFIG_EXTRA_CFLAGS,"$(TARGET_CFLAGS)", \
$(SWUPDATE_BUILD_CONFIG))
$(call KCONFIG_SET_OPT,CONFIG_EXTRA_LDFLAGS,"$(TARGET_LDFLAGS)", \
$(SWUPDATE_BUILD_CONFIG))
endef
define SWUPDATE_KCONFIG_FIXUP_CMDS
$(SWUPDATE_PREFER_STATIC)
$(SWUPDATE_SET_BUILD_OPTIONS)
$(SWUPDATE_SET_LUA_VERSION)
endef
define SWUPDATE_BUILD_CMDS
$(TARGET_MAKE_ENV) $(SWUPDATE_MAKE_ENV) $(MAKE) -C $(@D)
endef
define SWUPDATE_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0755 $(@D)/swupdate $(TARGET_DIR)/usr/bin/swupdate
$(if $(BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE), \
mkdir -p $(TARGET_DIR)/var/www/swupdate; \
cp -dpf $(@D)/www/* $(TARGET_DIR)/var/www/swupdate)
endef
# Checks to give errors that the user can understand
# Must be before we call to kconfig-package
ifeq ($(BR2_PACKAGE_SWUPDATE)$(BR_BUILDING),yy)
ifeq ($(call qstrip,$(BR2_PACKAGE_SWUPDATE_CONFIG)),)
$(error No Swupdate configuration file specified, check your BR2_PACKAGE_SWUPDATE_CONFIG setting)
endif
endif
$(eval $(kconfig-package))