summaryrefslogtreecommitdiffstats
path: root/initrd
diff options
context:
space:
mode:
authorDirk von Suchodoletz2006-04-03 16:52:12 +0200
committerDirk von Suchodoletz2006-04-03 16:52:12 +0200
commit1e83b5df834a2629aaabaee7f21560d9e28bf7d9 (patch)
tree4224605f3e1a447e084d2fec461fefef7f35f935 /initrd
parentminifix and comment for installer ... (diff)
downloadcore-1e83b5df834a2629aaabaee7f21560d9e28bf7d9.tar.gz
core-1e83b5df834a2629aaabaee7f21560d9e28bf7d9.tar.xz
core-1e83b5df834a2629aaabaee7f21560d9e28bf7d9.zip
added cowdev (for cowloop device activation) to mkdxsinitrd,
generalized nfsmnt function ... git-svn-id: http://svn.openslx.org/svn/openslx/ld4@146 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initrd')
-rwxr-xr-xinitrd/initrd-stuff/bin/servconfig8
-rw-r--r--initrd/initrd-stuff/etc/functions16
-rw-r--r--initrd/initrd-stuff/etc/messages5
-rwxr-xr-xinitrd/initrd-stuff/init47
-rwxr-xr-xinitrd/mkdxsinitrd8
5 files changed, 54 insertions, 30 deletions
diff --git a/initrd/initrd-stuff/bin/servconfig b/initrd/initrd-stuff/bin/servconfig
index fc04749b..9debb823 100755
--- a/initrd/initrd-stuff/bin/servconfig
+++ b/initrd/initrd-stuff/bin/servconfig
@@ -4,7 +4,7 @@
# for linux diskless clients (executed within initial
# ramdisk)
#
-# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 25-03-2006
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 03-04-2006
# Blabla
# Blub
#
@@ -225,8 +225,10 @@ if [ "x$vmware" != "x" ] || [ "x$vmware" != "xno" ] ; then
if [ -d /mnt/usr/share/vmware ] ; then
ln -sf /usr/share/vmware /var/lib/vmware
elif [ -n "${imgsrv}" ] ; then
- mount -t nfs -o ro,nolock,intr,nodev,soft,timeo=2,nosuid \
- ${imgsrv} /mnt/var/lib/vmware &
+ # nfsmnt script should be used here ...
+ nfsmnt ${imgsrv} /mnt/var/lib/vmware &
+ #mount -n -t nfs -o ro,nolock,intr,nodev,soft,timeo=2,nosuid \
+ # ${imgsrv}
fi
# generate a runlevel script
d_mkrlscript init vmware-prep "Starting preparation of vmware environment"
diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions
index a83f2fe0..8c8e1c8f 100644
--- a/initrd/initrd-stuff/etc/functions
+++ b/initrd/initrd-stuff/etc/functions
@@ -2,9 +2,8 @@
# linux diskless clients (included by init, hwautocfg,
# servconfig, ... within initial ramdisk)
#
-# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 23-03-2006
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 03-04-2006
# Felix Endres, 21-03-2006
-# Blub
#
# Copyright: (c) 2006 - RZ Universitaet Freiburg
#
@@ -139,10 +138,17 @@ case $ipcfg in
esac
}
#######################################################################
-# nfs mounter
+# nfs mounter for root filesystem and other sources
nfsmnt ()
{
local nfsroot=$1
+local dest=$2
+if [ -z "$dest" ] ; then
+ dest="/mnt"
+ e_nfs="$error_rnfs"
+else
+ e_nfs="$error_gnfs"
+fi
for mnt in nfsmount mount none; do
test -x /bin/$mnt && break;
done
@@ -150,11 +156,11 @@ done
loadmod /lib/modules/@@@KERNVER@@@/kernel/fs/nfs/nfs.ko "$error_modnfs"
case $mnt in
nfsmount)
- nfsmount -o ro $nfsroot /mnt || error "$error_nfs"
+ nfsmount -o ro $nfsroot $dest || error "$e_nfs"
;;
mount)
portmap || error "$error_portm"
- mount -n -t nfs -o ro $nfsroot /mnt || error "$errmsg"
+ mount -n -t nfs -o ro,nolock $nfsroot $dest || error "$e_nfs"
killall -9 portmap
;;
none)
diff --git a/initrd/initrd-stuff/etc/messages b/initrd/initrd-stuff/etc/messages
index 416caa81..c7adeb3e 100644
--- a/initrd/initrd-stuff/etc/messages
+++ b/initrd/initrd-stuff/etc/messages
@@ -3,7 +3,7 @@
# version 4
# this file could be used for localization of error messages
#
-# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 02-04-2006
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 03-04-2006
#
# Copyright: (c) 2006 - RZ Universitaet Freiburg
#
@@ -89,12 +89,13 @@ error_modnfs="needed for mounting rootfs"
error_iptool=" No tool for local IP configuration found. You should at \
least add\n one of the following programs to your ramdisk: ip \
ipconfig\n ifconfig."
-error_nfs=" Mount of root filesystem via NFS was requested via kernel command \
+error_rnfs=" Mount of root filesystem via NFS was requested via kernel command \
line\nbut failed. There might be the following reasons for that:\n\
* No nfs.ko module could be loaded and no NFS support was present in the\n\
running kernel - see error messages above\n\
* You tried to mount from wrong server or path ($nfsroot)\n\
* No NFS server is running or you do not have permissions"
+error_gnfs=" Mount of some NFS source failed ..."
error_portm=" Portmapper should be present, if normal mount \
command is used. Please\n check your initial ramdisk setup (mkdxsinitrd)."
error_mntt=" No suitable mount tool found."
diff --git a/initrd/initrd-stuff/init b/initrd/initrd-stuff/init
index 18cc1583..02133c30 100755
--- a/initrd/initrd-stuff/init
+++ b/initrd/initrd-stuff/init
@@ -2,11 +2,11 @@
# Description: main script for new type of initial ramdisk for
# linux diskless clients version 4
#
-# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 02-04-2006
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 03-04-2006
#
# Copyright: (c) 2006 - RZ Universitaet Freiburg
#
-# Version: 0.2.4a
+# Version: 0.2.4b
# functions common for all distros, messages contains all error and info
# output
@@ -46,11 +46,14 @@ exec < /dev/console > /dev/console 2>&1
preinit
# start device auto discovery service - distro specific function
udev_hotplug
-# read kernel commandline
+# set defaults and create waitfor files
TMPFSSIZE="50%"
+COWSIZE="50%"
+RWDIR=/dev/shm
echo "noldap" > /tmp/ldap-done
echo "nodhcp" > /tmp/dhcp-done
echo "nofile" > /tmp/file-done
+# read kernel commandline
read KCMDLINE < /proc/cmdline
export KCMDLINE
for opts in ${KCMDLINE} ; do
@@ -247,8 +250,28 @@ if [ -n "${NBD}" ] ; then
;;
esac
usleep 20
- mount -n -t $RFST -o ro $RDEV /mnt
+ RWRO="ro"
+ if [ -n "${COWLOOP}" -a -x /bin/cowdev ] ; then
+ modprobe ${MODPRV} cowloop || {
+ error "$init_loadcow" nonfatal
+ COWLOOP=""; }
+ fi
+ if [ -n "${COWLOOP}" ] ; then
+ if [ -n "${UNIONFS}" ] ; then
+ error "$init_cownonbd"
+ UNIONFS="";
+ fi
+ echo "Using Copy-on-Write block device for rw access"
+ mount -n -t tmpfs -o size=${COWSIZE} ramfs ${RWDIR}
+ cowdev -a /dev/nbd0 ${RWDIR}/nbd.cow
+ RWRO="rw"
+ RDEV=/dev/cow/0
+ # run ldconfig if not switched off via kernel command line
+ [ -z "${NOLDSC}" ] && echo $init_ldcfg && ldconfig /etc/ld.so.cache &
+ fi
+ mount -n -t $RFST -o $RWRO $RDEV /mnt
fi
+
# if no type of root filesystem is passed via kernel command line try
# information gathered from dhcp process
if [ -z "${DNBDOPT}" -a -z "${NBDOPT}" -a -z "${NFSROOT}" ] ; then
@@ -262,7 +285,7 @@ if [ -z "${DNBDOPT}" -a -z "${NBDOPT}" -a -z "${NFSROOT}" ] ; then
fi
# call function for nfs mounts
if [ -z "${DNBDOPT}" -a -z "${NBDOPT}" ] ; then
- nfsmnt ${NFSROOT} ${MODPRV}
+ nfsmnt ${NFSROOT}
fi
# get the complete collection of kernel modules available
@@ -272,21 +295,11 @@ mount -n --bind /mnt/lib/modules/${KERNEL} /lib/modules/${KERNEL} || \
hwautocfg &
# try to use unionfs for rw access if available
-RWDIR=/dev/shm
if [ -n "${UNIONFS}" -o -n "${UNION}" ] ; then
modprobe ${MODPRV} unionfs || {
error "$init_loadufs" nonfatal
UNIONFS=""; }
fi
-if [ -n "${COWLOOP}" ] ; then
- modprobe ${MODPRV} cowloop || {
- error "$init_loadcow" nonfatal
- COWLOOP=""; }
- if [ -z "${NBD}" -o -n "${UNIONFS}" ] ; then
- error "$init_cownonbd"
- COWLOOP="";
- fi
-fi
# if additional sources should be used for a combined root filesystem
# probably more sources should be merged into union (${UNION} is defined)
@@ -308,9 +321,7 @@ if [ -n "${UNIONFS}" ] ; then
mount -n --move ${RWDIR}/uniontmp /mnt/uniontmp
# run ldconfig if not switched off via kernel command line
[ -z "${NOLDSC}" ] && echo $init_ldcfg && ldconfig /etc/ld.so.cache &
-elif [ -n "${COWLOOP}" -a -n "${NBD}" ] ; then
- :
-else
+elif [ -z "$COWLOOP" ] ; then
echo "Using bind mounts to ramdisk for rw access"
mount -n -t tmpfs -o size=${TMPFSSIZE} ramfs ${RWDIR}
for path in ${D_BINDMPTS} ; do
diff --git a/initrd/mkdxsinitrd b/initrd/mkdxsinitrd
index 5c6865be..d886061e 100755
--- a/initrd/mkdxsinitrd
+++ b/initrd/mkdxsinitrd
@@ -3,10 +3,10 @@
# Description: universal (distro independent) generator for initial
# ramdisks for linux diskless clients
#
-# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 31-03-2006
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 03-04-2006
# Nico Dietrich
#
-# Version: 0.3.1f
+# Version: 0.3.1g
#
# Copyright: (c) 2003 - 2006 - RZ Universitaet Freiburg
@@ -376,6 +376,10 @@ fi
# if unionfs
cobi unionctl bin &>/dev/null || echo "Program unionctl not found"
+# if cowloop
+cobi cowdev bin &>/dev/null || echo "Program cowdev not found"
+
+
# distro specific additional stuff
case "${DISTRO}" in
debian*)