]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2005-08-20 Yoshinori K. Okuji <okuji@enbug.org>
authorokuji <okuji@localhost>
Sat, 20 Aug 2005 08:25:51 +0000 (08:25 +0000)
committerokuji <okuji@localhost>
Sat, 20 Aug 2005 08:25:51 +0000 (08:25 +0000)
        * loader/powerpc/ieee1275/linux.c (grub_rescue_cmd_linux): Specify
        the boot file by the option BOOT_IMAGE. Use grub_stpcpy instead of
        grub_strcat.

        * loader/i386/pc/linux.c (grub_rescue_cmd_linux): Specify the boot
        file by the option BOOT_IMAGE. Use grub_stpcpy instead of
        grub_strcpy and grub_strlen. Take it into account that a space
        character is inserted as a delimiter.

ChangeLog
NEWS
loader/i386/pc/linux.c
loader/powerpc/ieee1275/linux.c

index 23f8ea877c806368266b4e3f7e2dfb8d48817d87..634123b7a2fe70ab6e9a7e88fd6d59ba162cb443 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2005-08-20  Yoshinori K. Okuji  <okuji@enbug.org>
+
+       * loader/powerpc/ieee1275/linux.c (grub_rescue_cmd_linux): Specify
+       the boot file by the option BOOT_IMAGE. Use grub_stpcpy instead of
+       grub_strcat.
+
+       * loader/i386/pc/linux.c (grub_rescue_cmd_linux): Specify the boot
+       file by the option BOOT_IMAGE. Use grub_stpcpy instead of
+       grub_strcpy and grub_strlen. Take it into account that a space
+       character is inserted as a delimiter.
+
 2005-08-20  Yoshinori K. Okuji  <okuji@enbug.org>
 
        * partmap/pc.c (pc_partition_map_iterate): Include the value of an
diff --git a/NEWS b/NEWS
index 4f20f1610703b8edadc2aacb5bce68fb5a037dd4..eefddbccaf0b2c59d7d9672f44d8507298797962 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ New in 1.91:
 
 * New commands, "search", "vbetest" and "vbeinfo".
 
+* The option BOOT_IMAGE is passed to Linux.
+
 
 New in 1.90 - 2005-08-07:
 
index 50369cebb97ff1cee2eff07b72458e9d060717dd..48c59c79d344cbac15add55899e6d32f56f96716 100644 (file)
@@ -1,7 +1,7 @@
 /* linux.c - boot Linux zImage or bzImage */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005  Free Software Foundation, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -250,22 +250,22 @@ grub_rescue_cmd_linux (int argc, char *argv[])
                 ((GRUB_LINUX_MAX_SETUP_SECTS - setup_sects - 1)
                  << GRUB_DISK_SECTOR_BITS));
 
+  /* Specify the boot file.  */
+  dest = grub_stpcpy (grub_linux_tmp_addr + GRUB_LINUX_CL_OFFSET,
+                     "BOOT_IMAGE=");
+  dest = grub_stpcpy (dest, argv[0]);
+  
   /* Copy kernel parameters.  */
-  for (i = 1, dest = grub_linux_tmp_addr + GRUB_LINUX_CL_OFFSET;
+  for (i = 1;
        i < argc
-        && dest + grub_strlen (argv[i]) < (grub_linux_tmp_addr
-                                           + GRUB_LINUX_CL_END_OFFSET);
-       i++, *dest++ = ' ')
+        && dest + grub_strlen (argv[i]) + 1 < (grub_linux_tmp_addr
+                                               + GRUB_LINUX_CL_END_OFFSET);
+       i++)
     {
-      grub_strcpy (dest, argv[i]);
-      dest += grub_strlen (argv[i]);
+      *dest++ = ' ';
+      dest = grub_stpcpy (dest, argv[i]);
     }
 
-  if (i != 1)
-    dest--;
-
-  *dest = '\0';
-
   len = prot_size;
   if (grub_file_read (file, (char *) GRUB_LINUX_BZIMAGE_ADDR, len) != len)
     grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
index 659bdd4ab789611ad1a04eabaf12435f5ba4a57f..19a8cb5cd8eb42c9c05227e16517431da308b0a8 100644 (file)
@@ -108,6 +108,7 @@ grub_rescue_cmd_linux (int argc, char *argv[])
   grub_addr_t entry;
   int found_addr = 0;
   int size;
+  char *dest;
 
   grub_dl_ref (my_mod);
 
@@ -214,18 +215,22 @@ grub_rescue_cmd_linux (int argc, char *argv[])
        }
     }
 
-  size = 0;
+  size = sizeof ("BOOT_IMAGE=") + grub_strlen (argv[0]);
   for (i = 0; i < argc; i++)
-    size += grub_strlen (argv[i]);
+    size += grub_strlen (argv[i]) + 1;
 
-  linux_args = grub_malloc (size + argc + 1);
-  if (!linux_args)
+  linux_args = grub_malloc (size);
+  if (! linux_args)
     goto fail;
 
+  /* Specify the boot file.  */
+  dest = grub_stpcpy (linux_args, "BOOT_IMAGE=");
+  dest = grub_stpcpy (dest, argv[0]);
+  
   for (i = 1; i < argc; i++)
     {
-      grub_strcat (linux_args, argv[i]);
-      grub_strcat (linux_args, " ");
+      *dest++ = ' ';
+      dest = grub_stpcpy (dest, argv[i]);
     }
 
  fail: