Skip to contentSkip to conversation

systemd: Build the systemctl executable

PATCH Superseded [email protected] 3 participants 6 messages Feb 18, 2025 – Feb 19, 2025 Arm/Amlogic Meson SoC support

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/2 systemd: Build the systemctl executable

From: Vyacheslav Yurkov <[email protected]>

Instead of the python re-implementation build the actual systemctl from the systemd source tree. The python script was used when systemd didn't provide an option to build individual executables. It is possible in the meantime, so instead of always adapting the script when there's a new functionality, we simply use upstream implementation.

License-Update: Base recipe is used

---
 .../systemd/systemd-systemctl-native.bb       |  26 +-
 ...-meson-add-install-tag-for-systemctl.patch |  25 ++
 ...2-meson-Bypass-certain-config-checks.patch |  64 +++
 .../systemd/systemd-systemctl/systemctl       | 376 ------------------
 4 files changed, 104 insertions(+), 387 deletions(-)
 create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch
 create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0002-meson-Bypass-certain-config-checks.patch
 delete mode 100755 meta/recipes-core/systemd/systemd-systemctl/systemctl
meta/recipes-core/systemd/systemd-systemctl-native.bb +15 -11
index ffa024caef..7416d806ef 100644
@@ -1,17 +1,21 @@
-SUMMARY = "Wrapper for enabling systemd services"
+SUMMARY = "Systemctl executable from systemd"
 
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+require systemd.inc
 
+DEPENDS = "gperf-native libcap-native util-linux-native python3-jinja2-native"
 
-inherit native
+inherit pkgconfig meson native
 
-SRC_URI = "file://systemctl"
+SRC_URI:append = " \
+    file://0001-meson-add-install-tag-for-systemctl.patch \
+    file://0002-meson-Bypass-certain-config-checks.patch \
+"
 
-S = "${WORKDIR}/sources"
-UNPACKDIR = "${S}"
+MESON_TARGET = "systemctl:executable"
+MESON_INSTALL_TAGS = "systemctl"
+EXTRA_OEMESON:append = " -Dlink-systemctl-shared=false"
 
