aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2021-01-22 18:33:51 +0000
committerMichael Brown <mcb30@ipxe.org>2021-01-22 18:34:47 +0000
commitae73fb5aa0c8a39d6dc688d856483610ebe12682 (patch)
tree11a3b1d0c788bc1e5fd32701df0127bd93e9ca72
parent34f51a0dcac5c444ed24c3b4ac73c1c6a2ddeb89 (diff)
downloadipxe-ae73fb5aa0c8a39d6dc688d856483610ebe12682.zip
ipxe-ae73fb5aa0c8a39d6dc688d856483610ebe12682.tar.gz
ipxe-ae73fb5aa0c8a39d6dc688d856483610ebe12682.tar.bz2
[build] Allow an initrd script to be provided via genfsimg
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rwxr-xr-xsrc/util/genfsimg19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/util/genfsimg b/src/util/genfsimg
index b30ffe4..b9d5b3f 100755
--- a/src/util/genfsimg
+++ b/src/util/genfsimg
@@ -11,9 +11,10 @@ help() {
echo "usage: ${0} [OPTIONS] foo.lkrn|foo.efi [bar.lkrn|bar.efi,...]"
echo
echo "where OPTIONS are:"
- echo " -h show this help"
- echo " -o FILE save image to file"
- echo " -p PAD pad filesystem (in kB)"
+ echo " -h show this help"
+ echo " -o FILE save image to file"
+ echo " -p PAD pad filesystem (in kB)"
+ echo " -s SCRIPT use executable script"
}
# Get hex byte from binary file
@@ -113,7 +114,8 @@ copy_syslinux_file() {
#
OUTFILE=
PAD=0
-while getopts "hlo:p:" OPTION ; do
+SCRIPT=
+while getopts "hlo:p:s:" OPTION ; do
case "${OPTION}" in
h)
help
@@ -125,6 +127,9 @@ while getopts "hlo:p:" OPTION ; do
p)
PAD="${OPTARG}"
;;
+ s)
+ SCRIPT="${OPTARG}"
+ ;;
*)
help
exit 1
@@ -197,9 +202,15 @@ for FILENAME ; do
echo "SAY iPXE boot image" > "${SYSLINUXCFG}"
echo "TIMEOUT 30" >> "${SYSLINUXCFG}"
echo "DEFAULT ${DESTFILE}" >> "${SYSLINUXCFG}"
+ if [ -n "${SCRIPT}" ] ; then
+ cp "${SCRIPT}" "${BIOSDIR}/autoexec.ipxe"
+ fi
fi
echo "LABEL ${DESTFILE}" >> "${SYSLINUXCFG}"
echo " KERNEL ${DESTFILE}" >> "${SYSLINUXCFG}"
+ if [ -n "${SCRIPT}" ] ; then
+ echo " APPEND initrd=autoexec.ipxe" >> "${SYSLINUXCFG}"
+ fi
LKRN=1
;;
*.efi)