[syslinux] Possible improvements for chain.c

H. Peter Anvin hpa at zytor.com
Tue Jul 20 17:56:05 PDT 2010


On 07/20/2010 04:19 PM, Michal Soltys wrote:
> 
> Anyway, I was thinking about extending chain.c32 code a bit to do 
> following when "sethidden" option is specified (or better add extra 
> options - such as "setgeometry", "setdrive" and "setbpb" (equivalent of 
> all options specified) - to keep it more flexible):
> 
> - update hidden sectors field (as it does currently) - at 0x1C
> - update sectors-per-track and heads fields (if cbios data is valid) - 
> at 0x18 and 0x1A respectively
> - update drive number (also respecting opt.swap value) - at 0x24
> 
> Additionally - "savebpb" could allow permanent update of the sector 
> (would be executed only if some of the values changed).
> 
> Patch should be straightforward. A side "bonus" to that would be a 
> capability to chainload DOSes from drive > 0x80 without a stub. I have 
> one question though:
> 
> 
>      if (!opt.loadfile || data[0].base >= 0x7c00 + SECTOR) {
>          /* Actually read the boot sector */
>          if (!cur_part) {
>              data[ndata].data = mbr;
> 
> Both freedos/msdos/pcdos option implicitly assume sethidden, but 
> considering their data[0].base - the condition will always be false (and 
> rightly so as the kernel overlaps with bootsector), so sethidden will 
> not work here.
> 
> Also, looking at freedos bootsectors, I think they require relocated 
> bootsector to work (at 0x1fe0:0x7c00) - so there is potentially a room 
> for improvement here.
> 
> Would patches adding such functionality be considered ?
> 

Yes, patches adding such functionality would be considered if they are
clean.

For the options that write to the disk -- especially those that would
write to the nonprimary partitions (non-MBR) I'd prefer if we could wait
for sha0's disklib patches to be integrated.  I guess I should set up a
development branch.

chain.c is starting to get complex enough that it probably needs to be
broken up into source files, too.

	-hpa




More information about the Syslinux mailing list