From 7958db1549a7c7560eeeb8f9c06d3be9487d8804 Mon Sep 17 00:00:00 2001 From: Noel Georgi Date: Tue, 16 May 2023 16:14:03 +0530 Subject: [PATCH] chore: copy over sd-boot and sd-stub from tools Copy over sd-boot and sd-stub from tools, since they are sttaic EFI PE32 executables. Signed-off-by: Noel Georgi --- Pkgfile | 2 +- libinih/pkg.yaml | 9 ++++----- sd-boot/patches/musl.patch | 40 -------------------------------------- sd-boot/pkg.yaml | 40 +++----------------------------------- sd-stub/patches/musl.patch | 40 -------------------------------------- sd-stub/pkg.yaml | 40 +++----------------------------------- 6 files changed, 11 insertions(+), 160 deletions(-) delete mode 100644 sd-boot/patches/musl.patch delete mode 100644 sd-stub/patches/musl.patch diff --git a/Pkgfile b/Pkgfile index d26f7f84..15319b5a 100644 --- a/Pkgfile +++ b/Pkgfile @@ -3,7 +3,7 @@ format: v1alpha2 vars: - TOOLS_IMAGE: ghcr.io/siderolabs/tools:v1.5.0-alpha.0-4-geedc294 + TOOLS_IMAGE: ghcr.io/siderolabs/tools:v1.5.0-alpha.0-5-g271c4a6 # renovate: datasource=github-releases depName=containernetworking/plugins cni_version: v1.3.0 diff --git a/libinih/pkg.yaml b/libinih/pkg.yaml index a79af420..ef3d6656 100644 --- a/libinih/pkg.yaml +++ b/libinih/pkg.yaml @@ -3,14 +3,13 @@ variant: scratch shell: /toolchain/bin/bash dependencies: - stage: base + - stage: openssl steps: - sources: - url: https://github.com/benhoyt/inih/archive/refs/tags/r{{ .libinih_version }}.tar.gz destination: inih.tar.gz sha256: "{{ .libinih_sha256 }}" sha512: "{{ .libinih_sha512 }}" - env: - LD_LIBRARY_PATH: /toolchain/lib prepare: - | tar -xzf inih.tar.gz --strip-components=1 @@ -45,13 +44,13 @@ steps: -Dutf-8_bom=true \ -Dinline_comments=true \ -Duse_heap=false \ - . output + . build build: - | - meson compile -j 1 -C output + meson compile -j 1 -C build install: - | - DESTDIR="/rootfs" meson install --no-rebuild -C output + DESTDIR="/rootfs" meson install --no-rebuild -C build finalize: - from: /rootfs to: / diff --git a/sd-boot/patches/musl.patch b/sd-boot/patches/musl.patch deleted file mode 100644 index f703aa9b..00000000 --- a/sd-boot/patches/musl.patch +++ /dev/null @@ -1,40 +0,0 @@ -From a4ff7772acf1d983921833aa20ccd7c4d5e59a1c Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin -Date: Mon, 6 Mar 2023 15:24:49 +0100 -Subject: [PATCH] src/boot/efi/efi-string.c: define wchar_t from __WCHAR_TYPE__ - -systemd-boot relies on wchar_t being 16 bit, and breaks at build time otherwise. - -To set wchar_t to 16 bit it is passing -fshort-wchar to gcc; this has the -desired effect on glibc (which sets wchar_t from __WCHAR_TYPE__) but not on -musl (which hardcodes it to 32 bit). - -This patch ensures wchar_t is set from the compiler flags on all systems; note -that systemd-boot is not actually using functions from musl or other libc, just their headers. - -Meanwhile upstream has refactored the code to not rely on libc headers at all; -however this will not be backported to v253 and we need a different fix. - -Upstream-Status: Inappropriate [fixed differently in trunk according to https://github.com/systemd/systemd/pull/26689] -Signed-off-by: Alexander Kanavin ---- - src/boot/efi/efi-string.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/boot/efi/efi-string.c b/src/boot/efi/efi-string.c -index 22923d60f6..22a8d1ef71 100644 ---- a/src/boot/efi/efi-string.c -+++ b/src/boot/efi/efi-string.c -@@ -2,7 +2,13 @@ - - #include - #include -+ -+#if SD_BOOT -+typedef __WCHAR_TYPE__ wchar_t; -+#define __DEFINED_wchar_t -+#else - #include -+#endif - - #include "efi-string.h" diff --git a/sd-boot/pkg.yaml b/sd-boot/pkg.yaml index 87ea073e..1c004211 100644 --- a/sd-boot/pkg.yaml +++ b/sd-boot/pkg.yaml @@ -3,47 +3,13 @@ variant: scratch shell: /toolchain/bin/bash dependencies: - stage: base + - image: "{{ .TOOLS_IMAGE }}" steps: - - sources: - - url: https://github.com/systemd/systemd/archive/refs/tags/v{{ .systemd_version }}.tar.gz - destination: systemd.tar.gz - sha256: "{{ .systemd_sha256 }}" - sha512: "{{ .systemd_sha512 }}" - env: - LD_LIBRARY_PATH: /toolchain/lib - prepare: - - | - tar -xzf systemd.tar.gz --strip-components=1 - - ln -s /toolchain/bin/echo /toolchain/bin/getent - mkdir -p /usr/bin - ln -sf /toolchain/bin/env /usr/bin/env - ln -sf /toolchain/bin/python3 /toolchain/bin/python - - pip3 install jinja2 ninja - - patch -p1 < /pkg/patches/musl.patch - - meson setup build \ - --buildtype=release \ - -Dmode=release \ - -Dsbat-distro=talos \ - -Dsbat-distro-summary="Talos Linux" \ - -Dsbat-distro-url=https://github.com/siderolabs/pkgs/issues \ - -Dman=false \ - -Defi=true \ - -Dgnu-efi=true \ - -Defi-libdir=/toolchain/lib \ - -Defi-includedir=/toolchain/include/efi \ - -Dtests=false - build: - - | - ninja -j $(nproc) -C build systemd-boot - install: + - install: - | mkdir -p /rootfs - cp build/src/boot/efi/*.efi /rootfs + cp /toolchain/lib/systemd/boot/efi/*.efi /rootfs finalize: - from: /rootfs to: / diff --git a/sd-stub/patches/musl.patch b/sd-stub/patches/musl.patch deleted file mode 100644 index f703aa9b..00000000 --- a/sd-stub/patches/musl.patch +++ /dev/null @@ -1,40 +0,0 @@ -From a4ff7772acf1d983921833aa20ccd7c4d5e59a1c Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin -Date: Mon, 6 Mar 2023 15:24:49 +0100 -Subject: [PATCH] src/boot/efi/efi-string.c: define wchar_t from __WCHAR_TYPE__ - -systemd-boot relies on wchar_t being 16 bit, and breaks at build time otherwise. - -To set wchar_t to 16 bit it is passing -fshort-wchar to gcc; this has the -desired effect on glibc (which sets wchar_t from __WCHAR_TYPE__) but not on -musl (which hardcodes it to 32 bit). - -This patch ensures wchar_t is set from the compiler flags on all systems; note -that systemd-boot is not actually using functions from musl or other libc, just their headers. - -Meanwhile upstream has refactored the code to not rely on libc headers at all; -however this will not be backported to v253 and we need a different fix. - -Upstream-Status: Inappropriate [fixed differently in trunk according to https://github.com/systemd/systemd/pull/26689] -Signed-off-by: Alexander Kanavin ---- - src/boot/efi/efi-string.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/boot/efi/efi-string.c b/src/boot/efi/efi-string.c -index 22923d60f6..22a8d1ef71 100644 ---- a/src/boot/efi/efi-string.c -+++ b/src/boot/efi/efi-string.c -@@ -2,7 +2,13 @@ - - #include - #include -+ -+#if SD_BOOT -+typedef __WCHAR_TYPE__ wchar_t; -+#define __DEFINED_wchar_t -+#else - #include -+#endif - - #include "efi-string.h" diff --git a/sd-stub/pkg.yaml b/sd-stub/pkg.yaml index eb9beacc..40f150f6 100644 --- a/sd-stub/pkg.yaml +++ b/sd-stub/pkg.yaml @@ -3,47 +3,13 @@ variant: scratch shell: /toolchain/bin/bash dependencies: - stage: base + - image: "{{ .TOOLS_IMAGE }}" steps: - - sources: - - url: https://github.com/systemd/systemd/archive/refs/tags/v{{ .systemd_version }}.tar.gz - destination: systemd.tar.gz - sha256: "{{ .systemd_sha256 }}" - sha512: "{{ .systemd_sha512 }}" - env: - LD_LIBRARY_PATH: /toolchain/lib - prepare: - - | - tar -xzf systemd.tar.gz --strip-components=1 - - ln -s /toolchain/bin/echo /toolchain/bin/getent - mkdir -p /usr/bin - ln -sf /toolchain/bin/env /usr/bin/env - ln -sf /toolchain/bin/python3 /toolchain/bin/python - - pip3 install jinja2 ninja - - patch -p1 < /pkg/patches/musl.patch - - meson setup build \ - --buildtype=release \ - -Dmode=release \ - -Dsbat-distro=talos \ - -Dsbat-distro-summary="Talos Linux" \ - -Dsbat-distro-url=https://github.com/siderolabs/pkgs/issues \ - -Dman=false \ - -Defi=true \ - -Dgnu-efi=true \ - -Defi-libdir=/toolchain/lib \ - -Defi-includedir=/toolchain/include/efi \ - -Dtests=false - build: - - | - ninja -j $(nproc) -C build systemd-stub - install: + - install: - | mkdir -p /rootfs - cp build/src/boot/efi/*.efi.stub /rootfs + cp /toolchain/lib/systemd/boot/efi/*.efi.stub /rootfs finalize: - from: /rootfs to: /