[syslinux] IP details in COM32 module

Coe, Colin C. (Unix Engineer) Colin.Coe at woodside.com.au
Sun Jun 10 21:05:20 PDT 2007


> 
> Coe, Colin C. (Unix Engineer) wrote:
> > After appending all the ip info I want to be passed to 
> anaconda into __com32.cs_bounce, then printing 
> __com32.cs_bounce only the first 32 chars are shown.  Also 
> looking in ./com32/include/com32.h in "extern struct 
> com32_sys_args" I saw "uint32_t cs_bounce_size" so I figured 
> 32 chars, from your responce I gather I'm way off base.
> 
> You did something like fputs(__com32.cs_bounce, stdout); I 
> presume (or printf, or what have you.)
> 
> This will be translated into a write() call to the console, 
> which calls back into syslinux; that will use... (wait for 
> it) the bounce buffer internally in the library.
> 
> > I very confused as to why this string gets truncated at the 
> 32 char mark...
> 
> See above.
> 
> Pretty much, any libc function which does I/O will clobber 
> the bounce buffer, and many that don't.  Consider it a very 
> volatile, single-threaded resource which is only supposed to 
> be used right around the intcall that invokes it.
> 
> In syslinux-3.50-pre* you can use the wrapper function
> syslinux_run_command() to do that I believe you want to do; 
> it's defined in <syslinux/boot.h>.Z
> 
> 	-hpa

Apologies for going on with this but I still don't get what I need to
do.

The guts of what I'm trying to do is this:
- network boot is selected
- using dmi code, check model and BIOS versions
- parse file bios_rev.csv on TFTP server look for matching line
- if match found and BIOS version not right, boot DOS floppy image,
flash bios, rewrite first 2 bytes of HDD to ensure another network boot
- otherwise:
  - get name of menu to netboot plus IP, gw, nm and dns from DHCP packet

  - assemble these into one string and boot.  
  - eg 'rhel3 ksdevice=eth0 hostname=linuxwks ip=1.1.1.2
gateway=1.1.1.254 netwmask=255.255.255.0 dns=1.1.1.1'

My .csv file looks like this
--
xw9300,2.09
xw8400,2.21
--

My PXELINUX config  file looks like
--
say Satellite (LWS)

default flash_bios
prompt 1
timeout 100

label flash_bios
        kernel wel_boot.c32
        append el3u8

label el3u8
        kernel ks-rhel-x86_64-ws-3-u8/vmlinuz
        append initrd=ks-rhel-x86_64-ws-3-u8/initrd.img
ks=http://sat_server/kickstart/ks/org/1x33bf2048269014bdb91b23c8c6411c37
/label/lws_el3u8 vga=1 load_ramdisk=1
--

So what I want to do is grab the relevent info from the DHCP lease (ip,
gateway, netmask, etc) and put it at the end of the append line in label
'el3u8'.

I've extracted the info I want but when I try and assemble it, I get a
hard hang.
--
                /* BIOS is right, boot config in argv[1]  */
                char *details;
                printf("BIOS revision OK, starting rebuild...\n");
                /* Parse the 'flash_bios' append line */
                for (i=1; i<argc; i++) {
                     sprintf(buff, "%s %s", buff, argv[i]);
                }
                sprintf(__com32.cs_bounce, "%s bootproto=static
ksdevice=eth0 ip=%s netmask=%s gateway=%s dns=%s domain=%s", buff,
my_ip, my_netmask, my_gateway, my_dns, my_domain);

                printf("__com32.cs_bounce contains '%s'\n",
__com32.cs_bounce);

                /* Populate the registers AX and BX then call INT22 */
                memset(&reg, 0, sizeof(reg));
                reg.eax.w[0] = 0x0003;
                reg.ebx.w[0] = OFFS(__com32.cs_bounce);
                reg.es       = SEG(__com32.cs_bounce);
                __intcall(0x22, &reg, &reg);

                return ( reg.eflags.l & EFLAGS_CF ) ? -1 : 0;
            }
--

The hard hang happens on the line doing the 'sprintf(__com32.cs_bounce',
I never see the line '__com32.cs_bounce contains ...'

Could someone please give me a point in the right direction?

TIA

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.




More information about the Syslinux mailing list