rpms/grub/devel 0001-Get-rid-of-usr-bin-cmp-dependency.patch, NONE, 1.1 0002-Add-strspn-strcspn-and-strtok_r.patch, NONE, 1.1 0003-Allow-passing-multiple-image-files-to-the-initrd-com.patch, NONE, 1.1 0004-Obey-2.06-boot-protocol-s-cmdline_size.patch, NONE, 1.1 grub.spec, 1.77, 1.78

Lubomir Rintel lkundrak at fedoraproject.org
Sun Jan 11 13:08:29 UTC 2009


Author: lkundrak

Update of /cvs/pkgs/rpms/grub/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv21355

Modified Files:
	grub.spec 
Added Files:
	0001-Get-rid-of-usr-bin-cmp-dependency.patch 
	0002-Add-strspn-strcspn-and-strtok_r.patch 
	0003-Allow-passing-multiple-image-files-to-the-initrd-com.patch 
	0004-Obey-2.06-boot-protocol-s-cmdline_size.patch 
Log Message:
* Sun Jan 11 2009 Lubomir Rintel <lkundrak at v3.sk> - 0.97-37
- Get rid of /usr/bin/cmp dependency (Ville Skyttä, #431351)
- Support multiple initrds (Jeff Layton, #179127)
- Obey 2.06 boot protocol's cmdline_size (Lubomir Rintel, #327541)


0001-Get-rid-of-usr-bin-cmp-dependency.patch:

--- NEW FILE 0001-Get-rid-of-usr-bin-cmp-dependency.patch ---
>From 25a07e29651d771c6d86ab94ea9489f7475c5b48 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ville=20Skytt=C3=A4?= <ville.skytta at iki.fi>
Date: Sun, 11 Jan 2009 11:50:11 +0100
Subject: [PATCH] Get rid of /usr/bin/cmp dependency

Looks like it would be easy to get rid of the diffutils dependency in grub,
patch attached.

More discussion at
http://www.redhat.com/archives/fedora-devel-list/2008-January/msg02881.html

Bug Report: https://bugzilla.redhat.com/show_bug.cgi?id=431351
---
 util/grub-install.in |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/util/grub-install.in b/util/grub-install.in
index 5ceb77d..24e4490 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -597,9 +597,14 @@ for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do
     while test $count -gt 0; do
         dump_boot_block $root_drive $img_file
         if grep "Error [0-9]*: " $log_file >/dev/null; then
-    	:
-        elif cmp $file $img_file >/dev/null; then
-    	break
+            :
+        else
+            # Use sha1sum instead of cmp to avoid a dependency on diffutils.
+            sha1=`sha1sum $file | cut -d' ' -f 1`
+            sha2=`sha1sum $img_file | cut -d' ' -f 1`
+            if test -f $file -a -f $img_file -a "$sha1" = "$sha2"; then
+                break
+            fi
         fi
         sleep 1
         count=`expr $count - 1`    
-- 
1.5.5.6


0002-Add-strspn-strcspn-and-strtok_r.patch:

--- NEW FILE 0002-Add-strspn-strcspn-and-strtok_r.patch ---
>From 45286d4ad7d54adc8d9d06dd3382912b5bee6845 Mon Sep 17 00:00:00 2001
From: Jeff Layton <jlayton at redhat.com>
Date: Sun, 11 Jan 2009 11:55:35 +0100
Subject: [PATCH] Add strspn, strcspn, and strtok_r

This adds strspn, strcspn, and strtok_r to char_io.c. This is to support the
parsing of multiple options on the initrd commandline.

These were "borrowed" from dietlibc with some small changes.

Bug Report: https://bugzilla.redhat.com/show_bug.cgi?id=179127
---
 stage2/char_io.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 stage2/shared.h  |    7 ++++++-
 2 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/stage2/char_io.c b/stage2/char_io.c
index 7a67289..9b67c0d 100644
--- a/stage2/char_io.c
+++ b/stage2/char_io.c
@@ -1363,6 +1363,57 @@ grub_strlen (const char *str)
 
   return len;
 }
+
+/* this function "borrowed" from dietlibc */
+int
+grub_strspn(const char *s, const char *accept)
+{
+  int l=0;
+  int a=1,i,al=grub_strlen(accept);
+
+  while((a)&&(*s))
+  {
+    for(a=i=0;(!a)&&(i<al);i++)
+      if (*s==accept[i]) a=1;
+    if (a) l++;
+    s++;
+  }
+  return l;
+}
+
+/* this function "borrowed" from dietlibc */
+int
+grub_strcspn(const char *s, const char *reject)
+{
+  int l=0;
+  int a=1,i,al=grub_strlen(reject);
+
+  while((a)&&(*s))
+  {
+    for(i=0;(a)&&(i<al);i++)
+      if (*s==reject[i]) a=0;
+    if (a) l++;
+    s++;
+  }
+  return l;
+}
+
+/* this function "borrowed" from dietlibc */
+char *
+grub_strtok_r(char *s, const char *delim, char **ptrptr) {
+  char *tmp=0;
+
+  if (s==0) s=*ptrptr;
+  s+=grub_strspn(s,delim);           /* overread leading delimiter */
+  if (*s) {
+    tmp=s;
+    s+=grub_strcspn(s,delim);
+    if (*s) *s++=0;   /* not the end ? => terminate it */
+  }
+  *ptrptr=s;
+  return tmp;
+}
+
 #endif /* ! STAGE1_5 */
 
 #ifdef GRUB_UTIL
diff --git a/stage2/shared.h b/stage2/shared.h
index 1be7ab1..93f586f 100644
--- a/stage2/shared.h
+++ b/stage2/shared.h
@@ -375,9 +375,11 @@ extern void *grub_scratch_mem;
 #define tolower grub_tolower
 #define strlen grub_strlen
 #define strcpy grub_strcpy
+#define strspn grub_strspn
+#define strcspn grub_strcspn
+#define strtok_r grub_strtok_r
 #endif /* WITHOUT_LIBC_STUBS */
 
-
 #ifndef ASM_FILE
 /*
  *  Below this should be ONLY defines and other constructs for C code.
@@ -899,6 +901,9 @@ int grub_memcmp (const char *s1, const char *s2, int n);
 int grub_strcmp (const char *s1, const char *s2);
 int grub_strlen (const char *str);
 char *grub_strcpy (char *dest, const char *src);
+int grub_strspn(const char *s, const char *accept);
+int grub_strcspn(const char *s, const char *reject);
+char *grub_strtok_r(char *s, const char *delim, char **ptrptr);
 
 #ifndef GRUB_UTIL
 typedef unsigned long grub_jmp_buf[8];
-- 
1.5.5.6


0003-Allow-passing-multiple-image-files-to-the-initrd-com.patch:

--- NEW FILE 0003-Allow-passing-multiple-image-files-to-the-initrd-com.patch ---
>From 4d0a7b6087a228c60cd85d9360bb47f62773fefd Mon Sep 17 00:00:00 2001
From: Jeff Layton <jlayton at redhat.com>
Date: Sun, 11 Jan 2009 11:56:35 +0100
Subject: [PATCH] Allow passing multiple image files to the initrd command

This patch allows you to pass multiple image files to the kernel by adding more
than one filename to the initrd parameter. i.e.:

initrd /initramfs-image1.gz /initramfs-image2.gz

Bug Report: https://bugzilla.redhat.com/show_bug.cgi?id=179127
---
 stage2/boot.c |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/stage2/boot.c b/stage2/boot.c
index ec25acf..eee8bb1 100644
--- a/stage2/boot.c
+++ b/stage2/boot.c
@@ -814,7 +814,8 @@ load_initrd (char *initrd)
 #endif
   return grub_load_initrd (initrd);
 #else
-  int len;
+  int len, next_addr;
+  char *singleimage, *pos;
   unsigned long moveto;
   unsigned long max_addr;
   struct linux_kernel_header *lh
@@ -823,16 +824,24 @@ load_initrd (char *initrd)
 #ifndef NO_DECOMPRESSION
   no_decompression = 1;
 #endif
-  
-  if (! grub_open (initrd))
-    goto fail;
+  len = 0;
+  next_addr = cur_addr;
 
-  len = grub_read ((char *) cur_addr, -1);
-  if (! len)
-    {
-      grub_close ();
-      goto fail;
-    }
+  /* loop over all initrd images and concatenate them in memory */
+  singleimage = strtok_r(initrd," \t",&pos);
+  while (singleimage) {
+    if (! grub_open (singleimage))
+      continue;
+
+    len += grub_read ((char *) next_addr, -1);
+    grub_close ();
+
+    next_addr = cur_addr + len;
+    singleimage = strtok_r(NULL," \t",&pos);
+  }
+
+  if (!len)
+    goto fail;
 
   if (linux_mem_size)
     moveto = linux_mem_size;
@@ -862,7 +871,6 @@ load_initrd (char *initrd)
   lh->ramdisk_image = RAW_ADDR (moveto);
   lh->ramdisk_size = len;
 
-  grub_close ();
 
  fail:
   
-- 
1.5.5.6


0004-Obey-2.06-boot-protocol-s-cmdline_size.patch:

--- NEW FILE 0004-Obey-2.06-boot-protocol-s-cmdline_size.patch ---
>From cbb7e3d28164467b104814484965d30333d529ba Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak at v3.sk>
Date: Sun, 11 Jan 2009 12:04:10 +0100
Subject: [PATCH] Obey 2.06 boot protocol's cmdline_size

This increases the limit for the command line according to kernel's
setting, up to 0x7FF characters. This limit was chosen because it
matches current kernel's limitation and doesn't need substantial
change in memory layout, consuming only spare space (and leaving
once as much bytes spare for possible future expansion).

Bug Report: https://bugzilla.redhat.com/attachment.cgi?id=327541
---
 stage2/boot.c   |   13 +++++++++++--
 stage2/shared.h |    7 +++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/stage2/boot.c b/stage2/boot.c
index eee8bb1..2267721 100644
--- a/stage2/boot.c
+++ b/stage2/boot.c
@@ -228,6 +228,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
     {
       int big_linux = 0;
       int setup_sects = lh->setup_sects;
+      int cmdline_size = 0xff;
 
       if (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0200)
 	{
@@ -255,6 +256,14 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
 	      lh->cl_offset = LINUX_CL_OFFSET;
 	      lh->setup_move_size = LINUX_SETUP_MOVE_SIZE;
 	    }
+
+	  if (lh->version >= 0x0206)
+	    {
+	      cmdline_size = lh->cmdline_size;
+	      if (cmdline_size > (LINUX_CL_END_OFFSET - LINUX_CL_OFFSET))
+		cmdline_size = LINUX_CL_END_OFFSET - LINUX_CL_OFFSET;
+	    }
+
 	}
       else
 	{
@@ -411,7 +420,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
 	    char *src = skip_to (0, arg);
 	    char *dest = linux_data_tmp_addr + LINUX_CL_OFFSET;
 	
-	    while (dest < linux_data_tmp_addr + LINUX_CL_END_OFFSET && *src)
+	    while (dest < linux_data_tmp_addr + LINUX_CL_OFFSET + cmdline_size && *src)
 	      *(dest++) = *(src++);
 	
 	    /* Old Linux kernels have problems determining the amount of
@@ -432,7 +441,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
 	    if (! grub_strstr (arg, "mem=")
 		&& ! (load_flags & KERNEL_LOAD_NO_MEM_OPTION)
 		&& lh->version < 0x0203		/* kernel version < 2.4.18 */
-		&& dest + 15 < linux_data_tmp_addr + LINUX_CL_END_OFFSET)
+		&& dest + 15 < linux_data_tmp_addr + LINUX_CL_OFFSET + cmdline_size)
 	      {
 		*dest++ = ' ';
 		*dest++ = 'm';
diff --git a/stage2/shared.h b/stage2/shared.h
index 93f586f..49711af 100644
--- a/stage2/shared.h
+++ b/stage2/shared.h
@@ -162,8 +162,8 @@ extern void *grub_scratch_mem;
 #define LINUX_VID_MODE_ASK		0xFFFD
 
 #define LINUX_CL_OFFSET			0x9000
-#define LINUX_CL_END_OFFSET		0x90FF
-#define LINUX_SETUP_MOVE_SIZE		0x9100
+#define LINUX_CL_END_OFFSET		0x97FF
+#define LINUX_SETUP_MOVE_SIZE		0x9800
 #define LINUX_CL_MAGIC			0xA33F
 
 /*
@@ -423,6 +423,9 @@ struct linux_kernel_header
   unsigned short pad1;			/* Unused */
   char *cmd_line_ptr;			/* Points to the kernel command line */
   unsigned int initrd_addr_max;		/* The highest address of initrd */
+  unsigned int kernel_alignment;	/* Physical addr alignment required for kernel */
+  unsigned int relocatable_kernel;	/* Whether kernel is relocatable or not */
+  unsigned int cmdline_size;		/* Maximum size of the kernel command line */
 } __attribute__ ((packed));
 
 /* Memory map address range descriptor used by GET_MMAP_ENTRY. */
