2010-05-14 21:13:14 +00:00
|
|
|
diff -urN syslinux-3.86/com32/mboot/mboot.c syslinux-3.86-multibootif/com32/mboot/mboot.c
|
|
|
|
--- syslinux-3.86/com32/mboot/mboot.c 2010-03-31 12:24:25.000000000 -0400
|
2010-05-15 01:22:44 +00:00
|
|
|
+++ syslinux-3.86-multibootif/com32/mboot/mboot.c 2010-05-14 21:15:43.000000000 -0400
|
2010-05-14 21:13:14 +00:00
|
|
|
@@ -93,9 +93,18 @@
|
|
|
|
char **argp, **argx;
|
|
|
|
struct module_data *mp;
|
|
|
|
int rv;
|
|
|
|
+ int firstmod = 1;
|
|
|
|
int module_count = 1;
|
|
|
|
int arglen;
|
|
|
|
const char module_separator[] = "---";
|
|
|
|
+ com32sys_t reg;
|
|
|
|
+ char *bootifstr;
|
|
|
|
+ reg.eax.w[0] = 0x000f; /* Get IPAPPEND strings */
|
|
|
|
+ __intcall(0x22,®,®);
|
|
|
|
+ if (!(reg.eflags.l & EFLAGS_CF)) {
|
2010-05-15 01:22:44 +00:00
|
|
|
+ bootifstr = MK_PTR(reg.es,
|
|
|
|
+ *(uint16_t *) MK_PTR(reg.es, reg.ebx.w[0] + 2));
|
|
|
|
+ } /* bootifstr would now be like BOOTIF= argument */
|
2010-05-14 21:13:14 +00:00
|
|
|
|
|
|
|
for (argp = argv; *argp; argp++) {
|
|
|
|
if (!strcmp(*argp, module_separator))
|
2010-05-15 01:22:44 +00:00
|
|
|
@@ -130,15 +139,29 @@
|
2010-05-14 21:13:14 +00:00
|
|
|
arglen += strlen(*argx) + 1;
|
|
|
|
|
|
|
|
if (arglen == 0) {
|
|
|
|
- mp->cmdline = strdup("");
|
2010-05-15 01:22:44 +00:00
|
|
|
+ if (firstmod) { /* first module, let's add BOOTIF to the command line */
|
|
|
|
+ firstmod=0;
|
2010-05-14 21:13:14 +00:00
|
|
|
+ mp->cmdline = strdup(bootifstr);
|
|
|
|
+ } else {
|
|
|
|
+ mp->cmdline = strdup("");
|
|
|
|
+ }
|
|
|
|
} else {
|
|
|
|
char *p;
|
2010-05-15 01:22:44 +00:00
|
|
|
+ if (firstmod) {
|
|
|
|
+ arglen += strlen(bootifstr) + 1;
|
|
|
|
+ }
|
2010-05-14 21:13:14 +00:00
|
|
|
mp->cmdline = p = malloc(arglen);
|
2010-05-15 01:22:44 +00:00
|
|
|
for (; *argp && strcmp(*argp, module_separator); argp++) {
|
2010-05-14 21:13:14 +00:00
|
|
|
p = strpcpy(p, *argp);
|
|
|
|
*p++ = ' ';
|
|
|
|
}
|
|
|
|
- *--p = '\0';
|
2010-05-15 01:22:44 +00:00
|
|
|
+ if (firstmod) { /* first module, let's add BOOTIF to the command line */
|
|
|
|
+ firstmod=0;
|
|
|
|
+ p = strpcpy(p,bootifstr);
|
|
|
|
+ *p = '\0';
|
|
|
|
+ } else {
|
2010-05-14 21:13:14 +00:00
|
|
|
+ *--p = '\0';
|
2010-05-15 01:22:44 +00:00
|
|
|
+ }
|
2010-05-14 21:13:14 +00:00
|
|
|
}
|
|
|
|
mp++;
|
|
|
|
if (*argp)
|