All of lore.kernel.org
 help / color / mirror / Atom feed
* grub themes fail to load due to missing dependencies
@ 2010-03-18  8:06 Mario Vazquez
  2010-04-09 14:38 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 3+ messages in thread
From: Mario Vazquez @ 2010-03-18  8:06 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 756 bytes --]

Grub 1.98 comes with the gfxmenu patch. The code used to include the
entries in 00_header currently only adds the theme name, but nothing
else. Due to either a bug or feature, currently grub do not load
dependencies automatically. This means that when using a theme, it
will not load the image modules or fonts required by the selected
theme, causing it to fail to load at all.

I included a patch that searches the theme directory, and add the
entries just before the theme file.

How to reproduce:
 1. Put a GRUB_THEME entry with your theme in /etc/default/grub.
 2. Generate your grub.cfg with grub-mkconfig
 3. Reboot
 4. The theme will not load at all.

The patch was tested against both grub 1.98 and trunk r2263
https://savannah.gnu.org/bugs/?29251

[-- Attachment #2: gfxmenu-dependencies.patch --]
[-- Type: text/x-patch, Size: 1293 bytes --]

diff -ur grub-1.98.orig/util/grub.d/00_header.in grub-1.98/util/grub.d/00_header.in
--- grub-1.98.orig/util/grub.d/00_header.in	2010-03-12 12:54:12.686589681 -0400
+++ grub-1.98/util/grub.d/00_header.in	2010-03-13 01:55:04.425437673 -0400
@@ -108,6 +108,28 @@
 	&& is_path_readable_by_grub $GRUB_THEME; then
     echo "Found theme: $GRUB_THEME" >&2
     prepare_grub_to_access_device `${grub_probe} --target=device $GRUB_THEME` | sed -e "s/^/  /"
+    theme_dir=`dirname $GRUB_THEME`
+    old_reader="null"
+    # add any font dependency
+    for f in ${theme_dir}/*.pf2 ; do
+        if [ -e $f ] ; then
+            echo "  loadfont (\$root)`make_system_path_relative_to_its_root $f`"
+        fi
+    done 
+    # adding insmod dependencies for images
+    for f in ${theme_dir}/*.{jpg,jpeg,png,tga} ; do
+        if [ -e $f ] ; then
+            case $f in
+                *.png)         reader=png ;;
+                *.tga)         reader=tga ;;
+                *.jpg|*.jpeg)  reader=jpeg ;;
+            esac
+            if [ $old_reader != $reader ] ; then
+               echo "  insmod ${reader}"
+                old_reader=$reader
+            fi
+         fi
+    done 
     cat << EOF
   insmod gfxmenu
   set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`

^ permalink raw reply	[flat|nested] 3+ messages in thread
* RE: grub themes fail to load due to missing dependencies
@ 2010-03-18 16:54 Mario Vazquez
  0 siblings, 0 replies; 3+ messages in thread
From: Mario Vazquez @ 2010-03-18 16:54 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 146 bytes --]

In my previous post the patch was recognized as binary.  Included the
patch with a description entry to see if this time is recognized
correctly.

[-- Attachment #2: gfxmenu-dependencies.patch --]
[-- Type: application/octet-stream, Size: 1374 bytes --]

Description: Adds dependency checking of font and images used by selected theme

diff -ur grub-1.98.orig/util/grub.d/00_header.in grub-1.98/util/grub.d/00_header.in
--- grub-1.98.orig/util/grub.d/00_header.in	2010-03-12 12:54:12.686589681 -0400
+++ grub-1.98/util/grub.d/00_header.in	2010-03-13 01:55:04.425437673 -0400
@@ -108,6 +108,28 @@
 	&& is_path_readable_by_grub $GRUB_THEME; then
     echo "Found theme: $GRUB_THEME" >&2
     prepare_grub_to_access_device `${grub_probe} --target=device $GRUB_THEME` | sed -e "s/^/  /"
+    theme_dir=`dirname $GRUB_THEME`
+    old_reader="null"
+    # add any font dependency
+    for f in ${theme_dir}/*.pf2 ; do
+        if [ -e $f ] ; then
+            echo "  loadfont (\$root)`make_system_path_relative_to_its_root $f`"
+        fi
+    done 
+    # adding insmod dependencies for images
+    for f in ${theme_dir}/*.{jpg,jpeg,png,tga} ; do
+        if [ -e $f ] ; then
+            case $f in
+                *.png)         reader=png ;;
+                *.tga)         reader=tga ;;
+                *.jpg|*.jpeg)  reader=jpeg ;;
+            esac
+            if [ $old_reader != $reader ] ; then
+               echo "  insmod ${reader}"
+                old_reader=$reader
+            fi
+         fi
+    done 
     cat << EOF
   insmod gfxmenu
   set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-04-09 14:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-18  8:06 grub themes fail to load due to missing dependencies Mario Vazquez
2010-04-09 14:38 ` Vladimir 'φ-coder/phcoder' Serbinenko
  -- strict thread matches above, loose matches on Subject: below --
2010-03-18 16:54 Mario Vazquez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.