~ubuntu-branches/ubuntu/trusty/grub2/trusty-updates

« back to all changes in this revision

Viewing changes to debian/patches/branch_longlinuxcmd.patch

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-02-08 11:39:26 UTC
  • mfrom: (17.6.26 experimental)
  • mto: (17.6.27 experimental)
  • mto: This revision was merged to the branch mainline in revision 104.
  • Revision ID: james.westby@ubuntu.com-20110208113926-clfs90haboyk9zip
Tags: 1.99~rc1-2
* Merge 1.98+20100804-13 and 1.98+20100804-14, updating translations:
  - Kazakh (Baurzhan Muftakhidinov / Timur Birsh).
* mkconfig_skip_dmcrypt.patch: Refer to GRUB_PRELOAD_MODULES rather than
  suggesting people write a /etc/grub.d/01_modules script (thanks, Jordan
  Uggla).
* Handle empty dir passed to grub_find_root_device_from_mountinfo; fixes
  grub-mkrelpath on btrfs subvolumes (LP: #712029).
* Add rootflags=subvol=<name> if / is on a btrfs subvolume (LP: #712029).
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Support long Linux command lines
 
2
Author: Vladimir Serbinenko <phcoder@gmail.com>
 
3
Origin: upstream, http://bzr.sv.gnu.org/r/grub/branches/longlinuxcmd/
 
4
Forwarded: not-needed
 
5
Last-Update: 2011-01-05
 
6
 
 
7
Index: b/grub-core/loader/i386/linux.c
 
8
===================================================================
 
9
--- a/grub-core/loader/i386/linux.c
 
10
+++ b/grub-core/loader/i386/linux.c
 
11
@@ -55,7 +55,6 @@
 
12
 #endif
 
13
 
 
14
 #define GRUB_LINUX_CL_OFFSET           0x1000
 
15
-#define GRUB_LINUX_CL_END_OFFSET       0x2000
 
16
 
 
17
 static grub_dl_t my_mod;
 
18
 
 
19
@@ -72,6 +71,7 @@
 
20
 static grub_uint32_t initrd_pages;
 
21
 static struct grub_relocator *relocator = NULL;
 
22
 static void *efi_mmap_buf;
 
23
+static grub_size_t maximal_cmdline_size;
 
24
 #ifdef GRUB_MACHINE_EFI
 
25
 static grub_efi_uintn_t efi_mmap_size;
 
26
 #else
 
27
@@ -186,7 +186,7 @@
 
28
   grub_err_t err;
 
29
 
 
30
   /* Make sure that each size is aligned to a page boundary.  */
 
31
-  real_size = GRUB_LINUX_CL_END_OFFSET;
 
32
+  real_size = GRUB_LINUX_CL_OFFSET + maximal_cmdline_size;
 
33
   prot_size = page_align (prot_size);
 
34
   mmap_size = find_mmap_size ();
 
35
 
 
36
@@ -657,6 +657,14 @@
 
37
       goto fail;
 
38
     }
 
39
 
 
40
+  if (grub_le_to_cpu16 (lh.version) >= 0x0206)
 
41
+    maximal_cmdline_size = grub_le_to_cpu32 (lh.cmdline_size) + 1;
 
42
+  else
 
43
+    maximal_cmdline_size = 256;
 
44
+
 
45
+  if (maximal_cmdline_size < 128)
 
46
+    maximal_cmdline_size = 128;
 
47
+
 
48
   setup_sects = lh.setup_sects;
 
49
 
 
50
   /* If SETUP_SECTS is not set, set it to the default (4).  */
 
51
@@ -670,7 +678,7 @@
 
52
     goto fail;
 
53
 
 
54
   params = (struct linux_kernel_params *) real_mode_mem;
 
55
-  grub_memset (params, 0, GRUB_LINUX_CL_END_OFFSET);
 
56
+  grub_memset (params, 0, GRUB_LINUX_CL_OFFSET + maximal_cmdline_size);
 
57
   grub_memcpy (&params->setup_sects, &lh.setup_sects, sizeof (lh) - 0x1F1);
 
58
 
 
59
   params->ps_mouse = params->padding10 =  0;
 
60
@@ -865,7 +873,7 @@
 
61
   grub_create_loader_cmdline (argc, argv,
 
62
                              (char *)real_mode_mem + GRUB_LINUX_CL_OFFSET
 
63
                              + sizeof (LINUX_IMAGE) - 1,
 
64
-                             GRUB_LINUX_CL_END_OFFSET - GRUB_LINUX_CL_OFFSET
 
65
+                             maximal_cmdline_size
 
66
                              - (sizeof (LINUX_IMAGE) - 1));
 
67
 
 
68
   len = prot_size;
 
69
Index: b/grub-core/loader/i386/pc/linux.c
 
70
===================================================================
 
71
--- a/grub-core/loader/i386/pc/linux.c
 
72
+++ b/grub-core/loader/i386/pc/linux.c
 
73
@@ -37,7 +37,6 @@
 
74
 #include <grub/lib/cmdline.h>
 
75
 
 
76
 #define GRUB_LINUX_CL_OFFSET           0x9000
 
77
-#define GRUB_LINUX_CL_END_OFFSET       0x90FF
 
78
 
 
79
 static grub_dl_t my_mod;
 
80
 
 
81
@@ -47,6 +46,7 @@
 
82
 static grub_addr_t grub_linux_real_target;
 
83
 static char *grub_linux_real_chunk;
 
84
 static grub_size_t grub_linux16_prot_size;
 
85
+static grub_size_t maximal_cmdline_size;
 
86
 
 
87
 static grub_err_t
 
88
 grub_linux16_boot (void)
 
89
@@ -126,15 +126,20 @@
 
90
   setup_sects = lh.setup_sects;
 
91
   linux_mem_size = 0;
 
92
 
 
93
+  maximal_cmdline_size = 256;
 
94
+
 
95
   if (lh.header == grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE)
 
96
       && grub_le_to_cpu16 (lh.version) >= 0x0200)
 
