Add zstdio support for booting Trixie kernels in Xen
cover Add zstdio support for booting Trixie kernels in Xen
Debian has started compressing the kernel images in the Trixie release. This breaks booting xen kernels seeing grub has no support to decompress the zstd images[1][2].
To improve this situation, this patch series adds zstdio support in a way that's very similar to xzio. The first patch adds this support. The remaining patchs expand the file_filter tests so this functionality is covered.
Thanks,
Logan
--
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1102066
[2] https://www.mail-archive.com/[email protected]/msg41663.html
Logan Gunthorpe (4):
io: Implement zstdio decompression
tests/file_filter: Regenerate gpg keys
tests/file_filter: Add zstd test file
tests/file_filter: Add zstd tests
Makefile.util.def | 1 + grub-core/Makefile.core.def | 9 +- grub-core/io/zstdio.c | 237 ++++++++++++++++++++++++++++++++ include/grub/file.h | 3 +- tests/file_filter/file.gz.sig | Bin 96 -> 310 bytes tests/file_filter/file.lzop.sig | Bin 96 -> 310 bytes tests/file_filter/file.xz.sig | Bin 96 -> 310 bytes tests/file_filter/file.zstd | Bin 0 -> 26 bytes tests/file_filter/file.zstd.sig | Bin 0 -> 310 bytes tests/file_filter/keys | Bin 994 -> 1308 bytes tests/file_filter/keys.pub | Bin 990 -> 657 bytes tests/file_filter/test.cfg | 1 + tests/file_filter_test.in | 7 +- 13 files changed, 254 insertions(+), 4 deletions(-) create mode 100644 grub-core/io/zstdio.c create mode 100644 tests/file_filter/file.zstd create mode 100644 tests/file_filter/file.zstd.sig
base-commit: ee789e1a625a43b31e17f91a11d4cfb609bc4c52
Signature · 7 lines
2.47.3 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH 1/4 io: Implement zstdio decompression
Add zstd based io decompression.
Based largely on the existing xzio, implement the same features using the zstd library already included in the project.
--- Makefile.util.def | 1 + grub-core/Makefile.core.def | 9 +- grub-core/io/zstdio.c | 237 ++++++++++++++++++++++++++++++++++++ include/grub/file.h | 3 +- 4 files changed, 248 insertions(+), 2 deletions(-) create mode 100644 grub-core/io/zstdio.c
Makefile.util.def +1 -0
@@ -162,6 +162,7 @@ library = { common = grub-core/io/gzio.c; common = grub-core/io/xzio.c; common = grub-core/io/lzopio.c; + common = grub-core/io/zstdio.c; common = grub-core/kern/ia64/dl_helper.c; common = grub-core/kern/arm/dl_helper.c; common = grub-core/kern/arm64/dl_helper.c;
grub-core/Makefile.core.def +8 -1
@@ -473,7 +473,7 @@ image = { i386_pc = boot/i386/pc/boot.S; cppflags = '-DHYBRID_BOOT=1'; - + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
@@ -2486,6 +2486,13 @@ module = { cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/minilzo -DMINILZO_HAVE_CONFIG_H'; }; +module = { + name = zstdio; + common = io/zstdio.c; + cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/zstd'; + cflags='-Wno-unreachable-code'; +}; + module = { name = testload; common = commands/testload.c;
grub-core/io/zstdio.c new file +237 -0
237 lines not on this page · raw message
include/grub/file.h +2 -1
@@ -186,9 +186,10 @@ typedef enum grub_file_filter_idGRUB_FILE_FILTER_GZIO ,GRUB_FILE_FILTER_XZIO ,GRUB_FILE_FILTER_LZOPIO , +GRUB_FILE_FILTER_ZSTDIO ,GRUB_FILE_FILTER_MAX ,GRUB_FILE_FILTER_COMPRESSION_FIRST =GRUB_FILE_FILTER_GZIO , -GRUB_FILE_FILTER_COMPRESSION_LAST =GRUB_FILE_FILTER_LZOPIO , +GRUB_FILE_FILTER_COMPRESSION_LAST =GRUB_FILE_FILTER_ZSTDIO , } grub_file_filter_id_t;typedef grub_file_t (*grub_file_filter_t ) (grub_file_t in,enum grub_file_type type);
Signature · 7 lines
2.47.3 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH 2/4 tests/file_filter: Regenerate gpg keys
In reply to Logan Gunthorpe via Grub-develThe 'keys' file is not a valid GPG secret key so it is not possible to generate new signatures.
Create a new key and use gpg --export-secret-key to export the key and gpg --export to export the public key. Then resign all the signatures with gpg --detach-sign.
--- tests/file_filter/file.gz.sig | Bin 96 -> 310 bytes tests/file_filter/file.lzop.sig | Bin 96 -> 310 bytes tests/file_filter/file.xz.sig | Bin 96 -> 310 bytes tests/file_filter/keys | Bin 994 -> 1308 bytes tests/file_filter/keys.pub | Bin 990 -> 657 bytes 5 files changed, 0 insertions(+), 0 deletions(-)
tests/file_filter/file.gz.sig binary +0 -0
tests/file_filter/file.lzop.sig binary +0 -0
tests/file_filter/file.xz.sig binary +0 -0
tests/file_filter/keys binary +0 -0
tests/file_filter/keys.pub binary +0 -0
Signature · 7 lines
2.47.3 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH 3/4 tests/file_filter: Add zstd test file
In reply to Logan Gunthorpe via Grub-develAdd a file.zstd similar to the other compression methods and generate a gpg signature with gpg --detach-sign
--- tests/file_filter/file.zstd | Bin 0 -> 26 bytes tests/file_filter/file.zstd.sig | Bin 0 -> 310 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/file_filter/file.zstd create mode 100644 tests/file_filter/file.zstd.sig
tests/file_filter/file.zstd new file binary +0 -0
tests/file_filter/file.zstd.sig new file binary +0 -0
Signature · 7 lines
2.47.3 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH 4/4 tests/file_filter: Add zstd tests
In reply to Logan Gunthorpe via Grub-develTest zstd decompression in the same way that other decompressors are tested.
--- tests/file_filter/test.cfg | 1 + tests/file_filter_test.in | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-)
tests/file_filter/test.cfg +1 -0
@@ -3,4 +3,5 @@ set check_signatures=enforce cat /file.gz cat /file.xz cat /file.lzop +cat /file.zstd set check_signatures=
tests/file_filter_test.in +5 -2
@@ -19,14 +19,15 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" -filters="gzio xzio lzopio pgp" +filters="gzio xzio lzopio zstdio pgp" modules="cat mpi" for mod in $(cut -d ' ' -f 2 "@builddir@/grub-core/crypto.lst" | sort -u); do modules="$modules $mod" done -for file in file.gz file.xz file.lzop file.gz.sig file.xz.sig file.lzop.sig keys.pub; do +for file in file.gz file.xz file.lzop file.zstd file.gz.sig file.xz.sig \ + file.lzop.sig file.zstd.sig keys.pub; do files="$files /$file=@srcdir@/tests/file_filter/$file" done
@@ -35,6 +36,8 @@ result="Hello, user! Hello, user! +Hello, user! + Hello, user!" out="$("${grubshell}" --modules="$modules $filters" --files="$files" "@srcdir@/tests/file_filter/test.cfg")"
Signature · 7 lines
2.47.3 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
Hello,
Quoted 8 lines · Logan Gunthorpe via Grub-devel
Debian has started compressing the kernel images in the Trixie release. This breaks booting xen kernels seeing grub has no support to decompress the zstd images[1][2].
To improve this situation, this patch series adds zstdio support in a way that's very similar to xzio. The first patch adds this support. The remaining patchs expand the
file_filtertests so this functionality is covered.
It has been a couple weeks with no response, is someone able to review this?
Thanks,
Logan
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel