From patchwork Sat Dec 7 18:00:37 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: 1205492 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.137; helo=fraxinus.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="MZZIY2fP"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47VchK04k0z9sR1 for ; Sun, 8 Dec 2019 05:01:03 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 1481886E2C; Sat, 7 Dec 2019 18:01:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ep9BpCRDle8N; Sat, 7 Dec 2019 18:00:59 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id B6BF686DF7; Sat, 7 Dec 2019 18:00:58 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id E47061BF3BE for ; Sat, 7 Dec 2019 18:00:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D9BFF86D33 for ; Sat, 7 Dec 2019 18:00:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Uh5Qbc6G-wdS for ; Sat, 7 Dec 2019 18:00:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 619BC86D16 for ; Sat, 7 Dec 2019 18:00:55 +0000 (UTC) Received: by mail-wr1-f48.google.com with SMTP id a15so11300979wrf.9 for ; Sat, 07 Dec 2019 10:00:55 -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=v7rUewSxpBsMv/Xgu2Pi3WRbwxcMiNwnKQG2LElyQBw=; b=MZZIY2fP5SuPoG7EFU494O9dRUpZflbYdK2tPTEf4MH4FEtjQkJqWQ91uIfuJ5k4G+ vAVACIJlgY/b5CAVoN81IvAPSdcxIEIRfV7tnq7/d+EDZ1wx+YeqaHhIeDhJ/SNAH95A p19TFDFvbvFehLjFFb+cbD34DHi/ebCO/IA3btBY4eLz+rTx+AauHA2GL46ZyzVUGtmH 73wfkLUK7MqBhWy4X1CQy26xsXu5AT0/fWkr9eWaN8sqUIxIE1H5NKb1RIvUcNNGpxLf XRvwA8zEM4ZX7zKrDdGjoGSt0dEpCHIjm/auPQIiG/u11TuTYoaUG2ZNVsWvOzcWb7du x2PA== 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=v7rUewSxpBsMv/Xgu2Pi3WRbwxcMiNwnKQG2LElyQBw=; b=Gl2HjYpvfo5rkbFUroF3kB3AFCYEbSMsnVwkqbioUCF9W3Yzj8lGavcm335PWDSlaG ea8ZTbhB1MJF4UKVrWQyaNY0x7FBkkA+iVW0+GCBwtVJ9mrOut2STEpgfAFBFcZZhhqw h+SIsbBgB4+bJ4a+kJh5f84T0INhgWIIli0Jg+oNpOjtimba1rGZozsT5faTPJzYADqi ZBrNyl682oCjkSly41IWkJUbk+b69VjutpZni9rVFdxBeKMP4/zrbkH7TYV+adQ7snRD 11GCC37dQykge3bd6vJHgdyau4YEGdd6TaAc1SdYqMPnY0wOWEdTrbX74ITc+RYECuwQ JNtg== X-Gm-Message-State: APjAAAUWvyGJy4MecXpyGNctoTLaVQTl5MoBXFLRSvKrftwHS+qZaauO vzhL1TyO5xN+EKi7Foos2ce9dPgtnA== X-Google-Smtp-Source: APXvYqyFNVJn3nFPULCXTmwRlsCIuG7mE+nfj+v0hpPVj/AHYbdKHt5lG1vW9fOgoDGyb6RnwmjDwQ== X-Received: by 2002:a5d:4984:: with SMTP id r4mr20863382wrq.137.1575741653359; Sat, 07 Dec 2019 10:00:53 -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 z4sm7558964wme.17.2019.12.07.10.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Dec 2019 10:00:52 -0800 (PST) From: =?utf-8?b?SsOpcsOpbXkgUm9zZW4=?= To: buildroot@buildroot.org Date: Sat, 7 Dec 2019 19:00:37 +0100 Message-Id: <20191207180049.3245578-2-jeremy.rosen@smile.fr> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191207180049.3245578-1-jeremy.rosen@smile.fr> References: <20191207180049.3245578-1-jeremy.rosen@smile.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 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.host | 3 ++ package/systemd/systemd.mk | 93 ++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) 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.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 ebec9bdd91..5aeaef3904 100644 --- a/package/systemd/systemd.mk +++ b/package/systemd/systemd.mk @@ -551,3 +551,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))