append a mem= option instead of prepending it.
This commit is contained in:
parent
bda2eea18d
commit
0bcf40674e
2 changed files with 22 additions and 9 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2000-09-12 OKUJI Yoshinori <okuji@gnu.org>
|
||||||
|
|
||||||
|
Add additional magic to avoid a bug in Linux. *sigh*
|
||||||
|
|
||||||
|
* stage2/boot.c (load_image): Copy SRC to DEST first, and append
|
||||||
|
a "mem=" option to DEST instead of prepending.
|
||||||
|
|
||||||
2000-09-11 OKUJI Yoshinori <okuji@gnu.org>
|
2000-09-11 OKUJI Yoshinori <okuji@gnu.org>
|
||||||
|
|
||||||
Reported by Alessandro Rubini:
|
Reported by Alessandro Rubini:
|
||||||
|
|
|
@ -304,29 +304,35 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
|
||||||
0,
|
0,
|
||||||
(64 - setup_sects - 1) << 9);
|
(64 - setup_sects - 1) << 9);
|
||||||
|
|
||||||
/* copy command-line plus memory hack to staging area */
|
/* Copy command-line plus memory hack to staging area.
|
||||||
|
NOTE: Linux has a bug that it doesn't handle multiple spaces
|
||||||
|
between two options and a space after a "mem=" option isn't
|
||||||
|
removed correctly so the arguments to init could be like
|
||||||
|
{"init", "", "", NULL}. This affects some not-very-clever
|
||||||
|
shells. Thus, the code below does a trick to avoid the bug.
|
||||||
|
That is, copy "mem=XXX" to the end of the command-line, and
|
||||||
|
avoid to copy spaces unnecessarily. Hell. */
|
||||||
{
|
{
|
||||||
char *src = arg;
|
char *src = skip_to (0, arg);
|
||||||
char *dest = (char *) CL_MY_LOCATION;
|
char *dest = (char *) CL_MY_LOCATION;
|
||||||
|
|
||||||
|
while (((int) dest) < CL_MY_END_ADDR && (*(dest++) = *(src++)));
|
||||||
|
|
||||||
/* Add a mem option automatically only if the user doesn't
|
/* Add a mem option automatically only if the user doesn't
|
||||||
specify it explicitly. */
|
specify it explicitly. */
|
||||||
if (! grub_strstr (src, "mem=")
|
if (! grub_strstr (arg, "mem=")
|
||||||
&& ! (load_flags & KERNEL_LOAD_NO_MEM_OPTION))
|
&& ! (load_flags & KERNEL_LOAD_NO_MEM_OPTION))
|
||||||
{
|
{
|
||||||
|
if (dest != (char *) CL_MY_LOCATION)
|
||||||
|
*(dest++) = ' ';
|
||||||
|
|
||||||
grub_memmove (dest, "mem=", 4);
|
grub_memmove (dest, "mem=", 4);
|
||||||
dest += 4;
|
dest += 4;
|
||||||
|
|
||||||
dest = convert_to_ascii (dest, 'u', (extended_memory + 0x400));
|
dest = convert_to_ascii (dest, 'u', (extended_memory + 0x400));
|
||||||
*(dest++) = 'K';
|
*(dest++) = 'K';
|
||||||
*(dest++) = ' ';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*src && *src != ' ')
|
|
||||||
src++;
|
|
||||||
|
|
||||||
while (((int) dest) < CL_MY_END_ADDR && (*(dest++) = *(src++)));
|
|
||||||
|
|
||||||
*dest = 0;
|
*dest = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue