[syslinux] Custom MBR

YYZ yyz01 at yahoo.com
Sat Dec 13 15:48:06 PST 2008


Hi,

I have a multi-boot setup with windows installed on the active primary
partition. Now this partition is encrypted and the only way to boot
windows is through a custom boot loader provided by the encryption
software (which requires entering a pre-boot password to unlock the
decryption key). Unfortunately, this boot loader is pretty lame (in terms
of multi-boot capabilities) and is completely inflexible (in that, it must
reside in mbr + unused sectors of track0 and cannot be relocated). However,
it's first stage in the mbr can be backed up in a file and chainloaded (as
long as subsequent stages in track0 are intact). Additionally, it won't
boot windows unless this partition is active.

Now I could boot other operating systems by adding entries to the boot.ini
of the encrypted windows system but this way, I would be required to enter
the password even though those other operating systems that I finally boot
are not encrypted. Not only that, this leads to the decryption keys loaded
in the memory even when I'm not running encrypted windows.

Now I want to completely bypass this boot loader by overwriting its first
stage in MBR with custom code (while keeping the windows partition active)
to transfer control to syslinux installed in an available partition (which
in my case is a logical drive). Once I'm in syslinux, I can easily start
any operating system I want (even the encrypted windows by chainloading
the original mbr that I backed up in a file).

Now, I looked at the syslinux mbr source (the newer version) and it
appears to already have the code to parse the extended partition tables.
With little modification, it should be possible to make it do what I want.
Unfortunately, though somewhat familiar with assembly language, I don't
think it's something I can pull-off myself.

That's the reason for my request to bundle such a custom mbr with
syslinux - it could act as a first stage loader for an unconditional boot
into syslinux. The users would be able to install this MBR into sector 0,
set the correct byte to the # of partition where syslinux is installed
(0,1,2,3 or primary 4 onwards for logical), and the MBR code would find,
load and execute the corresponding boot sector. Once in syslinux, they
can interactively decide which operating system they want to boot into.

Of course users can use the traditional mbr based on the activation flag,
if they don't want this functionality.

Thanks!

--- On Fri, 12/12/08, H. Peter Anvin <hpa at zytor.com> wrote:

> From: H. Peter Anvin <hpa at zytor.com>
> Subject: Re: [syslinux] Custom MBR
> To: yyz01 at yahoo.com, "For discussion of Syslinux and tftp-hpa" <syslinux at zytor.com>
> Date: Friday, December 12, 2008, 11:39 PM
> H. Peter Anvin wrote:
> > 
> > Uhm, yes that is exactly non-standard.
> > 
> > The active flag is the standard way to tell the MBR
> where it should get
> > its next bootloader from.  And yes, it's
> nonstandard and incompatible
> > with other software -- INTENTIONALLY.
> > 
> > Technically, it's not difficult at all.  The much
> more important
> > question is WHY.  "Grub does this" is not a
> valid answer.
> > 
> 
> I should probably emphasize that this is not meant, in any
> way, as a
> rethorical question.  It is entirely possible you have
> stumbled upon a
> use case which requires this, but if so, I need to
> understand the use
> case before discussing technical solutions.
> 
> 	-hpa


      




More information about the Syslinux mailing list