Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -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_=""
1 change: 0 additions & 1 deletion debian/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 0 additions & 23 deletions default_config
Original file line number Diff line number Diff line change
Expand Up @@ -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))"
Expand All @@ -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
21 changes: 4 additions & 17 deletions grml-terminalserver
Original file line number Diff line number Diff line change
Expand Up @@ -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 (pxelinux)
execute "source $TEMPLATE_CONFIG_DIR_/grub-pxelinux_config" die
# PXE / BIOS boot (GRUB)
execute "source $TEMPLATE_CONFIG_DIR_/grub-bios_config" die

# PXE / EFI boot (GRUB)
execute "source $TEMPLATE_CONFIG_DIR_/grub-shim_config" die
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion templates/dhcpd_config
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion templates/dnsmasq_config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
81 changes: 81 additions & 0 deletions templates/grub-bios_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# the following variables are available in the template:
#
# $INTERFACE_ (interface for the terminalserver)
# $IP_ (ip for the terminalserver to bind)
# $NETMASK_ (network mask)
# $GW_ (gateway)
# $NAMESERVERS_ (nameservers for the nodes)
# $IPRANGE_FROM_ (user configured iprange, first ip)
# $IPRANGE_TO_ (user configured iprange, last ip)
# $NETWORK_ (first ip in this subnet)
# $OPTIONS_ (options for grml-terminalserver)
# $BOOT_ARGS_ (boot arguments for the nodes)
#
# NOTE:
# templates are shellscript fragments and will be sourced from the
# terminalserver
#
# GLOBAL_README_END

if [ -e "$MOUNT_POINT_" ]; then
default_boot_args_="root=/dev/nfs rw nfsroot=$IP_:$MOUNT_POINT_ \
noprompt noeject"
else
default_boot_args_="ramdisk_size=24000 root=/dev/ram0 rw \
init=/etc/init nfsdir=$IP_:$MOUNT_POINT_ nodhcp noprompt noeject \
apm=power-off nomce"
fi

if ! [ -d /run/live/medium ] ; then
echo "Error: couldn't access /run/live/medium for executing grml2usb with it." >&2
exit 2
fi

DEST_DIR=$(mktemp -d)
grml2usb --bootloader-only \
--bootoptions="$default_boot_args_ $BOOT_ARGS_" \
--remove-bootoption=nodhcp \
/run/live/medium "$DEST_DIR"

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. 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

# remove grub entries
rm -f "$TFTPD_DATA_DIR_/"addon_*grub*.cfg

rm -rf "$DEST_DIR"

# BIOS/Legacy GRUB netboot setup
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do this (Additionally for now i guess) also do this in grml-live and pack the relevant files into the iso? (not squashfs)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah maybe, didn't look into this yet (and I guess I could use some second pair of eyes + another brain to make sure we don't add too much duplicated code and all of it still makes sense, so far I tried to get it working with what we have, also want to avoid having a too strict version dependency between Grml ISOs and grml-terminalserver)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on 2026-09-03 at the Grml release sprint with @zeha, moved this to a separate issue: #28

And we'll submit this as-is for the time being.

fi
fi
fi

let ret_=$ret_+$?
return $ret_
121 changes: 0 additions & 121 deletions templates/grub-pxelinux_config

This file was deleted.

Loading
Loading