-- 
1.5.5.6



Index: grub.spec
===================================================================
RCS file: /cvs/pkgs/rpms/grub/devel/grub.spec,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- grub.spec	22 Oct 2008 20:50:06 -0000	1.77
+++ grub.spec	11 Jan 2009 13:07:58 -0000	1.78
@@ -1,25 +1,36 @@
 Name: grub
 Version: 0.97
-Release: 36%{?dist}
-Summary: GRUB - the Grand Unified Boot Loader.
+Release: 37%{?dist}
+Summary: Grand Unified Boot Loader
 Group: System Environment/Base
 License: GPLv2+
 
 ExclusiveArch: i386 x86_64 ia64
 BuildRequires: binutils >= 2.9.1.0.23, ncurses-devel, ncurses-static, texinfo
 BuildRequires: autoconf /usr/lib/crt1.o automake gnu-efi >= 3.0e-2
-PreReq: /sbin/install-info
+Requires(post): /sbin/install-info
+Requires(preun): /sbin/install-info
 Requires: mktemp
-Requires: /usr/bin/cmp
 Requires: system-logos
-BuildRoot: %{_tmppath}/%{name}-%{version}-root
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 URL: http://www.gnu.org/software/%{name}/
 Source0: ftp://alpha.gnu.org/gnu/%{name}/%{name}-%{version}.tar.gz
