path: root/
diff options
author Eric Hameleers <>2016-04-13 00:34:31 +0200
committer Eric Hameleers <>2016-04-13 00:34:31 +0200
commit6dfb4058af8a59c17aeeb80b567ce521f6ace59b (patch)
tree868744a63ca8b7e03b218d060ae18c889fde5053 /
parent801f1f62b09c68a42c078b3a619539456b160f45 (diff)
Add NFS root support.
It is now possible to PXE-boot the Slackware Live Edition. Extract the content of the ISO to (for instance) a new directory called 'slackware-live' below your TFTP server's /tftproot directory and then add lines like this to your pxelinux.cfg/default file: label liveslak kernel slackware-live/boot/generic append initrd=slackware-live/boot/initrd.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=us tz=Europe/Amsterdam locale=us_EN.utf8 nfsroot= hostname=pxelive Two new boot parameters have been added to support a NFS root: * nfsroot => mandatory parameter defines the IP address of the NFS server and the path to the extracted content of Slackware Live Edition. * nic => parameter defining the driver for the network card (optional and usually not needed because UDEV will figure out the driver for you), the interface name (optional), the IP configuration method (static IP or DHCP), and in case of a static IP, the required parameters ipaddress, netmask and an optional gateway. Note that the 'nic' parameter is optional if you have a DHCP server in your LAN: Slackware Live will figure out what the interface name is. Syntax of these parameters: nic=<driver>:<interface>:<dhcp|static>[:ipaddr:netmask[:gateway]] Example use of these parameters: nfsroot= nic=auto:eth0:static: nic=:eth1:static:
Diffstat (limited to '')
1 files changed, 36 insertions, 1 deletions
diff --git a/ b/
index f3f82d7..6fe3b34 100755
--- a/
+++ b/
@@ -36,7 +36,7 @@
# -----------------------------------------------------------------------------
# Version of the Live OS generator:
# Directory where our live tools are stored:
LIVE_TOOLDIR=${LIVE_TOOLDIR:-"$(cd $(dirname $0); pwd)"}
@@ -65,6 +65,9 @@ BOOTLOADSIZE=${BOOTLOADSIZE:-4}
# Therefore we disable 32bit EFI by default. Enable at your own peril:
+# Include support for NFS root (PXE boot), will increase size of the initrd:
# Timestamp:
THEDATE=$(date +%Y%m%d)
@@ -163,6 +166,15 @@ SEQ_CIN="tagfile:a,ap,d,e,f,k,l,n,t,tcl,x,xap,xfce,y pkglist:slackextra,cinnamon
# Lots of HID modules added to support keyboard input for LUKS password entry:
+# Firmware for wired network cards required for NFS root support:
+NETFIRMWARE="3com acenic adaptec bnx tigon e100 sun kaweth tr_smctr cxgb3"
+# Network kernel modules to include for NFS root support:
+# Network kernel modules to exclude from above list:
+NETEXCL="appletalk arcnet bonding can dummy.ko hamradio hippi ifb.ko irda macvlan.ko macvtap.ko pcmcia sb1000.ko team tokenring tun.ko usb veth.ko wan wimax wireless xen-netback.ko"
# ---------------------------------------------------------------------------
@@ -1558,6 +1570,29 @@ cat $LIVE_TOOLDIR/liveinit | sed \
cat /dev/null > ${LIVE_ROOTDIR}/boot/initrd-tree/luksdev
# We do not add openobex to the initrd and don't want to see irrelevant errors:
rm ${LIVE_ROOTDIR}/boot/initrd-tree/lib/udev/rules.d/*openobex*rules 2>${DBGOUT} || true
+if [ "$NFSROOTSUP" = "YES" ]; then
+ # Add dhcpcd for NFS root support:
+ DHCPD_PKG=$(find ${DEF_SL_PKGROOT}/../ -name "dhcpcd-*.t?z" |head -1)
+ tar -C ${LIVE_ROOTDIR}/boot/initrd-tree/ -xf ${DHCPD_PKG} \
+ var/lib/dhcpcd lib/dhcpcd sbin/dhcpcd usr/lib${DIRSUFFIX}/dhcpcd \
+ etc/
+ mv ${LIVE_ROOTDIR}/boot/initrd-tree/etc/dhcpcd.conf{.new,}
+ # Add just the right kernel network modules by pruning unneeded stuff:
+ KMODS_PKG=$(find ${DEF_SL_PKGROOT}/../ -name "kernel-modules-*$(echo $KVER |tr - _)*.t?z" |head -1)
+ tar -C ${LIVE_ROOTDIR}/boot/initrd-tree/ -xf ${KMODS_PKG} \
+ lib/modules/${KVER}/${NETMODS}
+ for KNETRM in ${NETEXCL} ; do
+ find ${LIVE_ROOTDIR}/boot/initrd-tree/lib/modules/${KVER}/${NETMODS} \
+ -name $KNETRM -depth -exec rm -rf {} \;
+ done
+ # We added extra modules to the initrd, so we run depmod again:
+ chroot ${LIVE_ROOTDIR}/boot/initrd-tree /sbin/depmod $KVER
+ # Add the firmware for network cards that need them:
+ KFW_PKG=$(find ${DEF_SL_PKGROOT}/../ -name "kernel-firmware-*.t?z" |head -1)
+ tar tf ${KFW_PKG} |grep -E "($(echo $NETFIRMWARE |tr ' ' '|'))" \
+ |xargs tar -C ${LIVE_ROOTDIR}/boot/initrd-tree/ -xf ${KFW_PKG} \
+ 2>/dev/null || true
# Wrap up the initrd.img again:
chroot ${LIVE_ROOTDIR} /sbin/mkinitrd 1>/dev/null 2>${DBGOUT}
rm -rf ${LIVE_ROOTDIR}/boot/initrd-tree