--- c/hw/i386/multiboot.c +++ i/hw/i386/multiboot.c @@ -288,8 +288,7 @@ int load_multiboot(FWCfgState *fw_cfg, mbs.offset_mbinfo = mbs.mb_buf_size; /* Calculate space for cmdlines, bootloader name, and mb_mods */ - cmdline_len = strlen(kernel_filename) + 1; - cmdline_len += strlen(kernel_cmdline) + 1; + cmdline_len = strlen(kernel_cmdline) + 1; if (initrd_filename) { const char *r = initrd_filename; cmdline_len += strlen(initrd_filename) + 1; @@ -327,10 +326,11 @@ int load_multiboot(FWCfgState *fw_cfg, /* if a space comes after the module filename, treat everything after that as parameters */ - hwaddr c = mb_add_cmdline(&mbs, one_file); + hwaddr c = 0; next_space = strchr(one_file, ' '); if (next_space) { *next_space = '\0'; + c = mb_add_cmdline(&mbs, next_space + 1); } mb_debug("multiboot loading module: %s", one_file); mb_mod_length = get_image_size(one_file); @@ -360,10 +360,7 @@ int load_multiboot(FWCfgState *fw_cfg, } /* Commandline support */ - char kcmdline[strlen(kernel_filename) + strlen(kernel_cmdline) + 2]; - snprintf(kcmdline, sizeof(kcmdline), "%s %s", - kernel_filename, kernel_cmdline); - stl_p(bootinfo + MBI_CMDLINE, mb_add_cmdline(&mbs, kcmdline)); + stl_p(bootinfo + MBI_CMDLINE, mb_add_cmdline(&mbs, kernel_cmdline)); stl_p(bootinfo + MBI_BOOTLOADER, mb_add_bootloader(&mbs, bootloader_name));