Package: casper
Version: 1.61+debian-2
Here is a patch to the casper script (1.61+debian-2)
(same as sent to debian-live-devel mailing list)
Boot with a pxelinux config like this:
label linux
kernel dr/vmlinuz
append initrd=dr/initrd.gz boot=casper netboot root=/dev/nfs
nfsroot=192.168.23.45:/srv/NFSroot/live/chroot
Notes:
1: Need "netboot" to do either CIFS or NFS boot. "root=/dev/nfs"
chooses NFS ommit "root=" should do cifs. I'm not entirely happy with
this interface. I think whoever wants to maintain cifs function should
test for "root=/dev/cifs" - see note 3
2: I have only tested the NFS part... however the CIFS part could
never be run as far as I could see in the old code... at least now it
can be run... someone else can fix that bit!!!
3: I think all initrd/initramfs that try to do NFSroot should try and
follow the rules laid down on nfsroot.txt in the Linux kernel source
Documentation.
--- casper.orig 2006-07-19 18:56:35.000000000 +0000
+++ casper 2006-07-30 14:32:21.000000000 +0000
@@ -13,6 +13,7 @@
overlay_method=unionfs
if [ "${DPKG_ARCH}" = "ia64" ] || [ "${DPKG_ARCH}" = "hppa" ] || [ "${DPKG_ARCH}" = "sparc" ]; then
overlay_method=devmapper
+ #FIXME# error if netboot - only makes sence to unionfs on netboot
fi
USERNAME=debian
@@ -105,6 +106,8 @@
}
get_fstype() {
+ #FIXME# one use of this function expects "unknown" another does not!
+ # which is it???
local FSTYPE
local FSSIZE
eval $(fstype < $1)
@@ -210,6 +213,43 @@
do_netmount() {
rofsmnt="$1"
+ #choose NFS or CIFS mount
+ if [ "${ROOT}" = "/dev/nfs" ] ; then
+ do_nfsmount $rofsmnt
+ else
+ do_cifsmount
+ fi
+}
+
+do_nfsmount() {
+ rofsmnt="$1"
+ # adapted from NFS filesystem mounting
+
+ modprobe -q nfs
+ # For DHCP
+ modprobe -q af_packet
+
+ ipconfig ${DEVICE} /tmp/net-${DEVICE}.conf
+ if [ "x${NFSROOT}" = "xauto" ]; then
+ NFSROOT=${ROOTSERVER}:${ROOTPATH}
+ fi
+
+ if [ "x${NFSOPTS}" = "x" ]; then
+ #NFSOPTS="-o retrans=10"
+ NFSOPTS=""
+ fi
+
+ [ "$quiet" != "y" ] && log_begin_msg "Mounting NFS with nfsmount -o nolock -o ro ${NFSOPTS} ${NFSROOT} ${rofsmnt}"
+ while true ; do
+ nfsmount -o nolock -o ro ${NFSOPTS} "${NFSROOT}" "${rofsmnt}" && break
+ sleep 1
+ done
+
+ [ "$quiet" != "y" ] && log_end_msg
+}
+
+do_cifsmount() {
+ rofsmnt="$1"
# adapted from NFS filesystem mounting
modprobe -q cifs
@@ -349,6 +389,7 @@
set_usplash_timeout
+ if ! grep -q netboot /proc/cmdline; then
for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13; do
live_image=$(find_live)
if [ "${live_image}" ]; then
@@ -363,8 +404,12 @@
if grep -q toram /proc/cmdline; then
copy_to_ram
fi
-
setup_cow "$overlay_method" "$(get_backing_device $live_image)" "$rootmnt"
+ else
+ #netboot
+ setup_cow "$overlay_method" "netboot" "$rootmnt"
+
+ fi
# show it on new rootfs
mkdir ${rootmnt}/${mountpoint}