97
     {
 
98
       grub_linux_is_bzimage = (lh.loadflags & GRUB_LINUX_FLAG_BIG_KERNEL);
 
99
       lh.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE;
 
100
 
 
101
+      if (grub_le_to_cpu16 (lh.version) >= 0x0206)
 
102
+       maximal_cmdline_size = grub_le_to_cpu32 (lh.cmdline_size) + 1;
 
103
+
 
104
       /* Put the real mode part at as a high location as possible.  */
 
105
       grub_linux_real_target = grub_mmap_get_lower () 
 
106
-       - GRUB_LINUX_SETUP_MOVE_SIZE;
 
107
+       - (GRUB_LINUX_CL_OFFSET + maximal_cmdline_size);
 
108
       /* But it must not exceed the traditional area.  */
 
109
       if (grub_linux_real_target > GRUB_LINUX_OLD_REAL_MODE_ADDR)
 
110
        grub_linux_real_target = GRUB_LINUX_OLD_REAL_MODE_ADDR;
 
111
@@ -151,7 +156,8 @@
 
112
        {
 
113
          lh.cl_magic = grub_cpu_to_le16 (GRUB_LINUX_CL_MAGIC);
 
114
          lh.cl_offset = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET);
 
115
-         lh.setup_move_size = grub_cpu_to_le16 (GRUB_LINUX_SETUP_MOVE_SIZE);
 
116
+         lh.setup_move_size = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET
 
117
+                                                + maximal_cmdline_size);
 
118
        }
 
119
     }
 
120
   else
 
121
@@ -183,12 +189,13 @@
 
122
       goto fail;
 
123
     }
 
124
 
 
125
-  if (grub_linux_real_target + GRUB_LINUX_SETUP_MOVE_SIZE
 
126
+  if (grub_linux_real_target + GRUB_LINUX_CL_OFFSET + maximal_cmdline_size
 
127
       > grub_mmap_get_lower ())
 
128
     {
 
129
       grub_error (GRUB_ERR_OUT_OF_RANGE,
 
130
                 "too small lower memory (0x%x > 0x%x)",
 
131
-                 grub_linux_real_target + GRUB_LINUX_SETUP_MOVE_SIZE,
 
132
+                 grub_linux_real_target + GRUB_LINUX_CL_OFFSET
 
133
+                 + maximal_cmdline_size,
 
134
                  (int) grub_mmap_get_lower ());
 
135
       goto fail;
 
136
     }
 
137
@@ -261,7 +268,8 @@
 
138
     grub_relocator_chunk_t ch;
 
139
     err = grub_relocator_alloc_chunk_addr (relocator, &ch,
 
140
                                           grub_linux_real_target,
 
141
-                                          GRUB_LINUX_SETUP_MOVE_SIZE);
 
142
+                                          GRUB_LINUX_CL_OFFSET
 
143
+                                          + maximal_cmdline_size);
 
144
     if (err)
 
145
       return err;
 
146
     grub_linux_real_chunk = get_virtual_current_address (ch);
 
147
@@ -292,7 +300,7 @@
 
148
   grub_create_loader_cmdline (argc, argv,
 
149
                              (char *)grub_linux_real_chunk
 
150
                              + GRUB_LINUX_CL_OFFSET + sizeof (LINUX_IMAGE) - 1,
 
151
-                             GRUB_LINUX_CL_END_OFFSET - GRUB_LINUX_CL_OFFSET
 
152
+                             maximal_cmdline_size
 
153
                              - (sizeof (LINUX_IMAGE) - 1));
 
154
 
 
155
   if (grub_linux_is_bzimage)
 
156
Index: b/include/grub/i386/linux.h
 
157
===================================================================
 
158
--- a/include/grub/i386/linux.h
 
159
+++ b/include/grub/i386/linux.h
 
160
@@ -41,7 +41,6 @@
 
161
 #define GRUB_LINUX_VID_MODE_ASK                0xFFFD
 
162
 #define GRUB_LINUX_VID_MODE_VESA_START 0x0300
 
163
 
 
164
-#define GRUB_LINUX_SETUP_MOVE_SIZE     0x9100
 
165
 #define GRUB_LINUX_CL_MAGIC            0xA33F
 
166
 
 
167
 #ifdef __x86_64__
 
168
@@ -130,6 +129,10 @@
 
169
   grub_uint16_t pad1;                  /* Unused */
 
170
   grub_uint32_t cmd_line_ptr;          /* Points to the kernel command line */
 
171
   grub_uint32_t initrd_addr_max;        /* Highest address for initrd */
 
172
+  grub_uint32_t kernel_alignment;
 
173
+  grub_uint8_t relocatable;
 
174
+  grub_uint8_t pad[3];
 
175
+  grub_uint32_t cmdline_size;
 
176
 } __attribute__ ((packed));
 
177
 
 
178
 /* Boot parameters for Linux based on 2.6.12. This is used by the setup