From 03555257808510dd37d49bacf12f7d72df471dcc Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 30 Apr 2026 12:46:21 +0200 Subject: [PATCH 1/5] GRUB boot: set default timeout of 20 seconds To match the behavior of our default ISO boot. Closes: https://github.com/grml/grml-terminalserver/issues/25 --- templates/grub-shim_config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/grub-shim_config b/templates/grub-shim_config index e176401..5c9b762 100644 --- a/templates/grub-shim_config +++ b/templates/grub-shim_config @@ -90,7 +90,7 @@ cat > "${TFTPD_DATA_DIR_}/grub/grub.cfg" << EOT # GRUB PXE configuration file # adjust according to your needs -#set timeout=300 +set timeout=20 insmod png set gfxmode=auto From 39d490222aa42a08b24220dae97dad673ade7e05 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 30 Apr 2026 11:07:24 +0200 Subject: [PATCH 2/5] Switch BIOS PXE boot default from pxelinux to GRUB We switched to GRUB 2 for BIOS boot instead of isolinux in grml-live recently, see https://github.com/grml/grml-live/pull/459 Now we no longer provide the expected files on our ISO any longer. Booting BIOS systems via PXE using grml-terminalserver on recent Grml ISOs now fails with: PXELINUX 6.04 PXE 20250811 Copyright (c) 1994-2015 H. Peter Anvin et al Failed to load ldlinux.c32 Boot failed: press a key to retry, or wait for reset... So point both isc-dhcp-server and dnsmasq at grub/i386-pc/core.0 for BIOS/legacy clients instead of pxelinux.0. The GRUB i386-pc netboot image is generated via grub-mknetdir (from grub2-common, requires grub-pc-bin for the i386-pc modules), and shares the same grub/grub.cfg already served to EFI clients. Generation is decided whether pxelinux.0 is present in the TFTP directory, which indicates that BIOS boot support is expected, regardless of how the terminalserver system itself booted. pxelinux.0 and pxelinux.cfg/default remain in the TFTP tree for backwards compatibility with clients that request pxelinux explicitly. While at it, also drop the legacy /lib/live/mount/medium and grml-live template fallback code paths from grub-pxelinux_config, keeping only the /run/live/medium path in use since December 2018. Closes: https://github.com/grml/grml-terminalserver/issues/26 --- grml-terminalserver | 2 +- templates/dhcpd_config | 2 +- templates/dnsmasq_config | 2 +- templates/grub-pxelinux_config | 84 +++++++++++++--------------------- 4 files changed, 34 insertions(+), 56 deletions(-) diff --git a/grml-terminalserver b/grml-terminalserver index 824860e..47221b5 100755 --- a/grml-terminalserver +++ b/grml-terminalserver @@ -242,7 +242,7 @@ function createTftpConf execute "install -m 644 $PXE_BOOT_MSG_ $TFTPD_DATA_DIR_" die [ -f "$PXE_BOOT_LOGO_" ] && execute "install -m 644 $PXE_BOOT_LOGO_ $TFTPD_DATA_DIR_" die - # PXE / BIOS boot (pxelinux) + # PXE / BIOS boot (GRUB) execute "source $TEMPLATE_CONFIG_DIR_/grub-pxelinux_config" die # PXE / EFI boot (GRUB) diff --git a/templates/dhcpd_config b/templates/dhcpd_config index 68360ae..242dbe2 100644 --- a/templates/dhcpd_config +++ b/templates/dhcpd_config @@ -65,7 +65,7 @@ subnet $NETWORK_ netmask $NETMASK_ { } elsif option architecture-type = 00:0b { filename "bootaa64.efi"; } else { - filename "pxelinux.0"; + filename "grub/i386-pc/core.0"; } } } diff --git a/templates/dnsmasq_config b/templates/dnsmasq_config index 1bcae2b..a9fdbc8 100644 --- a/templates/dnsmasq_config +++ b/templates/dnsmasq_config @@ -64,7 +64,7 @@ dhcp-match=set:efi-aa64,option:client-arch,11 dhcp-boot=tag:efi-aa64,bootaa64.efi # BIOS/Legacy boot -dhcp-boot=pxelinux.0 +dhcp-boot=grub/i386-pc/core.0 no-resolv no-hosts diff --git a/templates/grub-pxelinux_config b/templates/grub-pxelinux_config index 8360ac3..6814d63 100644 --- a/templates/grub-pxelinux_config +++ b/templates/grub-pxelinux_config @@ -33,64 +33,25 @@ pxe_def_boot_args_="$default_boot_args_" ### ## create pxelinux config ### -DEST_DIR=$(mktemp -d) -if [ -d /run/live/medium ] ; then # since December 2018 - grml2usb --bootloader-only \ - --bootoptions="$pxe_def_boot_args_ $BOOT_ARGS_" \ - --remove-bootoption=nodhcp \ - /run/live/medium "$DEST_DIR" - - mv "$DEST_DIR"/boot/syslinux/* "$TFTPD_DATA_DIR_/" - rmdir "$DEST_DIR"/boot/syslinux +if ! [ -d /run/live/medium ] ; then + echo "Error: couldn't access /run/live/medium for executing grml2usb with it." >&2 + exit 2 +fi - mv "$DEST_DIR"/boot/ "$TFTPD_DATA_DIR_" -elif [ -d /lib/live/mount/medium ] ; then - grml2usb --bootloader-only \ - --bootoptions="$pxe_def_boot_args_ $BOOT_ARGS_" \ - --remove-bootoption=nodhcp \ - /lib/live/mount/medium "$DEST_DIR" +DEST_DIR=$(mktemp -d) +grml2usb --bootloader-only \ + --bootoptions="$pxe_def_boot_args_ $BOOT_ARGS_" \ + --remove-bootoption=nodhcp \ + /run/live/medium "$DEST_DIR" +# since Grml 2026.04 we no longer use isolinux/syslinux for BIOS boot +if [ -d "$DEST_DIR"/boot/syslinux ] ; then mv "$DEST_DIR"/boot/syslinux/* "$TFTPD_DATA_DIR_/" rmdir "$DEST_DIR"/boot/syslinux - - mv "$DEST_DIR"/boot/ "$TFTPD_DATA_DIR_" -else - if [ ! -d /usr/share/grml-live/templates/boot/isolinux ] ; then - echo "E: Could not find isolinux directory, can not operate without. - -Did you boot the system with the toram=... boot option? If so please -either do not use the toram boot option at all or use boot option toram -without any arguments (just \"toram\" instead of \"toram=...\")." >&2 - exit 2 - fi - - array=( $(cat /etc/grml_version) ) - grml_name_=${array[0]} - grml_version_=${array[1]} - - cp /usr/share/grml-live/templates/boot/isolinux/* "$TFTPD_DATA_DIR_/" - - config_files_=$(find "$TFTPD_DATA_DIR_/" -name "*.cfg" -type f) - sed -i "s/%ARCH%/$(uname -m)/" $config_files_ - sed -i "s/%BOOTID%/$RANDOM/" $config_files_ - sed -i "s/%SHORT_NAME%/dummy/" $config_files_ - sed -i "s/%VERSION%/$grml_version_/" $config_files_ - sed -i "s/%GRML_NAME%/$grml_name_/" $config_files_ - sed -i "s/%DISTRI_SPLASH%/grml.png/" $config_files_ - sed -i "s/%DISTRI_INFO%/Grml/" $config_files_ - sed -i "s#\(^.*append.*initrd.*$\)#\1 $pxe_def_boot_args_ $BOOT_ARGS_#" $config_files_ - cat > "$TFTPD_DATA_DIR_/grmlmain.cfg"</dev/null 2>&1 ; then + echo "Generating GRUB i386-pc netboot image for BIOS PXE boot" + grub-mknetdir --net-directory="${TFTPD_DATA_DIR_}" --subdir=grub + else + echo "WARN: grub-pc-bin not found, cannot set up GRUB BIOS boot." + let ret_=$ret_+1 + fi +fi + let ret_=$ret_+$? return $ret_ From 31096386f5e44f07abde3711122df1491a53dfba Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 30 Apr 2026 13:19:49 +0200 Subject: [PATCH 3/5] Drop pxelinux support, use GRUB exclusively for BIOS PXE boot Remove all pxelinux/syslinux installation and configuration code, now pxelinux.0, pxelinux.cfg/, boot.msg, logo.16, ISOLIN_PATH_, PXE_BOOT_MSG_, and PXE_BOOT_LOGO_ are all gone. The grub-pxelinux_config template gets renamed to grub-bios_config to reflect that GRUB now handles both BIOS and EFI network boot. The GRUB BIOS setup is handled depending on grub-pc-bin being present or not, which as expected skips the i386-pc setup on arm64. We drop the dependency on pxelinux, and add grub-pc-bin (as required by grub-mknetdir to generate grub/i386-pc/core.0) to Recommends, as we have an architecture all package. Drop the deprecated ldbsd.com / addon__*_bsd.cfg support, while at it. --- config | 8 ---- debian/TODO | 1 - debian/control | 7 ++-- default_config | 23 ----------- grml-terminalserver | 19 ++------- ...{grub-pxelinux_config => grub-bios_config} | 41 +++++-------------- 6 files changed, 17 insertions(+), 82 deletions(-) rename templates/{grub-pxelinux_config => grub-bios_config} (59%) diff --git a/config b/config index e1abbca..099d9e7 100644 --- a/config +++ b/config @@ -14,14 +14,6 @@ # default: /run/live/medium/boot/addons/memtest #MEMTEST_IMAGE_="" -# path to pxelinux boot message -# default: /run/live/medium/boot/isolinux/boot.msg -#PXE_BOOT_MSG_="" - -# path to pxelinux boot logo -# default: /run/live/medium/boot/isolinux/logo.16 -#PXE_BOOT_LOGO_="" - # should the terminalserver activate snat for the clients to his default gateway? # default: true #IPTABLES_SNAT_="" diff --git a/debian/TODO b/debian/TODO index ee1a611..2db558c 100644 --- a/debian/TODO +++ b/debian/TODO @@ -3,7 +3,6 @@ TODOs for grml-terminalserver * DON'T delete /var/lib/tftpdboot on a !grml-system * config vars to use external services (dhcp, tftp, nfs) - * make pxelinux configurable (to use another pxe-boot-manager) (MAYBE) * don't write to /etc/grml/terminalserver * don't recreate the config on every grml-terminalserver start * introduce a special config rewrite commando diff --git a/debian/control b/debian/control index 2937bc5..5e9ae37 100644 --- a/debian/control +++ b/debian/control @@ -21,13 +21,14 @@ Depends: dialog, dnsmasq-base | isc-dhcp-server, grml2usb, - grub-efi-amd64-signed | grub-efi-amd64-bin | grub-efi-arm64-signed | grub-efi-arm64-bin | pxelinux, + grub-efi-amd64-signed | grub-efi-amd64-bin | grub-efi-arm64-signed | grub-efi-arm64-bin, ipcalc, iptables, nfs-kernel-server, - pxelinux, - shim-signed:amd64 | shim-signed:arm64 | pxelinux, + shim-signed:amd64 | shim-signed:arm64, ${misc:Depends}, +Recommends: + grub-pc-bin, Description: terminalserver for grml to boot via PXE These packages provides all what's needed to boot grml over the network (PXE). An easy to use interface diff --git a/default_config b/default_config index 62da7f7..e714d53 100644 --- a/default_config +++ b/default_config @@ -15,15 +15,6 @@ else # no grml2usb but running from CD DATA_PATH_="$MOUNT_POINT_/boot" fi -# new grml2usb layout -if [ -d "$MOUNT_POINT_"/boot/syslinux ] ; then - ISOLIN_PATH_="$MOUNT_POINT_/boot/syslinux" - test -d $ISOLIN_PATH_ || ISOLIN_PATH_="$MOUNT_POINT_" -else # old layout - ISOLIN_PATH_="$DATA_PATH_/isolinux" - test -d $ISOLIN_PATH_ || ISOLIN_PATH_="$MOUNT_POINT_" -fi - # addons if [[ "$(find $MOUNT_POINT_ -maxdepth 3 -name memtest |head -n1)" != "" ]] ; then ADDONS_PATH_="$(dirname $(find $MOUNT_POINT_ -maxdepth 3 -name memtest |head -n1))" @@ -48,20 +39,6 @@ if [ ! -f "$MEMTEST_IMAGE_" ] ; then MEMTEST_IMAGE_=$(find /boot -name memtest*.bin | head -n1) fi -PXE_BOOT_MSG_="$ISOLIN_PATH_/boot.msg" -# grml2usb with grub doesn't provide boot.msg, so generate a default one -if ! [ -f "$PXE_BOOT_MSG_" ] ; then - PXE_BOOT_MSG_="$(mktemp)" - cat > $PXE_BOOT_MSG_ << EOF -17 logo.16 - -Some information and boot options available via keys F2 - F10. http://grml.org/ - -EOF -fi - -PXE_BOOT_LOGO_="$ISOLIN_PATH_/logo.16" - IPTABLES_SNAT_="true" # EOF diff --git a/grml-terminalserver b/grml-terminalserver index 47221b5..0d2314b 100755 --- a/grml-terminalserver +++ b/grml-terminalserver @@ -229,21 +229,13 @@ function createTftpConf { removeTftpConf - execute "mkdir -p $TFTPD_DATA_DIR_/pxelinux.cfg" die - if [ -r /usr/lib/PXELINUX/pxelinux.0 ] ; then - execute "install -m 644 /usr/lib/PXELINUX/pxelinux.0 $TFTPD_DATA_DIR_" die - else # older versions of syslinux-common (<= 2:4.05+dfsg-6+deb7u1): - execute "install -m 644 /usr/lib/syslinux/pxelinux.0 $TFTPD_DATA_DIR_" die - fi if [ -d "$MOUNT_POINT_"/boot/release ] ; then cp -r "$MOUNT_POINT_"/boot/release "$TFTPD_DATA_DIR_" fi [ -f "$MEMTEST_IMAGE" ] && execute "install -m 644 $MEMTEST_IMAGE_ $TFTPD_DATA_DIR_/memtest" die - execute "install -m 644 $PXE_BOOT_MSG_ $TFTPD_DATA_DIR_" die - [ -f "$PXE_BOOT_LOGO_" ] && execute "install -m 644 $PXE_BOOT_LOGO_ $TFTPD_DATA_DIR_" die # PXE / BIOS boot (GRUB) - execute "source $TEMPLATE_CONFIG_DIR_/grub-pxelinux_config" die + execute "source $TEMPLATE_CONFIG_DIR_/grub-bios_config" die # PXE / EFI boot (GRUB) execute "source $TEMPLATE_CONFIG_DIR_/grub-shim_config" die @@ -422,17 +414,12 @@ isExistent $DEFAULT_CONFIG_ die # used config vars: # MOUNT_POINT_ # MEMTEST_IMAGE_ -# PXE_BOOT_MSG_ -# PXE_BOOT_LOGO_ if [[ $MEMTEST_IMAGE_ == "" ]]; then warn "MEMTEST_IMAGE_=\"$MEMTEST_IMAGE_\"" fi -if [[ $MOUNT_POINT_ == "" || \ - $PXE_BOOT_MSG_ == "" || $PXE_BOOT_MSG_ == "" ]]; then - warn "MOUNT_POINT_=\"$MOUNT_POINT_\" \ -PXE_BOOT_MSG_=\"$PXE_BOOT_MSG_\" -PXE_BOOT_LOGO_=\"$PXE_BOOT_LOGO_\"" +if [[ $MOUNT_POINT_ == "" ]]; then + warn "MOUNT_POINT_=\"$MOUNT_POINT_\"" die "Wrong configuration, please update $CONFIG_" fi diff --git a/templates/grub-pxelinux_config b/templates/grub-bios_config similarity index 59% rename from templates/grub-pxelinux_config rename to templates/grub-bios_config index 6814d63..0051e7b 100644 --- a/templates/grub-pxelinux_config +++ b/templates/grub-bios_config @@ -17,7 +17,6 @@ # # GLOBAL_README_END -# default boot arguments used for both grub and pxelinux if [ -e "$MOUNT_POINT_" ]; then default_boot_args_="root=/dev/nfs rw nfsroot=$IP_:$MOUNT_POINT_ \ noprompt noeject" @@ -27,12 +26,6 @@ init=/etc/init nfsdir=$IP_:$MOUNT_POINT_ nodhcp noprompt noeject \ apm=power-off nomce" fi -# special boot arguments required by pxelinux -pxe_def_boot_args_="$default_boot_args_" - -### -## create pxelinux config -### if ! [ -d /run/live/medium ] ; then echo "Error: couldn't access /run/live/medium for executing grml2usb with it." >&2 exit 2 @@ -40,16 +33,10 @@ fi DEST_DIR=$(mktemp -d) grml2usb --bootloader-only \ - --bootoptions="$pxe_def_boot_args_ $BOOT_ARGS_" \ + --bootoptions="$default_boot_args_ $BOOT_ARGS_" \ --remove-bootoption=nodhcp \ /run/live/medium "$DEST_DIR" -# since Grml 2026.04 we no longer use isolinux/syslinux for BIOS boot -if [ -d "$DEST_DIR"/boot/syslinux ] ; then - mv "$DEST_DIR"/boot/syslinux/* "$TFTPD_DATA_DIR_/" - rmdir "$DEST_DIR"/boot/syslinux -fi - mv "$DEST_DIR"/boot/ "$TFTPD_DATA_DIR_" # Copy initrd.img and vmlinuz from all directories which name begins @@ -67,31 +54,23 @@ if [ -d "$MOUNT_POINT_"/boot/release ] ; then sed -i -e 's#\(.*\)/boot/\(.*\)#\1\2#' $config_files_ fi -# adjust ldbsd.com bootline -if ls "$TFTPD_DATA_DIR_/"addon_*_bsd.cfg >/dev/null 2>&1; then - sed -i -e 's#\(.*kernel .*/ldbsd.com\)#\1 set image /boot/addons/bsd4grml/bsd.rd`echo Type "boot" to load MirOS bsd4grml via keeppxe#' "$TFTPD_DATA_DIR_/"addon_*_bsd.cfg -fi - # remove grub entries rm -f "$TFTPD_DATA_DIR_/"addon_*grub*.cfg -# since Grml 2026.04 we no longer use isolinux/syslinux for BIOS boot -if [ -f "$TFTPD_DATA_DIR_/syslinux.cfg" ] ; then - mv "$TFTPD_DATA_DIR_/syslinux.cfg" "$TFTPD_DATA_DIR_/pxelinux.cfg/default" -fi - rm -rf "$DEST_DIR" # BIOS/Legacy GRUB netboot setup -if [ -r "${TFTPD_DATA_DIR_}/pxelinux.0" ] ; then - if [ -r "${TFTPD_DATA_DIR_}/grub/i386-pc/core.0" ] ; then - echo "${TFTPD_DATA_DIR_}/grub/i386-pc/core.0 exists already, nothing to do." - elif [ -d /usr/lib/grub/i386-pc ] && command -v grub-mknetdir >/dev/null 2>&1 ; then - echo "Generating GRUB i386-pc netboot image for BIOS PXE boot" - grub-mknetdir --net-directory="${TFTPD_DATA_DIR_}" --subdir=grub - else +if [ -d /usr/lib/grub/i386-pc ] ; then + if ! command -v grub-mknetdir >/dev/null 2>&1 ; then echo "WARN: grub-pc-bin not found, cannot set up GRUB BIOS boot." let ret_=$ret_+1 + else + if [ -r "${TFTPD_DATA_DIR_}/grub/i386-pc/core.0" ] ; then + echo "${TFTPD_DATA_DIR_}/grub/i386-pc/core.0 exists already, nothing to do." + else + echo "Generating GRUB i386-pc netboot image for BIOS PXE boot" + grub-mknetdir --net-directory="${TFTPD_DATA_DIR_}" --subdir=grub + fi fi fi From d4beb69fb95b924437ee058eae8c2a3857431c11 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 30 Apr 2026 16:28:46 +0200 Subject: [PATCH 4/5] GRUB: support custom themes + bring configuration closer to grml-live defaults Now that we support $prefix instead of hardcoded /boot/grub usage in our GRUB configuration files (see https://github.com/grml/grml-live/pull/548), we can also support custom GRUB themes and alike. Set up `grub` directory in tftpboot directory (/var/lib/tftpboot by default) for booting GRUB via PXE/netboot, providing all files that might be relevant for booting. Avoid rewriting the configuration files on the fly, and instead bring grub.cfg as close as possible to what we're using on the live system also (the GRUB netboot binary sadly doesn't neither support sourcing files with regexp nor testing for files with [ -e ....]). NOTE: we are *not* setting up / including `addons.cfg`, as all entries are known to be failing (the test for the files all fail as stated in the previous paragraph already), even when removing the tests and adjusting the paths to use $prefix/../addons/ instead of /boot/addons/, it doesn't work and chainloading the addons via PXE/netboot fail with: error: Access violation See https://github.com/grml/grml-live/issues/321 --- templates/grub-bios_config | 23 ++++++++++-------- templates/grub-shim_config | 49 ++++++++++++++++++-------------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/templates/grub-bios_config b/templates/grub-bios_config index 0051e7b..e1ee88a 100644 --- a/templates/grub-bios_config +++ b/templates/grub-bios_config @@ -39,21 +39,24 @@ grml2usb --bootloader-only \ mv "$DEST_DIR"/boot/ "$TFTPD_DATA_DIR_" +if [ -d "$DEST_DIR"/grub ] ; then + mkdir -p "$TFTPD_DATA_DIR_"/grub + cp -r "$DEST_DIR"/grub/. "$TFTPD_DATA_DIR_"/grub/ +fi + # Copy initrd.img and vmlinuz from all directories which name begins -# with grml, e.g. grml32full and grml64full -# This way we can boot multiple ISOs -for filename in "${MULTIBOOT_PATH_}"/grml* ; do +# with grml, e.g. grml-full and grml-small +# This way we can boot multiple ISOs. +# Try MULTIBOOT_PATH_ first; if that yields nothing also search the standard +# /run/live/medium/boot/ location directly (MULTIBOOT_PATH_ may fall back to +# MOUNT_POINT_ when the grml2usb release/ layout is absent on newer ISOs). +for filename in "${MULTIBOOT_PATH_}"/grml* "${MOUNT_POINT_}/boot"/grml* ; do [ -d "$filename" ] || continue + dest_="${TFTPD_DATA_DIR_}/boot/$(basename "${filename}")" + [ -d "$dest_" ] && continue cp -r "${filename}" "${TFTPD_DATA_DIR_}/boot/" done -config_files_=$(find "$TFTPD_DATA_DIR_/" -name "*.cfg" -type f) - -# cd is multi iso, grml2usb got it right ;0 -if [ -d "$MOUNT_POINT_"/boot/release ] ; then - sed -i -e 's#\(.*\)/boot/\(.*\)#\1\2#' $config_files_ -fi - # remove grub entries rm -f "$TFTPD_DATA_DIR_/"addon_*grub*.cfg diff --git a/templates/grub-shim_config b/templates/grub-shim_config index 5c9b762..619e5b3 100644 --- a/templates/grub-shim_config +++ b/templates/grub-shim_config @@ -84,46 +84,43 @@ else echo "WARN: No unicode.pf2 for usage with PXE boot found." fi -echo "Setting up GRUB configuration for PXE/UEFI usage" +echo "Setting up GRUB configuration for PXE/EFI/BIOS usage" mkdir -p "${TFTPD_DATA_DIR_}/grub/" -cat > "${TFTPD_DATA_DIR_}/grub/grub.cfg" << EOT +cat > "${TFTPD_DATA_DIR_}/grub/grub.cfg" << "EOT" # GRUB PXE configuration file -# adjust according to your needs -set timeout=20 - -insmod png -set gfxmode=auto -insmod gfxterm -terminal_output gfxterm - -loadfont unicode - -set menu_color_normal=white/black -set menu_color_highlight=black/yellow - -# this needs some tuning, so not enabled by default -# set theme=/boot/grub/grml-theme/theme.txt -# export theme +source "${prefix}/header.cfg" EOT -# theme support requires e.g. icons/submenu.png within the theme directory, -# which we don't ship though, so not enabled by default -#mkdir -p "${TFTPD_DATA_DIR_}"/grub/themes/boot/grub -#ln -s "${TFTPD_DATA_DIR_}"/boot/grub/grml-theme "${TFTPD_DATA_DIR_}"/grub/themes/boot/grub/ - -for file in "${TFTPD_DATA_DIR_}"/boot/grub/*_default.cfg "${TFTPD_DATA_DIR_}"/boot/grub/*_options.cfg ; do +# NOTE: GRUB in netboot doesn't support sourcing files with regexp, so we need to prepare this statically +for file in "${TFTPD_DATA_DIR_}"/grub/*_default.cfg "${TFTPD_DATA_DIR_}"/grub/*_options.cfg ; do + [ -f "$file" ] || continue filename="$(basename "${file}")" - echo "source boot/grub/${filename}" >> "${TFTPD_DATA_DIR_}/grub/grub.cfg" + echo "source \${prefix}/${filename}" >> "${TFTPD_DATA_DIR_}/grub/grub.cfg" done -cat >> "${TFTPD_DATA_DIR_}/grub/grub.cfg" << EOT +cat >> "${TFTPD_DATA_DIR_}/grub/grub.cfg" << "EOT" +# separator entry, no action +menuentry "" { + true +} + +source "${prefix}/help.cfg" + +if [ "${grub_platform}" == "efi" ] ; then +menuentry "UEFI Firmware Settings" { + fwsetup +} +fi # efi mode menuentry "Boot OS of first partition on first disk" { set root=(hd0,1) chainloader +1 } + +source "${prefix}/footer.cfg" +# EOF EOT (( ret_=ret_+ $? )) From d58cabc54f658420a9e20e23e03e2cf70a27e5f7 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sun, 12 Jul 2026 01:48:42 +0200 Subject: [PATCH 5/5] GRUB: add support for 32-bit firmware on 64-bit CPU hardware While 32-bit UEFI hopefully isn't common any longer, let's support it if either the grub-efi-ia32-signed or grub-efi-ia32-unsigned packages are available, given we also support it in grml-live's config/media-scripts/GRMLBASE/31-grub. --- templates/grub-shim_config | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/templates/grub-shim_config b/templates/grub-shim_config index 619e5b3..79f34de 100644 --- a/templates/grub-shim_config +++ b/templates/grub-shim_config @@ -18,6 +18,7 @@ # GLOBAL_README_END if [ "$(uname -m)" = "x86_64" ]; then + # 64-bit UEFI (grubx64.efi / bootx64.efi) if [ -r "${TFTPD_DATA_DIR_}"/grubx64.efi ] ; then echo "${TFTPD_DATA_DIR_}/grubx64.efi exists already, nothing to do." elif [ -r /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed ] ; then @@ -44,6 +45,21 @@ if [ "$(uname -m)" = "x86_64" ]; then echo "WARN: No shimx64.efi for usage with PXE boot found. Using GRUB directly as bootx64.efi." cp "${TFTPD_DATA_DIR_}"/grubx64.efi "${TFTPD_DATA_DIR_}"/bootx64.efi fi + + # 32-bit UEFI (grubia32.efi) + # targets 32-bit firmware on 64-bit CPU hardware + if [ -r "${TFTPD_DATA_DIR_}"/grubia32.efi ] ; then + echo "${TFTPD_DATA_DIR_}/grubia32.efi exists already, nothing to do." + elif [ -r /usr/lib/grub/i386-efi-signed/grubnetia32.efi.signed ] ; then + echo "Installing /usr/lib/grub/i386-efi-signed/grubnetia32.efi.signed as grubia32.efi for TFTP usage" + cp /usr/lib/grub/i386-efi-signed/grubnetia32.efi.signed "${TFTPD_DATA_DIR_}"/grubia32.efi + elif [ -r /usr/lib/grub/i386-efi/monolithic/grubnetia32.efi ] ; then + echo "Installing /usr/lib/grub/i386-efi/monolithic/grubnetia32.efi as grubia32.efi for TFTP usage" + cp /usr/lib/grub/i386-efi/monolithic/grubnetia32.efi "${TFTPD_DATA_DIR_}"/grubia32.efi + else + echo "WARN: No grubnetia32.efi for usage with PXE boot found, not setting up 32-bit UEFI boot via GRUB." + (( ret_=ret_+ $? )) + fi fi if [ "$(uname -m)" = "aarch64" ]; then if [ -r "${TFTPD_DATA_DIR_}"/grubaa64.efi ] ; then