-do_install() {
-	install -d ${D}${bindir}
-	install -m 0755 ${S}/systemctl ${D}${bindir}
-}
+# Systemctl is supposed to operate on target, but the target sysroot is not
+# determined at run-time, but rather set during configure
+# More details are here https://github.com/systemd/systemd/issues/35897#issuecomment-2665405887
+EXTRA_OEMESON:append = " --sysconfdir ${sysconfdir_native}"
meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch new file +25 -0
new file mode 100644
index 0000000000..a9b3e62708
@@ -0,0 +1,25 @@
+From fbf1ae3b7bd074a8d3bfb741f54b8539123399f1 Mon Sep 17 00:00:00 2001
+From: Vyacheslav Yurkov <[email protected]>
+Date: Sun, 2 Feb 2025 10:13:38 +0100
+Subject: [PATCH] meson: add install tag for systemctl
+
+Upstream-Status: Backport
+[https://github.com/systemd/systemd/commit/b1e5a7aa3f1e552c56d5adbeed6ff67d88d1e103]
+
+Signed-off-by: Vyacheslav Yurkov <[email protected]>
+---
+ src/systemctl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/systemctl/meson.build b/src/systemctl/meson.build
+index 88f73bf502..46218dc8ef 100644
+--- a/src/systemctl/meson.build
++++ b/src/systemctl/meson.build
+@@ -61,6 +61,7 @@ executables += [
+                         libzstd_cflags,
+                         threads,
+                 ],
++                'install_tag' : 'systemctl',
+         },
+         fuzz_template + {
+                 'sources' : [
meta/recipes-core/systemd/systemd-systemctl/0002-meson-Bypass-certain-config-checks.patch new file +64 -0

64 lines not on this page · raw message

meta/recipes-core/systemd/systemd-systemctl/systemctl deleted +0 -376

376 lines not on this page · raw message

#1 lore raw

PATCH v5 2/2 oeqa/selftest: Drop dependency on systemd-native

From: Vyacheslav Yurkov <[email protected]>

The tests don't need it. On top of that, this extra requirement creates a dependency loop between systemd-systemctl-native and util-linux.

---
 meta/lib/oeqa/selftest/cases/uki.py | 1 -
 meta/lib/oeqa/selftest/cases/wic.py | 1 -
 2 files changed, 2 deletions(-)
meta/lib/oeqa/selftest/cases/uki.py +0 -1
index cd20a99aca..9a1aa4e269 100644
@@ -94,7 +94,6 @@ WKS_FILE = "efi-uki-bootdisk.wks.in"
 
 # efi, uki and systemd features must be enabled
 MACHINE_FEATURES:append = " efi"
-DISTRO_FEATURES_NATIVE:append = " systemd"
 IMAGE_CLASSES:append:pn-core-image-base = " uki"
 
 # uki embeds also an initrd, no systemd or udev
meta/lib/oeqa/selftest/cases/wic.py +0 -1
index 207e487002..4f5d43b5ee 100644
@@ -1363,7 +1363,6 @@ WKS_FILE = "test_efi_plugin.wks"
 
 # efi, uki and systemd features must be enabled
 MACHINE_FEATURES:append = " efi"
-DISTRO_FEATURES_NATIVE:append = " systemd"
 IMAGE_CLASSES:append:pn-core-image-base = " uki"
 
 # uki embeds also an initrd, no systemd or udev
Reviewed-by on v5 2/2
#2 lore raw

Re: [PATCH v5 2/2] oeqa/selftest: Drop dependency on systemd-native

Hi,

Quoted 4 lines · On Tue, Feb 18, 2025 at 12:56:47PM +0100, [email protected] wrote:

From: Vyacheslav Yurkov <[email protected]>

The tests don't need it. On top of that, this extra requirement creates a dependency loop between systemd-systemctl-native and util-linux.

Yes, this is the right thing to do.

Cheers,

-Mikko

Quoted 30 lines
---
 meta/lib/oeqa/selftest/cases/uki.py | 1 -
 meta/lib/oeqa/selftest/cases/wic.py | 1 -
 2 files changed, 2 deletions(-)
meta/lib/oeqa/selftest/cases/uki.py +0 -1
index cd20a99aca..9a1aa4e269 100644
@@ -94,7 +94,6 @@ WKS_FILE = "efi-uki-bootdisk.wks.in"
 
 # efi, uki and systemd features must be enabled
 MACHINE_FEATURES:append = " efi"
-DISTRO_FEATURES_NATIVE:append = " systemd"
 IMAGE_CLASSES:append:pn-core-image-base = " uki"
 
 # uki embeds also an initrd, no systemd or udev
meta/lib/oeqa/selftest/cases/wic.py +0 -1
index 207e487002..4f5d43b5ee 100644
@@ -1363,7 +1363,6 @@ WKS_FILE = "test_efi_plugin.wks"
 
 # efi, uki and systemd features must be enabled
 MACHINE_FEATURES:append = " efi"
-DISTRO_FEATURES_NATIVE:append = " systemd"
 IMAGE_CLASSES:append:pn-core-image-base = " uki"
 
 # uki embeds also an initrd, no systemd or udev
#3 lore raw
In reply to [email protected]
Quoted 13 lines · Vyacheslav Yurkov via lists.openembedded.org

From: Vyacheslav Yurkov <[email protected]>

Instead of the python re-implementation build the actual systemctl from
the systemd source tree. The python script was used when systemd didn't
provide an option to build individual executables. It is possible in the
meantime, so instead of always adapting the script when there's a new functionality, we simply use upstream implementation.

License-Update: Base recipe is used

Quoted 8 lines

---
 .../systemd/systemd-systemctl-native.bb       |  26 +- ...-meson-add-install-tag-for-systemctl.patch |  25 ++ ...2-meson-Bypass-certain-config-checks.patch |  64 +++ .../systemd/systemd-systemctl/systemctl       | 376 ---------------- --

https://autobuilder.yoctoproject.org/valkyrie/#/builders/9/builds/1022

and many similar failures unfortunately. Did we get out of sync with systemd versions?

I'm keen to have something like this recipe so thanks for working on it.

Cheers,

Richard

#4 lore raw

Hi,

Quoted 24 lines · Richard Purdie
Quoted 13 lines · Vyacheslav Yurkov via lists.openembedded.org

From: Vyacheslav Yurkov <[email protected]>

Instead of the python re-implementation build the actual systemctl from
the systemd source tree. The python script was used when systemd didn't
provide an option to build individual executables. It is possible in the
meantime, so instead of always adapting the script when there's a new functionality, we simply use upstream implementation.

License-Update: Base recipe is used

Quoted 8 lines

---
�.../systemd/systemd-systemctl-native.bb������ |� 26 +- �...-meson-add-install-tag-for-systemctl.patch |� 25 ++ �...2-meson-Bypass-certain-config-checks.patch |� 64 +++ �.../systemd/systemd-systemctl/systemctl������ | 376 ---------------- --
�

Quoted 4 lines

https://autobuilder.yoctoproject.org/valkyrie/#/builders/9/builds/1022

and many similar failures unfortunately. Did we get out of sync with systemd versions?

I think a rebase is needed since point release update from 257.1 to 257.3. Should be trivial. The patch file can be dropped since 257.3 already has it. Thanks for upstreaming it!

Cheers,

-Mikko

#5 lore raw
Quoted 30 lines · Mikko Rapeli

Hi,

Quoted 23 lines · Richard Purdie
Quoted 13 lines · Vyacheslav Yurkov via lists.openembedded.org

From: Vyacheslav Yurkov <[email protected]>

Instead of the python re-implementation build the actual systemctl from
the systemd source tree. The python script was used when systemd didn't
provide an option to build individual executables. It is possible in the
meantime, so instead of always adapting the script when there's a new functionality, we simply use upstream implementation.

License-Update: Base recipe is used

Quoted 8 lines
---
  .../systemd/systemd-systemctl-native.bb       |  26 +-
  ...-meson-add-install-tag-for-systemctl.patch |  25 ++
  ...2-meson-Bypass-certain-config-checks.patch |  64 +++
  .../systemd/systemd-systemctl/systemctl       | 376 ----------------

--

Quoted 4 lines

https://autobuilder.yoctoproject.org/valkyrie/#/builders/9/builds/1022

and many similar failures unfortunately. Did we get out of sync with systemd versions?

Quoted 7 lines

I think a rebase is needed since point release update from 257.1 to 257.3. Should be trivial. The patch file can be dropped since 257.3 already has it. Thanks for upstreaming it!

Cheers,

-Mikko

Oops, I did check that it was still applicable before sending v5. But yeah, v6 should be even simpler. will send rebased version soon.

Slava