Add some patches to grub.
[people/pmueller/ipfire-2.x.git] / src / patches / grub-0.97-nx-multiinstall.patch
1 2006-03-09 Alexandre Oliva <oliva@gnu.org>
2
3 * lib/builtins.c (install_blocklist_helper): Move static
4 last_lenght...
5 (install_func_context): ... here.
6 (install_func): Reset it.
7
8 Index: grub-0.97/stage2/builtins.c
9 ===================================================================
10 --- grub-0.97.orig/stage2/builtins.c 2006-03-09 10:26:41.000000000 -0300
11 +++ grub-0.97/stage2/builtins.c 2006-03-09 11:36:18.000000000 -0300
12 @@ -1926,11 +1926,13 @@ static struct {
13 int saved_sector;
14 int installaddr;
15 int installlist;
16 + int last_length;
17 char *stage2_first_buffer;
18 } install_func_context = {
19 .saved_sector = 0,
20 .installaddr = 0,
21 .installlist = 0,
22 + .last_length = SECTOR_SIZE,
23 .stage2_first_buffer = NULL,
24 };
25
26 @@ -1960,19 +1962,19 @@ install_blocklist_helper (int sector, in
27 int *installlist = &install_func_context.installlist;
28 char **stage2_first_buffer = &install_func_context.stage2_first_buffer;
29 /* Was the last sector full? */
30 - static int last_length = SECTOR_SIZE;
31 + int *last_length = &install_func_context.last_length;
32
33 if (debug)
34 printf("[%d]", sector);
35
36 - if (offset != 0 || last_length != SECTOR_SIZE)
37 + if (offset != 0 || *last_length != SECTOR_SIZE)
38 {
39 /* We found a non-sector-aligned data block. */
40 errnum = ERR_UNALIGNED;
41 return;
42 }
43
44 - last_length = length;
45 + *last_length = length;
46
47 if (*((unsigned long *) (*installlist - 4))
48 + *((unsigned short *) *installlist) != sector
49 @@ -2027,7 +2029,11 @@ install_func (char *arg, int flags)
50 int is_open = 0;
51 /* If LBA is forced? */
52 int is_force_lba = 0;
53 + int *last_length = &install_func_context.last_length;
54
55 + /* Reset state. */
56 + *last_length = SECTOR_SIZE;
57 +
58 *stage2_first_buffer = old_sect + SECTOR_SIZE;
59 #ifdef GRUB_UTIL
60 /* If the Stage 2 is in a partition mounted by an OS, this will store