* [PR PATCH] New package: systemd-boot-256
@ 2024-08-12 21:38 Calandracas606
2024-08-12 21:44 ` Calandracas606
` (62 more replies)
0 siblings, 63 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-12 21:38 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]
There is a new pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72955 bytes --]
From 13e4fb31a1237671e793ff6b956426a7f9e5a1b9 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 2 +
.../files/kernel.d/systemd-boot.post-install | 61 ++
.../files/kernel.d/systemd-boot.post-remove | 33 +
.../files/patches/musl/musl-gshadow.patch | 158 +++
.../files/patches/musl/musl-malloc_info.patch | 57 ++
.../files/patches/musl/musl-malloc_trim.patch | 39 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../files/patches/musl/musl-prctl.patch | 32 +
.../files/patches/musl/musl-printf.patch | 434 +++++++++
.../files/patches/musl/musl-rlim.patch | 106 ++
.../files/patches/musl/musl-strerror_r.patch | 76 ++
.../files/patches/musl}/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1951 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub/patches => systemd-boot/files/patches/musl}/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..598ad4419daba4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,2 @@
+# uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..0372bf2b22886c
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed=$(bootctl is-installed)
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+#get major kernel ver, eg: linux6.8 -> 6.8
+major_ver=$(echo $PKGNAME | cut -c 6-)
+boot="$ROOTDIR/boot"
+esp="$ROOTDIR/boot/efi"
+entries="$esp/loader/entries"
+name="void-$major_ver"
+entry="$entries/$name.conf"
+options="$esp/loader/void-options.conf"
+loader="$esp/loader/loader.conf"
+uuid=$(cat /etc/fstab | awk '$2 == "/" { print $1 }' | sed 's/^UUID=//')
+
+[ -d "$esp" ] || exit 0
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $major_ver
+ version $VERSION
+ linux vmlinuz-void-$major_ver
+ initrd initramfs-void-$major_ver.img
+ options root=UUID=$uuid rw
+EOF
+
+if [ -r "$options" ]; then
+ # Add user provided options from /boot/loader/void-options.conf:
+ printf 'options %s\n' "$(cat "$options" | sed '/^#/d;/^$/d')" >> "$entry"
+fi
+
+if grep -q ^default "$loader" 2>/dev/null; then
+ # Replace existing default entry with this entry:
+ sed -i "s/default.*/default $name/" "$loader"
+else
+ # Add this entry as the default:
+ printf 'default %s\n' $name >>"$loader"
+fi
+
+cp "$boot/vmlinuz-$VERSION" "$esp/vmlinuz-void-$major_ver"
+cp "$boot/initramfs-$VERSION.img" "$esp/initramfs-void-$major_ver.img"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..0fce80f5a4bbf8
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+#get major kernel ver, eg: linux6.8 -> 6.8
+major_ver=$(echo $PKGNAME | cut -c 6-)
+boot="$ROOTDIR/boot"
+esp="$ROOTDIR/boot/efi"
+entries="$esp/loader/entries"
+name="void-$major_ver"
+entry="$entries/$name.conf"
+loader="$esp/loader/loader.conf"
+
+[ -d "$boot" ] || exit 0
+
+rm -f "$entry"
+
+# No default entry if the removed entry was the default:
+[ -e "$loader" ] && sed -i "/^default $name\$/d" "$loader"
+
+rm "$esp/vmlinuz-void-$major_ver"
+rm "$esp/initramfs-void-$major_ver.img"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/files/patches/musl/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
@ 2024-08-12 21:44 ` Calandracas606
2024-08-12 22:46 ` [PR REVIEW] " Haagen-Dazs
` (61 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-12 21:44 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 405 bytes --]
New comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#issuecomment-2284957639
Comment:
lint fails because the revision is 2
I set the revision to 2 because I've changed `systemd-boot-efistub` to be a subpackage of `systemd-boot`
I've probably done a pretty messy job with the kernel hooks, please provide feedback if they need improvment
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
2024-08-12 21:44 ` Calandracas606
@ 2024-08-12 22:46 ` Haagen-Dazs
2024-08-12 23:44 ` [PR PATCH] [Updated] " Calandracas606
` (60 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Haagen-Dazs @ 2024-08-12 22:46 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 273 bytes --]
New review comment by Haagen-Dazs on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1714443894
Comment:
Is it possible not to hardcode `UUID`? Useful if someone uses `PARTUUID` for example.
See `gummiboot` hook for reference
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
2024-08-12 21:44 ` Calandracas606
2024-08-12 22:46 ` [PR REVIEW] " Haagen-Dazs
@ 2024-08-12 23:44 ` Calandracas606
2024-08-13 2:00 ` [PR REVIEW] " classabbyamp
` (59 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-12 23:44 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1503 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 73014 bytes --]
From 3b1d0b57135e19dcdf1b676558e4a487abef8209 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 2 +
.../files/kernel.d/systemd-boot.post-install | 63 ++
.../files/kernel.d/systemd-boot.post-remove | 33 +
.../files/patches/musl/musl-gshadow.patch | 158 +++
.../files/patches/musl/musl-malloc_info.patch | 57 ++
.../files/patches/musl/musl-malloc_trim.patch | 39 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../files/patches/musl/musl-prctl.patch | 32 +
.../files/patches/musl/musl-printf.patch | 434 +++++++++
.../files/patches/musl/musl-rlim.patch | 106 ++
.../files/patches/musl/musl-strerror_r.patch | 76 ++
.../files/patches/musl}/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1953 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub/patches => systemd-boot/files/patches/musl}/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..598ad4419daba4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,2 @@
+# uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..509ac0d02366f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed=$(bootctl is-installed)
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+#get major kernel ver, eg: linux6.8 -> 6.8
+major_ver=$(echo $PKGNAME | cut -c 6-)
+boot="$ROOTDIR/boot"
+esp="$ROOTDIR/boot/efi"
+entries="$esp/loader/entries"
+name="void-$major_ver"
+entry="$entries/$name.conf"
+options="$esp/loader/void-options.conf"
+loader="$esp/loader/loader.conf"
+
+[ -d "$esp" ] || exit 0
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $major_ver
+ version $VERSION
+ linux vmlinuz-void-$major_ver
+ initrd initramfs-void-$major_ver.img
+EOF
+
+if [ -r "$options" ]; then
+ # Add user provided options from /boot/loader/void-options.conf:
+ printf 'options %s\n' "$(cat "$options" | sed '/^#/d;/^$/d')" >> "$entry"
+else
+ # get UUID from fstab
+ uuid=$(cat /etc/fstab | awk '$2 == "/" { print $1 }' | sed 's/^UUID=//')
+ printf 'options %s\n' "root=UUID=$uuid rw" >> "$entry"
+fi
+
+if grep -q ^default "$loader" 2>/dev/null; then
+ # Replace existing default entry with this entry:
+ sed -i "s/default.*/default $name/" "$loader"
+else
+ # Add this entry as the default:
+ printf 'default %s\n' $name >>"$loader"
+fi
+
+cp "$boot/vmlinuz-$VERSION" "$esp/vmlinuz-void-$major_ver"
+cp "$boot/initramfs-$VERSION.img" "$esp/initramfs-void-$major_ver.img"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..0fce80f5a4bbf8
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+#get major kernel ver, eg: linux6.8 -> 6.8
+major_ver=$(echo $PKGNAME | cut -c 6-)
+boot="$ROOTDIR/boot"
+esp="$ROOTDIR/boot/efi"
+entries="$esp/loader/entries"
+name="void-$major_ver"
+entry="$entries/$name.conf"
+loader="$esp/loader/loader.conf"
+
+[ -d "$boot" ] || exit 0
+
+rm -f "$entry"
+
+# No default entry if the removed entry was the default:
+[ -e "$loader" ] && sed -i "/^default $name\$/d" "$loader"
+
+rm "$esp/vmlinuz-void-$major_ver"
+rm "$esp/initramfs-void-$major_ver.img"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/files/patches/musl/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (4 preceding siblings ...)
2024-08-13 2:00 ` classabbyamp
@ 2024-08-13 2:00 ` classabbyamp
2024-08-13 2:00 ` classabbyamp
` (56 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-13 2:00 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 166 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1714557546
Comment:
same as above
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (2 preceding siblings ...)
2024-08-12 23:44 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-08-13 2:00 ` classabbyamp
2024-08-13 2:00 ` classabbyamp
` (58 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-13 2:00 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 213 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1714558001
Comment:
can we apply this on all libcs? conditional patches are ugly
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (3 preceding siblings ...)
2024-08-13 2:00 ` [PR REVIEW] " classabbyamp
@ 2024-08-13 2:00 ` classabbyamp
2024-08-13 2:00 ` classabbyamp
` (57 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-13 2:00 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 305 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1714556195
Comment:
i think this would mean you only get an entry for the latest version of a kernel series. is that intended? if not, i would go for `name="void-$VERSION"`
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (5 preceding siblings ...)
2024-08-13 2:00 ` classabbyamp
@ 2024-08-13 2:00 ` classabbyamp
2024-08-13 2:00 ` classabbyamp
` (55 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-13 2:00 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 211 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1714553719
Comment:
```suggestion
is_installed="$(bootctl is-installed)"
```
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (6 preceding siblings ...)
2024-08-13 2:00 ` classabbyamp
@ 2024-08-13 2:00 ` classabbyamp
2024-08-13 2:09 ` Calandracas606
` (54 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-13 2:00 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 234 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1714554790
Comment:
```suggestion
major_ver="${VERSION%.*}"
```
works assuming `major.minor.patch`
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (7 preceding siblings ...)
2024-08-13 2:00 ` classabbyamp
@ 2024-08-13 2:09 ` Calandracas606
2024-08-13 2:13 ` Calandracas606
` (53 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 2:09 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 244 bytes --]
New review comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1714563437
Comment:
This was intended. Having an entry for each minor version would fill the ESP very rapidly
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (8 preceding siblings ...)
2024-08-13 2:09 ` Calandracas606
@ 2024-08-13 2:13 ` Calandracas606
2024-08-13 12:34 ` [PR PATCH] [Updated] " Calandracas606
` (52 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 2:13 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 353 bytes --]
New review comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1714567344
Comment:
most of the patches can be applied to all libcs, the main one that's problematic is `musl-misc.patch`. I could pepper it with `#ifdef __GLIBC__`, but it would make the updates a bit more complicated
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (9 preceding siblings ...)
2024-08-13 2:13 ` Calandracas606
@ 2024-08-13 12:34 ` Calandracas606
2024-08-13 12:44 ` Calandracas606
` (51 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 12:34 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 73035 bytes --]
From e0979633d82d847ace4eec4b6177fd0639f8842a Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 10 +
.../files/kernel.d/systemd-boot.post-install | 60 ++
.../files/kernel.d/systemd-boot.post-remove | 33 +
.../files/patches/musl/musl-gshadow.patch | 158 +++
.../files/patches/musl/musl-malloc_info.patch | 57 ++
.../files/patches/musl/musl-malloc_trim.patch | 39 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../files/patches/musl/musl-prctl.patch | 32 +
.../files/patches/musl/musl-printf.patch | 434 +++++++++
.../files/patches/musl/musl-rlim.patch | 106 ++
.../files/patches/musl/musl-strerror_r.patch | 76 ++
.../files/patches/musl}/musl-wchar_t.patch | 0
.../template | 60 +-
srcpkgs/ukify | 2 +-
15 files changed, 1960 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub/patches => systemd-boot/files/patches/musl}/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (63%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..13306579a81239
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,10 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## System architechture
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..3cabd7df33f647
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT=${BOOT:-"$ROOTDIR/boot"}
+ESP=${ESP:-"$BOOT"}
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+options="$ESP/loader/void-options.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ version $VERSION
+ linux vmlinuz-$VERSION
+ initrd initramfs-$VERSION.img
+EOF
+
+echo "Created systemd-boot entry $entry"
+
+if [ -r "$options" ]; then
+ # Add user provided options from /boot/loader/void-options.conf:
+ printf 'options %s\n' "$(sed '/^#/d;/^$/d' < "$options")" >> "$entry"
+else
+ # get UUID from fstab
+ uuid=$(awk '$2 == "/" { print $1 }' < /etc/fstab | sed 's/^UUID=//')
+ printf 'options %s\n' "root=UUID=$uuid rw" >> "$entry"
+fi
+
+if grep -q ^default "$loader" 2>/dev/null; then
+ # Replace existing default entry with this entry:
+ sed -i "s/default.*/default $name/" "$loader"
+else
+ # Add this entry as the default:
+ printf 'default %s\n' "$name" >>"$loader"
+fi
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..0fce80f5a4bbf8
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+#get major kernel ver, eg: linux6.8 -> 6.8
+major_ver=$(echo $PKGNAME | cut -c 6-)
+boot="$ROOTDIR/boot"
+esp="$ROOTDIR/boot/efi"
+entries="$esp/loader/entries"
+name="void-$major_ver"
+entry="$entries/$name.conf"
+loader="$esp/loader/loader.conf"
+
+[ -d "$boot" ] || exit 0
+
+rm -f "$entry"
+
+# No default entry if the removed entry was the default:
+[ -e "$loader" ] && sed -i "/^default $name\$/d" "$loader"
+
+rm "$esp/vmlinuz-void-$major_ver"
+rm "$esp/initramfs-void-$major_ver.img"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/files/patches/musl/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 63%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..b4c5bdfe24b783 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,19 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
+
+ printf '$ARCH=%s\n' "$XBPS_TARGET_MACHINE" >> ${DESTDIR}/etc/default/systemd-boot
}
ukify_package() {
@@ -76,3 +106,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (10 preceding siblings ...)
2024-08-13 12:34 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-08-13 12:44 ` Calandracas606
2024-08-13 13:22 ` Calandracas606
` (50 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 12:44 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 73036 bytes --]
From 54c7bf3cd5458f5a263ebb204fdb5f810accd46d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 10 +
.../files/kernel.d/systemd-boot.post-install | 60 ++
.../files/kernel.d/systemd-boot.post-remove | 33 +
.../files/patches/musl/musl-gshadow.patch | 158 +++
.../files/patches/musl/musl-malloc_info.patch | 57 ++
.../files/patches/musl/musl-malloc_trim.patch | 39 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../files/patches/musl/musl-prctl.patch | 32 +
.../files/patches/musl/musl-printf.patch | 434 +++++++++
.../files/patches/musl/musl-rlim.patch | 106 ++
.../files/patches/musl/musl-strerror_r.patch | 76 ++
.../files/patches/musl}/musl-wchar_t.patch | 0
.../template | 60 +-
srcpkgs/ukify | 2 +-
15 files changed, 1960 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub/patches => systemd-boot/files/patches/musl}/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (63%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..13306579a81239
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,10 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## System architechture
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..3cabd7df33f647
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT=${BOOT:-"$ROOTDIR/boot"}
+ESP=${ESP:-"$BOOT"}
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+options="$ESP/loader/void-options.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ version $VERSION
+ linux vmlinuz-$VERSION
+ initrd initramfs-$VERSION.img
+EOF
+
+echo "Created systemd-boot entry $entry"
+
+if [ -r "$options" ]; then
+ # Add user provided options from /boot/loader/void-options.conf:
+ printf 'options %s\n' "$(sed '/^#/d;/^$/d' < "$options")" >> "$entry"
+else
+ # get UUID from fstab
+ uuid=$(awk '$2 == "/" { print $1 }' < /etc/fstab | sed 's/^UUID=//')
+ printf 'options %s\n' "root=UUID=$uuid rw" >> "$entry"
+fi
+
+if grep -q ^default "$loader" 2>/dev/null; then
+ # Replace existing default entry with this entry:
+ sed -i "s/default.*/default $name/" "$loader"
+else
+ # Add this entry as the default:
+ printf 'default %s\n' "$name" >>"$loader"
+fi
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..0fce80f5a4bbf8
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+#get major kernel ver, eg: linux6.8 -> 6.8
+major_ver=$(echo $PKGNAME | cut -c 6-)
+boot="$ROOTDIR/boot"
+esp="$ROOTDIR/boot/efi"
+entries="$esp/loader/entries"
+name="void-$major_ver"
+entry="$entries/$name.conf"
+loader="$esp/loader/loader.conf"
+
+[ -d "$boot" ] || exit 0
+
+rm -f "$entry"
+
+# No default entry if the removed entry was the default:
+[ -e "$loader" ] && sed -i "/^default $name\$/d" "$loader"
+
+rm "$esp/vmlinuz-void-$major_ver"
+rm "$esp/initramfs-void-$major_ver.img"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/files/patches/musl/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 63%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..3e859f2b8dbe49 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,19 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
+
+ printf 'ARCH="%s"\n' "$XBPS_TARGET_MACHINE" >> ${DESTDIR}/etc/default/systemd-boot
}
ukify_package() {
@@ -76,3 +106,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (11 preceding siblings ...)
2024-08-13 12:44 ` Calandracas606
@ 2024-08-13 13:22 ` Calandracas606
2024-08-13 13:35 ` [PR REVIEW] " classabbyamp
` (49 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 13:22 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72994 bytes --]
From 9e5d6b6ce9639d35893ecd5dda79f4f0ac967637 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 10 +
.../files/kernel.d/systemd-boot.post-install | 61 ++
.../files/kernel.d/systemd-boot.post-remove | 29 +
.../files/patches/musl/musl-gshadow.patch | 158 +++
.../files/patches/musl/musl-malloc_info.patch | 57 ++
.../files/patches/musl/musl-malloc_trim.patch | 39 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../files/patches/musl/musl-prctl.patch | 32 +
.../files/patches/musl/musl-printf.patch | 434 +++++++++
.../files/patches/musl/musl-rlim.patch | 106 ++
.../files/patches/musl/musl-strerror_r.patch | 76 ++
.../files/patches/musl}/musl-wchar_t.patch | 0
.../template | 61 +-
srcpkgs/ukify | 2 +-
15 files changed, 1958 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub/patches => systemd-boot/files/patches/musl}/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (62%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..13306579a81239
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,10 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## System architechture
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..8ce3f910545c5a
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT=${BOOT:-"$ROOTDIR/boot"}
+ESP=${ESP:-"$BOOT"}
+ARCH=${ARCH:-"$(xbps-uhelper arch)"}
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+options="$ESP/loader/void-$ARCH-options.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ version $VERSION
+ linux vmlinuz-$VERSION
+ initrd initramfs-$VERSION.img
+EOF
+
+echo "Created systemd-boot entry $entry"
+
+if [ -r "$options" ]; then
+ # Add user provided options from /boot/loader/void-options.conf:
+ printf 'options %s\n' "$(sed '/^#/d;/^$/d' < "$options")" >> "$entry"
+else
+ # get UUID from fstab
+ uuid=$(awk '$2 == "/" { print $1 }' < /etc/fstab | sed 's/^UUID=//')
+ printf 'options %s\n' "root=UUID=$uuid rw" >> "$entry"
+fi
+
+if grep -q ^default "$loader" 2>/dev/null; then
+ # Replace existing default entry with this entry:
+ sed -i "s/default.*/default $name/" "$loader"
+else
+ # Add this entry as the default:
+ printf 'default %s\n' "$name" >>"$loader"
+fi
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..e3458f8fccd3e6
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT=${BOOT:-"$ROOTDIR/boot"}
+ESP=${ESP:-"$BOOT"}
+ARCH=${ARCH:-"$(xbps-uhelper arch)"}
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+# No default entry if the removed entry was the default:
+[ -e "$loader" ] && sed -i "/^default $name.conf\$/d" "$loader"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/files/patches/musl/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 62%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..3d997138063014 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,20 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
+
+ # sample default arch
+ printf '#ARCH="%s"\n' "$XBPS_TARGET_MACHINE" >> ${DESTDIR}/etc/default/systemd-boot
}
ukify_package() {
@@ -76,3 +107,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (12 preceding siblings ...)
2024-08-13 13:22 ` Calandracas606
@ 2024-08-13 13:35 ` classabbyamp
2024-08-13 13:45 ` [PR PATCH] [Updated] " Calandracas606
` (48 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-13 13:35 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 234 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1715306216
Comment:
then I'd prefer to make most of them apply universally except the problematic one
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (13 preceding siblings ...)
2024-08-13 13:35 ` [PR REVIEW] " classabbyamp
@ 2024-08-13 13:45 ` Calandracas606
2024-08-13 13:45 ` [PR REVIEW] " Calandracas606
` (47 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 13:45 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72645 bytes --]
From b8b37a3188e6e3a590eecc231e2c374ea8146b3c Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 10 +
.../files/kernel.d/systemd-boot.post-install | 61 ++
.../files/kernel.d/systemd-boot.post-remove | 29 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 61 +-
srcpkgs/ukify | 2 +-
15 files changed, 1958 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (62%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..13306579a81239
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,10 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## System architechture
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..8ce3f910545c5a
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT=${BOOT:-"$ROOTDIR/boot"}
+ESP=${ESP:-"$BOOT"}
+ARCH=${ARCH:-"$(xbps-uhelper arch)"}
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+options="$ESP/loader/void-$ARCH-options.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ version $VERSION
+ linux vmlinuz-$VERSION
+ initrd initramfs-$VERSION.img
+EOF
+
+echo "Created systemd-boot entry $entry"
+
+if [ -r "$options" ]; then
+ # Add user provided options from /boot/loader/void-options.conf:
+ printf 'options %s\n' "$(sed '/^#/d;/^$/d' < "$options")" >> "$entry"
+else
+ # get UUID from fstab
+ uuid=$(awk '$2 == "/" { print $1 }' < /etc/fstab | sed 's/^UUID=//')
+ printf 'options %s\n' "root=UUID=$uuid rw" >> "$entry"
+fi
+
+if grep -q ^default "$loader" 2>/dev/null; then
+ # Replace existing default entry with this entry:
+ sed -i "s/default.*/default $name/" "$loader"
+else
+ # Add this entry as the default:
+ printf 'default %s\n' "$name" >>"$loader"
+fi
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..e3458f8fccd3e6
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT=${BOOT:-"$ROOTDIR/boot"}
+ESP=${ESP:-"$BOOT"}
+ARCH=${ARCH:-"$(xbps-uhelper arch)"}
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+# No default entry if the removed entry was the default:
+[ -e "$loader" ] && sed -i "/^default $name.conf\$/d" "$loader"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 62%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..3d997138063014 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,20 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
+
+ # sample default arch
+ printf '#ARCH="%s"\n' "$XBPS_TARGET_MACHINE" >> ${DESTDIR}/etc/default/systemd-boot
}
ukify_package() {
@@ -76,3 +107,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (14 preceding siblings ...)
2024-08-13 13:45 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-08-13 13:45 ` Calandracas606
2024-08-13 13:46 ` Calandracas606
` (46 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 13:45 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 246 bytes --]
New review comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1715322247
Comment:
> then I'd prefer to make most of them apply universally except the problematic one
done
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (15 preceding siblings ...)
2024-08-13 13:45 ` [PR REVIEW] " Calandracas606
@ 2024-08-13 13:46 ` Calandracas606
2024-08-13 13:57 ` [PR PATCH] [Updated] " Calandracas606
` (45 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 13:46 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 183 bytes --]
New review comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1715322856
Comment:
removed this part altogether
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (16 preceding siblings ...)
2024-08-13 13:46 ` Calandracas606
@ 2024-08-13 13:57 ` Calandracas606
2024-08-13 14:02 ` [PR REVIEW] " classabbyamp
` (44 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 13:57 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72496 bytes --]
From 1c38484d284724efb2a466449ef5ad8b2dc1bbb9 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 8 +
.../files/kernel.d/systemd-boot.post-install | 61 ++
.../files/kernel.d/systemd-boot.post-remove | 29 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1953 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..3e1e13189a4d95
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,8 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..dbe72e43b3615a
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT=${BOOT:-"$ROOTDIR/boot"}
+ESP=${ESP:-"$BOOT"}
+ARCH="$(xbps-uhelper arch)"
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+options="$ESP/loader/void-$ARCH-options.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ version $VERSION
+ linux vmlinuz-$VERSION
+ initrd initramfs-$VERSION.img
+EOF
+
+echo "Created systemd-boot entry $entry"
+
+if [ -r "$options" ]; then
+ # Add user provided options from /boot/loader/void-options.conf:
+ printf 'options %s\n' "$(sed '/^#/d;/^$/d' < "$options")" >> "$entry"
+else
+ # get UUID from fstab
+ uuid=$(awk '$2 == "/" { print $1 }' < /etc/fstab | sed 's/^UUID=//')
+ printf 'options %s\n' "root=UUID=$uuid rw" >> "$entry"
+fi
+
+if grep -q ^default "$loader" 2>/dev/null; then
+ # Replace existing default entry with this entry:
+ sed -i "s/default.*/default $name/" "$loader"
+else
+ # Add this entry as the default:
+ printf 'default %s\n' "$name" >>"$loader"
+fi
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..e3458f8fccd3e6
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT=${BOOT:-"$ROOTDIR/boot"}
+ESP=${ESP:-"$BOOT"}
+ARCH=${ARCH:-"$(xbps-uhelper arch)"}
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+# No default entry if the removed entry was the default:
+[ -e "$loader" ] && sed -i "/^default $name.conf\$/d" "$loader"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (17 preceding siblings ...)
2024-08-13 13:57 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-08-13 14:02 ` classabbyamp
2024-08-13 14:02 ` classabbyamp
` (43 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-13 14:02 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 290 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1715352787
Comment:
```suggestion
BOOT="${BOOT:-/boot}"
ESP="${ESP:-"$BOOT"}"
BOOT="$ROOTDIR/$BOOT"
ESP="$ROOTDIR/$ESP"
ARCH="$(xbps-uhelper arch)"
```
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (18 preceding siblings ...)
2024-08-13 14:02 ` [PR REVIEW] " classabbyamp
@ 2024-08-13 14:02 ` classabbyamp
2024-08-13 14:52 ` [PR PATCH] [Updated] " Calandracas606
` (42 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-13 14:02 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 323 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1715333478
Comment:
i think these need to ensure they have a `ROOTDIR` prefix
```suggestion
BOOT="${BOOT:-/boot}"
ESP="${ESP:-"$BOOT"}"
BOOT="$ROOTDIR/$BOOT"
ESP="$ROOTDIR/$ESP"
```
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (19 preceding siblings ...)
2024-08-13 14:02 ` classabbyamp
@ 2024-08-13 14:52 ` Calandracas606
2024-08-13 14:56 ` Calandracas606
` (41 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 14:52 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72576 bytes --]
From 7053f8d4366648537794556ebf8c641e3fc1dcbf Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 65 ++
.../files/kernel.d/systemd-boot.post-remove | 34 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1965 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..11e62dee21932c
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,65 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ version $VERSION
+ linux vmlinuz-$VERSION
+ initrd initramfs-$VERSION.img
+EOF
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ uuid=$(awk '$2 == "/" { print $1 }' < /etc/fstab | sed 's/^UUID=//')
+ CMDLINE="root=UUID=$uuid quiet rw"
+fi
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
+
+printf 'options %s\n' "$CMDLINE" >> "$entry"
+
+if grep -q ^default "$loader" 2>/dev/null; then
+ # Replace existing default entry with this entry:
+ sed -i "s/default.*/default $name/" "$loader"
+else
+ # Add this entry as the default:
+ printf 'default %s\n' "$name" >>"$loader"
+fi
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..a3e3948c60b5e7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+# No default entry if the removed entry was the default:
+[ -e "$loader" ] && sed -i "/^default $name.conf\$/d" "$loader"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (20 preceding siblings ...)
2024-08-13 14:52 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-08-13 14:56 ` Calandracas606
2024-08-13 15:18 ` [PR REVIEW] " classabbyamp
` (40 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 14:56 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72586 bytes --]
From b51f9e1d4a27564033d13572aef846151a238935 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 65 ++
.../files/kernel.d/systemd-boot.post-remove | 34 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1965 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..485d954b60596a
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,65 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ version $VERSION
+ linux vmlinuz-$VERSION
+ initrd initramfs-$VERSION.img
+EOF
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ uuid=$(awk '$2 == "/" { print $1 }' < /etc/fstab | sed 's/^UUID=//')
+ CMDLINE="root=UUID=$uuid quiet rw"
+fi
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
+
+printf 'options %s\n' "$CMDLINE" >> "$entry"
+
+if grep -q ^default "$loader" 2>/dev/null; then
+ # Replace existing default entry with this entry:
+ sed -i "s/default.*/default $name.conf/" "$loader"
+else
+ # Add this entry as the default:
+ printf 'default %s\n' "$name.conf" >>"$loader"
+fi
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..a3e3948c60b5e7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+# No default entry if the removed entry was the default:
+[ -e "$loader" ] && sed -i "/^default $name.conf\$/d" "$loader"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (22 preceding siblings ...)
2024-08-13 15:18 ` [PR REVIEW] " classabbyamp
@ 2024-08-13 15:18 ` classabbyamp
2024-08-13 15:18 ` classabbyamp
` (38 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-13 15:18 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 199 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1715458833
Comment:
do we want to always set ourselves as default?
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (23 preceding siblings ...)
2024-08-13 15:18 ` classabbyamp
@ 2024-08-13 15:18 ` classabbyamp
2024-08-13 15:21 ` Calandracas606
` (37 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-13 15:18 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 181 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1715459214
Comment:
swap these two lines i think
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (21 preceding siblings ...)
2024-08-13 14:56 ` Calandracas606
@ 2024-08-13 15:18 ` classabbyamp
2024-08-13 15:18 ` classabbyamp
` (39 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-13 15:18 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 215 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1715473946
Comment:
```suggestion
echo "Removed systemd-boot entry $entry"
```
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (24 preceding siblings ...)
2024-08-13 15:18 ` classabbyamp
@ 2024-08-13 15:21 ` Calandracas606
2024-08-13 15:24 ` Calandracas606
` (36 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 15:21 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 263 bytes --]
New review comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1715490446
Comment:
Maybe only set ourselves as default if the default is already void: `s/default void.*/default $name.conf/` ?
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (25 preceding siblings ...)
2024-08-13 15:21 ` Calandracas606
@ 2024-08-13 15:24 ` Calandracas606
2024-08-13 15:36 ` [PR PATCH] [Updated] " Calandracas606
` (35 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 15:24 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 280 bytes --]
New review comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1715496232
Comment:
I guess there's also the case where an old kernel is being updated. we probably don't want to update the default in that case
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (26 preceding siblings ...)
2024-08-13 15:24 ` Calandracas606
@ 2024-08-13 15:36 ` Calandracas606
2024-08-13 15:41 ` [PR REVIEW] " Calandracas606
` (34 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 15:36 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72641 bytes --]
From a34280590c87a2de54e326fde207347bc3ca117b Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 65 ++
.../files/kernel.d/systemd-boot.post-remove | 36 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1967 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..f6921bda99b0fd
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,65 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ version $VERSION
+ linux vmlinuz-$VERSION
+ initrd initramfs-$VERSION.img
+EOF
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ uuid=$(awk '$2 == "/" { print $1 }' < /etc/fstab | sed 's/^UUID=//')
+ CMDLINE="root=UUID=$uuid quiet rw"
+fi
+
+printf 'options %s\n' "$CMDLINE" >> "$entry"
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
+
+if grep -q ^default "$loader" 2>/dev/null; then
+ # Replace existing default entry with this entry:
+ sed -i "s/default void-$ARCH.*/default $name.conf/" "$loader"
+else
+ # Add this entry as the default:
+ printf 'default %s\n' "$name.conf" >>"$loader"
+fi
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..5954274e1e263b
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
+
+# No default entry if the removed entry was the default:
+[ -e "$loader" ] && sed -i "/^default $name.conf\$/d" "$loader"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (27 preceding siblings ...)
2024-08-13 15:36 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-08-13 15:41 ` Calandracas606
2024-08-13 15:48 ` classabbyamp
` (33 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 15:41 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 324 bytes --]
New review comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1715525915
Comment:
probably best to ditch the "default" and just ensure that the entries are sorted properly: https://uapi-group.org/specifications/specs/boot_loader_specification/#sorting
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (28 preceding siblings ...)
2024-08-13 15:41 ` [PR REVIEW] " Calandracas606
@ 2024-08-13 15:48 ` classabbyamp
2024-08-13 16:14 ` [PR PATCH] [Updated] " Calandracas606
` (32 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-13 15:48 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 174 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1715535691
Comment:
sorting sounds better
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (29 preceding siblings ...)
2024-08-13 15:48 ` classabbyamp
@ 2024-08-13 16:14 ` Calandracas606
2024-08-13 16:15 ` Calandracas606
` (31 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 16:14 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72221 bytes --]
From d9f6c021d56835e8850c65a07b2caabbedfa56b0 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 56 ++
.../files/kernel.d/systemd-boot.post-remove | 33 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1955 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..ae95184ea22308
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ version $VERSION
+ linux vmlinuz-$VERSION
+ initrd initramfs-$VERSION.img
+EOF
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ uuid=$(awk '$2 == "/" { print $1 }' < /etc/fstab | sed 's/^UUID=//')
+ CMDLINE="root=UUID=$uuid quiet rw"
+fi
+
+printf 'options %s\n' "$CMDLINE" >> "$entry"
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..197e61ce5d5a0c
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+loader="$ESP/loader/loader.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (30 preceding siblings ...)
2024-08-13 16:14 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-08-13 16:15 ` Calandracas606
2024-08-13 16:49 ` Calandracas606
` (30 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 16:15 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72187 bytes --]
From 5dd79601f0f9d153f37fc3cd3c8219be61cfe454 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 56 ++
.../files/kernel.d/systemd-boot.post-remove | 32 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1954 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..ae95184ea22308
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ version $VERSION
+ linux vmlinuz-$VERSION
+ initrd initramfs-$VERSION.img
+EOF
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ uuid=$(awk '$2 == "/" { print $1 }' < /etc/fstab | sed 's/^UUID=//')
+ CMDLINE="root=UUID=$uuid quiet rw"
+fi
+
+printf 'options %s\n' "$CMDLINE" >> "$entry"
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..89825b557408b7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (31 preceding siblings ...)
2024-08-13 16:15 ` Calandracas606
@ 2024-08-13 16:49 ` Calandracas606
2024-08-13 17:08 ` Calandracas606
` (29 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 16:49 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72401 bytes --]
From 37d6146aecb6f0a277a96f6f6a4cfa415fd2cf55 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 64 ++
.../files/kernel.d/systemd-boot.post-remove | 32 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1962 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..69bfa2039f1c17
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,64 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+[ -d "$ESP" ] || exit 0
+
+ARCH="$(xbps-uhelper arch)"
+
+# EFI_ARCH is the identifier from the UEFI specification
+case "$ARCH" in
+ x86_64*) EFI_ARCH="x64";;
+ i686*) EFI_ARCH="IA32";;
+ aarch64*) EFI_ARCH="AA64";;
+esac
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ uuid=$(awk '$2 == "/" { print $1 }' < /etc/fstab | sed 's/^UUID=//')
+ CMDLINE="root=UUID=$uuid quiet rw"
+fi
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ sort-key void
+ version $VERSION
+ options $CMDLINE
+ architecture $EFI_ARCH
+ linux vmlinuz-$VERSION
+ initrd initramfs-$VERSION.img
+EOF
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..89825b557408b7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (32 preceding siblings ...)
2024-08-13 16:49 ` Calandracas606
@ 2024-08-13 17:08 ` Calandracas606
2024-08-14 18:26 ` [PR REVIEW] " ahesford
` (28 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-13 17:08 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 451 bytes --]
New comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#issuecomment-2286725506
Comment:
Thoughts on possibly adding an option to use ukify in the hook instead of kernel + initramfs?
Such an option would make migration easier for users who are already using the "normal" configuration, and don't want to mount ESP to /boot.
Obviously users could always write their own hooks to do this
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (35 preceding siblings ...)
2024-08-14 18:26 ` ahesford
@ 2024-08-14 18:26 ` ahesford
2024-08-25 22:31 ` [PR PATCH] [Updated] " Calandracas606
` (25 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: ahesford @ 2024-08-14 18:26 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 658 bytes --]
New review comment by ahesford on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1717369324
Comment:
```suggestion
rdev="$(awk '$2 == "/" { print $1 }' < /etc/fstab)" || rdev=
if [ -z "${rdev}" ]; then
echo "failed to determine root device, aborting"
exit 1
fi
CMDLINE="root=UUID=$uuid quiet rw"
```
Not expecting that `fstab` uses a `UUID` designation is a bit more robust, although it still doesn't consider situations like
# / some valid comment that will fool the parser
Might be worth doing a bit more validation on fields 1 and 2 to make sure they really look like a root entry.
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (33 preceding siblings ...)
2024-08-13 17:08 ` Calandracas606
@ 2024-08-14 18:26 ` ahesford
2024-08-14 18:26 ` ahesford
` (27 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: ahesford @ 2024-08-14 18:26 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 367 bytes --]
New review comment by ahesford on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1717371502
Comment:
It would be better if the hook confirmed that these files actually exist where expected, or else early abort. Better to have a bootloader entry for the last kernel persist than overwrite it with one that will not boot.
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (34 preceding siblings ...)
2024-08-14 18:26 ` [PR REVIEW] " ahesford
@ 2024-08-14 18:26 ` ahesford
2024-08-14 18:26 ` ahesford
` (26 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: ahesford @ 2024-08-14 18:26 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 352 bytes --]
New review comment by ahesford on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1717373141
Comment:
If one of the `$EFI_ARCH` values defined above are critical, then the hook should abort for other architectures. Otherwise, this line should be gated behind a test that `$EFI_ARCH` is actually non-empty.
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (36 preceding siblings ...)
2024-08-14 18:26 ` ahesford
@ 2024-08-25 22:31 ` Calandracas606
2024-08-25 22:35 ` [PR REVIEW] " Calandracas606
` (24 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-25 22:31 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72590 bytes --]
From 75333d52904caac48a55c2080ed9906bcdf30d07 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 79 ++
.../files/kernel.d/systemd-boot.post-remove | 32 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1977 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..1c419f1954d558
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,79 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+[ -d "$ESP" ] || exit 0
+
+ARCH="$(xbps-uhelper arch)"
+
+# EFI_ARCH is the identifier from the UEFI specification
+case "$ARCH" in
+ x86_64*) EFI_ARCH="x64";;
+ i686*) EFI_ARCH="IA32";;
+ aarch64*) EFI_ARCH="AA64";;
+esac
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ CMDLINE=$( awk ' /^[^#]/ {
+ DEVICE=$1
+ MOUNTPOINT=$2
+ FSTYPE=$3
+ if (MOUNTPOINT == "/")
+ {
+ print "rootfstype="FSTYPE, "root="DEVICE
+ exit
+ }
+ }' "$ROOTDIR/etc/fstab"
+ )
+ CMDLINE="${CMDLINE} quiet rw"
+fi
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ sort-key void
+ version $VERSION
+ options $CMDLINE
+ linux vmlinuz-$VERSION
+ initrd initramfs-$VERSION.img
+EOF
+
+if [ "$EFI_ARCH" ]; then
+ cat <<-EOF >> "$entry"
+ architecture $EFI_ARCH
+ EOF
+fi
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..89825b557408b7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (37 preceding siblings ...)
2024-08-25 22:31 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-08-25 22:35 ` Calandracas606
2024-08-25 22:42 ` [PR PATCH] [Updated] " Calandracas606
` (23 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-25 22:35 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 421 bytes --]
New review comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1730443833
Comment:
fixed this with a more sophisticated awk which will ignore comment lines (lines which begin with `#`) in fstab, and rather than looking for UUID, it will use whatever is in the "device" column. also addresses the situation where fstab contains `PARTUUID` or `/dev/`
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (38 preceding siblings ...)
2024-08-25 22:35 ` [PR REVIEW] " Calandracas606
@ 2024-08-25 22:42 ` Calandracas606
2024-08-25 22:43 ` Calandracas606
` (22 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-25 22:42 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72861 bytes --]
From 15221d01ff749215a62203efefdf7844a431ba1d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 94 ++
.../files/kernel.d/systemd-boot.post-remove | 32 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1992 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..7b00ecd0da9938
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+[ -d "$ESP" ] || exit 0
+
+ARCH="$(xbps-uhelper arch)"
+
+# EFI_ARCH is the identifier from the UEFI specification
+case "$ARCH" in
+ x86_64*) EFI_ARCH="x64";;
+ i686*) EFI_ARCH="IA32";;
+ aarch64*) EFI_ARCH="AA64";;
+esac
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+LINUX="vmlinuz-${VERSION}"
+INITRD="initramfs-${VERSION}.img"
+
+if [ -f "$ESP/$LINUX" ]; then
+ echo "Failed to find kernel at $ESP/$LINUX"
+ echo "Aborting..."
+ exit 1
+fi
+
+if [ -f "$ESP/$INITRD" ]; then
+ echo "Failed to find initramfs at $ESP/$INITRD"
+ echo "Aborting..."
+ exit 1
+fi
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ CMDLINE=$( awk ' /^[^#]/ {
+ DEVICE=$1
+ MOUNTPOINT=$2
+ FSTYPE=$3
+ if (MOUNTPOINT == "/")
+ {
+ print "rootfstype="FSTYPE, "root="DEVICE
+ exit
+ }
+ }' "$ROOTDIR/etc/fstab"
+ )
+ CMDLINE="${CMDLINE} quiet rw"
+fi
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ sort-key void
+ version $VERSION
+ options $CMDLINE
+ linux $LINUX
+ initrd $INITRD
+EOF
+
+if [ "$EFI_ARCH" ]; then
+ cat <<-EOF >> "$entry"
+ architecture $EFI_ARCH
+ EOF
+fi
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..89825b557408b7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (39 preceding siblings ...)
2024-08-25 22:42 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-08-25 22:43 ` Calandracas606
2024-08-25 22:55 ` [PR REVIEW] " classabbyamp
` (21 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-25 22:43 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72865 bytes --]
From 507afee6bc2b6434c5f50a7ee42d990491c97c5f Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 94 ++
.../files/kernel.d/systemd-boot.post-remove | 32 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1992 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..f313ccece6df58
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+[ -d "$ESP" ] || exit 0
+
+ARCH="$(xbps-uhelper arch)"
+
+# EFI_ARCH is the identifier from the UEFI specification
+case "$ARCH" in
+ x86_64*) EFI_ARCH="x64";;
+ i686*) EFI_ARCH="IA32";;
+ aarch64*) EFI_ARCH="AA64";;
+esac
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+LINUX="vmlinuz-${VERSION}"
+INITRD="initramfs-${VERSION}.img"
+
+if [ ! -f "$ESP/$LINUX" ]; then
+ echo "Failed to find kernel at $ESP/$LINUX"
+ echo "Aborting..."
+ exit 1
+fi
+
+if [ ! -f "$ESP/$INITRD" ]; then
+ echo "Failed to find initramfs at $ESP/$INITRD"
+ echo "Aborting..."
+ exit 1
+fi
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ CMDLINE=$( awk ' /^[^#]/ {
+ DEVICE=$1
+ MOUNTPOINT=$2
+ FSTYPE=$3
+ if (MOUNTPOINT == "/")
+ {
+ print "rootfstype="FSTYPE, "root="DEVICE
+ exit
+ }
+ }' "$ROOTDIR/etc/fstab"
+ )
+ CMDLINE="${CMDLINE} quiet rw"
+fi
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ sort-key void
+ version $VERSION
+ options $CMDLINE
+ linux $LINUX
+ initrd $INITRD
+EOF
+
+if [ "$EFI_ARCH" ]; then
+ cat <<-EOF >> "$entry"
+ architecture $EFI_ARCH
+ EOF
+fi
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..89825b557408b7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (40 preceding siblings ...)
2024-08-25 22:43 ` Calandracas606
@ 2024-08-25 22:55 ` classabbyamp
2024-08-25 23:01 ` [PR PATCH] [Updated] " Calandracas606
` (20 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-25 22:55 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 189 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1730447055
Comment:
what about leading space situations?
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (41 preceding siblings ...)
2024-08-25 22:55 ` [PR REVIEW] " classabbyamp
@ 2024-08-25 23:01 ` Calandracas606
2024-08-25 23:03 ` [PR REVIEW] " Calandracas606
` (19 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-25 23:01 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72939 bytes --]
From 66321e1002066e9a305cf25ac750eb683c203856 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 96 ++
.../files/kernel.d/systemd-boot.post-remove | 32 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1994 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..a63a7ebdbdeb41
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,96 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+[ -d "$ESP" ] || exit 0
+
+ARCH="$(xbps-uhelper arch)"
+
+# EFI_ARCH is the identifier from the UEFI specification
+case "$ARCH" in
+ x86_64*) EFI_ARCH="x64";;
+ i686*) EFI_ARCH="IA32";;
+ aarch64*) EFI_ARCH="AA64";;
+esac
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+LINUX="vmlinuz-${VERSION}"
+INITRD="initramfs-${VERSION}.img"
+
+if [ ! -f "$ESP/$LINUX" ]; then
+ echo "Failed to find kernel at $ESP/$LINUX, aborting"
+ exit 1
+fi
+
+if [ ! -f "$ESP/$INITRD" ]; then
+ echo "Failed to find initramfs at $ESP/$INITRD, aborting"
+ exit 1
+fi
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ CMDLINE=$( awk ' /^[^#]/ {
+ DEVICE=$1
+ MOUNTPOINT=$2
+ FSTYPE=$3
+ if (MOUNTPOINT == "/")
+ {
+ print "rootfstype="FSTYPE, "root="DEVICE
+ exit
+ }
+ }' "$ROOTDIR/etc/fstab"
+ )
+ if [ -z "$CMDLINE" ]; then
+ echo "Failed to determine root device, aborting"
+ exit 1
+ fi
+ CMDLINE="${CMDLINE} quiet rw"
+fi
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ sort-key void
+ version $VERSION
+ options $CMDLINE
+ linux $LINUX
+ initrd $INITRD
+EOF
+
+if [ "$EFI_ARCH" ]; then
+ cat <<-EOF >> "$entry"
+ architecture $EFI_ARCH
+ EOF
+fi
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..89825b557408b7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (42 preceding siblings ...)
2024-08-25 23:01 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-08-25 23:03 ` Calandracas606
2024-08-25 23:03 ` Calandracas606
` (18 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-25 23:03 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 301 bytes --]
New review comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1730448116
Comment:
the efi arch is non-critical. I've added a check later down to ensure that `$EFI_ARCH` is non empty, and will ignore adding it to the loader entry
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (43 preceding siblings ...)
2024-08-25 23:03 ` [PR REVIEW] " Calandracas606
@ 2024-08-25 23:03 ` Calandracas606
2024-08-25 23:09 ` [PR PATCH] [Updated] " Calandracas606
` (17 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-25 23:03 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 228 bytes --]
New review comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1730448176
Comment:
add checks that these files actually exist, and will abort if they do not
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (44 preceding siblings ...)
2024-08-25 23:03 ` Calandracas606
@ 2024-08-25 23:09 ` Calandracas606
2024-08-26 0:08 ` [PR REVIEW] " Calandracas606
` (16 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-25 23:09 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72941 bytes --]
From d843263ce08c439a2b977233448bb3a7aed73ded Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 96 ++
.../files/kernel.d/systemd-boot.post-remove | 32 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1994 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..7eb4a43fd51fc9
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,96 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+[ -d "$ESP" ] || exit 0
+
+ARCH="$(xbps-uhelper arch)"
+
+# EFI_ARCH is the identifier from the UEFI specification
+case "$ARCH" in
+ x86_64*) EFI_ARCH="x64";;
+ i686*) EFI_ARCH="IA32";;
+ aarch64*) EFI_ARCH="AA64";;
+esac
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+LINUX="vmlinuz-${VERSION}"
+INITRD="initramfs-${VERSION}.img"
+
+if [ ! -f "$ESP/$LINUX" ]; then
+ echo "Failed to find kernel at $ESP/$LINUX, aborting"
+ exit 1
+fi
+
+if [ ! -f "$ESP/$INITRD" ]; then
+ echo "Failed to find initramfs at $ESP/$INITRD, aborting"
+ exit 1
+fi
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ CMDLINE="$( awk ' /^[^#]/ {
+ DEVICE=$1
+ MOUNTPOINT=$2
+ FSTYPE=$3
+ if (MOUNTPOINT == "/")
+ {
+ print "rootfstype="FSTYPE, "root="DEVICE
+ exit
+ }
+ }' "$ROOTDIR/etc/fstab"
+ )"
+ if [ -z "$CMDLINE" ]; then
+ echo "Failed to determine root device, aborting"
+ exit 1
+ fi
+ CMDLINE="${CMDLINE} quiet rw"
+fi
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ sort-key void
+ version $VERSION
+ options $CMDLINE
+ linux $LINUX
+ initrd $INITRD
+EOF
+
+if [ "$EFI_ARCH" ]; then
+ cat <<-EOF >> "$entry"
+ architecture $EFI_ARCH
+ EOF
+fi
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..89825b557408b7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (45 preceding siblings ...)
2024-08-25 23:09 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-08-26 0:08 ` Calandracas606
2024-08-26 1:10 ` classabbyamp
` (15 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-26 0:08 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 254 bytes --]
New review comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1730467791
Comment:
> what about leading space situations?
I'm not sure what you mean. Could you provide an example?
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (46 preceding siblings ...)
2024-08-26 0:08 ` [PR REVIEW] " Calandracas606
@ 2024-08-26 1:10 ` classabbyamp
2024-08-26 1:11 ` classabbyamp
` (14 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-26 1:10 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 201 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1730494095
Comment:
```
# comment with leading whitespace
```
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (47 preceding siblings ...)
2024-08-26 1:10 ` classabbyamp
@ 2024-08-26 1:11 ` classabbyamp
2024-08-26 1:45 ` [PR PATCH] [Updated] " Calandracas606
` (13 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-08-26 1:11 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 235 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1730494095
Comment:
```
some valid line
# comment with leading whitespace
some valid line
```
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (48 preceding siblings ...)
2024-08-26 1:11 ` classabbyamp
@ 2024-08-26 1:45 ` Calandracas606
2024-08-26 1:45 ` [PR REVIEW] " Calandracas606
` (12 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-26 1:45 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72963 bytes --]
From 140eca108ff024161633f7890d1a04933e39e66f Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 96 ++
.../files/kernel.d/systemd-boot.post-remove | 32 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1994 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..c283ac8192acf4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,96 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+is_installed="$(bootctl is-installed)"
+
+if [ "$is_installed" != "yes" ]; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+[ -d "$ESP" ] || exit 0
+
+ARCH="$(xbps-uhelper arch)"
+
+# EFI_ARCH is the identifier from the UEFI specification
+case "$ARCH" in
+ x86_64*) EFI_ARCH="x64";;
+ i686*) EFI_ARCH="IA32";;
+ aarch64*) EFI_ARCH="AA64";;
+esac
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+LINUX="vmlinuz-${VERSION}"
+INITRD="initramfs-${VERSION}.img"
+
+if [ ! -f "$ESP/$LINUX" ]; then
+ echo "Failed to find kernel at $ESP/$LINUX, aborting"
+ exit 1
+fi
+
+if [ ! -f "$ESP/$INITRD" ]; then
+ echo "Failed to find initramfs at $ESP/$INITRD, aborting"
+ exit 1
+fi
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ CMDLINE="$( awk ' /^[[:space:]]*[^[:space:]#]+/ {
+ DEVICE=$1
+ MOUNTPOINT=$2
+ FSTYPE=$3
+ if (MOUNTPOINT == "/")
+ {
+ print "rootfstype="FSTYPE, "root="DEVICE
+ exit
+ }
+ }' "$ROOTDIR/etc/fstab"
+ )"
+ if [ -z "$CMDLINE" ]; then
+ echo "Failed to determine root device, aborting"
+ exit 1
+ fi
+ CMDLINE="${CMDLINE} quiet rw"
+fi
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ sort-key void
+ version $VERSION
+ options $CMDLINE
+ linux $LINUX
+ initrd $INITRD
+EOF
+
+if [ "$EFI_ARCH" ]; then
+ cat <<-EOF >> "$entry"
+ architecture $EFI_ARCH
+ EOF
+fi
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..89825b557408b7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (49 preceding siblings ...)
2024-08-26 1:45 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-08-26 1:45 ` Calandracas606
2024-08-26 13:23 ` ahesford
` (11 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-26 1:45 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 226 bytes --]
New review comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1730511143
Comment:
fixed the situation where there is any number of spaces preceding a `#`
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (50 preceding siblings ...)
2024-08-26 1:45 ` [PR REVIEW] " Calandracas606
@ 2024-08-26 13:23 ` ahesford
2024-08-26 19:52 ` [PR PATCH] [Updated] " Calandracas606
` (10 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: ahesford @ 2024-08-26 13:23 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 522 bytes --]
New review comment by ahesford on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1731240997
Comment:
```suggestion
if ! bootctl is-installed >/dev/null; then
echo "systemd-boot is not installed to the ESP"
echo "run 'bootctl install' to install it"
exit 0
fi
```
It seems that [`bootctl` returns error when this query is negative](https://github.com/systemd/systemd/blob/main/src/boot/bootctl-install.c#L1135-L1143), so avoiding output scraping is preferable here.
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (51 preceding siblings ...)
2024-08-26 13:23 ` ahesford
@ 2024-08-26 19:52 ` Calandracas606
2024-10-06 0:08 ` Calandracas606
` (9 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-08-26 19:52 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72926 bytes --]
From 0ee384d4c2289b30375171b23e8c72329e458118 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 94 ++
.../files/kernel.d/systemd-boot.post-remove | 32 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1992 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..d5e43d53059745
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+if ! bootctl is-installed >/dev/null; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+[ -d "$ESP" ] || exit 0
+
+ARCH="$(xbps-uhelper arch)"
+
+# EFI_ARCH is the identifier from the UEFI specification
+case "$ARCH" in
+ x86_64*) EFI_ARCH="x64";;
+ i686*) EFI_ARCH="IA32";;
+ aarch64*) EFI_ARCH="AA64";;
+esac
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+LINUX="vmlinuz-${VERSION}"
+INITRD="initramfs-${VERSION}.img"
+
+if [ ! -f "$ESP/$LINUX" ]; then
+ echo "Failed to find kernel at $ESP/$LINUX, aborting"
+ exit 1
+fi
+
+if [ ! -f "$ESP/$INITRD" ]; then
+ echo "Failed to find initramfs at $ESP/$INITRD, aborting"
+ exit 1
+fi
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ CMDLINE="$( awk ' /^[[:space:]]*[^[:space:]#]+/ {
+ DEVICE=$1
+ MOUNTPOINT=$2
+ FSTYPE=$3
+ if (MOUNTPOINT == "/")
+ {
+ print "rootfstype="FSTYPE, "root="DEVICE
+ exit
+ }
+ }' "$ROOTDIR/etc/fstab"
+ )"
+ if [ -z "$CMDLINE" ]; then
+ echo "Failed to determine root device, aborting"
+ exit 1
+ fi
+ CMDLINE="${CMDLINE} quiet rw"
+fi
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ sort-key void
+ version $VERSION
+ options $CMDLINE
+ linux $LINUX
+ initrd $INITRD
+EOF
+
+if [ "$EFI_ARCH" ]; then
+ cat <<-EOF >> "$entry"
+ architecture $EFI_ARCH
+ EOF
+fi
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..89825b557408b7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (52 preceding siblings ...)
2024-08-26 19:52 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-10-06 0:08 ` Calandracas606
2024-10-06 0:29 ` Calandracas606
` (8 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-10-06 0:08 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 72926 bytes --]
From 8b7de4cf07942906e0b980d54b1440339d7fa4b8 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 94 ++
.../files/kernel.d/systemd-boot.post-remove | 32 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 58 +-
srcpkgs/ukify | 2 +-
15 files changed, 1992 insertions(+), 11 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (64%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..d5e43d53059745
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+if ! bootctl is-installed >/dev/null; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+[ -d "$ESP" ] || exit 0
+
+ARCH="$(xbps-uhelper arch)"
+
+# EFI_ARCH is the identifier from the UEFI specification
+case "$ARCH" in
+ x86_64*) EFI_ARCH="x64";;
+ i686*) EFI_ARCH="IA32";;
+ aarch64*) EFI_ARCH="AA64";;
+esac
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+LINUX="vmlinuz-${VERSION}"
+INITRD="initramfs-${VERSION}.img"
+
+if [ ! -f "$ESP/$LINUX" ]; then
+ echo "Failed to find kernel at $ESP/$LINUX, aborting"
+ exit 1
+fi
+
+if [ ! -f "$ESP/$INITRD" ]; then
+ echo "Failed to find initramfs at $ESP/$INITRD, aborting"
+ exit 1
+fi
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ CMDLINE="$( awk ' /^[[:space:]]*[^[:space:]#]+/ {
+ DEVICE=$1
+ MOUNTPOINT=$2
+ FSTYPE=$3
+ if (MOUNTPOINT == "/")
+ {
+ print "rootfstype="FSTYPE, "root="DEVICE
+ exit
+ }
+ }' "$ROOTDIR/etc/fstab"
+ )"
+ if [ -z "$CMDLINE" ]; then
+ echo "Failed to determine root device, aborting"
+ exit 1
+ fi
+ CMDLINE="${CMDLINE} quiet rw"
+fi
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ sort-key void
+ version $VERSION
+ options $CMDLINE
+ linux $LINUX
+ initrd $INITRD
+EOF
+
+if [ "$EFI_ARCH" ]; then
+ cat <<-EOF >> "$entry"
+ architecture $EFI_ARCH
+ EOF
+fi
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..89825b557408b7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 64%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..8a32e4b7589591 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
version=256
-revision=1
+revision=2
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (53 preceding siblings ...)
2024-10-06 0:08 ` Calandracas606
@ 2024-10-06 0:29 ` Calandracas606
2024-10-06 0:31 ` [PR REVIEW] " Calandracas606
` (7 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-10-06 0:29 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 73091 bytes --]
From 7107255b71460c1f2edb5a878d1e5b32faa4b0a2 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256.6
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 94 ++
.../files/kernel.d/systemd-boot.post-remove | 32 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 62 +-
srcpkgs/ukify | 2 +-
15 files changed, 1994 insertions(+), 13 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (60%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..d5e43d53059745
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+if ! bootctl is-installed >/dev/null; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+[ -d "$ESP" ] || exit 0
+
+ARCH="$(xbps-uhelper arch)"
+
+# EFI_ARCH is the identifier from the UEFI specification
+case "$ARCH" in
+ x86_64*) EFI_ARCH="x64";;
+ i686*) EFI_ARCH="IA32";;
+ aarch64*) EFI_ARCH="AA64";;
+esac
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+LINUX="vmlinuz-${VERSION}"
+INITRD="initramfs-${VERSION}.img"
+
+if [ ! -f "$ESP/$LINUX" ]; then
+ echo "Failed to find kernel at $ESP/$LINUX, aborting"
+ exit 1
+fi
+
+if [ ! -f "$ESP/$INITRD" ]; then
+ echo "Failed to find initramfs at $ESP/$INITRD, aborting"
+ exit 1
+fi
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ CMDLINE="$( awk ' /^[[:space:]]*[^[:space:]#]+/ {
+ DEVICE=$1
+ MOUNTPOINT=$2
+ FSTYPE=$3
+ if (MOUNTPOINT == "/")
+ {
+ print "rootfstype="FSTYPE, "root="DEVICE
+ exit
+ }
+ }' "$ROOTDIR/etc/fstab"
+ )"
+ if [ -z "$CMDLINE" ]; then
+ echo "Failed to determine root device, aborting"
+ exit 1
+ fi
+ CMDLINE="${CMDLINE} quiet rw"
+fi
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ sort-key void
+ version $VERSION
+ options $CMDLINE
+ linux $LINUX
+ initrd $INITRD
+EOF
+
+if [ "$EFI_ARCH" ]; then
+ cat <<-EOF >> "$entry"
+ architecture $EFI_ARCH
+ EOF
+fi
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..89825b557408b7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 60%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..402ae2a7026407 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
-version=256
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
+version=256.6
revision=1
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
-distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
-checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+distfiles="https://github.com/systemd/systemd/archive/refs/tags/v${version}.tar.gz"
+checksum=c085f162dec001407dd32f00abbf20b7e6ed7043dcfaf8ed954787d86707f409
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR REVIEW] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (54 preceding siblings ...)
2024-10-06 0:29 ` Calandracas606
@ 2024-10-06 0:31 ` Calandracas606
2024-10-06 0:53 ` [PR PATCH] [Updated] " Calandracas606
` (6 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-10-06 0:31 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 359 bytes --]
New review comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#discussion_r1788775304
Comment:
changed from `systemd-stable` to `systemd`, since the stable repo seems to be for backports to previous major releases. There are several minor releases since version 256 which are not in `systemd-stable`
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (55 preceding siblings ...)
2024-10-06 0:31 ` [PR REVIEW] " Calandracas606
@ 2024-10-06 0:53 ` Calandracas606
2024-10-06 1:29 ` Calandracas606
` (5 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-10-06 0:53 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 73202 bytes --]
From c813242c25a87af4257021939d954fe93fc57584 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256.6
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 98 ++
.../files/kernel.d/systemd-boot.post-remove | 32 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 62 +-
srcpkgs/ukify | 2 +-
15 files changed, 1998 insertions(+), 13 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (60%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..477f2b069f3726
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,98 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+if ! bootctl is-installed >/dev/null; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+[ -d "$ESP" ] || exit 0
+
+ARCH="$(xbps-uhelper arch)"
+
+# EFI_ARCH is the identifier from the UEFI specification
+case "$ARCH" in
+ x86_64*) EFI_ARCH="x64";;
+ i686*) EFI_ARCH="IA32";;
+ aarch64*) EFI_ARCH="AA64";;
+esac
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+LINUX="vmlinuz-${VERSION}"
+
+if [ ! -f "$ESP/$LINUX" ]; then
+ LINUX="vmlinux-${VERSION}"
+ if [ ! -f "$ESP/$LINUX" ]; then
+ echo "Failed to find kernel at $ESP/vmlinuz-${VERSION} or $ESP/vmlinux-${VERSION}, aborting"
+ exit 1
+ fi
+fi
+
+INITRD="initramfs-${VERSION}.img"
+
+if [ ! -f "$ESP/$INITRD" ]; then
+ echo "Failed to find initramfs at $ESP/$INITRD, aborting"
+ exit 1
+fi
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ CMDLINE="$( awk ' /^[[:space:]]*[^[:space:]#]+/ {
+ DEVICE=$1
+ MOUNTPOINT=$2
+ FSTYPE=$3
+ if (MOUNTPOINT == "/")
+ {
+ print "rootfstype="FSTYPE, "root="DEVICE
+ exit
+ }
+ }' "$ROOTDIR/etc/fstab"
+ )"
+ if [ -z "$CMDLINE" ]; then
+ echo "Failed to determine root device, aborting"
+ exit 1
+ fi
+ CMDLINE="${CMDLINE} quiet rw"
+fi
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ sort-key void
+ version $VERSION
+ options $CMDLINE
+ linux $LINUX
+ initrd $INITRD
+EOF
+
+if [ "$EFI_ARCH" ]; then
+ cat <<-EOF >> "$entry"
+ architecture $EFI_ARCH
+ EOF
+fi
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..89825b557408b7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 60%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..402ae2a7026407 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
-version=256
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
+version=256.6
revision=1
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
-distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
-checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+distfiles="https://github.com/systemd/systemd/archive/refs/tags/v${version}.tar.gz"
+checksum=c085f162dec001407dd32f00abbf20b7e6ed7043dcfaf8ed954787d86707f409
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Updated] New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (56 preceding siblings ...)
2024-10-06 0:53 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-10-06 1:29 ` Calandracas606
2024-10-06 18:51 ` [PR PATCH] [Merged]: " classabbyamp
` (4 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-10-06 1:29 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
There is an updated pull request by Calandracas606 against master on the void-packages repository
https://github.com/Calandracas606/void-packages systemd-boot
https://github.com/void-linux/void-packages/pull/51811
New package: systemd-boot-256
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
A patch file from https://github.com/void-linux/void-packages/pull/51811.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-systemd-boot-51811.patch --]
[-- Type: text/x-diff, Size: 73202 bytes --]
From fb3c4b8e9ffc54597aeffe2809eb1750ca81f1cb Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Aug 2024 11:41:37 -0400
Subject: [PATCH] New package: systemd-boot-256.6
---
srcpkgs/systemd-boot-efistub | 1 +
.../files/kernel.d/systemd-boot.conf | 11 +
.../files/kernel.d/systemd-boot.post-install | 98 ++
.../files/kernel.d/systemd-boot.post-remove | 32 +
.../files/patches/musl/musl-misc.patch | 903 ++++++++++++++++++
.../systemd-boot/patches/musl-gshadow.patch | 158 +++
.../patches/musl-malloc_info.patch | 57 ++
.../patches/musl-malloc_trim.patch | 39 +
srcpkgs/systemd-boot/patches/musl-prctl.patch | 32 +
.../systemd-boot/patches/musl-printf.patch | 434 +++++++++
srcpkgs/systemd-boot/patches/musl-rlim.patch | 106 ++
.../patches/musl-strerror_r.patch | 76 ++
.../patches/musl-wchar_t.patch | 0
.../template | 62 +-
srcpkgs/ukify | 2 +-
15 files changed, 1998 insertions(+), 13 deletions(-)
create mode 120000 srcpkgs/systemd-boot-efistub
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
create mode 100644 srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
create mode 100644 srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-gshadow.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_info.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-prctl.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-printf.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-rlim.patch
create mode 100644 srcpkgs/systemd-boot/patches/musl-strerror_r.patch
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/patches/musl-wchar_t.patch (100%)
rename srcpkgs/{systemd-boot-efistub => systemd-boot}/template (60%)
diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub
new file mode 120000
index 00000000000000..171756f5fb6754
--- /dev/null
+++ b/srcpkgs/systemd-boot-efistub
@@ -0,0 +1 @@
+systemd-boot
\ No newline at end of file
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
new file mode 100644
index 00000000000000..23c744dd2a63f4
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf
@@ -0,0 +1,11 @@
+## uncomment this line to disable the systemd-boot hook
+#SYSTEMD_BOOT_DISABLE=1
+
+## Default $BOOT is /boot
+#BOOT="/boot"
+
+## Default ESP is $BOOT
+#ESP="$BOOT"
+
+## If unset, cmdline will be generated using UUID from fstab
+#CMDLINE=""
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
new file mode 100644
index 00000000000000..ddfdef523a7568
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install
@@ -0,0 +1,98 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+if ! bootctl is-installed >/dev/null; then
+ echo "systemd-boot is not installed to the ESP"
+ echo "run 'bootctl install' to install it"
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+[ -d "$ESP" ] || exit 0
+
+ARCH="$(xbps-uhelper arch)"
+
+# EFI_ARCH is the identifier from the UEFI specification
+case "$ARCH" in
+ x86_64*) EFI_ARCH="x64";;
+ i686*) EFI_ARCH="ia32";;
+ aarch64*) EFI_ARCH="aa64";;
+esac
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+LINUX="vmlinuz-${VERSION}"
+
+if [ ! -f "$ESP/$LINUX" ]; then
+ LINUX="vmlinux-${VERSION}"
+ if [ ! -f "$ESP/$LINUX" ]; then
+ echo "Failed to find kernel at $ESP/vmlinuz-${VERSION} or $ESP/vmlinux-${VERSION}, aborting"
+ exit 1
+ fi
+fi
+
+INITRD="initramfs-${VERSION}.img"
+
+if [ ! -f "$ESP/$INITRD" ]; then
+ echo "Failed to find initramfs at $ESP/$INITRD, aborting"
+ exit 1
+fi
+
+# check if user provided options in /etc/default/systemd-boot
+if [ -z "$CMDLINE" ]; then
+ # get UUID from fstab
+ CMDLINE="$( awk ' /^[[:space:]]*[^[:space:]#]+/ {
+ DEVICE=$1
+ MOUNTPOINT=$2
+ FSTYPE=$3
+ if (MOUNTPOINT == "/")
+ {
+ print "rootfstype="FSTYPE, "root="DEVICE
+ exit
+ }
+ }' "$ROOTDIR/etc/fstab"
+ )"
+ if [ -z "$CMDLINE" ]; then
+ echo "Failed to determine root device, aborting"
+ exit 1
+ fi
+ CMDLINE="${CMDLINE} quiet rw"
+fi
+
+mkdir -p "$entries"
+
+cat <<-EOF > "$entry"
+ title Void Linux $ARCH $VERSION
+ sort-key void
+ version $VERSION
+ options $CMDLINE
+ linux $LINUX
+ initrd $INITRD
+EOF
+
+if [ "$EFI_ARCH" ]; then
+ cat <<-EOF >> "$entry"
+ architecture $EFI_ARCH
+ EOF
+fi
+
+echo "Created systemd-boot entry $entry with options '$CMDLINE'"
diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
new file mode 100644
index 00000000000000..89825b557408b7
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Kernel hook for systemd-boot.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "$ROOTDIR/etc/default/systemd-boot"
+
+if [ "$SYSTEMD_BOOT_DISABLE" ]; then
+ exit 0
+fi
+
+BOOT="${BOOT:-/boot}"
+ESP="${ESP:-"$BOOT"}"
+
+BOOT="$ROOTDIR/$BOOT"
+ESP="$ROOTDIR/$ESP"
+
+ARCH="$(xbps-uhelper arch)"
+
+entries="$ESP/loader/entries"
+name="void-$ARCH-$VERSION"
+entry="$entries/$name.conf"
+
+[ -d "$ESP" ] || exit 0
+
+rm -f "$entry"
+
+echo "Removed systemd-boot entry $entry"
diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
new file mode 100644
index 00000000000000..80f415eb7feb74
--- /dev/null
+++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch
@@ -0,0 +1,903 @@
+From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sat, 4 May 2024 02:58:07 +0200
+Subject: [PATCH] musl fixes
+
+This includes multiple tiny patches, so adding co-authored for these.
+Co-Authored-By: Chen Qi <Qi.Chen@windriver.com>
+Co-Authored-By: Caleb Connolly <caleb@postmarketos.org>
+---
+ src/basic/arphrd-util.c | 3 ++-
+ src/basic/arphrd-util.h | 1 +
+ src/basic/fd-util.h | 1 +
+ src/basic/fileio.h | 1 +
+ src/basic/generate-arphrd-list.sh | 2 +-
+ src/basic/glob-util.c | 14 --------------
+ src/basic/glob-util.h | 1 +
+ src/basic/linux/if.h | 6 ++++++
+ src/basic/linux/in6.h | 1 +
+ src/basic/missing_type.h | 16 ++++++++++++++++
+ src/basic/pidref.h | 1 +
+ src/basic/sort-util.h | 1 +
+ src/basic/string-util.h | 1 +
+ src/libsystemd-network/arp-util.c | 2 +-
+ src/libsystemd-network/sd-dhcp6-client.c | 2 +-
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ src/network/netdev/bareudp.c | 2 +-
+ src/network/netdev/batadv.c | 2 +-
+ src/network/netdev/bond.c | 2 +-
+ src/network/netdev/bridge.c | 1 -
+ src/network/netdev/dummy.c | 2 +-
+ src/network/netdev/geneve.c | 1 -
+ src/network/netdev/ifb.c | 2 +-
+ src/network/netdev/ipoib.c | 2 +-
+ src/network/netdev/ipvlan.c | 2 +-
+ src/network/netdev/macsec.c | 2 +-
+ src/network/netdev/macvlan.c | 2 +-
+ src/network/netdev/netdev.c | 2 +-
+ src/network/netdev/netdevsim.c | 2 +-
+ src/network/netdev/nlmon.c | 2 +-
+ src/network/netdev/tunnel.c | 2 +-
+ src/network/netdev/tuntap.c | 2 +-
+ src/network/netdev/vcan.c | 2 +-
+ src/network/netdev/veth.c | 3 ++-
+ src/network/netdev/vlan.c | 1 -
+ src/network/netdev/vrf.c | 1 -
+ src/network/netdev/vxcan.c | 2 +-
+ src/network/netdev/vxlan.c | 2 +-
+ src/network/netdev/wireguard.c | 3 ++-
+ src/network/netdev/xfrm.c | 2 +-
+ src/network/networkd-dhcp-common.c | 2 +-
+ src/network/networkd-dhcp-server.c | 2 +-
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-ipv6ll.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-ndisc.c | 2 +-
+ src/network/networkd-setlink.c | 2 +-
+ src/network/networkd-sysctl.c | 2 +-
+ src/shared/edit-util.c | 8 ++++----
+ src/shared/edit-util.h | 2 +-
+ src/shared/linux/ethtool.h | 2 +-
+ src/shared/netif-util.c | 2 +-
+ src/systemctl/systemctl-edit.c | 2 +-
+ src/test/test-arphrd-util.c | 1 -
+ src/test/test-glob-util.c | 9 ++-------
+ src/test/test-parse-argument.c | 1 +
+ src/test/test-recurse-dir.c | 1 +
+ src/tmpfiles/tmpfiles.c | 8 ++------
+ src/udev/udev-builtin-net_id.c | 2 +-
+ 59 files changed, 81 insertions(+), 73 deletions(-)
+
+diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
+index 3ea2c9d09a9..421c368d45c 100644
+--- a/src/basic/arphrd-util.c
++++ b/src/basic/arphrd-util.c
+@@ -2,7 +2,8 @@
+
+ #include <errno.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
++#include <linux/if_ether.h>
+ #include <linux/if_infiniband.h>
+ #include <string.h>
+
+diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h
+index 33f5694abd0..f4091276b15 100644
+--- a/src/basic/arphrd-util.h
++++ b/src/basic/arphrd-util.h
+@@ -3,6 +3,7 @@
+
+ #include <inttypes.h>
+ #include <stddef.h>
++#include <net/if_arp.h>
+
+ const char *arphrd_to_name(int id);
+ int arphrd_from_name(const char *name);
+diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
+index af17481dd86..fa20bfa30f9 100644
+--- a/src/basic/fd-util.h
++++ b/src/basic/fd-util.h
+@@ -6,6 +6,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <sys/socket.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "missing_fcntl.h"
+diff --git a/src/basic/fileio.h b/src/basic/fileio.h
+index 03c3f3ff283..7d2ea991552 100644
+--- a/src/basic/fileio.h
++++ b/src/basic/fileio.h
+@@ -8,6 +8,7 @@
+ #include <stdio.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/file.h>
+
+ #include "macro.h"
+ #include "time-util.h"
+diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
+index ca1ba7cad4d..2e8fb64ba30 100755
+--- a/src/basic/generate-arphrd-list.sh
++++ b/src/basic/generate-arphrd-list.sh
+@@ -3,6 +3,6 @@
+ set -eu
+ set -o pipefail
+
+-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
++${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
+ awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+ sed -e 's/ARPHRD_//'
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index 802ca8c655f..878683b5edc 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -19,20 +19,6 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
+- /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+- assert(!(flags & GLOB_ALTDIRFUNC));
+-
+- if (!pglob->gl_closedir)
+- pglob->gl_closedir = closedir_wrapper;
+- if (!pglob->gl_readdir)
+- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
+- if (!pglob->gl_opendir)
+- pglob->gl_opendir = (void *(*)(const char *)) opendir;
+- if (!pglob->gl_lstat)
+- pglob->gl_lstat = lstat;
+- if (!pglob->gl_stat)
+- pglob->gl_stat = stat;
+-
+ errno = 0;
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
+ if (k == GLOB_NOMATCH)
+diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
+index 7ca26cc27f7..c1d476ff2be 100644
+--- a/src/basic/glob-util.h
++++ b/src/basic/glob-util.h
+@@ -6,6 +6,7 @@
+
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ /* Note: this function modifies pglob to set various functions. */
+ int safe_glob(const char *path, int flags, glob_t *pglob);
+diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h
+index e79f5c8cebd..567c747ec3e 100644
+--- a/src/basic/linux/if.h
++++ b/src/basic/linux/if.h
+@@ -132,8 +132,14 @@ enum net_device_flags {
+ #define IFF_ECHO IFF_ECHO
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
+
++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE))
++#ifdef IFF_VOLATILE
++#undef IFF_VOLATILE
++#endif
++
+ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
++#endif
+
+ #define IF_GET_IFACE 0x0001 /* for querying only */
+ #define IF_GET_PROTO 0x0002
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index ff8d21f9e95..91afa8918c5 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -22,6 +22,7 @@
+ #ifndef _UAPI_LINUX_IN6_H
+ #define _UAPI_LINUX_IN6_H
+
++#include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 1d17705c356..2463fd3bcbb 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,19 @@
+ #if !HAVE_CHAR16_T
+ # define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
++#ifndef GLOB_ALTDIRFUNC
++#define GLOB_ALTDIRFUNC 0
++#endif
+diff --git a/src/basic/pidref.h b/src/basic/pidref.h
+index 9920ebb9b3b..e0df1ffb270 100644
+--- a/src/basic/pidref.h
++++ b/src/basic/pidref.h
+@@ -2,6 +2,7 @@
+ #pragma once
+
+ #include "macro.h"
++#include "signal.h"
+
+ /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
+ typedef struct PidRef {
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 9c818bd7470..ef10c8be2cf 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+diff --git a/src/basic/string-util.h b/src/basic/string-util.h
+index ff5efbcf557..b329da8d177 100644
+--- a/src/basic/string-util.h
++++ b/src/basic/string-util.h
+@@ -4,6 +4,7 @@
+ #include <stdbool.h>
+ #include <stddef.h>
+ #include <string.h>
++#include <libgen.h>
+
+ #include "alloc-util.h"
+ #include "macro.h"
+diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c
+index ad61614f12f..4a53f944ac9 100644
+--- a/src/libsystemd-network/arp-util.c
++++ b/src/libsystemd-network/arp-util.c
+@@ -5,7 +5,7 @@
+
+ #include <arpa/inet.h>
+ #include <linux/filter.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+
+ #include "arp-util.h"
+ #include "ether-addr-util.h"
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index 3e992d7cadc..afc88936cd5 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,7 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index a0b673f65fc..29dd2fee164 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -29,6 +29,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
+diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
+index 1df886573ba..80763cd009c 100644
+--- a/src/network/netdev/bareudp.c
++++ b/src/network/netdev/bareudp.c
+@@ -2,7 +2,7 @@
+ * Copyright © 2020 VMware, Inc. */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "bareudp.h"
+ #include "netlink-util.h"
+diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
+index 26da0231d45..52cc6943993 100644
+--- a/src/network/netdev/batadv.c
++++ b/src/network/netdev/batadv.c
+@@ -3,7 +3,7 @@
+ #include <inttypes.h>
+ #include <netinet/in.h>
+ #include <linux/genetlink.h>
+-#include <linux/if_arp.h>
++
+
+ #include "batadv.h"
+ #include "fileio.h"
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index 52a7f126b6d..f7ffc7910e0 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "bond.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index d426c0c5019..36c504b1b11 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
+index 00df1d27873..136a097eed8 100644
+--- a/src/network/netdev/dummy.c
++++ b/src/network/netdev/dummy.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "dummy.h"
+
+diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
+index 22c2b00e1b7..e6a24c0fa09 100644
+--- a/src/network/netdev/geneve.c
++++ b/src/network/netdev/geneve.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
+index d7ff44cb9ea..cf1f689e709 100644
+--- a/src/network/netdev/ifb.c
++++ b/src/network/netdev/ifb.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later
+ * Copyright © 2019 VMware, Inc. */
+
+-#include <linux/if_arp.h>
++
+
+ #include "ifb.h"
+
+diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
+index d5fe299b7b4..877bc011105 100644
+--- a/src/network/netdev/ipoib.c
++++ b/src/network/netdev/ipoib.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+
+ #include "ipoib.h"
+diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
+index 51ae64341db..d95fce77705 100644
+--- a/src/network/netdev/ipvlan.c
++++ b/src/network/netdev/ipvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "ipvlan.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 4b9f19cc95c..dbce56221fd 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+ #include <linux/genetlink.h>
+diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
+index 21933d3970a..ed690ccb395 100644
+--- a/src/network/netdev/macvlan.c
++++ b/src/network/netdev/macvlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "macvlan.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 2b411425ba1..11826705fc0 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <unistd.h>
+
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
+index 15d5c132f96..92600c9a75d 100644
+--- a/src/network/netdev/netdevsim.c
++++ b/src/network/netdev/netdevsim.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "netdevsim.h"
+
+diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
+index ff372092e61..3726180eac1 100644
+--- a/src/network/netdev/nlmon.c
++++ b/src/network/netdev/nlmon.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "nlmon.h"
+
+diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
+index db84e7cf6ee..f518e7cec85 100644
+--- a/src/network/netdev/tunnel.c
++++ b/src/network/netdev/tunnel.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/fou.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_tunnel.h>
+ #include <linux/ip.h>
+ #include <linux/ip6_tunnel.h>
+diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
+index f5be31ed943..c2e6a47f446 100644
+--- a/src/network/netdev/tuntap.c
++++ b/src/network/netdev/tuntap.c
+@@ -5,7 +5,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/if_tun.h>
+-#include <netinet/if_ether.h>
++#include <linux/if_ether.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
+index 380547ee1e8..7124f9f2c0c 100644
+--- a/src/network/netdev/vcan.c
++++ b/src/network/netdev/vcan.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "vcan.h"
+
+diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
+index 78555286d1a..3379309d4a7 100644
+--- a/src/network/netdev/veth.c
++++ b/src/network/netdev/veth.c
+@@ -3,7 +3,8 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/veth.h>
+ #include <netinet/in.h>
+
+diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
+index 60e49a5b8a9..8c0189e8036 100644
+--- a/src/network/netdev/vlan.c
++++ b/src/network/netdev/vlan.c
+@@ -3,7 +3,6 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <errno.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
+
+ #include "parse-util.h"
+diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
+index 24079a7203c..88d649fbc39 100644
+--- a/src/network/netdev/vrf.c
++++ b/src/network/netdev/vrf.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+ #include <netinet/in.h>
+
+ #include "vrf.h"
+diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
+index c0343f45b62..f1a96bef296 100644
+--- a/src/network/netdev/vxcan.c
++++ b/src/network/netdev/vxcan.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/can/vxcan.h>
+-#include <linux/if_arp.h>
++
+
+ #include "vxcan.h"
+
+diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
+index 37f65967a6b..ee1d9e15ac0 100644
+--- a/src/network/netdev/vxlan.c
++++ b/src/network/netdev/vxlan.c
+@@ -3,7 +3,7 @@
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+
+ #include "conf-parser.h"
+ #include "alloc-util.h"
+diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
+index fed1be8d110..c12c6e34903 100644
+--- a/src/network/netdev/wireguard.c
++++ b/src/network/netdev/wireguard.c
+@@ -5,7 +5,8 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <netinet/in.h>
++
+ #include <linux/ipv6_route.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
+diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
+index 905bfc0bdf0..05743977f9a 100644
+--- a/src/network/netdev/xfrm.c
++++ b/src/network/netdev/xfrm.c
+@@ -1,6 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++
+
+ #include "missing_network.h"
+ #include "xfrm.h"
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 9f0268d934e..4d871c4ea16 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "bus-locator.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index c35102af74a..b60cc53b5b9 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if.h>
+
+ #include "sd-dhcp-server.h"
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index 4dd6044b189..5c1d5887521 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -3,7 +3,7 @@
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "alloc-util.h"
+ #include "dhcp-client-internal.h"
+diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
+index 32229a3fc70..5e080fe8ce3 100644
+--- a/src/network/networkd-ipv6ll.c
++++ b/src/network/networkd-ipv6ll.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "in-addr-util.h"
+ #include "networkd-address.h"
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 6b0f09926a0..844f83850fc 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -4,7 +4,7 @@
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 7cafe1f6a3e..e38e176dd60 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -6,7 +6,7 @@
+ #include <arpa/inet.h>
+ #include <netinet/icmp6.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "sd-ndisc.h"
+
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 058bc00ba10..7f82ca6781a 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/if_bridge.h>
+
+ #include "missing_network.h"
+diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
+index 68c23e0eb79..56f71d71881 100644
+--- a/src/network/networkd-sysctl.c
++++ b/src/network/networkd-sysctl.c
+@@ -2,7 +2,7 @@
+
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "af-list.h"
+ #include "missing_network.h"
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index cfb2828f4e3..3015139016e 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
+ if (fchmod(fileno(f), 0644) < 0)
+ return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
+
+- if (e->context->stdin) {
++ if (e->context->_stdin) {
+ if (fwrite(contents, 1, contents_size, f) != contents_size)
+ return log_error_errno(SYNTHETIC_ERRNO(EIO),
+ "Failed to copy input to temporary file '%s'.", temp);
+@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
+ if (!tmp)
+ return log_oom();
+
+- if (e->context->marker_start && !e->context->stdin) {
++ if (e->context->marker_start && !e->context->_stdin) {
+ /* Trim out the lines between the two markers */
+ char *contents_start, *contents_end;
+
+@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ if (context->n_files == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
+
+- if (context->stdin) {
++ if (context->_stdin) {
+ r = read_full_stream(stdin, &data, &data_size);
+ if (r < 0)
+ return log_error_errno(r, "Failed to read stdin: %m");
+@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
+ return r;
+ }
+
+- if (!context->stdin) {
++ if (!context->_stdin) {
+ r = run_editor(context);
+ if (r < 0)
+ return r;
+diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
+index 9d9c890f2a9..5289782d719 100644
+--- a/src/shared/edit-util.h
++++ b/src/shared/edit-util.h
+@@ -15,7 +15,7 @@ typedef struct EditFileContext {
+ const char *marker_end;
+ bool remove_parent;
+ bool overwrite_with_origin; /* Always overwrite target with original file. */
+- bool stdin; /* Read contents from stdin instead of launching an editor. */
++ bool _stdin; /* Read contents from stdin instead of launching an editor. */
+ } EditFileContext;
+
+ void edit_file_context_done(EditFileContext *context);
+diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
+index 3d1da515c08..633494efbd6 100644
+--- a/src/shared/linux/ethtool.h
++++ b/src/shared/linux/ethtool.h
+@@ -16,7 +16,7 @@
+
+ #include <linux/const.h>
+ #include <linux/types.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+
+ #include <limits.h> /* for INT_MAX */
+
+diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
+index 8adc2c89c81..919491cea46 100644
+--- a/src/shared/netif-util.c
++++ b/src/shared/netif-util.c
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+
+ #include "arphrd-util.h"
+ #include "device-util.h"
+diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
+index 15398f83646..ae08d65b0f1 100644
+--- a/src/systemctl/systemctl-edit.c
++++ b/src/systemctl/systemctl-edit.c
+@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
+ .marker_end = DROPIN_MARKER_END,
+ .remove_parent = !arg_full,
+ .overwrite_with_origin = true,
+- .stdin = arg_stdin,
++ ._stdin = arg_stdin,
+ };
+ _cleanup_strv_free_ char **names = NULL;
+ sd_bus *bus;
+diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
+index 15b79977504..afa876506a6 100644
+--- a/src/test/test-arphrd-util.c
++++ b/src/test/test-arphrd-util.c
+@@ -2,7 +2,6 @@
+
+ /* Make sure the net/if.h header is included before any linux/ one */
+ #include <net/if.h>
+-#include <linux/if_arp.h>
+
+ #include "arphrd-util.h"
+ #include "string-util.h"
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 49d71f15c71..44becc6ead3 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,7 @@
+ #include "rm-rf.h"
+ #include "tests.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ TEST(glob_first) {
+ char *first, name[] = "/tmp/test-glob_first.XXXXXX";
+@@ -60,13 +61,7 @@ TEST(glob_no_dot) {
+ char template[] = "/tmp/test-glob-util.XXXXXXX";
+ const char *fn;
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_closedir = closedir_wrapper,
+- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+- .gl_opendir = (void *(*)(const char *)) opendir,
+- .gl_lstat = lstat,
+- .gl_stat = stat,
+- };
++ _cleanup_globfree_ glob_t g = {};
+
+ int r;
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index c07b2d9afe7..5b4562740e8 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <signal.h>
++#include <libgen.h>
+
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
+index 8684d064ec3..70fc2b53763 100644
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -8,6 +8,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 807925f199d..a932873f236 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -2569,9 +2569,7 @@ finish:
+ }
+
+ static int glob_item(Context *c, Item *i, action_t action) {
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+@@ -2597,9 +2595,7 @@ static int glob_item_recursively(
+ Item *i,
+ fdaction_t action) {
+
+- _cleanup_globfree_ glob_t g = {
+- .gl_opendir = (void *(*)(const char *)) opendir_nomod,
+- };
++ _cleanup_globfree_ glob_t g = {};
+ int r;
+
+ assert(c);
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
+index 384a1f31cbc..d8b3db40b7d 100644
+--- a/src/udev/udev-builtin-net_id.c
++++ b/src/udev/udev-builtin-net_id.c
+@@ -19,7 +19,7 @@
+ #include <stdarg.h>
+ #include <unistd.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
++
+ #include <linux/netdevice.h>
+ #include <linux/pci_regs.h>
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
new file mode 100644
index 00000000000000..a03510938284a7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch
@@ -0,0 +1,158 @@
+From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001
+From: jane400 <pmos@j4ne.de>
+Date: Sun, 2 Jun 2024 10:07:09 +0200
+Subject: [PATCH] musl: missing gshadow
+
+---
+ src/basic/gshadow.h | 5 +++++
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 31 insertions(+), 1 deletion(-)
+ create mode 100644 src/basic/gshadow.h
+
+diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h
+new file mode 100644
+index 00000000000..a6a56f38ce7
+--- /dev/null
++++ b/src/basic/gshadow.h
+@@ -0,0 +1,5 @@
++#pragma once
++
++#define ENABLE_GSHADOW 0
++
++struct sgrp {};
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index ffb57214662..2596c658b39 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -286,8 +286,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -303,6 +305,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -318,6 +321,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ int r;
+
+ assert(grp);
++#if ENABLE_GSHADOW
+ assert(ret_sgrp);
++#endif
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -391,6 +401,7 @@ int nss_group_record_by_name(
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -402,6 +413,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
+ _cleanup_free_ char *sbuf = NULL;
+ _cleanup_free_ struct group *result = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ r = getgrgid_malloc(gid, &result);
+ if (r < 0)
+ return r;
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 75dece34429..4f4e21a6c4b 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
++#endif
+
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ r = -EUCLEAN;
+ incomplete = true;
+ }
++#endif
++
++ r = nss_group_to_group_record(gr, NULL, ret);
+
+- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
+ if (r < 0)
+ return r;
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
new file mode 100644
index 00000000000000..516fcd60baf2f7
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch
@@ -0,0 +1,57 @@
+From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:20:40 -0700
+Subject: [PATCH] shared: Do not use malloc_info on musl
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/bus-util.c | 5 +++--
+ src/shared/common-signal.c | 4 ++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 30f9602b1ed..5308f168db2 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
+ _cleanup_close_ int fd = -EBADF;
+ size_t dump_size;
+ FILE *f;
+- int r;
++ int r = 0;
+
+ assert(message);
+
+ f = memstream_init(&m);
+ if (!f)
+ return -ENOMEM;
+-
++#ifdef __GLIBC__
+ r = RET_NERRNO(malloc_info(/* options= */ 0, f));
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
+index 8e70e365dd6..9e782caec9b 100644
+--- a/src/shared/common-signal.c
++++ b/src/shared/common-signal.c
+@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
+ log_oom();
+ break;
+ }
+-
++#ifdef __GLIBC__
+ if (malloc_info(0, f) < 0) {
+ log_error_errno(errno, "Failed to invoke malloc_info(): %m");
+ break;
+ }
+-
++#endif
+ (void) memstream_dump(LOG_INFO, &m);
+ break;
+ }
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
new file mode 100644
index 00000000000000..52de4fd3f63340
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch
@@ -0,0 +1,39 @@
+From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 2 Aug 2023 12:06:27 -0700
+Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc
+
+musl does not have this API
+
+Upstream-Status: Inappropriate [musl-specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libsystemd/sd-event/sd-event.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
+index a1305ef0149..b8a73da2a3b 100644
+--- a/src/libsystemd/sd-event/sd-event.c
++++ b/src/libsystemd/sd-event/sd-event.c
+@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
+ }
+
+ _public_ int sd_event_trim_memory(void) {
+- int r;
++ int r = 0;
+
+ /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
+ * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
+@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
+
+ usec_t before_timestamp = now(CLOCK_MONOTONIC);
+ hashmap_trim_pools();
++#ifdef __GLIBC__
+ r = malloc_trim(0);
++#endif
+ usec_t after_timestamp = now(CLOCK_MONOTONIC);
+
+ if (r > 0)
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch
new file mode 100644
index 00000000000000..7da334d0273915
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch
@@ -0,0 +1,32 @@
+From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index 2c9f9f6c50f..65a984b564e 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ #include "macro.h"
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch
new file mode 100644
index 00000000000000..6b37a4743dbba5
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-printf.patch
@@ -0,0 +1,434 @@
+From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index ea4e12aa1c6..c384e236698 100644
+--- a/meson.build
++++ b/meson.build
+@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/time_types.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'sys/sdt.h',
+ 'threads.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 9a214575a56..b49b6ade568 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -189,6 +189,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 00000000000..49437e54454
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 00000000000..47be7522d7f
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 0a2239d0225..43a765dacd5 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,12 +1,12 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
++#include "parse-printf-format.h"
+
+ _printf_(3, 4)
+ static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 7d02b57d7b4..75e8e08add5 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -28,6 +27,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch
new file mode 100644
index 00000000000000..ca3da713e7dd21
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch
@@ -0,0 +1,106 @@
+From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index ba7cff6a8b5..2736abb07b6 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index a9f7b87f289..059c67731d3 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
+ rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
+ rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 513e95e09d7..0e269617f82 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
new file mode 100644
index 00000000000000..9070170ccd57f0
--- /dev/null
+++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch
@@ -0,0 +1,76 @@
+From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index f415797700e..a5c6e9a3bdd 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index 75e8e08add5..41e5c7c2b89 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
+--
+GitLab
+
diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch
similarity index 100%
rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch
rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch
diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template
similarity index 60%
rename from srcpkgs/systemd-boot-efistub/template
rename to srcpkgs/systemd-boot/template
index 824ca02fd15195..402ae2a7026407 100644
--- a/srcpkgs/systemd-boot-efistub/template
+++ b/srcpkgs/systemd-boot/template
@@ -1,8 +1,9 @@
-# Template file for 'systemd-boot-efistub'
-pkgname=systemd-boot-efistub
-version=256
+# Template file for 'systemd-boot'
+pkgname=systemd-boot
+version=256.6
revision=1
build_style=meson
+conf_files="/etc/default/systemd-boot"
configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
-Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname}
-Dsbat-distro-version="${version}_${revision}"
@@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled
# most of these aren't needed for what we're building but it's easier than patching
hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl"
makedepends="libcap-devel libmount-devel"
-short_desc="UEFI stub loader from systemd-boot"
-maintainer="classabbyamp <void@placeviolette.net>"
+depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}"
+short_desc="Simple UEFI boot manager from systemd"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="LGPL-2.1-or-later"
homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/"
-distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz"
-checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17
-make_check=no # missing printf.h
+distfiles="https://github.com/systemd/systemd/archive/refs/tags/v${version}.tar.gz"
+checksum=c085f162dec001407dd32f00abbf20b7e6ed7043dcfaf8ed954787d86707f409
+make_check=no # tests a bunch of stuff we aren't using
if [ "${XBPS_TARGET_LIBC}" = glibc ]; then
makedepends+=" libxcrypt-devel"
+else
+ # see src/basic/linux/if_ether.h
+ export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types"
fi
case "${XBPS_TARGET_MACHINE}" in
@@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in
*) broken="unknown efi architecture" ;;
esac
-_bins=(ukify)
-_mans=(man/ukify.1 man/systemd-stub.7)
-_efis=("src/boot/efi/linux${_efi_arch}.efi.stub")
-make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}"
+_bins=(ukify bootctl)
+_mans=(man/ukify.1 man/systemd-stub.7
+ man/sd-boot.7 man/systemd-boot.7 man/bootctl.1)
+_efis=("src/boot/efi/linux${_efi_arch}.efi.stub"
+ "src/boot/efi/systemd-boot${_efi_arch}.efi")
+_libexecs=(systemd-bless-boot)
+make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}"
+
+post_patch() {
+ if [ "${XBPS_TARGET_LIBC}" = musl ]; then
+ for x in ${FILESDIR}/patches/musl/*.patch; do
+ msg_normal "Applying patch $x\n"
+ patch -sNp1 -i ${x}
+ done
+ fi
+}
do_install() {
for b in "${_bins[@]}"; do
@@ -66,6 +83,17 @@ do_install() {
for e in "${_efis[@]}"; do
vinstall "build/$e" 644 usr/lib/systemd/boot/efi
done
+
+ for l in "${_libexecs[@]}"; do
+ vinstall "build/$l" 644 usr/lib/systemd
+ done
+
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \
+ etc/kernel.d/post-install 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \
+ etc/kernel.d/post-remove 50-systemd-boot
+ vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \
+ etc/default systemd-boot
}
ukify_package() {
@@ -76,3 +104,13 @@ ukify_package() {
vmove usr/share/man/man1/ukify.1
}
}
+
+systemd-boot-efistub_package() {
+ short_desc="UEFI stub loader from systemd-boot"
+ pkg_install() {
+ vmove "usr/lib/systemd/boot/efi/linux*.efi.stub"
+ vmove "usr/share/man/man7/linux*.efi.*"
+ vmove usr/share/man/man7/sd-stub.7
+ vmove usr/share/man/man7/systemd-stub.7
+ }
+}
diff --git a/srcpkgs/ukify b/srcpkgs/ukify
index 9258199038ee7e..171756f5fb6754 120000
--- a/srcpkgs/ukify
+++ b/srcpkgs/ukify
@@ -1 +1 @@
-systemd-boot-efistub
\ No newline at end of file
+systemd-boot
\ No newline at end of file
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: [PR PATCH] [Merged]: New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (57 preceding siblings ...)
2024-10-06 1:29 ` Calandracas606
@ 2024-10-06 18:51 ` classabbyamp
2024-10-06 23:32 ` Makrennel
` (3 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: classabbyamp @ 2024-10-06 18:51 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1346 bytes --]
There's a merged pull request on the void-packages repository
New package: systemd-boot-256
https://github.com/void-linux/void-packages/pull/51811
Description:
closes #51578
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
Tested booting, post-install, and post-remove kernel hooks in qemu
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- x86_64-musl
- i686
- aarch64 (cross)
- aarch64-musl (cross)
- armv7l (cross)
- armv7l-musl (cross)
- armv6l (cross)
- armv6l-musl (cross)
musl patches are mostly taken from: https://gitlab.com/postmarketOS/systemd
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (58 preceding siblings ...)
2024-10-06 18:51 ` [PR PATCH] [Merged]: " classabbyamp
@ 2024-10-06 23:32 ` Makrennel
2024-10-07 1:16 ` Calandracas606
` (2 subsequent siblings)
62 siblings, 0 replies; 64+ messages in thread
From: Makrennel @ 2024-10-06 23:32 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 203 bytes --]
New comment by Makrennel on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#issuecomment-2395644663
Comment:
Is this intended to replace gummiboot? Does void need both?
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (59 preceding siblings ...)
2024-10-06 23:32 ` Makrennel
@ 2024-10-07 1:16 ` Calandracas606
2024-10-07 14:07 ` Makrennel
2024-10-07 16:43 ` ahesford
62 siblings, 0 replies; 64+ messages in thread
From: Calandracas606 @ 2024-10-07 1:16 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 629 bytes --]
New comment by Calandracas606 on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#issuecomment-2395711681
Comment:
> Is this intended to replace gummiboot? Does void need both?
the gummiboot project was integrated into systemd almost a decade ago.
I would argue that gummiboot is completely obsolete at this point, although it is still packaged.
Full disclaimer that I am not a void maintainer, and while it is my personal opinion that void does not need both, and gummiboot users should migrate to systemd-boot, removing the gummiboot package would likely cause breakage for some users
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (60 preceding siblings ...)
2024-10-07 1:16 ` Calandracas606
@ 2024-10-07 14:07 ` Makrennel
2024-10-07 16:43 ` ahesford
62 siblings, 0 replies; 64+ messages in thread
From: Makrennel @ 2024-10-07 14:07 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 844 bytes --]
New comment by Makrennel on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#issuecomment-2397037040
Comment:
> the gummiboot project was integrated into systemd almost a decade ago.
>
> I would argue that gummiboot is completely obsolete at this point, although it is still packaged.
>
> Full disclaimer that I am not a void maintainer, and while it is my personal opinion that void does not need both, and gummiboot users should migrate to systemd-boot, removing the gummiboot package would likely cause breakage for some users
I completely agree that it's obsolete. Perhaps gummiboot needs a deprecation message of some sorts before it eventually gets removed however far off in the future? I'm not sure if XBPS has such a thing built in, but perhaps `INSTALL.msg` could be used to warn users about this?
^ permalink raw reply [flat|nested] 64+ messages in thread
* Re: New package: systemd-boot-256
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
` (61 preceding siblings ...)
2024-10-07 14:07 ` Makrennel
@ 2024-10-07 16:43 ` ahesford
62 siblings, 0 replies; 64+ messages in thread
From: ahesford @ 2024-10-07 16:43 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 211 bytes --]
New comment by ahesford on void-packages repository
https://github.com/void-linux/void-packages/pull/51811#issuecomment-2397415162
Comment:
This is not the place for discussion about the removal of gummiboot.
^ permalink raw reply [flat|nested] 64+ messages in thread
end of thread, other threads:[~2024-10-07 16:43 UTC | newest]
Thread overview: 64+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-12 21:38 [PR PATCH] New package: systemd-boot-256 Calandracas606
2024-08-12 21:44 ` Calandracas606
2024-08-12 22:46 ` [PR REVIEW] " Haagen-Dazs
2024-08-12 23:44 ` [PR PATCH] [Updated] " Calandracas606
2024-08-13 2:00 ` [PR REVIEW] " classabbyamp
2024-08-13 2:00 ` classabbyamp
2024-08-13 2:00 ` classabbyamp
2024-08-13 2:00 ` classabbyamp
2024-08-13 2:00 ` classabbyamp
2024-08-13 2:09 ` Calandracas606
2024-08-13 2:13 ` Calandracas606
2024-08-13 12:34 ` [PR PATCH] [Updated] " Calandracas606
2024-08-13 12:44 ` Calandracas606
2024-08-13 13:22 ` Calandracas606
2024-08-13 13:35 ` [PR REVIEW] " classabbyamp
2024-08-13 13:45 ` [PR PATCH] [Updated] " Calandracas606
2024-08-13 13:45 ` [PR REVIEW] " Calandracas606
2024-08-13 13:46 ` Calandracas606
2024-08-13 13:57 ` [PR PATCH] [Updated] " Calandracas606
2024-08-13 14:02 ` [PR REVIEW] " classabbyamp
2024-08-13 14:02 ` classabbyamp
2024-08-13 14:52 ` [PR PATCH] [Updated] " Calandracas606
2024-08-13 14:56 ` Calandracas606
2024-08-13 15:18 ` [PR REVIEW] " classabbyamp
2024-08-13 15:18 ` classabbyamp
2024-08-13 15:18 ` classabbyamp
2024-08-13 15:21 ` Calandracas606
2024-08-13 15:24 ` Calandracas606
2024-08-13 15:36 ` [PR PATCH] [Updated] " Calandracas606
2024-08-13 15:41 ` [PR REVIEW] " Calandracas606
2024-08-13 15:48 ` classabbyamp
2024-08-13 16:14 ` [PR PATCH] [Updated] " Calandracas606
2024-08-13 16:15 ` Calandracas606
2024-08-13 16:49 ` Calandracas606
2024-08-13 17:08 ` Calandracas606
2024-08-14 18:26 ` [PR REVIEW] " ahesford
2024-08-14 18:26 ` ahesford
2024-08-14 18:26 ` ahesford
2024-08-25 22:31 ` [PR PATCH] [Updated] " Calandracas606
2024-08-25 22:35 ` [PR REVIEW] " Calandracas606
2024-08-25 22:42 ` [PR PATCH] [Updated] " Calandracas606
2024-08-25 22:43 ` Calandracas606
2024-08-25 22:55 ` [PR REVIEW] " classabbyamp
2024-08-25 23:01 ` [PR PATCH] [Updated] " Calandracas606
2024-08-25 23:03 ` [PR REVIEW] " Calandracas606
2024-08-25 23:03 ` Calandracas606
2024-08-25 23:09 ` [PR PATCH] [Updated] " Calandracas606
2024-08-26 0:08 ` [PR REVIEW] " Calandracas606
2024-08-26 1:10 ` classabbyamp
2024-08-26 1:11 ` classabbyamp
2024-08-26 1:45 ` [PR PATCH] [Updated] " Calandracas606
2024-08-26 1:45 ` [PR REVIEW] " Calandracas606
2024-08-26 13:23 ` ahesford
2024-08-26 19:52 ` [PR PATCH] [Updated] " Calandracas606
2024-10-06 0:08 ` Calandracas606
2024-10-06 0:29 ` Calandracas606
2024-10-06 0:31 ` [PR REVIEW] " Calandracas606
2024-10-06 0:53 ` [PR PATCH] [Updated] " Calandracas606
2024-10-06 1:29 ` Calandracas606
2024-10-06 18:51 ` [PR PATCH] [Merged]: " classabbyamp
2024-10-06 23:32 ` Makrennel
2024-10-07 1:16 ` Calandracas606
2024-10-07 14:07 ` Makrennel
2024-10-07 16:43 ` ahesford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).