From patchwork Sun Jun 25 18:25:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Waldemar Brodkorb X-Patchwork-Id: 780489 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wwgbv3hd1z9s4s for ; Mon, 26 Jun 2017 04:25:46 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id D9C3C8414E; Sun, 25 Jun 2017 18:25:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GQoudhFgm40g; Sun, 25 Jun 2017 18:25:40 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id B5D0483868; Sun, 25 Jun 2017 18:25:40 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 493FB1BFF0C for ; Sun, 25 Jun 2017 18:25:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 4257583868 for ; Sun, 25 Jun 2017 18:25:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D7dVD1ImZUEp for ; Sun, 25 Jun 2017 18:25:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from helium.openadk.org (helium.openadk.org [89.238.66.15]) by whitealder.osuosl.org (Postfix) with ESMTPS id 9AD6D8305D for ; Sun, 25 Jun 2017 18:25:36 +0000 (UTC) Received: by helium.openadk.org (Postfix, from userid 1000) id 9424A10114; Sun, 25 Jun 2017 20:25:33 +0200 (CEST) Date: Sun, 25 Jun 2017 20:25:33 +0200 From: Waldemar Brodkorb To: buildroot@buildroot.org Message-ID: <20170625182533.GA24682@waldemar-brodkorb.de> MIME-Version: 1.0 Content-Disposition: inline X-Operating-System: Linux 3.16.0-4-amd64 x86_64 User-Agent: Mutt/1.5.23 (2014-03-12) Subject: [Buildroot] [PATCH v2] systemd: allow to build with uClibc toolchains X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Both patches where applied upstream. We need to disable any systemd parts using either IDN or NSS. IDN is only disabled in C library function call to getnaminfo(), it does not effect libidn/libidn2 usage in systemd. Tested in qemu-system-arm. Signed-off-by: Waldemar Brodkorb --- v1 -> v2: - added Upstream commit URL suggested by Thomas Petazzoni - rework enable/disable options suggested by Thomas Petazzoni - extend commit message a little bit --- .../0004-Make-IDN-support-conditional.patch | 74 ++++++++++++++++++++++ ...0005-make-nss-systemd-support-conditional.patch | 62 ++++++++++++++++++ package/systemd/Config.in | 2 + package/systemd/systemd.mk | 11 ++++ system/Config.in | 6 +- 5 files changed, 152 insertions(+), 3 deletions(-) create mode 100644 package/systemd/0004-Make-IDN-support-conditional.patch create mode 100644 package/systemd/0005-make-nss-systemd-support-conditional.patch diff --git a/package/systemd/0004-Make-IDN-support-conditional.patch b/package/systemd/0004-Make-IDN-support-conditional.patch new file mode 100644 index 0000000..5729868 --- /dev/null +++ b/package/systemd/0004-Make-IDN-support-conditional.patch @@ -0,0 +1,74 @@ +Backported from: +https://github.com/systemd/systemd/commit/6326a143263fc460bbda871d6e74b1d7d2841ea1 + +From 6326a143263fc460bbda871d6e74b1d7d2841ea1 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb +Date: Thu, 15 Jun 2017 17:44:59 +0200 +Subject: [PATCH] Make IDN support conditional + +[zj: rename HAVE_IDN to ENABLE_IDN] + +Signed-off-by: Waldemar Brodkorb +--- + configure.ac | 10 ++++++++++ + src/basic/socket-util.c | 9 +++++++-- + 2 files changed, 17 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index a47492d..3e7af76 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1050,6 +1050,15 @@ fi + AM_CONDITIONAL(HAVE_LIBIDN, [test "$have_libidn" = "yes"]) + + # ------------------------------------------------------------------------------ ++have_idn=no ++AC_ARG_ENABLE(idn, AS_HELP_STRING([--disable-idn], [disable IDN when printing host names])) ++if test "x$enable_idn" != "xno"; then ++ have_idn=yes ++ AC_DEFINE(ENABLE_IDN, [1], [IDN is enabled]) ++fi ++AM_CONDITIONAL(ENABLE_IDN, [test "$have_idn" = "yes"]) ++ ++# ------------------------------------------------------------------------------ + have_libiptc=no + AC_ARG_ENABLE(libiptc, AS_HELP_STRING([--disable-libiptc], [disable optional LIBIPTC support])) + if test "x$enable_libiptc" != "xno"; then +@@ -1742,6 +1751,7 @@ AC_MSG_RESULT([ + libcurl: ${have_libcurl} + libidn2: ${have_libidn2} + libidn: ${have_libidn} ++ IDN: ${have_idn} + libiptc: ${have_libiptc} + ELFUTILS: ${have_elfutils} + binfmt: ${have_binfmt} +diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c +index e5847dc..49642c2 100644 +--- a/src/basic/socket-util.c ++++ b/src/basic/socket-util.c +@@ -48,6 +48,12 @@ + #include "utf8.h" + #include "util.h" + ++#ifdef ENABLE_IDN ++# define IDN_FLAGS (NI_IDN|NI_IDN_USE_STD3_ASCII_RULES) ++#else ++# define IDN_FLAGS 0 ++#endif ++ + int socket_address_parse(SocketAddress *a, const char *s) { + char *e, *n; + unsigned u; +@@ -723,8 +729,7 @@ int socknameinfo_pretty(union sockaddr_union *sa, socklen_t salen, char **_ret) + + assert(_ret); + +- r = getnameinfo(&sa->sa, salen, host, sizeof(host), NULL, 0, +- NI_IDN|NI_IDN_USE_STD3_ASCII_RULES); ++ r = getnameinfo(&sa->sa, salen, host, sizeof(host), NULL, 0, IDN_FLAGS); + if (r != 0) { + int saved_errno = errno; + +-- +2.1.4 + diff --git a/package/systemd/0005-make-nss-systemd-support-conditional.patch b/package/systemd/0005-make-nss-systemd-support-conditional.patch new file mode 100644 index 0000000..240d1d1 --- /dev/null +++ b/package/systemd/0005-make-nss-systemd-support-conditional.patch @@ -0,0 +1,62 @@ +Backported from: +https://github.com/systemd/systemd/commit/e7e11bbf340f031223b56442b3aa4f4220fed315 + +From e7e11bbf340f031223b56442b3aa4f4220fed315 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb +Date: Sat, 24 Jun 2017 19:30:26 +0200 +Subject: [PATCH] make nss-systemd support conditional (#6155) + +This allows the nss-systemd module to be disabled on minimal installations. + +Signed-off-by: Waldemar Brodkorb + +[ Stripped down patch only touching autotool infrastructure ] +--- +diff --git a/Makefile.am b/Makefile.am +index 07b425e..4838df6 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -5280,6 +5280,7 @@ manual_tests += \ + test-nss + + # ------------------------------------------------------------------------------ ++if ENABLE_NSS_SYSTEMD + libnss_systemd_la_SOURCES = \ + src/nss-systemd/nss-systemd.sym \ + src/nss-systemd/nss-systemd.c +@@ -5299,6 +5300,7 @@ libnss_systemd_la_LIBADD = \ + + rootlib_LTLIBRARIES += \ + libnss_systemd.la ++endif + + # ------------------------------------------------------------------------------ + if HAVE_MYHOSTNAME +diff --git a/configure.ac b/configure.ac +index 90e79d7..379f617 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1059,6 +1059,15 @@ fi + AM_CONDITIONAL(ENABLE_IDN, [test "$have_idn" = "yes"]) + + # ------------------------------------------------------------------------------ ++have_nss_systemd=no ++AC_ARG_ENABLE(nss-systemd, AS_HELP_STRING([--disable-nss-systemd], [disable nss-systemd support])) ++if test "x$enable_nss_systemd" != "xno"; then ++ have_nss_systemd=yes ++ AC_DEFINE(ENABLE_NSS_SYSTEMD, [1], [nss-systemd is enabled]) ++fi ++AM_CONDITIONAL(ENABLE_NSS_SYSTEMD, [test "$have_nss_systemd" = "yes"]) ++ ++# ------------------------------------------------------------------------------ + have_libiptc=no + AC_ARG_ENABLE(libiptc, AS_HELP_STRING([--disable-libiptc], [disable optional LIBIPTC support])) + if test "x$enable_libiptc" != "xno"; then +@@ -1801,6 +1810,7 @@ AC_MSG_RESULT([ + dbus: ${have_dbus} + glib: ${have_glib} + nss-myhostname: ${have_myhostname} ++ nss-systemd: ${have_nss_systemd} + hwdb: ${enable_hwdb} + tpm: ${have_tpm} + Python: ${have_python} diff --git a/package/systemd/Config.in b/package/systemd/Config.in index 478cc10..e1b66f9 100644 --- a/package/systemd/Config.in +++ b/package/systemd/Config.in @@ -188,6 +188,7 @@ config BR2_PACKAGE_SYSTEMD_MACHINED config BR2_PACKAGE_SYSTEMD_MYHOSTNAME bool "enable myhostname NSS plugin" + depends on !BR2_TOOLCHAIN_USES_UCLIBC default y help nss-myhostname is a plug-in module for the GNU Name Service @@ -243,6 +244,7 @@ config BR2_PACKAGE_SYSTEMD_RANDOMSEED config BR2_PACKAGE_SYSTEMD_RESOLVED bool "enable resolve daemon" + depends on !BR2_TOOLCHAIN_USES_UCLIBC default y help systemd-resolved is a system service that provides network diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk index 153d615..5474a86 100644 --- a/package/systemd/systemd.mk +++ b/package/systemd/systemd.mk @@ -43,6 +43,17 @@ SYSTEMD_CONF_OPTS += \ --with-default-dnssec=no \ --without-python +# disable unsupported features for non-glibc toolchains +ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y) +SYSTEMD_CONF_OPTS += \ + --enable-idn \ + --enable-nss-systemd +else +SYSTEMD_CONF_OPTS += \ + --disable-idn \ + --disable-nss-systemd +endif + SYSTEMD_CFLAGS = $(TARGET_CFLAGS) -fno-lto # Override paths to a few utilities needed at runtime, to diff --git a/system/Config.in b/system/Config.in index b47ae43..dc99b51 100644 --- a/system/Config.in +++ b/system/Config.in @@ -118,7 +118,7 @@ config BR2_INIT_SYSV config BR2_INIT_SYSTEMD bool "systemd" depends on BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS - depends on BR2_TOOLCHAIN_USES_GLIBC + depends on BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_UCLIBC depends on BR2_USE_WCHAR depends on BR2_TOOLCHAIN_HAS_THREADS depends on BR2_TOOLCHAIN_HAS_SSP @@ -129,8 +129,8 @@ config BR2_INIT_SYSTEMD select BR2_PACKAGE_SYSTEMD select BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW if BR2_ROOTFS_SKELETON_DEFAULT -comment "systemd needs a glibc toolchain, headers >= 3.10" - depends on !(BR2_TOOLCHAIN_USES_GLIBC \ +comment "systemd needs a glibc or uClibc toolchain, headers >= 3.10" + depends on !(BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_UCLIBC \ && BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10) config BR2_INIT_NONE