aboutsummaryrefslogtreecommitdiff
path: root/resources/grub/patch/0003-syslinux_parse-keep-initrd-in-kernel-the-command-lin.patch
diff options
context:
space:
mode:
Diffstat (limited to 'resources/grub/patch/0003-syslinux_parse-keep-initrd-in-kernel-the-command-lin.patch')
-rw-r--r--resources/grub/patch/0003-syslinux_parse-keep-initrd-in-kernel-the-command-lin.patch65
1 files changed, 65 insertions, 0 deletions
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
new file mode 100644
index 00000000..2582e6da
--- /dev/null
+++ b/resources/grub/patch/0003-syslinux_parse-keep-initrd-in-kernel-the-command-lin.patch
@@ -0,0 +1,65 @@
+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
+