summaryrefslogtreecommitdiffstats
path: root/src/arch
diff options
context:
space:
mode:
authorMichael Brown2009-05-26 07:58:53 +0200
committerMichael Brown2009-05-26 07:58:53 +0200
commit822b3b53f467a020cf5d6776a16a7e504097a8e7 (patch)
treec21db0adba5fae715fd4d6d0bbba5e0d734c143e /src/arch
parent[dhcp] Choose ProxyDHCP port based on presence of PXE options (diff)
downloadipxe-822b3b53f467a020cf5d6776a16a7e504097a8e7.tar.gz
ipxe-822b3b53f467a020cf5d6776a16a7e504097a8e7.tar.xz
ipxe-822b3b53f467a020cf5d6776a16a7e504097a8e7.zip
[multiboot] Include argv[0] as part of "command line"
Grub will include the module name as part of the command line, and some multiboot kernels expect this to be done.
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/i386/image/multiboot.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/arch/i386/image/multiboot.c b/src/arch/i386/image/multiboot.c
index 1690b1c4..1811e913 100644
--- a/src/arch/i386/image/multiboot.c
+++ b/src/arch/i386/image/multiboot.c
@@ -141,10 +141,11 @@ static void multiboot_build_memmap ( struct image *image,
/**
* Add command line in base memory
*
+ * @v imgname Image name
* @v cmdline Command line
* @ret physaddr Physical address of command line
*/
-physaddr_t multiboot_add_cmdline ( const char *cmdline ) {
+physaddr_t multiboot_add_cmdline ( const char *imgname, const char *cmdline ) {
char *mb_cmdline;
if ( ! cmdline )
@@ -155,7 +156,7 @@ physaddr_t multiboot_add_cmdline ( const char *cmdline ) {
mb_cmdline_offset +=
( snprintf ( mb_cmdline,
( sizeof ( mb_cmdlines ) - mb_cmdline_offset ),
- "%s", cmdline ) + 1 );
+ "%s %s", imgname, cmdline ) + 1 );
/* Truncate to terminating NUL in buffer if necessary */
if ( mb_cmdline_offset > sizeof ( mb_cmdlines ) )
@@ -210,8 +211,8 @@ multiboot_build_module_list ( struct image *image,
( ( count - insert ) * sizeof ( *module ) ) );
module->mod_start = start;
module->mod_end = end;
- module->string =
- multiboot_add_cmdline ( module_image->cmdline );
+ module->string = multiboot_add_cmdline ( module_image->name,
+ module_image->cmdline );
module->reserved = 0;
/* We promise to page-align modules */
@@ -269,7 +270,7 @@ static int multiboot_exec ( struct image *image ) {
multiboot_build_memmap ( image, &mbinfo, mbmemmap,
( sizeof(mbmemmap) / sizeof(mbmemmap[0]) ) );
mb_cmdline_offset = 0;
- mbinfo.cmdline = multiboot_add_cmdline ( image->cmdline );
+ mbinfo.cmdline = multiboot_add_cmdline ( image->name, image->cmdline );
mbinfo.mods_count = multiboot_build_module_list ( image, mbmodules,
( sizeof(mbmodules) / sizeof(mbmodules[0]) ) );
mbinfo.mods_addr = virt_to_phys ( mbmodules );