[syslinux] [PATCH 1/1] core: Add a check at ldlinux.sys build time.

Raphael S Carvalho raphael.scarv at gmail.com
Fri Jul 26 14:20:45 PDT 2013


On Fri, Jul 26, 2013 at 5:42 PM, H. Peter Anvin <hpa at zytor.com> wrote:

> On 07/26/2013 01:36 PM, Raphael S Carvalho wrote:
> >
> > Bootsector is installed into the 0-512 range, whereas 2 copies of ADV
> > into (65536 - 2 * ADV_SIZE).
> > Then basically ldlinux.sys must fit between the bootsector and two
> > copies of ADV whose size may vary.
> >
> > The range 0-64k is laid out something like this, right?!
> > [0](bootsector)[512](ldlinux.sys)[65536 - 2 * ADV_SIZE](2 copies of
> > ADV)[65536]
> >
> > If so, the size of ldlinux.sys can be at most: 65536 - 2 * ADV_SIZE -
> 512.
> > If ADV_SIZE change from 512 to 4k, it will be difficult to install
> > ldlinux.sys at the 0-64k range of a BTRFS image.
> >
>
> That is correct.  We may have to do something like Grub's "stage 1.5", a
> totally stripped down version of ldlinux.sys containing just enough to
> load the real ldlinux.sys from the filesystem.  Sigh.
>
>         -hpa
>
>
>
So I suppose that test can be fixed by just recalculating $limit.
However, $adv_size will need care since the size of ADV may change in the
future.

$adv_size = 512;
$limit = 65536 - 2 * $adv_size - 512;

Regards,
Raphael S. Carvalho.


More information about the Syslinux mailing list