diff --git a/cross/systemd-boot-x86/0001-patch-wchar_t-for-musl.patch b/cross/systemd-boot-x86/0001-patch-wchar_t-for-musl.patch index 512c70b2e..6e2597955 100644 --- a/cross/systemd-boot-x86/0001-patch-wchar_t-for-musl.patch +++ b/cross/systemd-boot-x86/0001-patch-wchar_t-for-musl.patch @@ -1,20 +1,35 @@ -From 87e8a19b2a9a15352d849918d995cea92ba287bb Mon Sep 17 00:00:00 2001 -From: Struan Robertson -Date: Mon, 16 Dec 2024 13:48:25 +0000 +From 01ce16f1299237946cf07f54952b72e533e5c59b Mon Sep 17 00:00:00 2001 +From: Struan Robertson +Date: Thu, 18 Sep 2025 15:32:35 +0100 Subject: [PATCH] patch wchar_t for musl --- - 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(-) + 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 aee98a8..314d14d 100644 +index 8e2c73d84d..08003fac5a 100644 --- a/src/boot/efi-string.c +++ b/src/boot/efi-string.c -@@ -570,7 +570,7 @@ typedef struct { +@@ -597,7 +597,7 @@ typedef struct { bool have_field_width; const char *str; @@ -23,7 +38,7 @@ index aee98a8..314d14d 100644 /* For numbers. */ bool is_signed; -@@ -631,7 +631,7 @@ static bool push_str(FormatContext *ctx, SpecifierContext *sp) { +@@ -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. */ @@ -32,16 +47,16 @@ index aee98a8..314d14d 100644 memcpy(ctx->buf + ctx->n, sp->wstr, sp->len * sizeof(*sp->wstr)); ctx->n += sp->len; } else { -@@ -725,7 +725,7 @@ static bool handle_format_specifier(FormatContext *ctx, SpecifierContext *sp) { +@@ -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(intmax_t) <= sizeof(long long)); + assert_cc(sizeof(long long) == sizeof(intmax_t)); assert(ctx); -@@ -820,13 +820,13 @@ static bool handle_format_specifier(FormatContext *ctx, SpecifierContext *sp) { +@@ -847,13 +847,13 @@ static bool handle_format_specifier(FormatContext *ctx, SpecifierContext *sp) { return push_str(ctx, sp); case 'c': @@ -58,10 +73,10 @@ index aee98a8..314d14d 100644 } else { sp->str = va_arg(ctx->ap, const char *) ?: "(null)"; diff --git a/src/boot/efi.h b/src/boot/efi.h -index e104263..d6c1aa4 100644 +index 1832df980c..4e6a2f7288 100644 --- a/src/boot/efi.h +++ b/src/boot/efi.h -@@ -10,7 +10,7 @@ +@@ -16,7 +16,7 @@ #if SD_BOOT /* uchar.h/wchar.h are not suitable for freestanding environments. */ @@ -70,7 +85,7 @@ index e104263..d6c1aa4 100644 typedef __CHAR16_TYPE__ char16_t; typedef __CHAR32_TYPE__ char32_t; -@@ -22,7 +22,7 @@ assert_cc(sizeof(uint8_t) == 1); +@@ -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); @@ -79,7 +94,7 @@ index e104263..d6c1aa4 100644 assert_cc(sizeof(char16_t) == 2); assert_cc(sizeof(char32_t) == 4); assert_cc(sizeof(size_t) == sizeof(void *)); -@@ -32,7 +32,7 @@ assert_cc(alignof(uint8_t) == 1); +@@ -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); @@ -89,10 +104,10 @@ index e104263..d6c1aa4 100644 assert_cc(alignof(char32_t) == 4); diff --git a/src/boot/fuzz-efi-printf.c b/src/boot/fuzz-efi-printf.c -index 6dee830..75017cc 100644 +index 2857b389a2..ec2a45568f 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) { +@@ -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); @@ -102,10 +117,10 @@ index 6dee830..75017cc 100644 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 +index e0d3bd9b71..52c65d753d 100644 --- a/src/boot/test-efi-string.c +++ b/src/boot/test-efi-string.c -@@ -649,7 +649,7 @@ TEST(xvasprintf_status) { +@@ -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' }); @@ -114,6 +129,21 @@ index b71a0c3..d2d1020 100644 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.47.1 +2.51.0 diff --git a/cross/systemd-boot-x86/0002-meson-minimal-configure-for-building-systemd-boot.patch b/cross/systemd-boot-x86/0002-meson-minimal-configure-for-building-systemd-boot.patch index 6940ba15d..3a50de9d3 100644 --- a/cross/systemd-boot-x86/0002-meson-minimal-configure-for-building-systemd-boot.patch +++ b/cross/systemd-boot-x86/0002-meson-minimal-configure-for-building-systemd-boot.patch @@ -1,57 +1,46 @@ -From f214e955b853d87aa1a34dfbb44b5d8edff3962c Mon Sep 17 00:00:00 2001 +From 9047f8b2a7374d95e8261f15941d07b6e4def3fe Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Tue, 7 Jan 2025 20:19:51 -0800 -Subject: [PATCH 1/2] meson: minimal configure for building systemd-boot +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 and libmount to required=false, they aren't needed for - building the bootloader, and they complicate cross compilation + - 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 | 16 +++++++++++----- - 1 file changed, 11 insertions(+), 5 deletions(-) + meson.build | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build -index bffda86845..b5a27de305 100644 +index 238b935372..8449eb8ecd 100644 --- a/meson.build +++ b/meson.build -@@ -766,9 +766,6 @@ conf.set('GPERF_LEN_TYPE', gperf_len_type, +@@ -688,7 +688,6 @@ conf.set('GPERF_LEN_TYPE', gperf_len_type, - ##################################################################### + foreach header : [ + 'crypt.h', +- 'sys/capability.h', + ] --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 + 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. -@@ -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' +@@ -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) @@ -66,7 +55,7 @@ index bffda86845..b5a27de305 100644 + ##################################################################### - check_efi_alignment_py = find_program('tools/check-efi-alignment.py') + check_efi_alignment_py = files('tools/check-efi-alignment.py') -- -2.47.1 +2.51.0 diff --git a/cross/systemd-boot-x86/APKBUILD b/cross/systemd-boot-x86/APKBUILD index f48bd4fdb..3595ba7a6 100644 --- a/cross/systemd-boot-x86/APKBUILD +++ b/cross/systemd-boot-x86/APKBUILD @@ -2,7 +2,7 @@ pkgname=systemd-boot-x86 _pkgname=systemd-boot # for monitoring -pkgver=257.9 +pkgver=258 pkgrel=0 pkgdesc="systemd's EFI boot manager for x86 EFI on x86_64." url="https://systemd.io/" @@ -70,7 +70,6 @@ build() { -Dlogind=false \ -Dmachined=false \ -Dnetworkd=false \ - -Dnscd=false \ -Dnss-myhostname=false \ -Dnss-mymachines=disabled \ -Dnss-resolve=disabled \ @@ -102,6 +101,7 @@ build() { -Dvmspawn=disabled \ -Dwheel-group=false \ -Dxdg-autostart=false \ + -Dlibmount=disabled \ --cross-file "$srcdir"/cross-x86.meson \ . output meson compile -C output systemd-boot @@ -119,8 +119,8 @@ efistub() { } sha512sums=" -23b3d2764e0f990d8373068ccb41177793413bc193f7bd34e38b03d6fc3cd32d07c86e9dcbf07e32904075bb5eeca208f65beab04d628ac0e0b81ba87a975c1b systemd-257.9.tar.gz -81e6f311d567ef8b1f8957f25f019e7fa995f640659381757d1abdd7295434810b79a09367d274c5755f1ed1f6d37d7d98e9c93645578daca34acdeca0ba3965 0001-patch-wchar_t-for-musl.patch -2c028d35c85a042582f668fd9ba1145134168e79e9137c90a2ea572c79124952b86114dc304dafa710a433b13aedc8251f5669aafffee9ddf42a32c2592bf5df 0002-meson-minimal-configure-for-building-systemd-boot.patch +c488354da1c170ad02e10926f561d1985c3c3393fec878562f295ef764fdf3a1b2877c3b2549253f19bf23e357be6e443a50b937f60f4677f286d3402d611b85 systemd-258.tar.gz +9ff8da74fa51b0ededaf6cf7b80b03f433c8617db39eb5cde01477031fa00724b8b7bdf68c945c277510f81e7fbbf3b2732f2c781b0f6ce67569b2737581595b 0001-patch-wchar_t-for-musl.patch +5cffc18f3eaaab1b6cc8f7191afed628036b9e794ca7f9fe0a7eb4653862f8cd2b43f18483916b52cdca4ddb17b8baae5baa212aa152b1ae8f2b31d57d6e1f45 0002-meson-minimal-configure-for-building-systemd-boot.patch ad54e2c7e7a21bfa9b5f9e8db1b6af6a6d78a3e5dfe2dafcec77488f6224865ab4d4c8a8c8ee1c54c99d1741361e9fb3a51e5d36bcbc7a1c3fdcc4d0c1672132 cross-x86.meson "