Archive for July 2011
Slitaz on NFS root
Slitaz won’t work out of the box on a NFS root, two problems have to been fixed:
- Kernel
- udhcp default script
Kernel
Recompile the kernel (as described here):
- call “tazpkg get-install linux-source”, this will install get-linux-source and all the kernel patches
- call “tazpkg get-install slitaz-toolchain”, this will install the binaries needed for compiling kernels
- call “tazpkg get-install ncurses-dev”, this will install ncurses files needed for the make target “menuconfig”
- call “tazpkg get-install perl”, needed by kernel malefiles
- call “get-linux-source”, this will download the kernel sources and patch them
- cd into /usr/src/linux-$(version)
- call “make menuconfig”
- activate “IP: kernel level autoconfiguration” (CONFIG_IP_PNP)
- activate “IP: DHCP support” (CONFIG_IP_PNP_DHCP)
- activate “Root file system on NFS” (CONFIG_ROOT_NFS)
- call “make bzImage”
- copy the resulting kernel (arch/x86/boot/bzImage) beside the exisiting kernel and add it to grub’s menu.lst or copy it over the existing kernel (not prefered since it would be overwritten when doing a kernel package update).
Patch /usr/share/udhcpc/default.script
Since udhcp would pull down the exisiting ethernet connection on the device used for the NFS mount we have to check for the NFS mount. The format defininition of the /proc/mounts changed in lately kernels so there are two possible regexps, the version active works on SliTaz cooking. I’m not sure on which kernel version the format did change.
Please patch the included /usr/share/udhcpc/default.script using the patch attached
@@ -9,9 +9,19 @@
[ -n "$broadcast" ] && BROADCAST=”broadcast $broadcast”
[ -n "$subnet" ] && NETMASK=”netmask $subnet”+# return 0 if root is mounted on a network filesystem
+root_is_nfs() {
+ ## old style
+ # grep -qe ‘^/dev/root.*\(nfs\|smbfs\|ncp\|coda\) .*’ /proc/mounts
+ ## new style
+ grep -qe ‘^.*:.* / \(nfs\|smbfs\|ncp\|coda\) .*’ /proc/mounts
+}
+
case “$1″ in
deconfig)
- /sbin/ifconfig $interface 0.0.0.0
+ if ! root_is_nfs ; then
+ /sbin/ifconfig $interface 0.0.0.0
+ fi
for i in /etc/ipdown.d/*; do
[ -x $i ] && $i $interface
done
@@ -22,9 +32,11 @@if [ -n "$router" ] ; then
echo “deleting routers”
- while route del default gw 0.0.0.0 dev $interface ; do
- :
- done
+ if ! root_is_nfs ; then
+ while route del default gw 0.0.0.0 dev $interface ; do
+ :
+ done
+ fimetric=0
for i in $router ; do
Boot and have fun!