-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add `sd-stub` and `sd-boot`. Signed-off-by: Noel Georgi <[email protected]>
- Loading branch information
Showing
7 changed files
with
188 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,8 @@ TARGETS = \ | |
openssl \ | ||
raspberrypi-firmware \ | ||
runc \ | ||
sd-boot \ | ||
sd-stub \ | ||
socat \ | ||
syslinux \ | ||
u-boot \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
From a4ff7772acf1d983921833aa20ccd7c4d5e59a1c Mon Sep 17 00:00:00 2001 | ||
From: Alexander Kanavin <[email protected]> | ||
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 <[email protected]> | ||
--- | ||
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 <stdbool.h> | ||
#include <stdint.h> | ||
+ | ||
+#if SD_BOOT | ||
+typedef __WCHAR_TYPE__ wchar_t; | ||
+#define __DEFINED_wchar_t | ||
+#else | ||
#include <wchar.h> | ||
+#endif | ||
|
||
#include "efi-string.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: sd-boot | ||
variant: scratch | ||
shell: /toolchain/bin/bash | ||
dependencies: | ||
- stage: base | ||
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: | ||
- | | ||
mkdir -p /rootfs | ||
cp build/src/boot/efi/*.efi /rootfs | ||
finalize: | ||
- from: /rootfs | ||
to: / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
From a4ff7772acf1d983921833aa20ccd7c4d5e59a1c Mon Sep 17 00:00:00 2001 | ||
From: Alexander Kanavin <[email protected]> | ||
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 <[email protected]> | ||
--- | ||
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 <stdbool.h> | ||
#include <stdint.h> | ||
+ | ||
+#if SD_BOOT | ||
+typedef __WCHAR_TYPE__ wchar_t; | ||
+#define __DEFINED_wchar_t | ||
+#else | ||
#include <wchar.h> | ||
+#endif | ||
|
||
#include "efi-string.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: sd-stub | ||
variant: scratch | ||
shell: /toolchain/bin/bash | ||
dependencies: | ||
- stage: base | ||
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: | ||
- | | ||
mkdir -p /rootfs | ||
cp build/src/boot/efi/*.efi.stub /rootfs | ||
finalize: | ||
- from: /rootfs | ||
to: / |