Tiny Core Linux
General TC => Programming & Scripting - Unofficial => Topic started by: gerald_clark on August 11, 2009, 08:54:26 PM
-
I have actually implemented NFS storage for PXE booting for TC 2.2
The changes below allow a directory on the server to be mounted into /mnt/nfs.
This directory can contain a working tce directory, and can be the target for the backup utility.
When you create the PXE boot config file for your workstation, add 2 boot options.
These are nfsmount= to define the nfs share being used and nfswait= to define how long to wait for dhcpd to complete.
EX:
label tcl-22.test
MENU LABEL Tiny Core Linux V 2.2 Test
kernel ../tcl-22.test/boot/bzImage
append initrd=../tcl-22.test/boot/tinycore.gz nfsmount=openvz:/tftpboot/nfs/tc2 waitnfs=10
Backup device for backup tool is 'nfs'
To implement:
Rebuild the tinycore.gz with the following 3 tce files extracted into it.
1. tcp_wrappers.tcel
2. portmap.tce
3. nfs-utils.tce
Two files need patching.
1. etc/init.d/tc-config - the tc-config.patch file is
*** tc-config.org 2009-08-11 22:30:44.000000000 -0500
--- tc-config 2009-08-11 22:31:07.000000000 -0500
***************
*** 158,163 ****
--- 158,165 ----
settime*) SETTIME=${i#*=} ;;
thm*) THEME=${i#*=} ;;
bkg*) BACKGROUND=${i#*=} ;;
+ nfsmount* ) NFSMOUNT=${i#*=} ;;
+ waitnfs* ) WAITNFS=${i#*=} ;;
esac
;;
*)
***************
*** 244,249 ****
--- 246,258 ----
/etc/init.d/dhcp.sh &
fi
+ if [ -n "$NFSMOUNT" ]; then
+ echo "$NFSMOUNT /mnt/nfs nfs defaults,nolock 0 0" >> /etc/fstab
+ mkdir /mnt/nfs
+ [ -n "$WAITNFS" ] && sleep "$WAITNFS"
+ mount /mnt/nfs
+ fi
+
if [ -n "$CHECKFS" ]; then
touch /etc/sysconfig/checkfs
wait $fstab_pid
2. etc/init.d/tc-functions - the tc-functions.patch file is
*** tc-functions.org 2009-08-11 22:30:44.000000000 -0500
--- tc-functions 2009-08-11 22:31:07.000000000 -0500
***************
*** 80,85 ****
--- 80,90 ----
MOUNTPOINT=""
MOUNTED="no"
D2="$1"
+ if [ "$D2" == "nfs" ]; then
+ MOUNTPOINT=/mnt/nfs
+ MOUNTED="yes"
+ return
+ fi
if [ "${D2:0:5}" == "UUID=" ]; then
D2=`/sbin/blkid -lt $D2 -o device`
if [ "$?" != 0 ]; then
***************
*** 117,123 ****
autoscan(){
FOUND=""
! for DEVICE in `grep "^/dev/" /etc/fstab | grep -vf /etc/init.d/tc_noscan.lst | awk 'FS="/" { print $3}'`; do
find_mountpoint $DEVICE
if [ -n "$MOUNTPOINT" ]; then
if [ "$MOUNTED" == "no" ]; then
--- 122,128 ----
autoscan(){
FOUND=""
! for DEVICE in `grep "/mnt/" /etc/fstab | grep -vf /etc/init.d/tc_noscan.lst | awk 'FS="/" { print $3}'`; do
find_mountpoint $DEVICE
if [ -n "$MOUNTPOINT" ]; then
if [ "$MOUNTED" == "no" ]; then
-
As of 2.3rc1, dhcp.sh will be moved to the end of tc-config after all the extensions are loaded. This is to facilitate the loading of network drivers and related support files via extension.
This has the effect that none of the conventional tc-config processing can take advantage of a network connection. Of course, all of the boot parameters currently refer to local files so this isn't an issue. However, the flexibility to supply tce= with an NFS directory is a useful customization. I think a quick solution is that each boot parameter is checked for a remote location. When one is found, simply wait for dhcp.sh to complete before continuing.
In your customization, I would suggest using the wait function to wait for dhcp.sh to finish. That will eliminate the need for the nfswait= boot option. Replace
/etc/init.d/dhcp.sh &
with
/etc/init.d/dhcp.sh & dhcp_pid=$!
and then replace
[ -n "$WAITNFS" ] && sleep "$WAITNFS"
with
wait $dhcp_pid
-
Done. Your suggestion works great.
Thanks.
-
If anyone is interested, here are the 2 patches for 2.3R1:
*** tc-config.org 2009-08-15 18:25:33.000000000 -0500
--- tc-config 2009-08-15 18:25:50.000000000 -0500
***************
*** 158,163 ****
--- 158,164 ----
settime*) SETTIME=${i#*=} ;;
thm*) THEME=${i#*=} ;;
bkg*) BACKGROUND=${i#*=} ;;
+ nfsmount* ) NFSMOUNT=${i#*=} ;;
esac
;;
*)
***************
*** 238,243 ****
--- 239,252 ----
/sbin/ifconfig lo 127.0.0.1 up
/sbin/route add 127.0.0.1 lo &
+ if [ -n "$NFSMOUNT" ]; then
+ /etc/init.d/dhcp.sh & dhcp_pid=$!
+ echo "$NFSMOUNT /mnt/nfs nfs defaults,nolock 0 0" >> /etc/fstab
+ mkdir /mnt/nfs
+ wait $dhcp_pid
+ mount /mnt/nfs
+ fi
+
if [ -n "$CHECKFS" ]; then
touch /etc/sysconfig/checkfs
wait $fstab_pid
***************
*** 550,556 ****
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 "$CRON" ] && /etc/init.d/crond start
[ -n "$SSH" ] && /etc/init.d/dropbear start >/dev/null && echo " ${GREEN}ssh started.${NORMAL}"
--- 559,565 ----
if [ -n "$NODHCP" ]; then
echo "${GREEN}Skipping DHCP broadcast/network detection as requested on boot commandline.${NORMAL}"
else
! [ -z "$NFSMOUNT" ] && /etc/init.d/dhcp.sh &
fi
[ -n "$CRON" ] && /etc/init.d/crond start
[ -n "$SSH" ] && /etc/init.d/dropbear start >/dev/null && echo " ${GREEN}ssh started.${NORMAL}"
*** tc-functions.org 2009-08-15 18:25:33.000000000 -0500
--- tc-functions 2009-08-15 18:25:50.000000000 -0500
***************
*** 80,85 ****
--- 80,90 ----
MOUNTPOINT=""
MOUNTED="no"
D2="$1"
+ if [ "$D2" == "nfs" ]; then
+ MOUNTPOINT=/mnt/nfs
+ MOUNTED="yes"
+ return
+ fi
if [ "${D2:0:5}" == "UUID=" ]; then
D2=`/sbin/blkid -lt $D2 -o device`
if [ "$?" != 0 ]; then
***************
*** 117,123 ****
autoscan(){
FOUND=""
! for DEVICE in `grep "^/dev/" /etc/fstab | grep -vf /etc/init.d/tc_noscan.lst | awk 'FS="/" { print $3}'`; do
find_mountpoint $DEVICE
if [ -n "$MOUNTPOINT" ]; then
if [ "$MOUNTED" == "no" ]; then
--- 122,128 ----
autoscan(){
FOUND=""
! for DEVICE in `grep "/mnt/" /etc/fstab | grep -vf /etc/init.d/tc_noscan.lst | awk 'FS="/" { print $3}'`; do
find_mountpoint $DEVICE
if [ -n "$MOUNTPOINT" ]; then
if [ "$MOUNTED" == "no" ]; then
-
[split code+discussion from Netbooting with installed apps (Solved) (http://forum.tinycorelinux.net/index.php?topic=1241.0)]
-
Great idea. So for this solution to work, you need to setup a PXE, TFTP and DHCP services in the same NFS box? What are the booting times that you are getting with this solution? What kind of client HW ? Server Specs?
thanks!
-
The DHCP server specifies the TFTP server in its configuration file, and it can specify a different machine. The NFS server can also be different. How you arrange it is a matter of convenience.
-
Boot time to X is 40 seconds on an 800MHz Via.
A kernel building development system takes 55 seconds.
-
I found that waiting for dhcp.sh to return is not sufficient.
Routing and resolv.conf can take up to 3 more seconds.
Instead I loop until I can ping the server.
Here is the new patch file for tc-config.
*** tc-config.org 2009-08-25 22:40:34.000000000 -0500
--- tc-config 2009-08-25 22:40:35.000000000 -0500
***************
*** 171,176 ****
--- 171,177 ----
settime*) SETTIME=${i#*=} ;;
thm*) THEME=${i#*=} ;;
bkg*) BACKGROUND=${i#*=} ;;
+ nfsmount* ) NFSMOUNT=${i#*=} ;;
esac
;;
*)
***************
*** 251,256 ****
--- 252,271 ----
/sbin/ifconfig lo 127.0.0.1 up
/sbin/route add 127.0.0.1 lo &
+ if [ -n "$NFSMOUNT" ]; then
+ /etc/init.d/dhcp.sh
+ echo "$NFSMOUNT /mnt/nfs nfs defaults,nolock 0 0" >> /etc/fstab
+ mkdir /mnt/nfs
+ SERVER=`echo $NFSMOUNT | awk -F\: '{ print $1 }'`
+ # dhcp.sh runs udhcpc async, so it exits before network is up
+ CNT=0
+ until ping -c 1 $SERVER >/dev/null 2>&1
+ do
+ [ $((CNT++)) -gt 30 ] && break || sleep 1
+ done
+ mount /mnt/nfs
+ fi
+
if [ -n "$CHECKFS" ]; then
touch /etc/sysconfig/checkfs
wait $fstab_pid
***************
*** 563,569 ****
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 "$CRON" ] && /etc/init.d/crond start
[ -n "$SSH" ] && /etc/init.d/dropbear start >/dev/null && echo " ${GREEN}ssh started.${NORMAL}"
--- 578,584 ----
if [ -n "$NODHCP" ]; then
echo "${GREEN}Skipping DHCP broadcast/network detection as requested on boot commandline.${NORMAL}"
else
! [ -z "$NFSMOUNT" ] && /etc/init.d/dhcp.sh &
fi
[ -n "$CRON" ] && /etc/init.d/crond start
[ -n "$SSH" ] && /etc/init.d/dropbear start >/dev/null && echo " ${GREEN}ssh started.${NORMAL}"
-
I have determined that the only things needed are these:
1. Add mount.nfs to /usr/local/sbin
2. Apply the two patches above.
This increases tinycore.gz by 42,223 bytes, and provides for an optional NFS based tce and restore directory.
Another tested but not posted method is to use tftp to install the mount.nfs.
This way only tc-config and tc-functions need patching.
The first ':' separated value is the nfs directory to mount, while the second is an optional tftp file to process.
append initrd=../tcl-23/boot/tinycore.gz nfsmount=openvz:/tftpboot/nfs/tc2-music;openvz:/nfs/tc2-music/nfs.tar
This uses tftp to download nfs/tc2-music/nfs.tar from openvz and extracts it to the root directory.
then it mounts openvzL/tftpboot/nfs/tc2-music on /mnt/nfs.
Any chance of getting one of these in RC4?
-
Latest update with patches.
I have eliminated the need to load nfs into the base.
I have added two boot options. Ex:
append initrd=../tcl-23/boot/tinycore.gz nfsmount=openvz:/tftpboot/nfs/tc2-music tftplist=openvz:/nfs/tc2-music/tftp/tcz.lst tz=CST+6CDT
tftplist=server:/directory/tczlist
This defines a tftp server and the path to a file that contains a list of tcz to load. My tcz.list is:
/nfs/tc2-music/tftp/nfs-utils.tcz
nfsmount=server:/directory
This defines an NFS share that will be mounted into /mnt/nfs.
This directory works just like /mnt/hda1 or /mnt/sda1 or any other device for the storage of mydata.tgz and a tce directory.
Backup is to 'nfs'.
By combining these two additions, a diskless workstation can PXE boot TC, load the NFS utilities over tftp, and
then loop mount a full compliment of tcz extensions over NFS.
I use this to boot a diskless music player over the network. It is accessed via vnc to play music from an NFS export.
No disk, no SD card, no thumb drive.
Here are the two patches
*** tc-functions.orig 2009-08-29 22:40:18.000000000 -0500
--- tc-functions 2009-08-29 22:40:35.000000000 -0500
***************
*** 80,85 ****
--- 80,90 ----
MOUNTPOINT=""
MOUNTED="no"
D2="$1"
+ if [ "$D2" == "nfs" ]; then
+ MOUNTPOINT=/mnt/nfs
+ MOUNTED="yes"
+ return
+ fi
if [ "${D2:0:5}" == "UUID=" ]; then
D2=`/sbin/blkid -lt $D2 -o device`
if [ "$?" != 0 ]; then
***************
*** 117,123 ****
autoscan(){
FOUND=""
! for DEVICE in `grep "^/dev/" /etc/fstab | grep -vf /etc/init.d/tc_noscan.lst | awk 'FS="/" { print $3}'`; do
find_mountpoint $DEVICE
if [ -n "$MOUNTPOINT" ]; then
if [ "$MOUNTED" == "no" ]; then
--- 122,128 ----
autoscan(){
FOUND=""
! for DEVICE in `grep "/mnt/" /etc/fstab | grep -vf /etc/init.d/tc_noscan.lst | awk 'FS="/" { print $3}'`; do
find_mountpoint $DEVICE
if [ -n "$MOUNTPOINT" ]; then
if [ "$MOUNTED" == "no" ]; then
*** tc-config.orig 2009-08-29 22:40:18.000000000 -0500
--- tc-config 2009-08-29 22:40:35.000000000 -0500
***************
*** 171,176 ****
--- 171,178 ----
settime*) SETTIME=${i#*=} ;;
thm*) THEME=${i#*=} ;;
bkg*) BACKGROUND=${i#*=} ;;
+ nfsmount* ) NFSMOUNT=${i#*=} ;;
+ tftplist* ) TFTPLIST=${i#*=} ;;
esac
;;
*)
***************
*** 251,256 ****
--- 253,300 ----
/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
+ waitfor() {
+ [ -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 }'`
+ waitfor $SERVER
+ ( mkdir /tmp/tftp ; cd /tmp/tftp
+ NAME=`basename $FILE`
+ tftp -g -r $FILE $SERVER
+ echo -ne "${BLUE}TFTP Loading Extensions ${YELLOW}"
+ while read EXTENSION
+ do
+ tftp -g -r $EXTENSION $SERVER
+ EXTNAME=`basename $EXTENSION`
+ echo -ne "$EXTNAME "
+ tcloop_mount "$EXTNAME" $(getbasefile "$EXTNAME" 1)
+ done < $NAME
+ echo "${GREEN} Done.${NORMAL}"
+ rm $NAME
+ )
+ fi
+
+ if [ -n "$NFSMOUNT" ]; then
+ SERVER=`echo $NFSMOUNT | awk -F\: '{ print $1 }'`
+ waitfor $SERVER
+ echo "$NFSMOUNT /mnt/nfs nfs defaults,nolock 0 0" >> /etc/fstab
+ echo "Mounting $NFSMOUNT"
+ mkdir /mnt/nfs
+ mount /mnt/nfs
+ fi
+
if [ -n "$CHECKFS" ]; then
touch /etc/sysconfig/checkfs
wait $fstab_pid
***************
*** 302,308 ****
tceSetup
#
! modprobe -q squashfs 2>/dev/null
if [ "$(ls -A /opt/tce)" ]; then
echo "${BLUE}Checking for /opt/tce items... ${NORMAL}"
gettceapps "/opt/tce"
--- 346,352 ----
tceSetup
#
! # modprobe -q squashfs 2>/dev/null
if [ "$(ls -A /opt/tce)" ]; then
echo "${BLUE}Checking for /opt/tce items... ${NORMAL}"
gettceapps "/opt/tce"
***************
*** 552,558 ****
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 "$CRON" ] && /etc/init.d/crond start
[ -n "$SSH" ] && /etc/init.d/dropbear start >/dev/null && echo " ${GREEN}ssh started.${NORMAL}"
--- 596,602 ----
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 "$CRON" ] && /etc/init.d/crond start
[ -n "$SSH" ] && /etc/init.d/dropbear start >/dev/null && echo " ${GREEN}ssh started.${NORMAL}"
That is it. Hope someone else finds it useful.
-
Suggesting a name change:
- the function "waitfor" is not really descriptive, how about waitfordhcp/waitforserver/etc?
-
Keep up the good work, Gerald! I think it's one of the most interesting features since tinycore is so small you can use it on Wyse Terminals and other clients with very little RAM and absolutely no disk space ;-)
I agree that it should be incorporated into tinycore!
btw. I nearly did the same but also swapped out over nfs (because just 50 MB ram) and reduced the tinycore.gz to the mininum by exporting unneeded libs which can be loaded after the nfs connection, so atm I'm working with a 3.5 MB tinycore.gz :)
Best regards,
Robert
-
3.5 MB? awesome. i would be interested in it, and i would ask the TC-team in order to know their mind about this concept:
- 3.5MB core of the core as new concept for microcore;
- a lib.tar.gz or lib.tcz extension file with the needed libraries to push up the core of the core to the current microcore.
what do you think?
-
@alu: I never thought about an extension, but you're right... thinking in tc{e,z} structure this would be the right approach! But since the minimization always depends on a NFS server it would be merely some kind of "new" distro (like the LTSP project). Nevertheless one could do:
a.) Minimize the kernel bzImage by using as many modules as possible.
b.) Reduce tinycore.gz to the least minimum (e.g. just busybox, libc, tftp-patches from Gerald, ...)
c.) Use boot params like Geralds and import the "nfs-utils.tcz", "lib.tcz", ... from an tftp/nfs, additionally any other extensions.
I think it would be possible to netboot with this way only 4 MB (bzImage + tinycore.gz) and it would be quite fast for thin clients.
One problem I see is, that it wouldn't reduce the amount of used ram with this extensions, as I need every byte I couldn't even afford to download and loop mount it (right now I'm loading it from nfs directly into ram, when it's needed, and it's "gone" from ram, when I close it).
-
As gutmensch, I see no use for the separation in cases other than thin clients with low ram. The ram savings would be negligible if the libs.tczl would be in ram, or worse by 3mb with lib.tcel (of course lib.tcel could be deleted after extraction, to get absolutely the same ram usage as current microcore). It would also bring some overhead, and with a tcz use one loop.
Also, what libraries one's setup considers needed and what are considered extra vary by the setup. For example if one client shows pics, it needs libpng; if another runs a webserver, it needs other libs. There's no general solution.
Being able to do this kind of customization is the forte of TC/MC. However I don't see some separation like this ready-done being useful to very many.
-
With NFS, it loopmounts over NFS, so it does not copy to RAM at all.
Only the TFTP loaded extensions get copied to RAM.
-
Indeed, I forgot to take that into account in my post. What I meant was "....ram savings in normal cases would be...".
-
nevertheless: starting with a microcore at 3.5 mb (or less) would deserve from thin client up to other machines (i did not know that while loading tc/mc from server, you only load the tftp extension in ram, since i ever did it, but want to move to this kind of boot methode; so thanks, i have learnt smthg); curaga, you'r certainly right while saying that it is just little ram saving, but my point is rather: as we have microcore with 7.* mb, why shouldn't we make it smaller (if it is not too much workload; obviously, i don't want to complicate the existing concept)? i did not think to make for each kind of library (or group of libraries) a special extension, rather to package all libraries at the moment in microcore which we could remove into one tcz extension. if you want, it would be a sorte of what gutmensch says, i.e. radicalization of the tcz approach while at the same time a step nearer to a kind of turn key machine. as a result, you have a minimal setting with bzImage and the kernel, and everything else come as a tcz extensions. that way, you would also have an alternative to a tftp/pxe approach for those user wanting to stay with their system on a physicall support. by the way, as we are there, another suggestion (useless these are only personal thoughs in order to share ideas and stimulate the reflection on tc/mc): would it be possible for the TC-Team to provide a kind of NFS-server access in order for us to remote install tc/mc?
-
by the way, as we are there, another suggestion (useless these are only personal thoughs in order to share ideas and stimulate the reflection on tc/mc): would it be possible for the TC-Team to provide a kind of NFS-server access in order for us to remote install tc/mc?
There is already such a service: netboot.me (that's the URL as well). It isn't ours, but they offer TC and MC as netbootable images.
-
thanks, did not see the post of the person loading the service, i shall have a look
-
New patches for 2.4 ( With suggested function name change. )
*** tc-config.orig 2009-09-20 23:48:37.000000000 -0500
--- tc-config 2009-09-20 23:48:37.000000000 -0500
***************
*** 217,222 ****
--- 217,224 ----
settime*) SETTIME=${i#*=} ;;
thm*) THEME=${i#*=} ;;
bkg*) BACKGROUND=${i#*=} ;;
+ nfsmount* ) NFSMOUNT=${i#*=} ;;
+ tftplist* ) TFTPLIST=${i#*=} ;;
esac
;;
*)
***************
*** 289,294 ****
--- 291,338 ----
/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
+ ( mkdir /tmp/tftp ; cd /tmp/tftp
+ NAME=`basename $FILE`
+ tftp -g -r $FILE $SERVER
+ echo -ne "${BLUE}TFTP Loading Extensions ${YELLOW}"
+ while read EXTENSION
+ do
+ tftp -g -r $EXTENSION $SERVER
+ EXTNAME=`basename $EXTENSION`
+ echo -ne "$EXTNAME "
+ tcloop_mount "$EXTNAME" $(getbasefile "$EXTNAME" 1)
+ done < $NAME
+ echo "${GREEN} Done.${NORMAL}"
+ rm $NAME
+ )
+ 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
+ echo "Mounting $NFSMOUNT"
+ mkdir /mnt/nfs
+ mount /mnt/nfs
+ fi
+
if [ -n "$CHECKFS" ]; then
touch /etc/sysconfig/checkfs
wait $fstab_pid
***************
*** 340,346 ****
tceSetup
#
- modprobe -q squashfs 2>/dev/null
if [ "$(ls -A /opt/tce)" ]; then
echo "${BLUE}Checking for /opt/tce items... ${NORMAL}"
gettceapps "/opt/tce"
--- 384,389 ----
***************
*** 588,594 ****
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"
--- 631,637 ----
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"
*** tc-functions.orig 2009-09-20 23:48:37.000000000 -0500
--- tc-functions 2009-09-20 23:48:37.000000000 -0500
***************
*** 74,79 ****
--- 74,84 ----
MOUNTPOINT=""
MOUNTED="no"
D2="$1"
+ if [ "$D2" == "nfs" ]; then
+ MOUNTPOINT=/mnt/nfs
+ MOUNTED="yes"
+ return
+ fi
if [ "${D2:0:5}" == "UUID=" ]; then
D2=`/sbin/blkid -lt $D2 -o device`
if [ "$?" != 0 ]; then
***************
*** 111,117 ****
autoscan(){
FOUND=""
! for DEVICE in `grep "^/dev/" /etc/fstab | grep -vf /etc/init.d/tc_noscan.lst | awk 'FS="/" { print $3}'`; do
find_mountpoint $DEVICE
if [ -n "$MOUNTPOINT" ]; then
if [ "$MOUNTED" == "no" ]; then
--- 116,122 ----
autoscan(){
FOUND=""
! for DEVICE in `grep "/mnt/" /etc/fstab | grep -vf /etc/init.d/tc_noscan.lst | awk 'FS="/" { print $3}'`; do
find_mountpoint $DEVICE
if [ -n "$MOUNTPOINT" ]; then
if [ "$MOUNTED" == "no" ]; then
-
Just in case anybody gives a hoot, here are patches for TC 1.4
*** tc-config.org 2009-09-26 12:59:32.000000000 -0500
--- tc-config 2009-09-26 12:59:33.000000000 -0500
***************
*** 13,18 ****
--- 13,30 ----
TCEWBAR="/usr/local/tce.wbar"
INSTALLED=""
+ tcloop_mount() {
+ [ -d /tmp/tcloop/"$2" ] || mkdir -p /tmp/tcloop/"$2"
+ mount "$1" /tmp/tcloop/"$2" -o loop
+
+ APPNAME=$2 tcz-symlinker --dir > /dev/null 2>&1
+ APPNAME=$2 tcz-symlinker > /dev/null 2>&1
+
+ if [ -f /tmp/tcloop/"$2"/user.tar.gz ]; then
+ tar xzf /tmp/tcloop/"$2"/user.tar.gz -C / > /dev/null 2>&1
+ fi
+ }
+
gettceapps(){
for FILE in `ls $1/*.tce* 2>/dev/null`
do
***************
*** 33,48 ****
if stringinstring "tcz" "$EXT"; then
BASE=$(getbasefile "$FILE" 1)
echo -n " ${YELLOW}$BASE${NORMAL}"
! [ -d /tmp/tcloop/"$BASE" ] || mkdir -p /tmp/tcloop/"$BASE"
! mount "$FILE" /tmp/tcloop/"$BASE" -o loop
!
! APPNAME=$BASE tcz-symlinker --dir > /dev/null 2>&1
! APPNAME=$BASE tcz-symlinker > /dev/null 2>&1
!
! if [ -f /tmp/tcloop/"$BASE"/user.tar.gz ]; then
! tar xzf /tmp/tcloop/"$BASE"/user.tar.gz -C / > /dev/null 2>&1
! fi
!
case "$EXT" in *m*) NEW_MODULES=1 ;; esac
case "$EXT" in *l*) NEW_LIBS=1 ;; esac
[ -x "$TCEINSTALLED"/"$BASE" ] || touch "$TCEINSTALLED"/"$BASE"
--- 45,51 ----
if stringinstring "tcz" "$EXT"; then
BASE=$(getbasefile "$FILE" 1)
echo -n " ${YELLOW}$BASE${NORMAL}"
! tcloop_mount "$FILE" "$BASE"
case "$EXT" in *m*) NEW_MODULES=1 ;; esac
case "$EXT" in *l*) NEW_LIBS=1 ;; esac
[ -x "$TCEINSTALLED"/"$BASE" ] || touch "$TCEINSTALLED"/"$BASE"
***************
*** 125,130 ****
--- 128,135 ----
resume*) RESUME=${i#*=} ;;
host*) HOST=1 ;;
settime*) SETTIME=${i#*=} ;;
+ nfsmount* ) NFSMOUNT=${i#*=} ;;
+ tftplist* ) TFTPLIST=${i#*=} ;;
esac
;;
*)
***************
*** 205,211 ****
if [ -n "$NODHCP" ]; then
echo "${GREEN}Skipping DHCP broadcast/network detection as requested on boot commandline.${NORMAL}"
else
! /etc/init.d/dhcp.sh &
fi
if [ -n "$CHECKFS" ]; then
--- 210,257 ----
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
!
! # 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
! if [ -n "$TFTPLIST" ]; then
! SERVER=`echo $TFTPLIST | awk -F\: '{ print $1 }'`
! FILE=`echo $TFTPLIST | awk -F\: '{ print $2 }'`
! wait4Server $SERVER
! ( mkdir /tmp/tftp ; cd /tmp/tftp
! NAME=`basename $FILE`
! tftp -g -r $FILE -l ./$NAME $SERVER
! echo -ne "${BLUE}TFTP Loading Extensions ${YELLOW}"
! while read EXTENSION
! do
! EXTNAME=`basename $EXTENSION`
! tftp -g -r $EXTENSION -l ./$EXTNAME $SERVER
! echo -ne "$EXTNAME "
! tcloop_mount "$EXTNAME" $(getbasefile "$EXTNAME" 1)
! done < $NAME
! echo "${GREEN} Done.${NORMAL}"
! rm $NAME
! )
! 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
! echo "Mounting $NFSMOUNT"
! mkdir /mnt/nfs
! mount /mnt/nfs
fi
if [ -n "$CHECKFS" ]; then
*** tc-functions.org 2009-09-26 12:59:32.000000000 -0500
--- tc-functions 2009-09-26 12:59:33.000000000 -0500
***************
*** 80,85 ****
--- 80,90 ----
MOUNTPOINT=""
MOUNTED="no"
D2="$1"
+ if [ "$D2" == "nfs" ]; then
+ MOUNTPOINT=/mnt/nfs
+ MOUNTED="yes"
+ return
+ fi
if [ "${D2:0:5}" == "UUID=" ]; then
D2=`/sbin/blkid -lt $D2 -o device`
if [ "$?" != 0 ]; then
***************
*** 117,123 ****
autoscan(){
FOUND=""
! for DEVICE in `grep "^/dev/" /etc/fstab | grep -vf /etc/init.d/tc_noscan.lst | awk 'FS="/" { print $3}'`; do
find_mountpoint $DEVICE
if [ -n "$MOUNTPOINT" ]; then
if [ "$MOUNTED" == "no" ]; then
--- 122,128 ----
autoscan(){
FOUND=""
! for DEVICE in `grep "/mnt/" /etc/fstab | grep -vf /etc/init.d/tc_noscan.lst | awk 'FS="/" { print $3}'`; do
find_mountpoint $DEVICE
if [ -n "$MOUNTPOINT" ]; then
if [ "$MOUNTED" == "no" ]; then
-
Wow. Significant changes to TCL 2.4rc2 cause previous patches to not apply.
Removal of tcloop_mount() requires substitution of tce-load. The current patches are:
*** tc-config.orig 2009-09-30 18:34:07.000000000 -0500
--- tc-config 2009-09-30 18:34:08.000000000 -0500
***************
*** 75,80 ****
--- 75,82 ----
settime*) SETTIME=${i#*=} ;;
thm*) THEME=${i#*=} ;;
bkg*) BACKGROUND=${i#*=} ;;
+ nfsmount* ) NFSMOUNT=${i#*=} ;;
+ tftplist* ) TFTPLIST=${i#*=} ;;
esac
;;
*)
***************
*** 146,151 ****
--- 148,198 ----
/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=`basename $FILE`
+ tftp -g -r $FILE $SERVER
+ echo -ne "${BLUE}TFTP Loading Extensions ${YELLOW}"
+ while read EXTENSION
+ do
+ tftp -g -r $EXTENSION $SERVER
+ EXTNAME=`basename $EXTENSION`
+ echo -ne "$EXTNAME "
+ /usr/bin/tce-load -i $TMPDIR/$EXTNAME
+ done < $NAME
+ 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
+ echo "Mounting $NFSMOUNT"
+ mkdir /mnt/nfs
+ mount /mnt/nfs
+ fi
+
if grep -q "^/dev/root" /proc/mounts; then
INSTALLED=1
echo "${RED}Detected Traditional (Scatter) Hard drive installation.${NORMAL}"
***************
*** 177,183 ****
fi
fi
#
- modprobe -q squashfs 2>/dev/null
if [ -n "$USER" ]; then
if ! grep "$USER" /etc/passwd >/dev/null; then addUser; fi
--- 224,229 ----
***************
*** 367,373 ****
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"
--- 413,419 ----
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"
*** tc-functions.orig 2009-09-30 18:34:07.000000000 -0500
--- tc-functions 2009-09-30 18:34:08.000000000 -0500
***************
*** 74,79 ****
--- 74,84 ----
MOUNTPOINT=""
MOUNTED="no"
D2="$1"
+ if [ "$D2" == "nfs" ]; then
+ MOUNTPOINT=/mnt/nfs
+ MOUNTED="yes"
+ return
+ fi
if [ "${D2:0:5}" == "UUID=" ]; then
D2=`/sbin/blkid -lt $D2 -o device`
if [ "$?" != 0 ]; then
***************
*** 111,117 ****
autoscan(){
FOUND=""
! for DEVICE in `grep "^/dev/" /etc/fstab | grep -vf /etc/init.d/tc_noscan.lst | awk 'FS="/" { print $3}'`; do
find_mountpoint $DEVICE
if [ -n "$MOUNTPOINT" ]; then
if [ "$MOUNTED" == "no" ]; then
--- 116,122 ----
autoscan(){
FOUND=""
! for DEVICE in `grep "/mnt/" /etc/fstab | grep -vf /etc/init.d/tc_noscan.lst | awk 'FS="/" { print $3}'`; do
find_mountpoint $DEVICE
if [ -n "$MOUNTPOINT" ]; then
if [ "$MOUNTED" == "no" ]; then
-
It's a PITA to rebuild patches for every "maintenance" release... good work, Gerald! For this reason I'll stay with 2.3.1 first ;-)
BTW your patches are working great, using them for a while now :)
Best regards,
Robert
-
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.
*** 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"
-
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
-
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!
-
Most excellent! I just remastered and rebooted my Primary Node and Compute Nodes and everybody is happily chunking along.
thanks