Compare commits

...
Author SHA1 Message Date
Clayton Craft 10efcc8f3e main/systemd-boot: remove 2025-05-13 18:00:36 -07:00
Clayton Craft f7449c5d66 main/systemd-boot-x86: new aport 2025-05-13 18:00:18 -07:00
Pablo Correa Gómez 49d0696f68 systemd-boot: upgrade to 257.5 2025-05-13 19:15:23 +02:00
5 changed files with 163 additions and 203 deletions

No files matched your search

@@ -1,15 +1,17 @@
From 32f9f6919206f7385a66d711f9644aaacf533181 Mon Sep 17 00:00:00 2001
From: Clayton Craft <clayton@craftyguy.net>
Date: Tue, 7 Jan 2025 20:21:29 -0800
Subject: [PATCH 2/2] fix wchar for compiling on musl
From 87e8a19b2a9a15352d849918d995cea92ba287bb Mon Sep 17 00:00:00 2001
From: Struan Robertson <contact@struanrobertson.co.uk>
Date: Mon, 16 Dec 2024 13:48:25 +0000
Subject: [PATCH] patch wchar_t for musl
---
src/boot/efi-string.c | 10 +++++-----
src/boot/efi.h | 5 +----
2 files changed, 6 insertions(+), 9 deletions(-)
src/boot/efi-string.c | 10 +++++-----
src/boot/efi.h | 6 +++---
src/boot/fuzz-efi-printf.c | 2 +-
src/boot/test-efi-string.c | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/boot/efi-string.c b/src/boot/efi-string.c
index aee98a81e1..314d14d3e5 100644
index aee98a8..314d14d 100644
--- a/src/boot/efi-string.c
+++ b/src/boot/efi-string.c
@@ -570,7 +570,7 @@ typedef struct {
@@ -56,7 +58,7 @@ index aee98a81e1..314d14d3e5 100644
} else {
sp->str = va_arg(ctx->ap, const char *) ?: "(null)";
diff --git a/src/boot/efi.h b/src/boot/efi.h
index e1042635b9..1c191d49e7 100644
index e104263..d6c1aa4 100644
--- a/src/boot/efi.h
+++ b/src/boot/efi.h
@@ -10,7 +10,7 @@
@@ -68,30 +70,50 @@ index e1042635b9..1c191d49e7 100644
typedef __CHAR16_TYPE__ char16_t;
typedef __CHAR32_TYPE__ char32_t;
@@ -22,7 +22,6 @@ assert_cc(sizeof(uint8_t) == 1);
@@ -22,7 +22,7 @@ assert_cc(sizeof(uint8_t) == 1);
assert_cc(sizeof(uint16_t) == 2);
assert_cc(sizeof(uint32_t) == 4);
assert_cc(sizeof(uint64_t) == 8);
-assert_cc(sizeof(wchar_t) == 2);
+assert_cc(sizeof(uint16_t) == 2);
assert_cc(sizeof(char16_t) == 2);
assert_cc(sizeof(char32_t) == 4);
assert_cc(sizeof(size_t) == sizeof(void *));
@@ -32,7 +31,6 @@ assert_cc(alignof(uint8_t) == 1);
@@ -32,7 +32,7 @@ assert_cc(alignof(uint8_t) == 1);
assert_cc(alignof(uint16_t) == 2);
assert_cc(alignof(uint32_t) == 4);
assert_cc(alignof(uint64_t) == 8);
-assert_cc(alignof(wchar_t) == 2);
+assert_cc(alignof(uint16_t) == 2);
assert_cc(alignof(char16_t) == 2);
assert_cc(alignof(char32_t) == 4);
@@ -41,7 +39,6 @@ assert_cc(alignof(char32_t) == 4);
# endif
#else
# include <uchar.h>
-# include <wchar.h>
#endif
diff --git a/src/boot/fuzz-efi-printf.c b/src/boot/fuzz-efi-printf.c
index 6dee830..75017cc 100644
--- a/src/boot/fuzz-efi-printf.c
+++ b/src/boot/fuzz-efi-printf.c
@@ -45,7 +45,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
fuzz_setup_logging();
/* We use size_t/ssize_t to represent UEFI UINTN/INTN. */
PRINTF_ONE(i->status, "%*.*s", i->field_width, (int) len, i->str);
- PRINTF_ONE(i->status, "%*.*ls", i->field_width, (int) (len / sizeof(wchar_t)), (const wchar_t *) i->str);
+ PRINTF_ONE(i->status, "%*.*ls", i->field_width, (int) (len / sizeof(uint16_t)), (const uint16_t *) i->str);
PRINTF_ONE(i->status, "%% %*.*m", i->field_width, i->precision);
PRINTF_ONE(i->status, "%*p", i->field_width, i->ptr);
diff --git a/src/boot/test-efi-string.c b/src/boot/test-efi-string.c
index b71a0c3..d2d1020 100644
--- a/src/boot/test-efi-string.c
+++ b/src/boot/test-efi-string.c
@@ -649,7 +649,7 @@ TEST(xvasprintf_status) {
test_printf_one("%-14ls %-10.0ls %-10.3ls", L"left", L"", L"chopped");
test_printf_one("%.6s", (char[]){ 'n', 'o', ' ', 'n', 'u', 'l' });
- test_printf_one("%.6ls", (wchar_t[]){ 'n', 'o', ' ', 'n', 'u', 'l' });
+ test_printf_one("%.6ls", (uint16_t[]){ 'n', 'o', ' ', 'n', 'u', 'l' });
test_printf_one("%u %u %u", 0U, 42U, 1234567890U);
test_printf_one("%i %i %i", 0, -42, -1234567890);
--
2.47.1
+123
View File
@@ -0,0 +1,123 @@
# Forked from Alpine INSERT-REASON-HERE (CHANGEME!)
pkgname=systemd-boot-x86
pkgver=257.5
pkgrel=0
pkgdesc="systemd's EFI boot manager for x86 EFI on x86_64."
url="https://systemd.io/"
# riscv64: I have no way to test this currently
arch="x86_64"
license="LGPL-2.1-or-later"
makedepends="
bash
coreutils
gcc-x86
gperf
libcap-dev
meson
musl-dev-x86
py3-elftools
py3-jinja2
util-linux-dev
"
source="
systemd-$pkgver.tar.gz::https://github.com/systemd/systemd/archive/refs/tags/v$pkgver.tar.gz
0001-patch-wchar_t-for-musl.patch
cross-x86.meson
"
# check: no tests
# archcheck: provides platform-specific EFI binary
options="!check !archcheck"
subpackages="
systemd-x86-efistub:efistub
"
builddir="$srcdir/systemd-$pkgver"
build() {
abuild-meson \
-Dsbat-distro="alpine" \
-Dsbat-distro-summary="Alpine Linux" \
-Dsbat-distro-pkgname="$pkgname" \
-Dsbat-distro-version="$pkgver" \
-Dsbat-distro-url="https://alpinelinux.org/" \
-Dadm-group=false \
-Danalyze=false \
-Dbacklight=false \
-Dbinfmt=false \
-Dbootloader=enabled \
-Dcompat-mutable-uid-boundaries=false \
-Dcoredump=false \
-Ddns-over-tls=false \
-Defi=true \
-Denvironment-d=false \
-Dfexecve=false \
-Dfirstboot=false \
-Dfirst-boot-full-preset=false \
-Dgshadow=false \
-Dhibernate=false \
-Dhomed=disabled \
-Dhostnamed=false \
-Dhwdb=false \
-Didn=false \
-Dima=false \
-Dimportd=disabled \
-Dinitrd=false \
-Dkernel-install=false \
-Dldconfig=false \
-Dlocaled=false \
-Dlogind=false \
-Dmachined=false \
-Dnetworkd=false \
-Dnscd=false \
-Dnss-myhostname=false \
-Dnss-mymachines=disabled \
-Dnss-resolve=disabled \
-Dnss-systemd=false \
-Doomd=false \
-Dpolkit=disabled \
-Dportabled=false \
-Dpstore=false \
-Dquotacheck=false \
-Drandomseed=false \
-Dremote=disabled \
-Drepart=disabled \
-Dresolve=false \
-Drfkill=false \
-Dsmack=false \
-Dstoragetm=false \
-Dsysext=false \
-Dsysupdate=disabled \
-Dsysusers=false \
-Dtimedated=false \
-Dtimesyncd=false \
-Dtmpfiles=false \
-Dtpm=false \
-Dukify=disabled \
-Durlify=false \
-Duserdb=false \
-Dutmp=false \
-Dvconsole=false \
-Dvmspawn=disabled \
-Dwheel-group=false \
-Dxdg-autostart=false \
--cross-file "$srcdir"/cross-x86.meson \
. output
meson compile -C output systemd-boot
}
package() {
find "$builddir/output/src/boot/" -name 'systemd*.efi' -exec \
install -Dm 644 {} -t "$pkgdir/usr/lib/systemd/boot/efi" \;
}
efistub() {
pkgdesc="systemd's EFI boot stub for x86 EFI on x86_64."
find "$builddir/output/src/boot/" -name '*.stub' -exec \
install -Dm 644 {} -t "$subpkgdir/usr/lib/systemd/boot/efi" \;
}
sha512sums="
9e5352c20c9edac53f302a534532035185139998628ed0a85411f440df47f1dd7cce6651aec787484809bb1aa2825008d062714c37936cbfd08451fbe29a998f systemd-257.5.tar.gz
81e6f311d567ef8b1f8957f25f019e7fa995f640659381757d1abdd7295434810b79a09367d274c5755f1ed1f6d37d7d98e9c93645578daca34acdeca0ba3965 0001-patch-wchar_t-for-musl.patch
ad54e2c7e7a21bfa9b5f9e8db1b6af6a6d78a3e5dfe2dafcec77488f6224865ab4d4c8a8c8ee1c54c99d1741361e9fb3a51e5d36bcbc7a1c3fdcc4d0c1672132 cross-x86.meson
"
File renamed without changes.
@@ -1,67 +0,0 @@
From f214e955b853d87aa1a34dfbb44b5d8edff3962c Mon Sep 17 00:00:00 2001
From: Clayton Craft <clayton@craftyguy.net>
Date: Tue, 7 Jan 2025 20:19:51 -0800
Subject: [PATCH 1/2] meson: minimal configure for building systemd-boot
Notes:
- toggling all ENABLED_* things off saves a ton of configure
time
- Removing capability.h, so that cross compiling doesn't fail
because that header isn't installed
- Set libcap and libmount to required=false, they aren't needed for
building the bootloader, and they complicate cross compilation
---
meson.build | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/meson.build b/meson.build
index bffda86845..b5a27de305 100644
--- a/meson.build
+++ b/meson.build
@@ -766,9 +766,6 @@ conf.set('GPERF_LEN_TYPE', gperf_len_type,
#####################################################################
-if not cc.has_header('sys/capability.h')
- error('POSIX caps headers not found')
-endif
foreach header : ['crypt.h',
'linux/ioprio.h',
'linux/memfd.h',
@@ -1052,7 +1049,7 @@ if not libcrypt.found()
# fallback to use find_library() if libcrypt is provided by glibc, e.g. for LibreELEC.
libcrypt = cc.find_library('crypt')
endif
-libcap = dependency('libcap')
+libcap = dependency('libcap', required : false)
# On some architectures, libatomic is required. But on some installations,
# it is found, but actual linking fails. So let's try to use it opportunistically.
@@ -1164,7 +1161,7 @@ else
endif
libmount = dependency('mount',
- version : fuzzer_build ? '>= 0' : '>= 2.30')
+ version : fuzzer_build ? '>= 0' : '>= 2.30', required : false)
libfdisk = dependency('fdisk',
version : '>= 2.32',
@@ -1931,6 +1928,15 @@ pefile = pymod.find_installation('python3', required: false, modules : ['pefile'
want_ukify = get_option('ukify').require(python_39 and (want_tests != 'true' or pefile.found()), error_message : 'Python >= 3.9 and pefile required').allowed()
conf.set10('ENABLE_UKIFY', want_ukify)
+foreach key : conf.keys()
+ if key.startswith('ENABLE_')
+ conf.set10(key, false)
+ endif
+endforeach
+
+conf.set10('ENABLE_EFI', true)
+conf.set10('ENABLE_BOOTLOADER', true)
+
#####################################################################
check_efi_alignment_py = find_program('tools/check-efi-alignment.py')
--
2.47.1
-118
View File
@@ -1,118 +0,0 @@
# Contributor: Clayton Craft <clayton@craftyguy.net>
# Maintainer: Clayton Craft <clayton@craftyguy.net>
#
# Notes:
# - Builds / packages *only* the EFI boot manager and stub loader, and any
# useful apps for managing those things.
# - The goal with the systemd patch and this package is *NOT* to create the
# fastest build possible (e.g. by hacking up meson a bunch).
# - The goal is to create the smallest diff from upstream so that rebasing
# this is as easy as possible.
# - If you can figure out how to have both, great!!! Otherwise, installing
# some extra build-time junk and waiting for a long meson configure step
# is an acceptable price to pay for not having to rebase a bunch of stuff.
#
pkgname=systemd-boot
pkgver=257.1
pkgrel=0
pkgdesc="systemd's EFI boot manager and stub"
url="https://systemd.io/"
# TODO:
# armv7: untested
# riscv64: untested
# x86: untested (and unnecessary?)
arch="aarch64 armv7 riscv64 x86_64"
license="GPL-2.0-only"
# Some of these are just to satisfy systemd's meson config, and aren't actually
# used for building the boot manager or stub...
makedepends="
bash
coreutils
gperf
meson
py3-elftools
py3-jinja2
"
source="
systemd-$pkgver.tar.gz::https://github.com/systemd/systemd/archive/refs/tags/v$pkgver.tar.gz
0001-meson-minimal-configure-for-building-systemd-boot.patch
0002-fix-wchar-for-compiling-on-musl.patch
cross-x86.meson
"
options="!check" # no tests
subpackages="ukify"
# TODO: cross-native fails on, e.g. aarch64, elf2efi gets an "unknown section
# with name '' " ...
# Maybe because meson thinks(?) the linker doesn't support norelro? It does
# when building the default way!
# Using meson cross files is a lot faster! But the whole thing is pretty small,
# so, meh.
# options="!check pmb:cross-native" # no tests
builddir="$srcdir/systemd-$pkgver"
case "$CARCH" in
# TODO: This doesn't work locally, pmboostrap's depends parser doesn't
# evaluate/consider shell stuff...
x86_64)
makedepends="$makedepends gcc-x86 musl-dev-x86"
;;
esac
build() {
abuild-meson \
-Dsbat-distro="postmarketOS" \
-Dsbat-distro-pkgname="$pkgname" \
-Dsbat-distro-summary="postmarketOS" \
-Dsbat-distro-url="postmarketos.org" \
-Dsbat-distro-version="$pkgver" \
. output
meson compile -C output systemd-boot
# Some x86_64 systems have 32-bit EFI, so cross compile the bootloader for
# 32-bit when building for this CARCH
# TODO: this should use systemd/meson.build's ability to cross-compile
# (setting meson "efi_arch_alt"). The check for that currently fails
# because the linker can't find the i586/32-bit stuff. Setting
# LIBRARY_PATH=/usr/lib/gcc/i586-alpine-linux-musl didn't work.
if [ "$CARCH" == "x86_64" ]; then
abuild-meson \
-Dsbat-distro="postmarketOS" \
-Dsbat-distro-pkgname="$pkgname" \
-Dsbat-distro-summary="postmarketOS" \
-Dsbat-distro-url="postmarketos.org" \
-Dsbat-distro-version="$pkgver" \
--cross-file "$srcdir"/cross-x86.meson \
. output.32
meson compile -C output.32 systemd-boot
fi
}
package() {
mkdir -p "$pkgdir"/usr/lib/systemd/boot/efi
mv output/src/boot/linux*.efi.stub \
"$pkgdir"/usr/lib/systemd/boot/efi/
mv output/src/boot/systemd*.efi \
"$pkgdir"/usr/lib/systemd/boot/efi/
if [ "$CARCH" == "x86_64" ]; then
mv output.32/src/boot/linux*.efi.stub \
"$pkgdir"/usr/lib/systemd/boot/efi/
mv output.32/src/boot/systemd*.efi \
"$pkgdir"/usr/lib/systemd/boot/efi/
fi
}
ukify() {
depends="binutils py3-pefile"
install -Dm755 "$builddir"/src/ukify/ukify.py \
"$subpkgdir"/usr/bin/ukify
}
sha512sums="
dded7555077f85d0f8106b72cc46604fbe4249452be6b2d55800770b6deb2a3a122697c5a5f23b22dab416e8c050e53fc30d59dfd3bfd7c9fbbdab3162e8ebe5 systemd-257.1.tar.gz
67ec8d16d678eb1358ccaa75a173b2fc9f91254b1a0b72912bdacc11da54ea6967dfc90ac852c776ce769b9d6b3fb0dbbf1aaab410a6ffca3d07b70c29419fef 0001-meson-minimal-configure-for-building-systemd-boot.patch
b8ff5a93bb3e394605e81f40f4054e9e3be73e7b26f6aad4e2019da7254217dcf12a63082115041bb20fc528b52989db29f444d502d8f6962b2227d352641b47 0002-fix-wchar-for-compiling-on-musl.patch
ad54e2c7e7a21bfa9b5f9e8db1b6af6a6d78a3e5dfe2dafcec77488f6224865ab4d4c8a8c8ee1c54c99d1741361e9fb3a51e5d36bcbc7a1c3fdcc4d0c1672132 cross-x86.meson
"