cross/systemd-boot-x86: upgrade to 259
https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/94895 Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7604>
This commit is contained in:
parent
6eae90872b
commit
30546c9795
3 changed files with 5 additions and 218 deletions
|
|
@ -1,149 +0,0 @@
|
|||
From 01ce16f1299237946cf07f54952b72e533e5c59b Mon Sep 17 00:00:00 2001
|
||||
From: Struan Robertson <contact@struan.tech>
|
||||
Date: Thu, 18 Sep 2025 15:32:35 +0100
|
||||
Subject: [PATCH] patch wchar_t for musl
|
||||
|
||||
---
|
||||
src/basic/stdio-util.h | 2 +-
|
||||
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 +-
|
||||
src/test/test-format-util.c | 4 ++--
|
||||
6 files changed, 13 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
|
||||
index 052087ce15..f9412e8be2 100644
|
||||
--- a/src/basic/stdio-util.h
|
||||
+++ b/src/basic/stdio-util.h
|
||||
@@ -49,7 +49,7 @@ do { \
|
||||
(void) va_arg(ap, long long int); \
|
||||
break; \
|
||||
case PA_WCHAR: \
|
||||
- (void) va_arg(ap, wchar_t); \
|
||||
+ (void) va_arg(ap, uint16_t); \
|
||||
break; \
|
||||
case PA_WSTRING: \
|
||||
case PA_STRING: \
|
||||
diff --git a/src/boot/efi-string.c b/src/boot/efi-string.c
|
||||
index 8e2c73d84d..08003fac5a 100644
|
||||
--- a/src/boot/efi-string.c
|
||||
+++ b/src/boot/efi-string.c
|
||||
@@ -597,7 +597,7 @@ typedef struct {
|
||||
bool have_field_width;
|
||||
|
||||
const char *str;
|
||||
- const wchar_t *wstr;
|
||||
+ const uint16_t *wstr;
|
||||
|
||||
/* For numbers. */
|
||||
bool is_signed;
|
||||
@@ -658,7 +658,7 @@ static bool push_str(FormatContext *ctx, SpecifierContext *sp) {
|
||||
push_padding(ctx, ' ', sp->padded_len);
|
||||
|
||||
/* In userspace unit tests we cannot just memcpy() the wide string. */
|
||||
- if (sp->wstr && sizeof(wchar_t) == sizeof(char16_t)) {
|
||||
+ if (sp->wstr && sizeof(uint16_t) == sizeof(char16_t)) {
|
||||
memcpy(ctx->buf + ctx->n, sp->wstr, sp->len * sizeof(*sp->wstr));
|
||||
ctx->n += sp->len;
|
||||
} else {
|
||||
@@ -752,7 +752,7 @@ static bool handle_format_specifier(FormatContext *ctx, SpecifierContext *sp) {
|
||||
* int in vararg functions, which is why we fetch only ints for any such types. The compiler would
|
||||
* otherwise warn about fetching smaller types. */
|
||||
assert_cc(sizeof(int) == 4);
|
||||
- assert_cc(sizeof(wchar_t) <= sizeof(int));
|
||||
+ assert_cc(sizeof(uint16_t) <= sizeof(int));
|
||||
assert_cc(sizeof(long long) == sizeof(intmax_t));
|
||||
|
||||
assert(ctx);
|
||||
@@ -847,13 +847,13 @@ static bool handle_format_specifier(FormatContext *ctx, SpecifierContext *sp) {
|
||||
return push_str(ctx, sp);
|
||||
|
||||
case 'c':
|
||||
- sp->wstr = &(wchar_t){ va_arg(ctx->ap, int) };
|
||||
+ sp->wstr = &(uint16_t){ va_arg(ctx->ap, int) };
|
||||
sp->len = 1;
|
||||
return push_str(ctx, sp);
|
||||
|
||||
case 's':
|
||||
if (sp->long_arg) {
|
||||
- sp->wstr = va_arg(ctx->ap, const wchar_t *) ?: L"(null)";
|
||||
+ sp->wstr = va_arg(ctx->ap, const uint16_t *) ?: L"(null)";
|
||||
sp->len = wcsnlen(sp->wstr, sp->len);
|
||||
} else {
|
||||
sp->str = va_arg(ctx->ap, const char *) ?: "(null)";
|
||||
diff --git a/src/boot/efi.h b/src/boot/efi.h
|
||||
index 1832df980c..4e6a2f7288 100644
|
||||
--- a/src/boot/efi.h
|
||||
+++ b/src/boot/efi.h
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#if SD_BOOT
|
||||
/* uchar.h/wchar.h are not suitable for freestanding environments. */
|
||||
-typedef __WCHAR_TYPE__ wchar_t;
|
||||
+typedef __WCHAR_TYPE__ uint16_t;
|
||||
typedef __CHAR16_TYPE__ char16_t;
|
||||
typedef __CHAR32_TYPE__ char32_t;
|
||||
|
||||
@@ -28,7 +28,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 *));
|
||||
@@ -38,7 +38,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);
|
||||
|
||||
diff --git a/src/boot/fuzz-efi-printf.c b/src/boot/fuzz-efi-printf.c
|
||||
index 2857b389a2..ec2a45568f 100644
|
||||
--- a/src/boot/fuzz-efi-printf.c
|
||||
+++ b/src/boot/fuzz-efi-printf.c
|
||||
@@ -44,7 +44,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
fuzz_setup_logging();
|
||||
|
||||
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 e0d3bd9b71..52c65d753d 100644
|
||||
--- a/src/boot/test-efi-string.c
|
||||
+++ b/src/boot/test-efi-string.c
|
||||
@@ -705,7 +705,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);
|
||||
diff --git a/src/test/test-format-util.c b/src/test/test-format-util.c
|
||||
index 0a95837dbe..d07333a5d1 100644
|
||||
--- a/src/test/test-format-util.c
|
||||
+++ b/src/test/test-format-util.c
|
||||
@@ -18,8 +18,8 @@ assert_cc(STRLEN(U"") == 0);
|
||||
assert_cc(STRLEN(U"a") == sizeof(char32_t));
|
||||
assert_cc(STRLEN(U"123") == 3 * sizeof(char32_t));
|
||||
assert_cc(STRLEN(L"") == 0);
|
||||
-assert_cc(STRLEN(L"a") == sizeof(wchar_t));
|
||||
-assert_cc(STRLEN(L"123") == 3 * sizeof(wchar_t));
|
||||
+assert_cc(STRLEN(L"a") == sizeof(uint16_t));
|
||||
+assert_cc(STRLEN(L"123") == 3 * sizeof(uint16_t));
|
||||
assert_cc(DECIMAL_STR_MAX(uint8_t) == STRLEN("255")+1);
|
||||
assert_cc(DECIMAL_STR_MAX(int8_t) == STRLEN("-127")+1);
|
||||
assert_cc(DECIMAL_STR_MAX(uint64_t) == STRLEN("18446744073709551615")+1);
|
||||
--
|
||||
2.51.0
|
||||
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
From 9047f8b2a7374d95e8261f15941d07b6e4def3fe Mon Sep 17 00:00:00 2001
|
||||
From: Clayton Craft <clayton@craftyguy.net>
|
||||
Date: Tue, 7 Jan 2025 20:19:51 -0800
|
||||
Subject: [PATCH] (pmOS cross/systemd-boot-x86 specific): 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 to required=false, they aren't needed for building the
|
||||
bootloader, and they complicate cross compilation
|
||||
|
||||
IMPORTANT: some of these dependencies don't exist for the target arch
|
||||
(x86) and since they aren't actually required by sd-boot it's easier
|
||||
to just disable/remove them from meson.build!!!
|
||||
---
|
||||
meson.build | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 238b935372..8449eb8ecd 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -688,7 +688,6 @@ conf.set('GPERF_LEN_TYPE', gperf_len_type,
|
||||
|
||||
foreach header : [
|
||||
'crypt.h',
|
||||
- 'sys/capability.h',
|
||||
]
|
||||
|
||||
if not cc.has_header(header)
|
||||
@@ -997,7 +996,7 @@ threads = dependency('threads')
|
||||
librt = cc.find_library('rt')
|
||||
libm = cc.find_library('m')
|
||||
libdl = cc.find_library('dl')
|
||||
-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.
|
||||
@@ -1886,6 +1885,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 = files('tools/check-efi-alignment.py')
|
||||
--
|
||||
2.51.0
|
||||
|
||||
|
|
@ -2,12 +2,11 @@
|
|||
|
||||
pkgname=systemd-boot-x86
|
||||
_pkgname=systemd-boot # for monitoring
|
||||
pkgver=258.3
|
||||
pkgver=259
|
||||
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"
|
||||
arch="x86_64" # x86 32-bit only makes sense on x86 64-bit
|
||||
license="LGPL-2.1-or-later"
|
||||
makedepends="
|
||||
bash
|
||||
|
|
@ -17,14 +16,13 @@ makedepends="
|
|||
libcap-dev
|
||||
meson
|
||||
musl-dev-x86
|
||||
musl-libintl
|
||||
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
|
||||
0002-meson-minimal-configure-for-building-systemd-boot.patch
|
||||
cross-x86.meson
|
||||
"
|
||||
# check: no tests
|
||||
|
|
@ -37,6 +35,7 @@ builddir="$srcdir/systemd-$pkgver"
|
|||
|
||||
build() {
|
||||
abuild-meson \
|
||||
-Dlibc="musl" \
|
||||
-Dsbat-distro="alpine" \
|
||||
-Dsbat-distro-summary="Alpine Linux" \
|
||||
-Dsbat-distro-pkgname="$pkgname" \
|
||||
|
|
@ -119,8 +118,6 @@ efistub() {
|
|||
}
|
||||
|
||||
sha512sums="
|
||||
9f4261e1703efd1f38c90e4166e6d85fa9379c99ac7f3c66caa62955c3cbe8a43ab259c261ab20bce0dd84dd682258192ace66b4dee0390bf3740c32f4569fed systemd-258.3.tar.gz
|
||||
9ff8da74fa51b0ededaf6cf7b80b03f433c8617db39eb5cde01477031fa00724b8b7bdf68c945c277510f81e7fbbf3b2732f2c781b0f6ce67569b2737581595b 0001-patch-wchar_t-for-musl.patch
|
||||
5cffc18f3eaaab1b6cc8f7191afed628036b9e794ca7f9fe0a7eb4653862f8cd2b43f18483916b52cdca4ddb17b8baae5baa212aa152b1ae8f2b31d57d6e1f45 0002-meson-minimal-configure-for-building-systemd-boot.patch
|
||||
ef46b13661df43e3cfbeee1bc22f0b1eb902e8ebe39c19868c465efd08b35a199c2a2cd9d8021a6bc4d692fa0c6e0eab3f13eecd6ce24dde81d3945464a25b50 systemd-259.tar.gz
|
||||
ad54e2c7e7a21bfa9b5f9e8db1b6af6a6d78a3e5dfe2dafcec77488f6224865ab4d4c8a8c8ee1c54c99d1741361e9fb3a51e5d36bcbc7a1c3fdcc4d0c1672132 cross-x86.meson
|
||||
"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue