SystemRescueCD iPXE menu script and monkeypatch for preloading sysrcd.dat with iPXE instead of loading from local storage
#!ipxe | |
set sysrcd-version 4.7.1 | |
echo Booting SystemRescueCD ${sysrcd-version} x86 for ${initiator-iqn} | |
# Kernel command-line options are documented here: | |
# http://www.system-rescue-cd.org/Sysresccd-manual-en_Booting_the_CD-ROM#Network_boot_using_PXE | |
set base-url sysrcd-${sysrcd-version}-x86/ | |
kernel ${base-url}isolinux/altker${archs} setkmap=no net.ifnames=0 backstore=off | |
initrd ${base-url}isolinux/initram.igz | |
initrd ${base-url}sysrcd.dat /sysrcd.dat | |
# Load the ramdisk again as a file inside the ramdisk, so our custom init script | |
# below can unpack the original init script and apply the monkeypatch | |
# For some reason, the kernel doesn't support the init=/myinit parameter. | |
initrd ${base-url}isolinux/initram.igz /initram.igz | |
initrd sysrcd.ipxe.init.diff /init.diff | |
initrd sysrcd.ipxe.init /init mode=755 | |
boot || goto failed | |
goto start |
#!/bin/sh | |
echo "Patching original init script with iPXE monkeypatch" | |
busybox xzcat /initram.igz | busybox cpio -i --quiet --to-stdout init >/init.dist | |
busybox patch /init.dist /init.diff | |
busybox mv /init.dist /init.patched | |
busybox rm /init.diff | |
busybox rm /initram.igz | |
echo "Sourcing patched init script" | |
. /init.patched |
--- init.dist 2016-07-06 22:41:12.662454285 +0200 | |
+++ init.patched 2016-07-06 22:42:41.210800377 +0200 | |
@@ -1757,6 +1757,13 @@ | |
# ============================================================================= | |
+# Monkeypatch for preloaded sysrcd.dat with iPXE | |
+sysresccd_stage1_normal() | |
+{ | |
+ good_msg "Moving preloaded /${LOOPDAT} into ${BOOTPATH}/..." | |
+ mv /${LOOPDAT} ${BOOTPATH}/ || sysresccd_panic "Unable to move /${LOOPDAT} to ${BOOTPATH}: $!" | |
+} | |
+ | |
sysresccd_init | |
sysresccd_parsecmdline | |
sysresccd_terminal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment