1 |
/* linux.c - boot Linux zImage or bzImage */ |
/* linux.c - boot Linux zImage or bzImage */ |
2 |
/* |
/* |
3 |
* GRUB -- GRand Unified Bootloader |
* GRUB -- GRand Unified Bootloader |
4 |
* 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. |
5 |
* |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
250 |
((GRUB_LINUX_MAX_SETUP_SECTS - setup_sects - 1) |
((GRUB_LINUX_MAX_SETUP_SECTS - setup_sects - 1) |
251 |
<< GRUB_DISK_SECTOR_BITS)); |
<< GRUB_DISK_SECTOR_BITS)); |
252 |
|
|
253 |
|
/* Specify the boot file. */ |
254 |
|
dest = grub_stpcpy (grub_linux_tmp_addr + GRUB_LINUX_CL_OFFSET, |
255 |
|
"BOOT_IMAGE="); |
256 |
|
dest = grub_stpcpy (dest, argv[0]); |
257 |
|
|
258 |
/* Copy kernel parameters. */ |
/* Copy kernel parameters. */ |
259 |
for (i = 1, dest = grub_linux_tmp_addr + GRUB_LINUX_CL_OFFSET; |
for (i = 1; |
260 |
i < argc |
i < argc |
261 |
&& dest + grub_strlen (argv[i]) < (grub_linux_tmp_addr |
&& dest + grub_strlen (argv[i]) + 1 < (grub_linux_tmp_addr |
262 |
+ GRUB_LINUX_CL_END_OFFSET); |
+ GRUB_LINUX_CL_END_OFFSET); |
263 |
i++, *dest++ = ' ') |
i++) |
264 |
{ |
{ |
265 |
grub_strcpy (dest, argv[i]); |
*dest++ = ' '; |
266 |
dest += grub_strlen (argv[i]); |
dest = grub_stpcpy (dest, argv[i]); |
267 |
} |
} |
268 |
|
|
|
if (i != 1) |
|
|
dest--; |
|
|
|
|
|
*dest = '\0'; |
|
|
|
|
269 |
len = prot_size; |
len = prot_size; |
270 |
if (grub_file_read (file, (char *) GRUB_LINUX_BZIMAGE_ADDR, len) != len) |
if (grub_file_read (file, (char *) GRUB_LINUX_BZIMAGE_ADDR, len) != len) |
271 |
grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file"); |
grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file"); |