[syslinux] [PATCH v2] core: Check size of ldlinux.sys at building time.

Matt Fleming
Thu, 03 Oct 2013 14:08:30 -0000

On Mon, 30 Sep, at 02:14:34AM, Raphael S.Carvalho wrote:
> From: Raphael S. Carvalho <raphael.scarv at gmail.com>
>
> v2: Extract ADV_SIZE automatically from libinstaller/setadv.h.
>
> Calc the size of ldlinux.sys from ldlinux.bin, and check if it exceeds the
limit.
> ldlinux.sys must fit between the bootsector and two copies of ADV whose
size may vary.
> Thus, the size of ldlinux.sys can be at most: 65536 - 2 * ADV_SIZE - 512
(limit).
>
> Certain file systems (such as BTRFS and UFS2) will rely on ldlinux.sys
being installed on the 0-64k range,
> thus it can't exceed the limit, otherwise the superblock would be
corrupted.
>
> Signed-off-by: Raphael S. Carvalho <raphael.scarv at gmail.com>
> Suggested-by: Matt Fleming <matt at console-pimps.org>
> ---
>  core/Makefile         |    1 +
>  core/ldlinux_limit.pl |   80
+++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 81 insertions(+), 0 deletions(-)
>  create mode 100755 core/ldlinux_limit.pl

[...]

> +use File::stat;
> +use constant DEBUG => (1);

Hehe, might wanna turn debug off ;-)

But the rest of this patch looks good to me. The problem now of course
is, how do we shrink the core so that this patch doesn't break the
build?

--
Matt Fleming, Intel Open Source Technology Center