Bundle unicode.pf2 with images
Resolves: #2143725 Resolves: #2144113 Signed-off-by: Robbie Harwood <rharwood@redhat.com>
This commit is contained in:
parent
558410c2d9
commit
0ccadff7a2
78
0299-font-Try-opening-fonts-from-the-bundled-memdisk.patch
Normal file
78
0299-font-Try-opening-fonts-from-the-bundled-memdisk.patch
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chris Coulson <chris.coulson@canonical.com>
|
||||||
|
Date: Wed, 16 Nov 2022 14:40:04 +0000
|
||||||
|
Subject: [PATCH] font: Try opening fonts from the bundled memdisk
|
||||||
|
|
||||||
|
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||||
|
---
|
||||||
|
grub-core/font/font.c | 48 +++++++++++++++++++++++++++++++-----------------
|
||||||
|
1 file changed, 31 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/grub-core/font/font.c b/grub-core/font/font.c
|
||||||
|
index e6616e610c..e421d1ae6f 100644
|
||||||
|
--- a/grub-core/font/font.c
|
||||||
|
+++ b/grub-core/font/font.c
|
||||||
|
@@ -409,6 +409,27 @@ read_section_as_short (struct font_file_section *section,
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static grub_file_t
|
||||||
|
+try_open_from_prefix (const char *prefix, const char *filename)
|
||||||
|
+{
|
||||||
|
+ grub_file_t file;
|
||||||
|
+ char *fullname, *ptr;
|
||||||
|
+
|
||||||
|
+ fullname = grub_malloc (grub_strlen (prefix) + grub_strlen (filename) + 1
|
||||||
|
+ + sizeof ("/fonts/") + sizeof (".pf2"));
|
||||||
|
+ if (!fullname)
|
||||||
|
+ return 0;
|
||||||
|
+ ptr = grub_stpcpy (fullname, prefix);
|
||||||
|
+ ptr = grub_stpcpy (ptr, "/fonts/");
|
||||||
|
+ ptr = grub_stpcpy (ptr, filename);
|
||||||
|
+ ptr = grub_stpcpy (ptr, ".pf2");
|
||||||
|
+ *ptr = 0;
|
||||||
|
+
|
||||||
|
+ file = grub_buffile_open (fullname, GRUB_FILE_TYPE_FONT, 1024);
|
||||||
|
+ grub_free (fullname);
|
||||||
|
+ return file;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Load a font and add it to the beginning of the global font list.
|
||||||
|
Returns 0 upon success, nonzero upon failure. */
|
||||||
|
grub_font_t
|
||||||
|
@@ -427,25 +448,18 @@ grub_font_load (const char *filename)
|
||||||
|
file = grub_buffile_open (filename, GRUB_FILE_TYPE_FONT, 1024);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- const char *prefix = grub_env_get ("prefix");
|
||||||
|
- char *fullname, *ptr;
|
||||||
|
- if (!prefix)
|
||||||
|
+ file = try_open_from_prefix ("(memdisk)", filename);
|
||||||
|
+ if (!file)
|
||||||
|
{
|
||||||
|
- grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"),
|
||||||
|
- "prefix");
|
||||||
|
- goto fail;
|
||||||
|
+ const char *prefix = grub_env_get ("prefix");
|
||||||
|
+ if (!prefix)
|
||||||
|
+ {
|
||||||
|
+ grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"),
|
||||||
|
+ "prefix");
|
||||||
|
+ goto fail;
|
||||||
|
+ }
|
||||||
|
+ file = try_open_from_prefix (prefix, filename);
|
||||||
|
}
|
||||||
|
- fullname = grub_malloc (grub_strlen (prefix) + grub_strlen (filename) + 1
|
||||||
|
- + sizeof ("/fonts/") + sizeof (".pf2"));
|
||||||
|
- if (!fullname)
|
||||||
|
- goto fail;
|
||||||
|
- ptr = grub_stpcpy (fullname, prefix);
|
||||||
|
- ptr = grub_stpcpy (ptr, "/fonts/");
|
||||||
|
- ptr = grub_stpcpy (ptr, filename);
|
||||||
|
- ptr = grub_stpcpy (ptr, ".pf2");
|
||||||
|
- *ptr = 0;
|
||||||
|
- file = grub_buffile_open (fullname, GRUB_FILE_TYPE_FONT, 1024);
|
||||||
|
- grub_free (fullname);
|
||||||
|
}
|
||||||
|
if (!file)
|
||||||
|
goto fail;
|
32
grub.macros
32
grub.macros
@ -399,22 +399,31 @@ rm -f %{1}.conf \
|
|||||||
gfxmenu gfxterm gzio \\\
|
gfxmenu gfxterm gzio \\\
|
||||||
halt hfsplus http increment iso9660 \\\
|
halt hfsplus http increment iso9660 \\\
|
||||||
jpeg loadenv loopback linux lvm luks \\\
|
jpeg loadenv loopback linux lvm luks \\\
|
||||||
luks2 mdraid09 mdraid1x minicmd net \\\
|
luks2 \\\
|
||||||
|
memdisk \\\
|
||||||
|
mdraid09 mdraid1x minicmd net \\\
|
||||||
normal part_apple part_msdos part_gpt \\\
|
normal part_apple part_msdos part_gpt \\\
|
||||||
password_pbkdf2 pgp png reboot regexp \\\
|
password_pbkdf2 pgp png reboot regexp \\\
|
||||||
search search_fs_uuid search_fs_file \\\
|
search search_fs_uuid search_fs_file \\\
|
||||||
search_label serial sleep syslinuxcfg \\\
|
search_label serial sleep \\\
|
||||||
|
squash4 \\\
|
||||||
|
syslinuxcfg \\\
|
||||||
test tftp version video xfs zstd " \
|
test tftp version video xfs zstd " \
|
||||||
|
|
||||||
%ifarch x86_64 aarch64 %{arm} riscv64
|
%ifarch %{efi_arch}
|
||||||
%define efi_mkimage() \
|
%define efi_mkimage() \
|
||||||
|
mkdir -p memdisk/fonts \
|
||||||
|
cp %{4}/unicode.pf2 memdisk/fonts \
|
||||||
|
mksquashfs memdisk memdisk.squashfs -comp xz \
|
||||||
%{4}./grub-mkimage -O %{1} -o %{2}.orig \\\
|
%{4}./grub-mkimage -O %{1} -o %{2}.orig \\\
|
||||||
-p /EFI/%{efi_vendor} -d grub-core \\\
|
-p /EFI/%{efi_vendor} -d grub-core \\\
|
||||||
--sbat %{4}./sbat.csv \\\
|
--sbat %{4}./sbat.csv \\\
|
||||||
|
-m memdisk.squashfs \\\
|
||||||
${GRUB_MODULES} \
|
${GRUB_MODULES} \
|
||||||
%{4}./grub-mkimage -O %{1} -o %{3}.orig \\\
|
%{4}./grub-mkimage -O %{1} -o %{3}.orig \\\
|
||||||
-p /EFI/BOOT -d grub-core \\\
|
-p /EFI/BOOT -d grub-core \\\
|
||||||
--sbat %{4}./sbat.csv \\\
|
--sbat %{4}./sbat.csv \\\
|
||||||
|
-m memdisk.squashfs \\\
|
||||||
${GRUB_MODULES} \
|
${GRUB_MODULES} \
|
||||||
%{expand:%%define ___pesign_client_cert %{?___pesign_client_cert}%{!?___pesign_client_cert:%{__pesign_client_cert}}} \
|
%{expand:%%define ___pesign_client_cert %{?___pesign_client_cert}%{!?___pesign_client_cert:%{__pesign_client_cert}}} \
|
||||||
%{?__pesign_client_cert:%{expand:%%define __pesign_client_cert %{___pesign_client_cert}}} \
|
%{?__pesign_client_cert:%{expand:%%define __pesign_client_cert %{___pesign_client_cert}}} \
|
||||||
@ -424,20 +433,14 @@ rm -f %{1}.conf \
|
|||||||
%{expand:%%{pesign -s -i %%{2}.onesig -o %%{2} -a %%{5} -c %%{6} -n %%{7}}} \
|
%{expand:%%{pesign -s -i %%{2}.onesig -o %%{2} -a %%{5} -c %%{6} -n %%{7}}} \
|
||||||
%{expand:%%{pesign -s -i %%{3}.onesig -o %%{3} -a %%{5} -c %%{6} -n %%{7}}} \
|
%{expand:%%{pesign -s -i %%{3}.onesig -o %%{3} -a %%{5} -c %%{6} -n %%{7}}} \
|
||||||
%{nil}
|
%{nil}
|
||||||
%else
|
|
||||||
%define efi_mkimage() \
|
|
||||||
%{4}./grub-mkimage -O %{1} -o %{2} \\\
|
|
||||||
-p /EFI/%{efi_vendor} -d grub-core \\\
|
|
||||||
${GRUB_MODULES} \
|
|
||||||
%{4}./grub-mkimage -O %{1} -o %{3} \\\
|
|
||||||
-p /EFI/BOOT -d grub-core \\\
|
|
||||||
${GRUB_MODULES} \
|
|
||||||
%{nil}
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%ifarch ppc64le
|
%ifarch ppc64le
|
||||||
%if 0%{?rhel}
|
%if 0%{?rhel}
|
||||||
%define ieee1275_mkimage() \
|
%define ieee1275_mkimage() \
|
||||||
|
mkdir -p memdisk/fonts \
|
||||||
|
cp %{4}/unicode.pf2 memdisk/fonts \
|
||||||
|
mksquashfs memdisk memdisk.squashfs -comp xz \
|
||||||
APPENDED_SIG_SIZE=0 \
|
APPENDED_SIG_SIZE=0 \
|
||||||
if [ -x /usr/bin/rpm-sign ]; then \
|
if [ -x /usr/bin/rpm-sign ]; then \
|
||||||
touch empty.unsigned \
|
touch empty.unsigned \
|
||||||
@ -450,6 +453,7 @@ fi \
|
|||||||
# FIXME: using this prefix is fragile, must be done properly \
|
# FIXME: using this prefix is fragile, must be done properly \
|
||||||
./grub-mkimage -O %{1} -o %{2}.orig \\\
|
./grub-mkimage -O %{1} -o %{2}.orig \\\
|
||||||
-p '/grub2' -d grub-core \\\
|
-p '/grub2' -d grub-core \\\
|
||||||
|
-m memdisk.squashfs \\\
|
||||||
-x %{3} \\\
|
-x %{3} \\\
|
||||||
--appended-signature-size ${APPENDED_SIG_SIZE} \\\
|
--appended-signature-size ${APPENDED_SIG_SIZE} \\\
|
||||||
${GRUB_MODULES} \
|
${GRUB_MODULES} \
|
||||||
@ -581,8 +585,6 @@ install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \
|
|||||||
%ifarch %{arm} \
|
%ifarch %{arm} \
|
||||||
install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \
|
install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \
|
||||||
%endif \
|
%endif \
|
||||||
install -D -m 700 unicode.pf2 \\\
|
|
||||||
${RPM_BUILD_ROOT}/boot/grub2/fonts/unicode.pf2 \
|
|
||||||
${RPM_BUILD_ROOT}/%{_bindir}/grub2-editenv \\\
|
${RPM_BUILD_ROOT}/%{_bindir}/grub2-editenv \\\
|
||||||
${RPM_BUILD_ROOT}/boot/grub2/grubenv create \
|
${RPM_BUILD_ROOT}/boot/grub2/grubenv create \
|
||||||
%{expand:%%do_install_protected_file grub2-%{package_arch}} \
|
%{expand:%%do_install_protected_file grub2-%{package_arch}} \
|
||||||
@ -690,7 +692,6 @@ ln -s ../boot/grub2/grub.cfg \\\
|
|||||||
%ifarch %{arm} \
|
%ifarch %{arm} \
|
||||||
%attr(0700,root,root) %verify(not mtime) %{efi_esp_boot}/BOOTARM.EFI \
|
%attr(0700,root,root) %verify(not mtime) %{efi_esp_boot}/BOOTARM.EFI \
|
||||||
%endif \
|
%endif \
|
||||||
%attr(0700,root,root)/boot/grub2/fonts \
|
|
||||||
%dir %attr(0700,root,root)/boot/loader/entries \
|
%dir %attr(0700,root,root)/boot/loader/entries \
|
||||||
%ghost %config(noreplace) %attr(0700,root,root)/boot/grub2/grub.cfg \
|
%ghost %config(noreplace) %attr(0700,root,root)/boot/grub2/grub.cfg \
|
||||||
%ghost %config(noreplace) %verify(not mtime) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \
|
%ghost %config(noreplace) %verify(not mtime) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \
|
||||||
@ -712,5 +713,4 @@ ln -s ../boot/grub2/grub.cfg \\\
|
|||||||
%{expand:%%files %{1}-cdboot} \
|
%{expand:%%files %{1}-cdboot} \
|
||||||
%defattr(-,root,root,-) \
|
%defattr(-,root,root,-) \
|
||||||
%attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{3} \
|
%attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{3} \
|
||||||
%attr(0700,root,root)/boot/grub2/fonts \
|
|
||||||
%{nil}
|
%{nil}
|
||||||
|
@ -296,3 +296,4 @@ Patch0295: 0295-font-Fix-an-integer-underflow-in-blit_comb.patch
|
|||||||
Patch0296: 0296-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch
|
Patch0296: 0296-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch
|
||||||
Patch0297: 0297-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch
|
Patch0297: 0297-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch
|
||||||
Patch0298: 0298-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch
|
Patch0298: 0298-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch
|
||||||
|
Patch0299: 0299-font-Try-opening-fonts-from-the-bundled-memdisk.patch
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
Name: grub2
|
Name: grub2
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 2.06
|
Version: 2.06
|
||||||
Release: 65%{?dist}
|
Release: 66%{?dist}
|
||||||
Summary: Bootloader with support for Linux, Multiboot and more
|
Summary: Bootloader with support for Linux, Multiboot and more
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
URL: http://www.gnu.org/software/grub/
|
URL: http://www.gnu.org/software/grub/
|
||||||
@ -529,6 +529,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Nov 22 2022 Robbie Harwood <rharwood@redhat.com> - 2.06-66
|
||||||
|
- Bundle unicode.pf2 with images
|
||||||
|
- Resolves: #2143725
|
||||||
|
- Resolves: #2144113
|
||||||
|
|
||||||
* Tue Nov 22 2022 Robbie Harwood <rharwood@redhat.com> - 1:2.06-65
|
* Tue Nov 22 2022 Robbie Harwood <rharwood@redhat.com> - 1:2.06-65
|
||||||
- Don't obsolete the tools package with extra/efi (pbrobinson)
|
- Don't obsolete the tools package with extra/efi (pbrobinson)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user