File grub-long-commandline of Package trustedgrub

Gentoo bug #183443, #216307
Upstream: http://savannah.gnu.org/bugs/?13606

Support commandlines with >255 characters. Common in manual netboot and
root-on-iSCSI setups. Usable for kernels >2.6.21_rc1


Acked-by: Bernhard Walle <bwalle@suse.de>

---
 stage2/boot.c   |   11 ++++++++++-
 stage2/shared.h |    4 +++-
 2 files changed, 13 insertions(+), 2 deletions(-)

Index: TrustedGRUB-1.1.3/stage2/boot.c
===================================================================
--- TrustedGRUB-1.1.3.orig/stage2/boot.c
+++ TrustedGRUB-1.1.3/stage2/boot.c
@@ -512,7 +512,7 @@ load_image (char *kernel, char *arg, ker
 	    }
 
 	  if (lh->version >= 0x0202)
-	    lh->cmd_line_ptr = linux_data_real_addr + LINUX_CL_OFFSET;
+	    lh->cmd_line_ptr = linux_data_real_addr + LINUX_CL_0202_PRM_OFFSET;
 	  else
 	    {
 	      lh->cl_magic = LINUX_CL_MAGIC;
@@ -682,6 +682,15 @@ load_image (char *kernel, char *arg, ker
 	    while (dest < linux_data_tmp_addr + LINUX_CL_END_OFFSET && *src)
 	      *(dest++) = *(src++);
 	
+	    {
+	    char *src = skip_to (0, arg);
+	    char *dest = linux_data_tmp_addr + LINUX_CL_0202_PRM_OFFSET;
+
+	    while (dest < linux_data_tmp_addr + LINUX_CL_0202_PRM_END_OFFSET && *src)
+	      *(dest++) = *(src++);
+	    *dest = 0;
+	    }
+
 	    /* Old Linux kernels have problems determining the amount of
 	       the available memory.  To work around this problem, we add
 	       the "mem" option to the kernel command line.  This has its
Index: TrustedGRUB-1.1.3/stage2/shared.h
===================================================================
--- TrustedGRUB-1.1.3.orig/stage2/shared.h
+++ TrustedGRUB-1.1.3/stage2/shared.h
@@ -176,7 +176,9 @@ extern char *grub_scratch_mem;
 
 #define LINUX_CL_OFFSET			0x9000
 #define LINUX_CL_END_OFFSET		0x90FF
-#define LINUX_SETUP_MOVE_SIZE		0x9100
+#define LINUX_CL_0202_PRM_OFFSET	0x9500
+#define LINUX_CL_0202_PRM_END_OFFSET	0x9FFF
+#define LINUX_SETUP_MOVE_SIZE		0xA000
 #define LINUX_CL_MAGIC			0xA33F
 
 /*
openSUSE Build Service is sponsored by