From 62fa042a17846f1619f257f878b928364d96b3a8 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 31 Oct 2021 00:54:53 +0100 Subject: re-add grub backgrounds and update grub. mitigate missing characters mitigate missing characters in unifont for border/arrow characters. this saves space because now it is no longer necessary to add a custom font the background added has the libreboot logo on it, and it's 10kb in size unlike the old gnulove background that was hundreds of KB --- ...ok21-Set-default-VRAM-to-64MiB-instead-of.patch | 23 ------ resources/grub/background/COPYING | 3 + resources/grub/background/background1024x768.png | Bin 0 -> 10274 bytes resources/grub/background/background1280x800.png | Bin 0 -> 12221 bytes resources/grub/config/grub.cfg | 8 ++ ...ub-s-missing-characters-for-borders-arrow.patch | 90 +++++++++++++++++++++ ...ree-as-in-freedom-instead-of-grub-version.patch | 25 ++++++ resources/scripts/build/boot/roms_helper | 8 ++ resources/scripts/download/grub | 5 +- 9 files changed, 138 insertions(+), 24 deletions(-) delete mode 100644 resources/coreboot/default/patches/0004-apple-macbook21-Set-default-VRAM-to-64MiB-instead-of.patch create mode 100644 resources/grub/background/COPYING create mode 100644 resources/grub/background/background1024x768.png create mode 100644 resources/grub/background/background1280x800.png create mode 100644 resources/grub/patches/0001-mitigate-grub-s-missing-characters-for-borders-arrow.patch create mode 100644 resources/grub/patches/0002-display-free-as-in-freedom-instead-of-grub-version.patch diff --git a/resources/coreboot/default/patches/0004-apple-macbook21-Set-default-VRAM-to-64MiB-instead-of.patch b/resources/coreboot/default/patches/0004-apple-macbook21-Set-default-VRAM-to-64MiB-instead-of.patch deleted file mode 100644 index 38f57332..00000000 --- a/resources/coreboot/default/patches/0004-apple-macbook21-Set-default-VRAM-to-64MiB-instead-of.patch +++ /dev/null @@ -1,23 +0,0 @@ -From d983a2fdd6434792ea03c6c83c0585b0e403cf31 Mon Sep 17 00:00:00 2001 -From: Leah Rowe -Date: Fri, 19 Mar 2021 05:54:58 +0000 -Subject: [PATCH 04/19] apple/macbook21: Set default VRAM to 64MiB instead of - 8MiB - ---- - src/mainboard/apple/macbook21/cmos.default | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/mainboard/apple/macbook21/cmos.default b/src/mainboard/apple/macbook21/cmos.default -index cf1bc4566e..dc0df3b6d6 100644 ---- a/src/mainboard/apple/macbook21/cmos.default -+++ b/src/mainboard/apple/macbook21/cmos.default -@@ -5,4 +5,4 @@ boot_devices='' - boot_default=0x40 - cmos_defaults_loaded=Yes - lpt=Enable --gfx_uma_size=8M -+gfx_uma_size=64M --- -2.25.1 - diff --git a/resources/grub/background/COPYING b/resources/grub/background/COPYING new file mode 100644 index 00000000..9a5f81c6 --- /dev/null +++ b/resources/grub/background/COPYING @@ -0,0 +1,3 @@ +The deer logo for Libreboot is copyright 2014 Marcus Moeller and released under +CC-0: https://creativecommons.org/publicdomain/zero/1.0/legalcode +The grey backgrounds with it were made by Leah Rowe in 2016, also CC-0 diff --git a/resources/grub/background/background1024x768.png b/resources/grub/background/background1024x768.png new file mode 100644 index 00000000..10a1cb3f Binary files /dev/null and b/resources/grub/background/background1024x768.png differ diff --git a/resources/grub/background/background1280x800.png b/resources/grub/background/background1280x800.png new file mode 100644 index 00000000..990236d2 Binary files /dev/null and b/resources/grub/background/background1280x800.png differ diff --git a/resources/grub/config/grub.cfg b/resources/grub/config/grub.cfg index b4d222cb..7d889989 100644 --- a/resources/grub/config/grub.cfg +++ b/resources/grub/config/grub.cfg @@ -23,6 +23,14 @@ terminal_output --append cbmemc gfxpayload=keep terminal_output --append gfxterm +if [ -f (cbfsdisk)/background.png ]; then + insmod png + background_image (cbfsdisk)/background.png +elif [ -f (cbfsdisk)/background.jpg ]; then + insmod jpeg + background_image (cbfsdisk)/background.jpg +fi + # Default to first option, automatically boot after 1 second set default="0" set timeout=10 diff --git a/resources/grub/patches/0001-mitigate-grub-s-missing-characters-for-borders-arrow.patch b/resources/grub/patches/0001-mitigate-grub-s-missing-characters-for-borders-arrow.patch new file mode 100644 index 00000000..5e472231 --- /dev/null +++ b/resources/grub/patches/0001-mitigate-grub-s-missing-characters-for-borders-arrow.patch @@ -0,0 +1,90 @@ +From 2abd6ada3fbd6a782346354b8fe47477463162fb Mon Sep 17 00:00:00 2001 +From: Leah Rowe +Date: Sun, 31 Oct 2021 03:47:05 +0000 +Subject: [PATCH 1/2] mitigate grub's missing characters for borders/arrow + characters + +This cleans up the display on the main screen in GRUB. + +Just don't draw a border, at all. +--- + grub-core/normal/menu_text.c | 49 ++---------------------------------- + 1 file changed, 2 insertions(+), 47 deletions(-) + +diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c +index 18240e76c..4d6282b43 100644 +--- a/grub-core/normal/menu_text.c ++++ b/grub-core/normal/menu_text.c +@@ -108,47 +108,6 @@ grub_print_message_indented (const char *msg, int margin_left, int margin_right, + grub_print_message_indented_real (msg, margin_left, margin_right, term, 0); + } + +-static void +-draw_border (struct grub_term_output *term, const struct grub_term_screen_geometry *geo) +-{ +- int i; +- +- grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL); +- +- grub_term_gotoxy (term, (struct grub_term_coordinate) { geo->first_entry_x - 1, +- geo->first_entry_y - 1 }); +- grub_putcode (GRUB_UNICODE_CORNER_UL, term); +- for (i = 0; i < geo->entry_width + 1; i++) +- grub_putcode (GRUB_UNICODE_HLINE, term); +- grub_putcode (GRUB_UNICODE_CORNER_UR, term); +- +- for (i = 0; i < geo->num_entries; i++) +- { +- grub_term_gotoxy (term, (struct grub_term_coordinate) { geo->first_entry_x - 1, +- geo->first_entry_y + i }); +- grub_putcode (GRUB_UNICODE_VLINE, term); +- grub_term_gotoxy (term, +- (struct grub_term_coordinate) { geo->first_entry_x + geo->entry_width + 1, +- geo->first_entry_y + i }); +- grub_putcode (GRUB_UNICODE_VLINE, term); +- } +- +- grub_term_gotoxy (term, +- (struct grub_term_coordinate) { geo->first_entry_x - 1, +- geo->first_entry_y - 1 + geo->num_entries + 1 }); +- grub_putcode (GRUB_UNICODE_CORNER_LL, term); +- for (i = 0; i < geo->entry_width + 1; i++) +- grub_putcode (GRUB_UNICODE_HLINE, term); +- grub_putcode (GRUB_UNICODE_CORNER_LR, term); +- +- grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL); +- +- grub_term_gotoxy (term, +- (struct grub_term_coordinate) { geo->first_entry_x - 1, +- (geo->first_entry_y - 1 + geo->num_entries +- + GRUB_TERM_MARGIN + 1) }); +-} +- + static int + print_message (int nested, int edit, struct grub_term_output *term, int dry_run) + { +@@ -167,10 +126,8 @@ command-line or ESC to discard edits and return to the GRUB menu."), + { + char *msg_translated; + +- msg_translated = grub_xasprintf (_("Use the %C and %C keys to select which " +- "entry is highlighted."), +- GRUB_UNICODE_UPARROW, +- GRUB_UNICODE_DOWNARROW); ++ msg_translated = grub_xasprintf (_("Use the arrow keys to select which " ++ "entry is highlighted.")); + if (!msg_translated) + return 0; + ret += grub_print_message_indented_real (msg_translated, STANDARD_MARGIN, +@@ -410,8 +367,6 @@ grub_menu_init_page (int nested, int edit, + + grub_term_normal_color = grub_color_menu_normal; + grub_term_highlight_color = grub_color_menu_highlight; +- if (geo->border) +- draw_border (term, geo); + grub_term_normal_color = old_color_normal; + grub_term_highlight_color = old_color_highlight; + geo->timeout_y = geo->first_entry_y + geo->num_entries +-- +2.25.1 + diff --git a/resources/grub/patches/0002-display-free-as-in-freedom-instead-of-grub-version.patch b/resources/grub/patches/0002-display-free-as-in-freedom-instead-of-grub-version.patch new file mode 100644 index 00000000..ef8eef7e --- /dev/null +++ b/resources/grub/patches/0002-display-free-as-in-freedom-instead-of-grub-version.patch @@ -0,0 +1,25 @@ +From f1f995a20cd246448881b4ee23375d25baf89a9e Mon Sep 17 00:00:00 2001 +From: Leah Rowe +Date: Sun, 31 Oct 2021 03:49:26 +0000 +Subject: [PATCH 2/2] display free as in freedom instead of grub version + +--- + grub-core/normal/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +index c4ebe9e22..6784d4154 100644 +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -209,7 +209,7 @@ grub_normal_init_page (struct grub_term_output *term, + + grub_term_cls (term); + +- msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION); ++ msg_formatted = grub_xasprintf (_("FREE AS IN FREEDOM")); + if (!msg_formatted) + return; + +-- +2.25.1 + diff --git a/resources/scripts/build/boot/roms_helper b/resources/scripts/build/boot/roms_helper index 77cc9f15..a4d5ff32 100755 --- a/resources/scripts/build/boot/roms_helper +++ b/resources/scripts/build/boot/roms_helper @@ -347,6 +347,14 @@ make_grubrom_from_keymap() { "${cbfstool_path}" "${tmprom}" add -f "${grubcfg}" -n grub.cfg -t raw "${cbfstool_path}" "${tmprom}" add -f "${grubtestcfg}" -n grubtest.cfg -t raw + backgroundfile="background1280x800.png" + if [ "${board}" = "x60" ] || [ "${board}" = "t60_intelgpu" ]; then + # TODO: don't hardcode this check. do it in board.cfg per board + backgroundfile="background1024x768.png" + fi + backgroundfile="resources/grub/background/${backgroundfile}" + "${cbfstool_path}" "${tmprom}" add -f ${backgroundfile} -n background.png -t raw + printf "%s\n" "${tmprom}" } diff --git a/resources/scripts/download/grub b/resources/scripts/download/grub index e5a448b3..47c75bc1 100755 --- a/resources/scripts/download/grub +++ b/resources/scripts/download/grub @@ -43,7 +43,10 @@ fi # modifications are required cd "grub/" # reset to known revision -git reset --hard c0e647eb0e2bd09315612446cb4d90f7f75cb44c +git reset --hard 50aace6bdb918150ba47e3c16146dcca271c134a +for grubpatch in ../resources/grub/patches/*; do + git am "${grubpatch}" +done git clone git://git.sv.gnu.org/gnulib gnulib cd gnulib/ -- cgit v1.2.1