Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Aug 2024 17:31:37 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e91ae9079619 - stable/14 - pxeboot: Enforce a 500k limit here
Message-ID:  <202408131731.47DHVbSe050932@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=e91ae90796195afb6c58adb601f6d04dea865877

commit e91ae90796195afb6c58adb601f6d04dea865877
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-08-05 21:19:36 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-08-13 17:31:38 +0000

    pxeboot: Enforce a 500k limit here
    
    Have a separate PXEBOOTSIZE variable that acts much like LOADERSIZE
    variable to limit the size of the loader used for pxeldr. This allows
    people to override it independently of LOADERSIZE, which they may need
    to set larger for other reasons. Combined with PXEBOOT_DEFAULT_INTERP,
    you can build a larger lua loader, while still being able to build pxeldr
    with the 4th one, for example.
    
    MFC After:              3 days
    Sponsored by:           Netflix
    Reviewed by:            markj
    Differential Revision:  https://reviews.freebsd.org/D46214
    
    (cherry picked from commit e1a6d93155cea7fbb038dee671ecf005c4846fd3)
---
 stand/i386/pxeldr/Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/stand/i386/pxeldr/Makefile b/stand/i386/pxeldr/Makefile
index 27f9a44cf21c..36d3d3ad878e 100644
--- a/stand/i386/pxeldr/Makefile
+++ b/stand/i386/pxeldr/Makefile
@@ -29,6 +29,12 @@ L=${PXEBOOT_DEFAULT_INTERP}
 L=${LOADER_DEFAULT_INTERP}
 .endif
 LOADERBIN= ${BOOTOBJ}/i386/loader_${L}/loader_${L}.bin
+# pxeboot runs in an environment where there's 500k or less of space available
+# due to space for packet buffers, network drivers, etc. While some environments
+# may have a bit more, the limit of 500,000 (488k) provides enough margin to
+# work in a huge array of environments. Larger values may work for specific
+# environments.
+PXEBOOTSIZE?=500000
 
 CLEANFILES+= ${BOOT}.tmp
 
@@ -44,6 +50,8 @@ CLEANFILES+= ${LOADER}
 # Note: pxeldr.S assumes a.out and will require changes for ELF if the output
 # format is changed to ELF.
 ${LOADER}: ${LOADERBIN} ${BTXLDR} ${BTXKERN}
+	@set -- `ls -l ${LOADERBIN}` ; x=$$((${PXEBOOTSIZE}-$$5)); \
+	    echo "$$x bytes available"; test $$x -ge 0
 	btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
 	    -b ${BTXKERN} ${LOADERBIN}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202408131731.47DHVbSe050932>