[syslinux] Custom com32
H. Peter Anvin
hpa at zytor.com
Thu Jan 25 13:51:11 PST 2007
Coe, Colin C. (Unix Engineer) wrote:
> OK, stupid question time. How do I specify the initrd? Currently I do:
>
> strcpy((char *)__com32.cs_bounce, array_model[i]);
> strcat((char *)__com32.cs_bounce, "_");
> strcat((char *)__com32.cs_bounce, array_bios[i]);
> strcat((char *)__com32.cs_bounce, ".img");
>
> memset(®, 0, sizeof reg);
> reg.eax.w[0] = 0x0003;
> reg.ebx.w[0] = OFFS(__com32.cs_bounce);
> reg.es = SEG(__com32.cs_bounce);
>
> #ifdef DEBUG
> printf("About to boot image %s\n", (char *)__com32.cs_bounce);
> fgets(buffer, sizeof buffer, stdin);
> #endif
> __intcall(0x22, ®, ®);
>
> if ( reg.eflags.l & EFLAGS_CF )
> return 0;
> else
> return reg.eax.l;
>
Something like:
char *bptr = __com32.cs_bounce;
char *image, *cmdline;
image = bptr;
bptr += sprintf(bptr, "memdisk"); /* Kernel image */
bptr++; /* Terminal null */
cmdline = bptr;
bptr += sprintf(bptr, "initrd=%s_%s.img", array_model, array_bios);
memset(®, 0, sizeof reg);
reg.eax.w[0] = 0x0016;
reg.esi.w[0] = OFFS(image);
reg.ds = SEG(image);
reg.ebx.w[0] = OFFS(cmdline);
reg.es = SEG(cmdline);
__intcall(0x22, ®, ®);
return (reg.eflags.l & EFLAGS_CF) ? -1 : 0;
More information about the Syslinux
mailing list