git: boot2: slim it down about 300 bytes

John Marino marino at
Sun Feb 5 03:05:30 PST 2012

commit c9a7ee71b09befb1fa44a0cc3ec4698b4ca75415
Author: John Marino <draco at>
Date:   Sun Feb 5 11:28:50 2012 +0100

    boot2: slim it down about 300 bytes
    The boot2_32.ld loader file needs to come in at 7680 bytes or less, while
    boot2_64.ld can be a little bigger with a 14848 byte threshold.  The
    32-bit version has the least memory margin.  Using the base gcc 4.4
    compiler, it only has 396 bytes to spare.
    Using updates from FreeBSD buys 292 additional bytes when built by the
    base compiler.  This additional space may be useful for building world
    with clang which may have slightly larger executables.
    List of changes from FreeBSD
    SVN 151382 (16 OCT 2005)
    SHRINK: Convert load() ep and es arrays to static variables
    SVN 180145 (01 JUL 2008)
    BUG: parse function off by one
    change "if (dsk.slice > NDOSPART)" to "if (dsk.slice > NDOSPART + 1)"
    SVN 214210 (22 OCT 2010)
    SHRINK: Avoid using memcpy() for copying 32bit chunks.
    SVN 218713 (15 FEB 2011)
    SHRINK: Change autoboot type from int to uint8_t
    SVN 218745 (16 FEB 2011)
    SHRINK: Remove reading of symbols from a.out loaded files.  This
    functionality was left over from the early FreeBSD 3.x days to
    support kernels in a.out format which never applied to DragonFly.
    Removing it saves around 100 bytes.  bootinfo.bi_esymtab was also
    relocated to the ELF section rather than aways being set.
    SVN 219186 (02 MAR 2011)
    SHRINK: Change the tick overflow computation.
    Remove bi_basemem, bi_extmem, bi_memsizes_valid (unused).
    Switch kname to a pointer from an array to avoid using memcpy() twice.
    Remove memsize function (unused)
    SVN 219452 (10 MAR 2011)
    SHRINK: Convert to uint8_t: dsk.slice, dsk.part, sl.
    Remove fmt variable in load() used in redundant condition ladder.
    Set buffer as static in printf() to save space.
    SVN 220392 (06 APR 2011)
    BUG: Move getc() before xgetc() so gcc does not emit a warning about
    function having no body.
    Minor changes from John Marino
    Created RBF_NOINTR and RBF_PROBEKBD macros for consist style.
    Removed "#if 0" sections to clean up.
    returned "static" back to drvread body (was still in prototype).
    Changed xputc() to return the char rather than void (matches FreeBSD),

Summary of changes:
 sys/boot/pc32/boot2/boot2.c |  140 +++++++++++++++----------------------------
 1 files changed, 49 insertions(+), 91 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list