2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2024-11-21 17:11:45 +00:00
xcat-dep/syslinux/syslinux-3.86-multibootif.patch

55 lines
1.6 KiB
Diff
Raw Permalink Normal View History

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
+++ syslinux-3.86-multibootif/com32/mboot/mboot.c 2010-05-14 21:15:43.000000000 -0400
@@ -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,&reg,&reg);
+ if (!(reg.eflags.l & EFLAGS_CF)) {
+ bootifstr = MK_PTR(reg.es,
+ *(uint16_t *) MK_PTR(reg.es, reg.ebx.w[0] + 2));
+ } /* bootifstr would now be like BOOTIF= argument */
for (argp = argv; *argp; argp++) {
if (!strcmp(*argp, module_separator))
@@ -130,15 +139,29 @@
arglen += strlen(*argx) + 1;
if (arglen == 0) {
- mp->cmdline = strdup("");
+ if (firstmod) { /* first module, let's add BOOTIF to the command line */
+ firstmod=0;
+ mp->cmdline = strdup(bootifstr);
+ } else {
+ mp->cmdline = strdup("");
+ }
} else {
char *p;
+ if (firstmod) {
+ arglen += strlen(bootifstr) + 1;
+ }
mp->cmdline = p = malloc(arglen);
for (; *argp && strcmp(*argp, module_separator); argp++) {
p = strpcpy(p, *argp);
*p++ = ' ';
}
- *--p = '\0';
+ if (firstmod) { /* first module, let's add BOOTIF to the command line */
+ firstmod=0;
+ p = strpcpy(p,bootifstr);
+ *p = '\0';
+ } else {
+ *--p = '\0';
+ }
}
mp++;
if (*argp)