General TC > Programming & Scripting - Unofficial

NFS storage base scripts mod for PXE booting [split]

<< < (6/6)

gerald_clark:
Glad to hear that the patches are appreciated.
I have added instructions in the netboot wiki article.
Good news ... The patches will be included in V2.5.
Now that 2.4rc4 is out, I have updated the tc-config patch to honor the 'showapps' boot option.
If you don't care about showapps, the previous patch still applies.

I am only posting the tc-config patch.  The tc-functions patch has not changed, and is still needed.


--- Code: ---*** tc-config.orig      2009-10-04 11:20:36.000000000 -0500
--- tc-config   2009-10-04 11:20:37.000000000 -0500
***************
*** 81,86 ****
--- 81,88 ----
           settime*) SETTIME=${i#*=} ;;
           thm*) THEME=${i#*=} ;;
           bkg*) BACKGROUND=${i#*=} ;;
+            nfsmount* ) NFSMOUNT=${i#*=} ;;
+            tftplist* ) TFTPLIST=${i#*=} ;;
          esac
        ;;
        *)
***************
*** 153,158 ****
--- 155,205 ----
  /sbin/ifconfig lo 127.0.0.1 up
  /sbin/route add 127.0.0.1 lo &

+ # dhcp.sh runs udhcpc async, so it exits before network is up
+ wait4Server() {
+    [ -z "$DHCP_RAN" ] && /etc/init.d/dhcp.sh
+    CNT=0
+    until ping -c 1 $1 >/dev/null 2>&1
+    do
+       [ $((CNT++)) -gt 30 ] && break || sleep 1
+    done
+    DHCP_RAN=1
+ }
+
+ # First process tftp entries
+ modprobe -q squashfs 2>/dev/null
+ if [ -n "$TFTPLIST" ]; then
+    SERVER=`echo $TFTPLIST | awk -F\: '{ print $1 }'`
+    FILE=`echo $TFTPLIST | awk -F\: '{ print $2 }'`
+    wait4Server $SERVER
+    (  TMPDIR=/tmp/tftp
+       TCEDIR=/opt/.tce_dir
+       echo > $TCEDIR
+       mkdir $TMPDIR ; cd $TMPDIR
+       NAME=${FILE##*/}
+       tftp -g -r $FILE $SERVER
+       [ $SHOWAPPS ] && echo -ne "${BLUE}TFTP Loading Extensions ${YELLOW}"
+       while read EXTENSION
+       do
+          tftp -g -r $EXTENSION $SERVER
+          EXTNAME=${EXTENSION##*/}
+          [ $SHOWAPPS ] && echo -ne "$EXTNAME "
+          /usr/bin/tce-load -i $TMPDIR/$EXTNAME
+       done < $NAME
+       [ $SHOWAPPS ] && echo "${GREEN} Done.${NORMAL}"
+       rm $NAME $TCEDIR
+    )
+ fi
+
+ if [ -n "$NFSMOUNT" ]; then
+    SERVER=`echo $NFSMOUNT | awk -F\: '{ print $1 }'`
+    wait4Server $SERVER
+    echo "$NFSMOUNT /mnt/nfs nfs defaults,nolock 0 0" >> /etc/fstab
+    [ $SHOWAPPS ] && echo "Mounting $NFSMOUNT"
+    mkdir /mnt/nfs
+    mount /mnt/nfs >/dev/null 2>&1
+ fi
+
  if grep -q "^/dev/root" /proc/mounts; then
     INSTALLED=1
     echo "${RED}Detected Traditional (Scatter) Hard drive installation.${NORMAL}"
***************
*** 184,190 ****
     fi
  fi
  #
- modprobe -q squashfs 2>/dev/null

  if [ -n "$USER" ]; then
     if ! grep "$USER" /etc/passwd >/dev/null; then addUser; fi
--- 231,236 ----
***************
*** 403,409 ****
  if [ -n "$NODHCP" ]; then
    echo "${GREEN}Skipping DHCP broadcast/network detection as requested on boot commandline.${NORMAL}"
  else
!   /etc/init.d/dhcp.sh &
  fi

  [ -n "$KEYMAP" ] || KEYMAP="us"
--- 449,455 ----
  if [ -n "$NODHCP" ]; then
    echo "${GREEN}Skipping DHCP broadcast/network detection as requested on boot commandline.${NORMAL}"
  else
!   [ -z "$DHCP_RAN" ] && /etc/init.d/dhcp.sh &
  fi

  [ -n "$KEYMAP" ] || KEYMAP="us"

--- End code ---

nsqtr:
Gerald,
The patches are much, much appreciated. Without them, I'd not been able to move down my desired path. I have a little LAN of cast-off laptops that I boot as a group of compute nodes. None of the laptops have HDDs and I've max'd out their respective memory capabilities.  The Primary Node must have two network interfaces and must be capable of booting from a CD ROM. Any machine can act as the Primary Node, thus making hardware replacements easy. Since they're all laptops, they are all battery-backed as well, so they act as little UPS-enabled compute nodes.  The non-Primary Nodes must merely be PXE-bootable.

Hence, your patches have been wonderful.

I've not moved up to microcore 2.4 yet and see that your work will be included in 2.,5 so will wait to upgrade.

However, I'm looking for suggestions on how to fix a race condition I have with my laptops that have Intel e10/e100 NICs. They need the firmware extension.  I've tried putting the tcz in the /opt/tce of the pxeimage and I've also tried NFS loop-mounting the TCZ from the primary node but I can't get the firmware tcz to load before DHCP tries to fire up the NIC and fails.  After the  boot dust has settled on the node, I can go in manually and run dhcp.sh and everything works fine.  I've also tried running with the NODHCP bootcode, then running dhcp.sh from within my bootlocal.sh but I find I've got the same problem.  I think it's because bootlocal.sh gets kicked off in a separate process with tc-config runs, hence the seeming race condition.

Any thoughts or ideas are greatly appreciated.

thanks

gutmensch:
glad to hear that too, I love his solution! :)

@nsqtr:
You could simply remaster the tinycore.gz so that it includes the correct modules and firmware, unpack it like said in the wiki, loop mount the needed modules/firmware extensions and copy the files to lib/modules and lib/firmware. Repack it and you should have a working image with network!

nsqtr:
Most excellent!  I just remastered and rebooted my Primary Node and Compute Nodes and everybody is happily chunking along.

thanks

Navigation

[0] Message Index

[*] Previous page

Go to full version