pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

sysutils/grub: will not boot with >= 2GB RAM [patch]



I discovered that the GRUB shipped in pkgsrc does not boot on systems
with >= 2GB RAM.  Apparently this is a known issue and a bug with a
patch has been filed with GNU several years ago[1]  but they haven't
done anything about it.  Other distributions like Debian have applied
this patch to their packages, but pkgsrc has not.

A GRUB boot CD made with the stage2_eltorito from pkgsrc GRUB fails to
boot on machines with large memory, giving the message "Error 28
Selected item cannot fit into memory" when attempting to load a
kernel.  If I enable the "OS Install Mode" in the BIOS, which limits
the available memory to 256MB, it works fine.  Also, using the
stage2_eltorito from Debian works.  Looking through the Debian
changelog [2], I saw this:
====
* patches/2gb_limit.diff: New.  Fix problem with systems with more than
    2 GB memory (notably, x86_64-based systems).  Thanks Goswin Brederlow.
====

I adapted the 2gb_limit.diff from the Debian source package into
pkgsrc, with the patch listed further in this message.  I did this my
running "make patch" on a cleaned directory, and then applying the
2gb_limit.diff in the work directory, and running mkpatches (from
pkgdiff) to generate new patches.  Hopefully they are in the right
format.  It changes patches/patch-ae and creates a new patch,
patch-an.  distinfo has been updated, but I did not bump pkgrevision
in the Makefile, as I'm not sure what the policy on that is.

With this patch, GRUB works correctly.

I will also submit a PR if that is necessary; please let me know if so.


Thanks,

Andrew Daugherity

[1] http://savannah.gnu.org/bugs/?9954
[2] 
http://packages.debian.org/changelogs/pool/main/g/grub/grub_0.97-27/changelog

patch follows:
====

Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/grub/distinfo,v
retrieving revision 1.22
diff -u -r1.22 distinfo
--- distinfo    25 Jun 2007 13:05:56 -0000      1.22
+++ distinfo    3 Jul 2007 20:58:10 -0000
@@ -7,7 +7,7 @@
SHA1 (patch-ab) = 945ee0385d82f4ea98e86acfa449bcbf2a214285
SHA1 (patch-ac) = dc7774a09ca88f6696e0680a7be39df56244eedc
SHA1 (patch-ad) = 613e915a015ad22c9bd5712d416e12b1b81fdb93
-SHA1 (patch-ae) = 96d8283e90ceb3e887ba0ada05619858c52bc144
+SHA1 (patch-ae) = 25f69804577c6b57bb9dfba80d3c5d26404a6910
SHA1 (patch-af) = 9447ead52940203c998afb67e38ae3d3d26097f8
SHA1 (patch-ag) = 1dd709652d457ba03dda47b64d22cd9320f81e26
SHA1 (patch-ah) = ff62b64177a0e68400c32e013cb585526db94217
@@ -16,3 +16,4 @@
SHA1 (patch-ak) = 8e67eb603e639ca47536cb191e7e29ec48b95642
SHA1 (patch-al) = 58761e867ff182ad46c42b15575395ba8c38fbd6
SHA1 (patch-am) = d848f67f7f21fa076751d14bd3235ae7351be1b7
+SHA1 (patch-an) = 7f6ed0645de3b6f49fc9f5dbbc085ea5fdf41f63
Index: patches/patch-ae
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/grub/patches/patch-ae,v
retrieving revision 1.3
diff -u -r1.3 patch-ae
--- patches/patch-ae    21 Aug 2005 15:08:46 -0000      1.3
+++ patches/patch-ae    3 Jul 2007 20:58:10 -0000
@@ -1,8 +1,17 @@
$NetBSD: patch-ae,v 1.3 2005/08/21 15:08:46 jmmv Exp $

---- stage2/shared.h    2004-06-19 18:40:09.000000000 +0200
-+++ stage2/shared.h    2005-07-25 21:33:19.000000000 +0200
-@@ -975,6 +975,8 @@
+--- stage2/shared.h.orig       2007-07-03 15:46:16.000000000 -0500
++++ stage2/shared.h
+@@ -911,7 +911,7 @@ int substring (const char *s1, const cha
+ int nul_terminate (char *str);
+ int get_based_digit (int c, int base);
+ int safe_parse_maxint (char **str_ptr, int *myint_ptr);
+-int memcheck (int start, int len);
++int memcheck (unsigned long int start, unsigned long int len);
+ void grub_putstr (const char *str);
+
+ #ifndef NO_DECOMPRESSION
+@@ -975,6 +975,8 @@ void copy_current_part_entry (char *buf)
 #ifndef STAGE1_5
 void bsd_boot (kernel_t type, int bootdev, char *arg)
      __attribute__ ((noreturn));
--- /dev/null   2007-07-03 15:58:10.000000000 -0500
+++ patches/patch-an    2007-07-03 15:56:44.000000000 -0500
@@ -0,0 +1,31 @@
+$NetBSD$
+
+--- stage2/char_io.c.orig      2007-07-03 11:09:58.000000000 -0500
++++ stage2/char_io.c
+@@ -1175,13 +1175,13 @@ grub_strlen (const char *str)
+ #endif /* ! STAGE1_5 */
+
+ int
+-memcheck (int addr, int len)
++memcheck (unsigned long int addr, unsigned long int len)
+ {
+ #ifdef GRUB_UTIL
+-  auto int start_addr (void);
+-  auto int end_addr (void);
++  auto unsigned long int start_addr (void);
++  auto int unsigned long end_addr (void);
+
+-  auto int start_addr (void)
++  auto unsigned long int start_addr (void)
+     {
+       int ret;
+ # if defined(HAVE_START_SYMBOL)
+@@ -1192,7 +1192,7 @@ memcheck (int addr, int len)
+       return ret;
+     }
+
+-  auto int end_addr (void)
++  auto unsigned long int end_addr (void)
+     {
+       int ret;
+ # if defined(HAVE_END_SYMBOL)



Home | Main Index | Thread Index | Old Index