+
+# This is from
+# http://git.kernel.org/?p=boot/grub-fedora/grub-fedora.git;a=summary
 Patch0: grub-fedora-9.patch
+
 Patch1: grub-keystatus.patch
 Patch2: grub-chainloader-timeout.patch
 
+# Various bugfixes
+# http://fedorapeople.org/~lkundrak/grub-fedora.git/
+Patch1001: 0001-Get-rid-of-usr-bin-cmp-dependency.patch
+Patch1002: 0002-Add-strspn-strcspn-and-strtok_r.patch
+Patch1003: 0003-Allow-passing-multiple-image-files-to-the-initrd-com.patch
+Patch1004: 0004-Obey-2.06-boot-protocol-s-cmdline_size.patch
+
 %description
 GRUB (Grand Unified Boot Loader) is an experimental boot loader
 capable of booting into most free operating systems - Linux, FreeBSD,
@@ -31,6 +42,10 @@
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch1001 -p1
+%patch1002 -p1
+%patch1003 -p1
+%patch1004 -p1
 
 %build
 autoreconf
@@ -93,6 +108,11 @@
 %{_datadir}/grub
 
 %changelog
+* Sun Jan 11 2009 Lubomir Rintel <lkundrak at v3.sk> - 0.97-37
+- Get rid of /usr/bin/cmp dependency (Ville Skyttä, #431351)
+- Support multiple initrds (Jeff Layton, #179127)
+- Obey 2.06 boot protocol's cmdline_size (Lubomir Rintel, #327541)
+
 * Wed Oct 22 2008 Peter Jones <pjones at redhat.com> - 0.97-36
 - Add force-chainloader patch from rstrode (rhbz #458576)
 




More information about the fedora-extras-commits mailing list