[syslinux] chain.c32 "map" argument

H. Peter Anvin hpa at zytor.com
Wed Dec 29 14:33:28 PST 2010


On 12/28/2010 11:51 PM, Joe Pelkey wrote:
> Hi,
> I have coded a function to parse a string to map BIOS drives to other
> BIOS drives.  I need such functionality because I want to chainload grub
> from syslinux on a USB flash drive.  The drive is considered a floppy
> disk by my BIOS, yet it's MSDOS partitioned, and grub can't handle
> partitions on floppy disks (hence my desire to fake 0x80 being 0x00).
> 
> The function can map a string of arbitrary drive numbers between 0 and
> 255 (entered in decimal, octal (leading 0), or hex (leading 0x)) to
> other values in a uint8_t array of the form of the p pointer to swapstub
> in do_boot() in com32/modules/chain.c.  The syntax can take multiple
> comma-delimited arguments of individual mappings, with each mapping in
> old=new format.  I can add boot/fdX/hdX tokens to the parser if wanted.
> 
> Since I don't know assembly, I need to know if the table modified by the
> p pointer in chain.c's swapstub is up to arbitrary drive number changes.
> If this a worthy modification to pursue, where can I send my patches (to
> syslinux 4.0.3) once I finish?
> 
> Also, what file would be best to add the function I made
> (parse_drive_map)?  It takes a command-line string and the address of
> the map array as input.
> 

Yes, the map can handle arbitrary permutations (it was designed with
this usage in mind; I was hoping someone would tackle it at some point),
although obviously some options may result in less-than-ideal results
(especially giving floppy disks a hard disk number.)

Right now all of chain.c32 is a single file, although that probably
should be fixed, so feel free to break it up if it makes the code cleaner.

Please send patches to this mailing list.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.




More information about the Syslinux mailing list