]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - src/patches/grub-0.97-nx-multiinstall.patch
Add some patches to grub.
[people/teissler/ipfire-2.x.git] / src / patches / grub-0.97-nx-multiinstall.patch
diff --git a/src/patches/grub-0.97-nx-multiinstall.patch b/src/patches/grub-0.97-nx-multiinstall.patch
new file mode 100644 (file)
index 0000000..f0e4ec0
--- /dev/null
@@ -0,0 +1,60 @@
+2006-03-09  Alexandre Oliva  <oliva@gnu.org>
+
+       * lib/builtins.c (install_blocklist_helper): Move static
+       last_lenght...
+       (install_func_context): ... here.
+       (install_func): Reset it.
+
+Index: grub-0.97/stage2/builtins.c
+===================================================================
+--- grub-0.97.orig/stage2/builtins.c   2006-03-09 10:26:41.000000000 -0300
++++ grub-0.97/stage2/builtins.c        2006-03-09 11:36:18.000000000 -0300
+@@ -1926,11 +1926,13 @@ static struct {
+       int saved_sector;
+       int installaddr;
+       int installlist;
++      int last_length;
+       char *stage2_first_buffer;
+ } install_func_context = {
+       .saved_sector = 0,
+       .installaddr = 0,
+       .installlist = 0,
++      .last_length = SECTOR_SIZE,
+       .stage2_first_buffer = NULL,
+ };
+@@ -1960,19 +1962,19 @@ install_blocklist_helper (int sector, in
+   int *installlist = &install_func_context.installlist;
+   char **stage2_first_buffer = &install_func_context.stage2_first_buffer;
+   /* Was the last sector full? */
+-  static int last_length = SECTOR_SIZE;
++  int *last_length = &install_func_context.last_length;
+   if (debug)
+     printf("[%d]", sector);
+-  if (offset != 0 || last_length != SECTOR_SIZE)
++  if (offset != 0 || *last_length != SECTOR_SIZE)
+     {
+       /* We found a non-sector-aligned data block. */
+       errnum = ERR_UNALIGNED;
+       return;
+     }
+-  last_length = length;
++  *last_length = length;
+   if (*((unsigned long *) (*installlist - 4))
+       + *((unsigned short *) *installlist) != sector
+@@ -2027,7 +2029,11 @@ install_func (char *arg, int flags)
+   int is_open = 0;
+   /* If LBA is forced?  */
+   int is_force_lba = 0;
++  int *last_length = &install_func_context.last_length;
+   
++  /* Reset state.  */
++  *last_length = SECTOR_SIZE;
++
+   *stage2_first_buffer = old_sect + SECTOR_SIZE;
+ #ifdef GRUB_UTIL
+   /* If the Stage 2 is in a partition mounted by an OS, this will store