summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancis Rowe <info@gluglug.org.uk>2015-03-17 12:58:01 (EDT)
committer Francis Rowe <info@gluglug.org.uk>2015-03-17 13:29:34 (EDT)
commitd4a3ecd091d45611a4196a55b43139fad2275238 (patch)
tree4dd6a4b62b79d8b45864bca0d844951d2d35ecb4
parent1c18bf754c4e80f43962310a7f30e0faebf55b62 (diff)
downloadlibreboot-d4a3ecd091d45611a4196a55b43139fad2275238.zip
libreboot-d4a3ecd091d45611a4196a55b43139fad2275238.tar.gz
libreboot-d4a3ecd091d45611a4196a55b43139fad2275238.tar.bz2
GRUB: add vesamenu.c32 support (fixes tails ISOLINUX menu)
Debian ISOLINUX menu is still broken (syslinux_configfile -i just puts you back to the main screen but with the Debian background). (same issue on gnewsense)
-rw-r--r--docs/release.html3
-rw-r--r--resources/grub/config/menuentries/common.cfg12
-rw-r--r--resources/grub/patch/0002-lib-syslinux_parse-add-support-for-vesa-menu.c32.patch (renamed from resources/grub/patch/0002-syslinux_parse-add-support-for-vesa-menu.c32.patch)64
-rw-r--r--resources/grub/patch/0003-syslinux_parse-keep-initrd-in-kernel-the-command-lin.patch65
-rwxr-xr-xresources/scripts/helpers/download/grub21
5 files changed, 43 insertions, 122 deletions
diff --git a/docs/release.html b/docs/release.html
index 12db3df..cfc3628 100644
--- a/docs/release.html
+++ b/docs/release.html
@@ -268,7 +268,8 @@
HIGH PRIORITY! <b>GRUB: Add vesamenu.c32 support to syslinux_configfile (for parsing isolinux menus).
See notes in the GRUB download script.</b>
<ul>
- <li>Patches no longer apply in latest GRUB. Re-base requested.</li>
+
+
</ul>
</li>
</ul>
diff --git a/resources/grub/config/menuentries/common.cfg b/resources/grub/config/menuentries/common.cfg
index f107a6d..7dacc69 100644
--- a/resources/grub/config/menuentries/common.cfg
+++ b/resources/grub/config/menuentries/common.cfg
@@ -33,10 +33,6 @@ menuentry 'Parse ISOLINUX menu (ahci0)' {
syslinux_configfile -i /boot/isolinux/isolinux.cfg
elif [ -f "/boot/syslinux/syslinux.cfg" ] ; then
syslinux_configfile -i /boot/syslinux/syslinux.cfg
- elif [ -f "/menu.cfg" ] ; then
- syslinux_configfile -i /menu.cfg
- elif [ -f "/txt.cfg" ] ; then
- syslinux_configfile -i /txt.cfg
fi
done
}
@@ -54,10 +50,6 @@ menuentry 'Parse ISOLINUX menu (USB)' {
syslinux_configfile -i /boot/isolinux/isolinux.cfg
elif [ -f "/boot/syslinux/syslinux.cfg" ] ; then
syslinux_configfile -i /boot/syslinux/syslinux.cfg
- elif [ -f "/menu.cfg" ] ; then
- syslinux_configfile -i /menu.cfg
- elif [ -f "/txt.cfg" ] ; then
- syslinux_configfile -i /txt.cfg
fi
done
}
@@ -75,10 +67,6 @@ menuentry 'Parse ISOLINUX menu (CD/DVD)' {
syslinux_configfile -i /boot/isolinux/isolinux.cfg
elif [ -f "/boot/syslinux/syslinux.cfg" ] ; then
syslinux_configfile -i /boot/syslinux/syslinux.cfg
- elif [ -f "/menu.cfg" ] ; then
- syslinux_configfile -i /menu.cfg
- elif [ -f "/txt.cfg" ] ; then
- syslinux_configfile -i /txt.cfg
fi
done
}
diff --git a/resources/grub/patch/0002-syslinux_parse-add-support-for-vesa-menu.c32.patch b/resources/grub/patch/0002-lib-syslinux_parse-add-support-for-vesa-menu.c32.patch
index 504b277..69bdde5 100644
--- a/resources/grub/patch/0002-syslinux_parse-add-support-for-vesa-menu.c32.patch
+++ b/resources/grub/patch/0002-lib-syslinux_parse-add-support-for-vesa-menu.c32.patch
@@ -1,17 +1,18 @@
-From c3b8bd878e97fe5c1b1d6409bcecf70f64e63669 Mon Sep 17 00:00:00 2001
+From 191aeee1b67ff30d6c868320a51cb9fb766874be Mon Sep 17 00:00:00 2001
From: Lunar <lunar@torproject.org>
-Date: Sat, 14 Feb 2015 14:14:25 +0100
+Date: Fri, 13 Feb 2015 22:08:11 +0100
Subject: [PATCH] lib/syslinux_parse: add support for (vesa)menu.c32
+Fixes Savannah bug #44238.
---
- grub-core/lib/syslinux_parse.c | 156 ++++++++++++++++++++++++++---------------
- 1 file changed, 98 insertions(+), 58 deletions(-)
+ grub-core/lib/syslinux_parse.c | 165 ++++++++++++++++++++++++++---------------
+ 1 file changed, 107 insertions(+), 58 deletions(-)
diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c
-index 2c874b1..1012f02 100644
+index 22389eb..153260b 100644
--- a/grub-core/lib/syslinux_parse.c
+++ b/grub-core/lib/syslinux_parse.c
-@@ -840,6 +840,74 @@ simplify_filename (char *str)
+@@ -840,6 +840,82 @@ simplify_filename (char *str)
}
static grub_err_t
@@ -19,23 +20,31 @@ index 2c874b1..1012f02 100644
+ struct syslinux_menu *menu,
+ const char *filename, const char *basedir)
+{
-+ grub_err_t err;
-+ char *new_cwd, *new_target_cwd;
++ struct syslinux_menu *menuptr;
++ grub_err_t err = GRUB_ERR_NONE;
++ char *new_cwd = NULL;
++ char *new_target_cwd = NULL;
++ char *newname = NULL;
++ int depth = 0;
+
+ new_cwd = get_read_filename (menu, basedir);
+ if (!new_cwd)
-+ return grub_errno;
++ {
++ err = grub_errno;
++ goto out;
++ }
+ new_target_cwd = get_target_filename (menu, basedir);
+ if (!new_target_cwd)
-+ return grub_errno;
-+
-+ struct syslinux_menu *menuptr;
-+ char *newname;
-+ int depth = 0;
-+
++ {
++ err = grub_errno;
++ goto out;
++ }
+ newname = get_read_filename (menu, filename);
+ if (!newname)
-+ return grub_errno;
++ {
++ err = grub_errno;
++ goto out;
++ }
+ simplify_filename (newname);
+
+ print_string ("#");
@@ -70,23 +79,23 @@ index 2c874b1..1012f02 100644
+ print_string ("# File ");
+ err = print (outbuf, newname, grub_strlen (newname));
+ if (err)
-+ return err;
++ goto out;
+ print_string (" not found\n");
+ }
-+ if (err)
-+ return err;
+ }
++
++ out:
+ grub_free (newname);
+ grub_free (new_cwd);
+ grub_free (new_target_cwd);
-+ return GRUB_ERR_NONE;
++ return err;
+}
+
+static grub_err_t
write_entry (struct output_buffer *outbuf,
struct syslinux_menu *menu,
struct syslinux_menuentry *curentry)
-@@ -1240,6 +1308,35 @@ write_entry (struct output_buffer *outbuf,
+@@ -1227,6 +1303,36 @@ write_entry (struct output_buffer *outbuf,
break;
}
@@ -108,11 +117,12 @@ index 2c874b1..1012f02 100644
+ *end++ = '\0';
+
+ /* "~" is supposed to be current file, so let's skip it */
-+ if (grub_strcmp (ptr, "~") == 0)
-+ continue;
-+ err = print_config (outbuf, menu, ptr, "");
-+ if (err != GRUB_ERR_NONE)
-+ break;
++ if (grub_strcmp (ptr, "~") != 0)
++ {
++ err = print_config (outbuf, menu, ptr, "");
++ if (err != GRUB_ERR_NONE)
++ break;
++ }
+ for (ptr = end; *ptr && grub_isspace (*ptr); ptr++);
+ }
+ err = GRUB_ERR_NONE;
@@ -122,7 +132,7 @@ index 2c874b1..1012f02 100644
/* FIXME: gdb, GFXBoot, Hdt, Ifcpu, Ifplop, Kbdmap,
FIXME: Linux, Lua, Meminfo, rosh, Sanbboot */
-@@ -1252,70 +1349,13 @@ write_entry (struct output_buffer *outbuf,
+@@ -1239,70 +1345,13 @@ write_entry (struct output_buffer *outbuf,
}
case KERNEL_CONFIG:
{
diff --git a/resources/grub/patch/0003-syslinux_parse-keep-initrd-in-kernel-the-command-lin.patch b/resources/grub/patch/0003-syslinux_parse-keep-initrd-in-kernel-the-command-lin.patch
deleted file mode 100644
index 2582e6d..0000000
--- a/resources/grub/patch/0003-syslinux_parse-keep-initrd-in-kernel-the-command-lin.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From c4722dc86c68fda07fe2972d8364465487d64118 Mon Sep 17 00:00:00 2001
-From: Lunar <lunar@torproject.org>
-Date: Sat, 14 Feb 2015 16:50:14 +0100
-Subject: [PATCH] lib/syslinux_parse: keep initrd= in kernel the command line
-
-SYSLINUX parses but does not remove "initrd=..." option from the kernel
-command line. As some distributions (e.g. Tails) rely on its
-presence, let's keep the same behavior.
----
- grub-core/lib/syslinux_parse.c | 24 +++++-------------------
- 1 file changed, 5 insertions(+), 19 deletions(-)
-
-diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c
-index 1012f02..3e58bee 100644
---- a/grub-core/lib/syslinux_parse.c
-+++ b/grub-core/lib/syslinux_parse.c
-@@ -939,6 +939,7 @@ write_entry (struct output_buffer *outbuf,
- char *ptr;
- char *cmdline;
- char *initrd = NULL;
-+ cmdline = grub_strdup(curentry->append);
- for (ptr = curentry->append; ptr && *ptr; ptr++)
- if ((ptr == curentry->append || grub_isspace (ptr[-1]))
- && grub_strncasecmp (ptr, "initrd=", sizeof ("initrd=") - 1)
-@@ -946,33 +947,18 @@ write_entry (struct output_buffer *outbuf,
- break;
- if (ptr && *ptr)
- {
-- char *ptr2;
-- grub_size_t totlen = grub_strlen (curentry->append);
- initrd = ptr + sizeof ("initrd=") - 1;
-- for (ptr2 = ptr; *ptr2 && !grub_isspace (*ptr2); ptr2++);
-- if (*ptr2)
-- {
-- *ptr2 = 0;
-- ptr2++;
-- }
-- cmdline = grub_malloc (totlen + 1 - (ptr2 - ptr));
-- if (!cmdline)
-- return grub_errno;
-- grub_memcpy (cmdline, curentry->append, ptr - curentry->append);
-- grub_memcpy (cmdline + (ptr - curentry->append),
-- ptr2, totlen - (ptr2 - curentry->append));
-- *(cmdline + totlen - (ptr2 - ptr)) = 0;
-+ for (; *ptr && !grub_isspace (*ptr); ptr++);
-+ *ptr = '\0';
- }
-- else
-- cmdline = curentry->append;
- print_string (" if test x$grub_platform = xpc; then "
- "linux_suffix=16; else linux_suffix= ; fi\n");
- print_string (" linux$linux_suffix ");
- print_file (outbuf, menu, curentry->kernel_file, NULL);
- print_string (" ");
-- if (cmdline)
-- print (outbuf, cmdline, grub_strlen (cmdline));
-+ print (outbuf, cmdline, grub_strlen (cmdline));
- print_string ("\n");
-+ grub_free(cmdline);
- if (initrd || curentry->initrds)
- {
- struct initrd_list *lst;
---
-1.9.1
-
diff --git a/resources/scripts/helpers/download/grub b/resources/scripts/helpers/download/grub
index 8497166..d13fc66 100755
--- a/resources/scripts/helpers/download/grub
+++ b/resources/scripts/helpers/download/grub
@@ -53,23 +53,10 @@ git reset --hard fa07d919d1ff868b18d8a42276d094b63a58e299
# Replace "GNU GRUB version" in GRUB screen with "FREE AS IN FREEDOM"
git am "../resources/grub/patch/0001-grub-core-normal-main.c-Display-FREE-AS-IN-FREEDOM-n.patch"
-## See these threads on grub-dev@gnu.org:
-## [bug #44238] Add support for menu.c32 and vesamenu.c32 in lib/syslinux_parse
-## [bug #44239] Behavior of syslinux_parse differs from SYSLINUX for initrd= option
-## These make vesamenu.c32 work (translation: Debian/Tails ISOLINUX) but they are
-## buggy at the moment; Trisquel ISOLINUX parsing fails with these patches, for instance:
-## "error: syntax error.", "error: Incorrect command."
-## The mailing list contains updated versions of the patches mentioned below
-## Work with Lunar^ on IRC on finishing the patch so that it fixes the issue
-## while not causing other regressions. Wait until this is merged in GRUB(upstream).
-# Add support for menu.c32 and vesamenu.c32 in lib/syslinux_parse
-# See https://savannah.gnu.org/bugs/index.php?44238
-# TODO: Remove this patch when it is upstreamed.
-# git am "../resources/grub/patch/0002-syslinux_parse-add-support-for-vesa-menu.c32.patch"
-# Behavior of syslinux_parse differs from SYSLINUX for initrd= option
-# See https://savannah.gnu.org/bugs/index.php?44239
-# TODO: Remove this patch when it is upstreamed.
-# git am "../resources/grub/patch/0003-syslinux_parse-keep-initrd-in-kernel-the-command-lin.patch"
+# See 0002-lib-syslinux_parse-add-support-for-vesa-menu.c32.patch
+# report back to Lunar^ if it works properly. The other patch was already merged in an improved version
+# https://people.torproject.org/~lunar/volatile/2015-03-17-e3Yp1d7FifQ/0001-lib-syslinux_parse-add-support-for-vesa-menu.c32.patch
+git am "../resources/grub/patch/0002-lib-syslinux_parse-add-support-for-vesa-menu.c32.patch"
cd ../
printf "\n\n"