Hi all I've written a basic COM32 module that checks (using the DMI example code) the product and BIOS and if the BIOS is not at the required level, is supposed to exit and boot using a DOS floppy image to flash the BIOS. The problem is that I can't work out how to call the DOS floppy image. Looking at the website, I see "Run Command" AX=0003H via int 22. The image name will be <productname>_<bios_rev> (i.e. xw9300_2.09.img) Is "Run Command" the right thing to do? How do I call it from my module? Thanks in advance CC NOTICE: This email and any attachments are confidential. They may contain legally privileged information or copyright material. You must not read, copy, use or disclose them without authorisation. If you are not an intended recipient, please contact us at once by return email and then delete both messages and all attachments.
Coe, Colin C. (Unix Engineer) wrote:> Hi all > > I've written a basic COM32 module that checks (using the DMI example > code) the product and BIOS and if the BIOS is not at the required level, > is supposed to exit and boot using a DOS floppy image to flash the BIOS. > > The problem is that I can't work out how to call the DOS floppy image. > Looking at the website, I see "Run Command" AX=0003H via int 22. The > image name will be <productname>_<bios_rev> (i.e. xw9300_2.09.img) > > Is "Run Command" the right thing to do? How do I call it from my > module? >You're probably better off using "Run kernel image" (AX=0016h). The kernel image would me "memdisk" and the command like something like "initrd=xw9300_2.09.img". -hpa
Many thanks! I ended up working out what needed to be done. Another question, how can I call fscanf from within my COM32 module. When I compiled the module I got linker errors. Any ideas? I wanted to use fscanf to read a csv file of "model,bios" values instead of hardcoding them into the COM32 module and having to recompile when different hardware is used. Thanks CC -----Original Message----- From: H. Peter Anvin [mailto:hpa at zytor.com] Sent: Thursday, 25 January 2007 12:56 PM To: Coe, Colin C. (Unix Engineer) Cc: syslinux at zytor.com Subject: Re: [syslinux] Custom com32 Coe, Colin C. (Unix Engineer) wrote:> Hi all > > I've written a basic COM32 module that checks (using the DMI example > code) the product and BIOS and if the BIOS is not at the required > level, is supposed to exit and boot using a DOS floppy image to flash > the BIOS. > > The problem is that I can't work out how to call the DOS floppy image.> Looking at the website, I see "Run Command" AX=0003H via int 22. The > image name will be <productname>_<bios_rev> (i.e. xw9300_2.09.img) > > Is "Run Command" the right thing to do? How do I call it from my > module? >You're probably better off using "Run kernel image" (AX=0016h). The kernel image would me "memdisk" and the command like something like "initrd=xw9300_2.09.img". -hpa NOTICE: This email and any attachments are confidential. They may contain legally privileged information or copyright material. You must not read, copy, use or disclose them without authorisation. If you are not an intended recipient, please contact us at once by return email and then delete both messages and all attachments.
Coe, Colin C. (Unix Engineer) wrote:> Many thanks! I ended up working out what needed to be done. > > Another question, how can I call fscanf from within my COM32 module. > When I compiled the module I got linker errors. Any ideas? > > I wanted to use fscanf to read a csv file of "model,bios" values instead > of hardcoding them into the COM32 module and having to recompile when > different hardware is used. >fscanf() is not supported due to the need for ungetc() support. Use fgets() and sscanf() instead. -hpa
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; This is using the 'Run Command', how do I do this with 'Run Kernel Image'? Thanks CC -----Original Message----- From: H. Peter Anvin [mailto:hpa at zytor.com] Sent: Thursday, 25 January 2007 12:56 PM To: Coe, Colin C. (Unix Engineer) Cc: syslinux at zytor.com Subject: Re: [syslinux] Custom com32 Coe, Colin C. (Unix Engineer) wrote:> Hi all > > I've written a basic COM32 module that checks (using the DMI example > code) the product and BIOS and if the BIOS is not at the required > level, is supposed to exit and boot using a DOS floppy image to flash > the BIOS. > > The problem is that I can't work out how to call the DOS floppy image.> Looking at the website, I see "Run Command" AX=0003H via int 22. The > image name will be <productname>_<bios_rev> (i.e. xw9300_2.09.img) > > Is "Run Command" the right thing to do? How do I call it from my > module? >You're probably better off using "Run kernel image" (AX=0016h). The kernel image would me "memdisk" and the command like something like "initrd=xw9300_2.09.img". -hpa NOTICE: This email and any attachments are confidential. They may contain legally privileged information or copyright material. You must not read, copy, use or disclose them without authorisation. If you are not an intended recipient, please contact us at once by return email and then delete both messages and all attachments.
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;