[syslinux] COM32 Advice

H. Peter Anvin hpa at zytor.com
Fri Apr 18 12:20:28 PDT 2003


ganapathy murali krishnan wrote:
> I am currently in the process of writing a small COM32 code. We have a 
> ISOLinux based CD, which boots into DOS/WinXP/Linux and does a whole lot 
> of useful things including installing (multiboot) OSes with software, 
> troubleshooting.... More details available at 
> http://people.cs.uchicago.edu/~gmurali/gui/index.html
> 
> The process of installing OSes (especially multiple OSes), require one 
> to boot in some particular order, e.g. Boot into DOS off the CD, and 
> then off the hard disk,.... I am currently trying to automate that 
> process. To that end I am writing a COM32 code, which ineffect reads a 
> particular sector from the hard disk (sector 6-9 in the 0th cylinder 
> which AFAIK is not used by any OS to do anything),
 >

Well... it's used (in a completely uncoordinated fashion) by various 
boot managers, etc.)  Track 0 is pretty much the wild west of 
harddrives; it doesn't *have* to be unpartitioned space, even, it just 
usually is.

> interprets that to be 
> a "stack" of names of "kernels" to boot from, pops the top one off the 
> stack, writes the new "stack" to the same sectors, and then asks 
> ISOLinux to boot using the correct kernel / from the hard disk.
> If no stack is found, then it runs a specific kernel.
> 
> In our case, the specific kernel boots into linux and asks the user the 
> combination of OSes, which needs to be installed, and based on the user
> selection writes the appropriate stack to the hard disk, so that the 
> COM32 code can find it the next time it runs.
> 
> I assume that my COM32 code, can use the standard BIOS calls to read and 
> write to the hard disk. Since the COMBOOT API, does not seem to have an 
> API to boot off a specific hard disk partition, I am looking for advice 
> on how to do that.

Yes, you can use standard BIOS calls.  Don't invoke int instructions 
directly, though, you still have to call through the COM32 syscall() 
mechanism (i.e. syscall(0x13, regsin, regsout).)  For anything that 
takes a segment:offset pointer into memory, you need to use the low 
memory bounce buffer.

Switching over to the boot sector once you have loaded it is a lot 
tricker.  It's sort of doable using the current API, but it's ugly as 
hell and requires a helper routine in low memory.  I think this really 
deserves a new API function, especially since the code is already in 
SYSLINUX anyway.

> And, any other gotchas I need to be aware of.

	-hpa



More information about the Syslinux mailing list