From patchwork Thu Dec 12 07:53:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsOpbXkgUk9TRU4=?= X-Patchwork-Id: 1208191 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="zN85VsRI"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47YQzv0ttTz9sPc for ; Thu, 12 Dec 2019 18:54:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 716E688728; Thu, 12 Dec 2019 07:54:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w+BM5Cw+2+VD; Thu, 12 Dec 2019 07:54:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 3B36C8871F; Thu, 12 Dec 2019 07:54:10 +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 B9AE21BF293 for ; Thu, 12 Dec 2019 07:54:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B670E88164 for ; Thu, 12 Dec 2019 07:54:07 +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 TLdolSk2hvL7 for ; Thu, 12 Dec 2019 07:54:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by whitealder.osuosl.org (Postfix) with ESMTPS id 45A2987EB8 for ; Thu, 12 Dec 2019 07:54:06 +0000 (UTC) Received: by mail-wr1-f44.google.com with SMTP id b6so1642217wrq.0 for ; Wed, 11 Dec 2019 23:54:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V5zlF2V9p8MIloKU0My4U7T1kKKQigYsYx3L4PD3Ab8=; b=zN85VsRIWZtbZw2/qLBof5bDFj7/8gdE4Y6GWpnfJQ9ub1hXAm2s+X+3Aiyt5WKhAE y4WIrHC5NxgeTB9G1KCptWYbs0zOZBOOSy2qpR600GZU4nKOV+rbaudR1kbGH3C4F9Jr 043vfdTvOuY+68xPin/zKa6qEax3ESuMfj52/g8Vg4b+ci5DVZBqqXPP4Xn9HvFEYG9x s4vwpImxsUWVjGEYA7u5HIj12kvam3yQuChbeNkv3/ctAX9U7f3nBgV9tb1BMu54eaSl EV57xTQwQuLKwL6VuOYewRZsugTzyMloTuUTjimdRhSqIZOyK52gPMWkAs2vtq6aJofw obhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V5zlF2V9p8MIloKU0My4U7T1kKKQigYsYx3L4PD3Ab8=; b=fLylWEufUn/SCBB1RyVapkihyP4/vJEuEoN7lo2RzPAk+jCUsGsfGxThttKPdXj2G5 +wNyJxqGf1YMHd3OYT2W0NhmJs9zXU0TZons80CfsZTSshlLulA5K49scQ0XDn27LZNr lYxcVatewk8rz8n0Yx5QhqhMtBjogVoq500fmZvjcaif3C4aprpenOlmGcahrFByK74q as3xuawH9afP7Qpa53/ayx+zNftUTzsRnAdN+zXUse5shC42VB2nU+H6Txjrf8JM17IX waRoyTEn423xas6PyHDQvsmM2CzwqlwmH7c1jEpNql/RG13FyTj3jg7rcZYs8xpNZ0UT k4ew== X-Gm-Message-State: APjAAAVCUqUKXm41/9GTpCrf7JJU5SS1Yn6etP4osDYehsOCF0kfeJvc e0lHHLQWq+VHJz2J5XkZrX5xAAcAaA== X-Google-Smtp-Source: APXvYqy+7QGoId2hZvE0OBucinYuNohCJxn8BSCca5lkdBVamKXezyDs79cXqkV2ZoinPsFDF4j7yw== X-Received: by 2002:adf:f8c4:: with SMTP id f4mr4479230wrq.243.1576137244231; Wed, 11 Dec 2019 23:54:04 -0800 (PST) Received: from localhost.localdomain (2a02-8428-0351-c201-4ead-12d2-d337-cdfb.rev.sfr.net. [2a02:8428:351:c201:4ead:12d2:d337:cdfb]) by smtp.googlemail.com with ESMTPSA id y20sm4909753wmi.25.2019.12.11.23.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 23:54:03 -0800 (PST) From: =?utf-8?b?SsOpcsOpbXkgUm9zZW4=?= To: buildroot@buildroot.org Date: Thu, 12 Dec 2019 08:53:48 +0100 Message-Id: <20191212075400.1499536-2-jeremy.rosen@smile.fr> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191212075400.1499536-1-jeremy.rosen@smile.fr> References: <20191212075400.1499536-1-jeremy.rosen@smile.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v4 01/13] new recipe : host-systemd X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?SsOpcsOpbXkgUm9zZW4=?= Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Add the infrastructure to build the host version of systemd * disable all optional features, they can be re-added when needed * systemd has creative way of dealing with cross compile we build a "normal" host systemd, but install it in $HOST_DIR we use systemctl --root to correctly act on TARGET_DIR * we need to adjust RPATH using patchelf because meson can't do it correctly by itsel Signed-off-by: Jérémy Rosen --- package/Config.in.host | 1 + package/systemd/Config.in | 1 - package/systemd/Config.in.host | 3 ++ package/systemd/systemd.mk | 98 ++++++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 package/systemd/Config.in.host diff --git a/package/Config.in.host b/package/Config.in.host index 758c268e00..62e860d7c3 100644 --- a/package/Config.in.host +++ b/package/Config.in.host @@ -70,6 +70,7 @@ menu "Host utilities" source "package/squashfs/Config.in.host" source "package/sunxi-tools/Config.in.host" source "package/swig/Config.in.host" + source "package/systemd/Config.in.host" source "package/tegrarcm/Config.in.host" source "package/ti-cgt-pru/Config.in.host" source "package/uboot-tools/Config.in.host" diff --git a/package/systemd/Config.in b/package/systemd/Config.in index 8f1d6fc0c0..81761b33a4 100644 --- a/package/systemd/Config.in +++ b/package/systemd/Config.in @@ -199,7 +199,6 @@ config BR2_PACKAGE_SYSTEMD_HOSTNAMED config BR2_PACKAGE_SYSTEMD_HWDB bool "enable hwdb installation" default y - select BR2_PACKAGE_HOST_EUDEV # for udevadm, during target-finalize help Enables hardware database installation to /usr/lib/udev/hwdb.d diff --git a/package/systemd/Config.in.host b/package/systemd/Config.in.host new file mode 100644 index 0000000000..219f24239e --- /dev/null +++ b/package/systemd/Config.in.host @@ -0,0 +1,3 @@ +# Select this if you need host systemd tools (e.g. systemctl) +config BR2_PACKAGE_HOST_SYSTEMD + bool diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk index a292a7512b..ad16b58ceb 100644 --- a/package/systemd/systemd.mk +++ b/package/systemd/systemd.mk @@ -204,6 +204,11 @@ endif ifeq ($(BR2_PACKAGE_SYSTEMD_HWDB),y) SYSTEMD_CONF_OPTS += -Dhwdb=true +define SYSTEMD_BUILD_HWDB + $(HOST_DIR)/bin/udevadm hwdb --update --root $(TARGET_DIR) +endef +SYSTEMD_TARGET_FINALIZE_HOOKS += SYSTEMD_BUILD_HWDB + else SYSTEMD_CONF_OPTS += -Dhwdb=false endif @@ -551,3 +556,96 @@ SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV) SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV) $(eval $(meson-package)) + +# +# Host-systemd configuration +# +#Options tweaked for buildroot +HOST_SYSTEMD_CONF_OPTS= \ + -Dsplit-bin=true \ + -Dsplit-usr=false \ + --prefix=/usr \ + --libdir=lib \ + --sysconfdir=/etc \ + --localstatedir=/var + +#disable everything else +HOST_SYSTEMD_CONF_OPTS+= \ + -Dutmp=false \ + -Dhibernate=false \ + -Dldconfig=false \ + -Dresolve=false \ + -Defi=false \ + -Dtpm=false \ + -Denvironment-d=false \ + -Dbinfmt=false \ + -Dcoredump=false \ + -Dpstore=false \ + -Dlogind=false \ + -Dhostnamed=false \ + -Dlocaled=false \ + -Dmachined=false \ + -Dportabled=false \ + -Dnetworkd=false \ + -Dtimedated=false \ + -Dtimesyncd=false \ + -Dremote=false \ + -Dcreate-log-dirs=false \ + -Dnss-myhostname=false \ + -Dnss-mymachines=false \ + -Dnss-resolve=false \ + -Dnss-systemd=false \ + -Dfirstboot=false \ + -Drandomseed=false \ + -Dbacklight=false \ + -Dvconsole=false \ + -Dquotacheck=false \ + -Dsysusers=false \ + -Dtmpfiles=false \ + -Dimportd=false \ + -Dhwdb=false \ + -Drfkill=false \ + -Dman=false \ + -Dhtml=false \ + -Dsmack=false \ + -Dpolkit=false \ + -Dblkid=false \ + -Didn=false \ + -Dadm-group=false \ + -Dwheel-group=false \ + -Dzlib=false \ + -Dgshadow=false \ + -Dima=false \ + -Dtests=false \ + -Dglib=false \ + -Dacl=false \ + -Dsysvinit-path='' + +HOST_SYSTEMD_DEPENDENCIES = \ + host-util-linux \ + host-patchelf \ + host-libcap \ + host-gperf + +# Fix RPATH After installation +# * systemd provides a install_rpath instruction to meson because the binaries need to link with +# libsystemd which is not in a standard path +# * meson can only replace the RPATH, not append to it +# * the original rpatch is thus lost. +# * the original path had been tweaked by buildroot vial LD_FLAGS to add $(HOST_DIR)/lib +# * thus re-tweak rpath after the installation for all binaries that need it +#buildroot detects incorrect RPATH, so adding new binaries should be safe (it won't compile +#unless properly integrated). +HOST_SYSTEMD_HOST_TOOLS = \ + systemd-analyze systemd-mount systemctl udevadm + +define HOST_SYSTEMD_FIX_RPATH + $(foreach f,$(HOST_SYSTEMD_HOST_TOOLS), \ + $(HOST_DIR)/bin/patchelf --set-rpath $(HOST_DIR)/lib:$(HOST_DIR)/lib/systemd $(HOST_DIR)/bin/$(f) + ) +endef + +HOST_SYSTEMD_POST_INSTALL_HOOKS += HOST_SYSTEMD_FIX_RPATH +HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR) + +$(eval $(host-meson-package))