diff options
author | Oliver Tappe | 2007-04-28 19:34:34 +0200 |
---|---|---|
committer | Oliver Tappe | 2007-04-28 19:34:34 +0200 |
commit | 5b2a2d233445ad29e3ff1ce9ca8e8af3753c3697 (patch) | |
tree | 29002b910c1f66ef9f0d753f39bc2f55be46a7c6 /initramfs | |
parent | * fixed -D not being accepted (diff) | |
download | core-5b2a2d233445ad29e3ff1ce9ca8e8af3753c3697.tar.gz core-5b2a2d233445ad29e3ff1ce9ca8e8af3753c3697.tar.xz core-5b2a2d233445ad29e3ff1ce9ca8e8af3753c3697.zip |
* instead of the outdated slxmkramfs, the demuxer now uses the older, but better
mkdxsinitrd
* removed slxmkramfs, as it is going to be reimplemented in perl, later
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@944 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs')
-rwxr-xr-x | initramfs/slxmkramfs | 709 |
1 files changed, 0 insertions, 709 deletions
diff --git a/initramfs/slxmkramfs b/initramfs/slxmkramfs deleted file mode 100755 index 194a82d3..00000000 --- a/initramfs/slxmkramfs +++ /dev/null @@ -1,709 +0,0 @@ -#!/bin/bash -# -# (c) 2003 - 2006 - RZ Universitaet Freiburg -# (c) 2006, 2007 - OpenSLX GmbH -# -# This program/file is free software distributed under the GPL version 2. -# See http://openslx.org/COPYING -# -# If you have any feedback please consult http://openslx.org/feedback and -# send your feedback to feedback@openslx.org -# -# General information about OpenSLX can be found under http://openslx.org -# -# universal (distro independent) generator for initialramfs for OpenSLX -# linux diskless clients (part of stage2 system setup). This script is the -# successor of mkdxsinitrd. It expects all project files to be installed. It -# does not work directly out of repository any more. - -# NOTE (zooey): -# this whole file should be reimplemented in perl in order to -# simplify the passing in of information and the logging/translation -# functionality. - - -# debug level of script itself -DEBUG=1 -# debug level of the initramfs (to trigger the addition of specific -# binaries and kernel modules) -IRFSDEBUG=1 -COMETCEXCL="XF86Config*\nissue*\nmtab*\nfstab*\n" -COMDIRINDXS="/tmp/scratch /var/lib/nobody" - -# distro specific settings read from configuration file -# D_SYSCONFDIR - system wide configuration settings in /etc - sysconfig in -# SuSE and RedHat, default in Debian and Ubuntu, conf.d in Gentoo -# D_ETCEXCL - list of files, wildcards to be excluded from /etc when using -# bind mounts -# D_DIRINBINDMNT - lists of directories to be created in bind mounted rw -# part of the client filesystem -# D_RODIRSINRW - ReadOnly Directories in RW part of filesystem to save on -# TempFS usage -# D_DIRINDXS - directories in client filesystem which should be present -# anyhow -# D_BINDMNT - any code which is specific in bind mount environment -# D_RCDIRS - runlevel directories relative to /etc -# D_HWMODTOIGNORE - - -# just ensure that variables are set and the user gets an idea if -# something fails -D_SYSCONFDIR="<set in ~/distro-config/distro file>" -D_ETCEXCL="<set in ~/distro-config/distro file>" -D_BINDMPTS="<set in ~/distro-config/distro file>" -D_DIRINBINDMNT="<set in ~/distro-config/distro file>" -D_RODIRSINRW="<set in ~/distro-config/distro file>" -D_DIRINDXS="<set in ~/distro-config/distro file>" -D_BINDMNT="<set in ~/distro-config/distro file>" -D_INITDIR="<set in ~/distro-config/distro file>" -D_INITBOOTD="<set in ~/distro-config/distro file>" -D_RCDIRS="<set in ~/distro-config/distro file>" -D_RCDIRSINRW="<set in ~/distro-config/distro file>" -D_INITSCRIPTS="<set in ~/distro-config/distro file>" -D_XF86CONFFILE="<set in ~/distro-config/distro file>" -D_XFONTPATH="<set in ~/distro-config/distro file>" -D_DEFAULTCOUNTRY="<set in ~/distro-config/distro file>" -# read in the global settings -SLX_CONFIG_PATH=@@@SLX_CONFIG_PATH@@@ -[ -f ${SLX_CONFIG_PATH}/settings.default ] && \ - . ${SLX_CONFIG_PATH}/settings.default -[ -f ${SLX_CONFIG_PATH}/settings.local ] && \ - . ${SLX_CONFIG_PATH}/settings.local - -######################################################################### -# End of global variable declaration, nothing needed to be changed at -# default below that line - -usage() -{ - echo -e "slxmkramfs [-bgh] [-k kernel version] [-i path/file] \ -[-f module(s)] [-n module(s)] [-s splashsize] \n\t \ -[-D name of distribution] -v [version of distribution] -r path\n" - echo "OPTIONS" - echo " -b Use busybox instead of separate binaries." - echo " -f list of filesystem modules (like, nfs, nbd, squashfs)" - echo " -g use glibc as base library in initramfs" - echo " -b use busybox instead of separate binaries" - echo " -h show usage information" - echo " -i path/file, provide information where to write initramfs" - echo " -k kernel version (without linux-)" - echo " slxmkramfs tries to find the most recent kernel version," - echo " If this fails a version can provided here" - echo " -m module list of otherwise uncovered modules, e.g. xen stuff" - echo " -n module list of client network adaptors to support" - echo " -r path to the root of the stage1 system you are preparing" - echo " ramdisk for e.g. /var/opt/openslx/stage1/suse-10.2" - echo " -s settings-file" - echo " -T theme (for splash)" - echo " -d debug (add special modules to initramfs)" - echo " -D name of distribution (stage1)" - echo " -v version of distribution (stage1)" - exit 0 -} - -# replaces which command to find executables inside ROOTDIR -binfinder() -{ -local PROGRAM="$1" -local RET=1 -for ELEMENT in bin sbin usr/bin usr/sbin usr/local/bin \ - usr/local/sbin usr/bin/X11; do - if [ -f "${ROOTDIR}/$ELEMENT/$PROGRAM" ] && \ - [ -x "${ROOTDIR}/$ELEMENT/$PROGRAM" ]; then - printf '%s\n' "${ROOTDIR}/$ELEMENT/$PROGRAM" - RET=0 - break - fi -done -return $RET -} - -# copy some binary to given destination. Takes binary in $1 and -# destination in $2 -cobi() -{ -local DEST=$2 -local FPTB=`binfinder $1` -if [ -z ${FPTB} ] ; then - return 1; -elif [ -L ${FPTB} ] ; then - # do not copy the link but the binary the link points to - local LINKDEST=`ls -la ${FPTB} | sed -e "s,.* ,,"` - case $LINKDEST in - /*) FPTB=${ROOTDIR}${LINKDEST} - ;; - *) ;; - esac - cp ${FPTB} ${INSTDIR}/${DEST} -else - cp ${FPTB} ${INSTDIR}/${DEST} -fi -slxldd --root-path=${ROOTDIR} ${FPTB#${ROOTDIR}*} >>${INSTDIR}/tmp/libraries -} - -# replace copy -repco() -{ -local FILENAME=$1 -DATE=`date +%m-%d-%Y` -# do not forget to define all variables which should be replaced within -# the start and configuration scripts. All comment lines will be deleted. -if [ -d ${SLX_SHARE_PATH}/initramfs/${FILENAME} ] ; then - [ -d ${INSTDIR}/${FILENAME} ] || mkdir -p ${INSTDIR}/${FILENAME} -else - if file ${SLX_SHARE_PATH}/initramfs/${FILENAME}|grep "ELF" &>/dev/null - then cp ${SLX_SHARE_PATH}/initramfs/${FILENAME} ${INSTDIR}/${FILENAME} - elif [ -L ${SLX_SHARE_PATH}/initramfs/${FILENAME} ] ; then - cp -a ${SLX_SHARE_PATH}/initramfs/${FILENAME} ${INSTDIR}/${FILENAME%/*} - else - sed -e "s,@@@INSTDIR@@@,${INSTDIR},g;s,@@@KERNVER@@@,${KERNVER},g" \ - -e "s,@@@DISTRO@@@,${DISTRO}-${DISTRO_VER},g;s,@@@NETIF@@@,${NET_IF},g" \ - -e "s,@@@NWMODULES@@@,${NWMODULES},g" \ - -e "s,@@@COMDIRINDXS@@@,${COMDIRINDXS},g" \ - -e "s,@@@COMETCEXCL@@@,${COMETCEXCL},g" \ - -e "s,@@@DATE@@@,${DATE},g;/^#[^!].*/d" \ - ${SLX_SHARE_PATH}/initramfs/${FILENAME} >> ${INSTDIR}/${FILENAME} - [ "$use_busybox" = 1 ] && sed -e "s,^#!/bin/sh,#!/bin/ash," \ - -i ${INSTDIR}/${FILENAME} - fi -fi -} - -copy_distro_stuff() { - # copy first the default distro dependent configuration (variables) and - # function files, then append to each the distro/version specific file - # variables, functions set in default might that way be overwritten by - # definitions in distro/version specific files - # use files from ${SLX_SHARE_PATH}/distro-specs (OpenSLX project files - # have to be installed via "make install") - prefix=${SLX_SHARE_PATH}/distro-specs/$1 - cat $prefix/config-default >${INSTDIR}/etc/sysconfig/config - cat $prefix/config-$2 >>${INSTDIR}/etc/sysconfig/config - #[ -f $SLX_CONFIG_PATH/settings.default ] && \ - # cat $SLX_CONFIG_PATH/settings.default >>${INSTDIR}/etc/sysconfig/config - #[ -f $SLX_CONFIG_PATH/settings.local ] && \ - # cat $SLX_CONFIG_PATH/settings.local >>${INSTDIR}/etc/sysconfig/config - cat $prefix/functions-default >${INSTDIR}/etc/distro-functions - cat $prefix/functions-$2 >>${INSTDIR}/etc/distro-functions - cp -a $prefix/files-default ${INSTDIR}/etc/sysconfig/files 2>/dev/null -} - -# add a bootsplash image to the initial ramdisk, only SuSE at the moment -add_theme() { -theme="${theme}" -splashsizes="640x480 800x600 1024x768 1280x1024 1400x1050 1600x1200" -splash_image= -splash_bin=$(chroot $ROOTDIR which splash) -themes_dir="${SLX_SHARE_PATH}/themes/openslx/bootsplash" -if [ -d "${SLX_SHARE_PATH}/themes/${theme}/bootsplash" ]; then - themes_dir="${SLX_SHARE_PATH}/themes/${theme}/bootsplash" -elif [ -d "$ROOTDIR/etc/bootsplash/themes/${theme}" ]; then - themes_dir="/etc/bootsplash/themes/${theme}" -elif [ -d "$ROOTDIR/usr/share/splash/themes/${theme}" ]; then - themes_dir="/usr/share/splash/themes/${theme}" -fi - -#fixme: very ugly ;) -mkdir -p $ROOTDIR/tmp/bootsplash -cp -a $themes_dir/* $ROOTDIR/tmp/bootsplash -themes=${themes_dir%bootsplash} -echo -e "\n\tUsing ${themes} for themes.\n" -themes_dir=$ROOTDIR/tmp/bootsplash - -if [ -n "$splashsizes" -a -n "$splash_bin" ]; then - if [ -n "$themes_dir" -a \ - -d "$themes_dir" -o -L "$themes_dir" ]; then - for size in $splashsizes; do - bootsplash_picture="$themes_dir/images/bootsplash-$size.jpg" - cfgname="$themes_dir/config/bootsplash-$size.cfg" - if [ ! -r $cfgname ] ; then - echo " disabled for resolution $size " - elif [ ! -r $bootsplash_picture ] ; then - echo " no image for resolution $size " - else - echo -n "${splash_image:+, }$THEME ($size)" - splash_image=" $splash_image ${cfgname#$ROOTDIR} " - fi - done - echo - else - echo "no theme selected" - fi -fi - -# Include bootsplash image -for image in $splash_image; do - # fixme: ugly hack to have the splash binary - chroot $ROOTDIR $splash_bin -s -f $image >> ${INSTDIR}/bootsplash -done - -rm -rf $ROOTDIR/tmp/bootsplash -# kdm/Xdialog theme -cp -a ${themes}* ${INSTDIR}/usr/share/themes -} - -######################################################################### -# End of function declaration - -while getopts :bhgk:i:r:o:s:T:f:m:n:Sut:d:D:v:I:V:a: a ; do - case $a in - \:|\?) - case $OPTARG in - k) echo "-k requires kernel version parameter";; - i) echo "-i requires initrd path parameter";; - f) echo "-f requires file system module list parameter";; - m) echo "-m requires misc module list parameter";; - n) echo "-n requires network module list parameter";; - r) echo "-r requires root dir parameter";; - s) echo "-s requires setings file name";; - T) echo "-t requires theme name";; - t) echo "-t requires tmp dir parameter";; - d) echo "-d requires debug level (integer)";; - D) echo "-D requires linux Distribution name";; - v) echo "-v requires linux distribution version";; - I) echo "-I requires network interface parameter";; - V) echo "-V requires an executable to run inside linuxrc";; - *) echo "Unknown option: -$OPTARG" - echo "Try slxmkramfs -h";; - esac - exit 1 - ;; - b) use_busybox=1;; - g) use_glibc=1;; - k) KERNVER=$OPTARG;; - i) INITRD_PATH=$OPTARG ;; - f) FSMODULES=$OPTARG;; - n) NWMODULES=$OPTARG ;; - r) ROOTDIR=$OPTARG;; - s) settings_file=$OPTARG;; - T) theme=$OPTARG;; - t) INSTDIR=$OPTARG;; - d) IRFSDEBUG=$OPTARG;; - D) DISTRO=$OPTARG;; - v) DISTRO_VER=$OPTARG;; - I) NET_IF=$OPTARG;; # Not in use - a) acpi_dsdt="$OPTARG";; # Not in use - S) use_selinux=1;; # Not in use - l) local_init_script="$OPTARG";; # use for pre/postinit.local? - u) sysfs_root=1 # Not in use - use_udev= - ;; - h) usage;; - esac -done -shift $(expr $OPTIND - 1) - -if [ "xx" = "xx$ROOTDIR" ] ; then - echo -e "Please specify the system root directory (-r <root-dir>)!"; - usage; - exit 1; -fi - -######################################################################### -# End of parameter, argument interpretation - -# set temporary setup directory, clean it and setup basic directory -# structure -if [ -z "$INSTDIR" ] ; then - INSTDIR=/tmp/slx-tmpramfs -fi -rm -rf ${INSTDIR} -mkdir -p ${INSTDIR}/{dev,proc,tmp,mnt,root,bin,sys,lib} -ln -s /bin ${INSTDIR}/sbin -mkdir -p ${INSTDIR}/usr/share -# needed for KNOPPIX hwsetup tool not to be confused with ${D_SYSCONFDIR} -mkdir -p ${INSTDIR}/etc/sysconfig - -if [ -n "${settings_file}" ] ; then - # copy settings file (slxsystem.conf) into the right place: - cp $settings_file ${INSTDIR}/etc/sysconfig/slxsystem.conf -fi - -# if still no distro name set, try to find it using significant files -if [ -z "${DISTRO}" ] ; then - if [ -e ${ROOTDIR}/etc/SuSE-release ] ; then - DISTRO=suse - DISTRO_VER=`grep "VERSION" ${ROOTDIR}/etc/SuSE-release | sed "s/.*= //"` - elif [ -e ${ROOTDIR}/etc/lsb-release ] ; then - . ${ROOTDIR}/etc/lsb-release - DISTRO=${DISTRIB_ID} - DISTRO_VER=${DISTRIB_RELEASE} - elif [ -e ${ROOTDIR}/etc/debian_version ] ; then - if [ $(grep Ubuntu /etc/issue | wc -l) -gt 0 ]; then - DISTRO=Ubuntu - DISTRO_VER=`sed 's/[Uu]buntu \([0-9]*\.[0-9]*\).*/\1/' /etc/issue` - else - DISTRO=debian - DISTRO_VER=`cat ${ROOTDIR}/etc/debian_version` - fi - elif [ -e ${ROOTDIR}/etc/gentoo-release ] ; then - DISTRO=gentoo - # any idea on the versioning scheme?? - DISTRO_VER="" - else - echo -e "Could not detect client distribution type and version. Please \ -specify\nas command line argument (-D <distro-name> -v <distro-version>)" - exit 1; - fi -fi - -# unify the description of distribution and its version -case "${DISTRO}" in - Debian*|debian*|Sarge*|sarge*) - DISTRO=debian - case "${DISTRO_VER}" in - Sarge*|sarge*|3.1*|*) - DISTRO_VER=3.1 - mkdir -p ${INSTDIR}/lib/udev - cp -r ${ROOTDIR}/lib/udev/* ${INSTDIR}/lib/udev/ - ;; - esac - ;; - Ubuntu*|ubuntu*) - DISTRO=ubuntu - case "${DISTRO_VER}" in - Breezy*|breezy*) - DISTRO_VER=5.10 - cp ${ROOTDIR}/lib/libnss_compat.so.2 ${INSTDIR}/lib - ;; - Dapper*|dapper*) - DISTRO_VER=6.06 - ;; - Edgy*|edgy*) - DISTRO_VER=6.10 - ;; - esac - ;; - Gentoo*|gentoo*) - DISTRO=gentoo - case "${DISTRO_VER}" in - 2005*) - DISTRO_VER=2005.1 - ;; - 2006*|*) - DISTRO_VER=2006.1 - ;; - esac - ;; - SuSE*|suse*|Suse*|SuSe*|SUSE*|*) - DISTRO=suse - case "${DISTRO_VER}" in - 9*) - DISTRO_VER=9.3 - ;; - 10.0) - DISTRO_VER=10.0 - ;; - 10.1) - DISTRO_VER=10.1 - ;; - 10.2) - DISTRO_VER=10.2 - ;; - esac - ;; -esac -# at this point ${DISTRO} ${DISTRO_VER} should be fixed -copy_distro_stuff ${DISTRO} ${DISTRO_VER} - -# binary and corresponding library copies could be avoided if a small -# initial ramdisk environment of its own is generated from busybox, -# dietlibc and similar, see OpenSLX project page ... - -# devices needed rather early (copied from /tmp to /dev in init) -mknod ${INSTDIR}/tmp/console c 5 1 &>/dev/null -mknod ${INSTDIR}/tmp/null c 1 3 &>/dev/null -mknod ${INSTDIR}/tmp/kmsg c 1 11 &>/dev/null -mknod ${INSTDIR}/tmp/ctl b 241 255 &>/dev/null -# suse specific, but might be usable with other distros too -mknod ${INSTDIR}/tmp/bootsplash p &>/dev/null - -# initial ramdisk scripts: init, functions, servconfig, hwautocfg, ... -# copy and replace variable names -for dirs in `find ${SLX_SHARE_PATH}/initramfs/* ! -regex ".*/\..*"` ; do - repco ${dirs##*initramfs/} -done -chmod 755 ${INSTDIR}/init \ - ${INSTDIR}/bin/{servconfig,hwautocfg,screenres,dhcpmkconfig} - -# test for the existance of busybox -if [ "$use_busybox" = 1 ]; then - [ -x ${SLX_SHARE_PATH}/busybox/busybox ] || { - unset use_busybox - echo "You wanted to include busybox, but did not provide it in \ -${SLX_SHARE_PATH}/busybox directory."; } -fi -if [ -n "$use_busybox" ] ; then - # somehow the target platform should be defined and proper busybox copied - cp ${SLX_SHARE_PATH}/busybox/busybox ${INSTDIR}/bin - echo "${ROOTDIR}/lib/libc.so.6" >>${INSTDIR}/tmp/libraries - echo "${ROOTDIR}/lib/ld-linux.so.2" >>${INSTDIR}/tmp/libraries - for bbins in [ ar arping ash bunzip2 cat chmod chown chroot cp cpio cut \ - date dd df dmesg du echo env expr fdisk free grep gunzip hwclock \ - insmod id ip kill killall ln ls lsmod mdev mkdir mke2fs mkfs.ext2 \ - mkfs.ext3 mknod mkswap modprobe mount mv nice ping printf ps rdate rm \ - rmmod sed sleep sort swapoff swapon switch_root tar test tftp time \ - touch tr udhcpc umount uptime usleep vconfig vi zcat zcip; do - ln -fs /bin/busybox ${INSTDIR}/bin/$bbins - done - # fake the sh link in busybox environment - echo -e "#!/bin/ash\n/bin/ash \$@" > ${INSTDIR}/bin/sh - chmod a+x ${INSTDIR}/bin/sh -else - # find and copy a shell to be used within initialramfs - for bbins in bash ash sh; do - if cobi ${bbins} bin ; then - ln -fs ${bbins} ${INSTDIR}/bin/sh - [ "${bbins}" != "ash" ] && ln -fs ${bbins} ${INSTDIR}/bin/ash - [ "${bbins}" != "bash" ] && ln -fs ${bbins} ${INSTDIR}/bin/bash - break - else echo "Binary not found (${bbins})"; fi - done - - # find and copy ip setup binaries - for bbins in ip ifconfig; do - if cobi ${bbins} bin ; then - [ "${bbins}" = "ifconfig" ] && cobi route bin - break - else echo "Binary not found"; fi - done - - # needed standard binaries (in init, servconfig, hwautocfg, ... scripts) - for bbins in \ - cat chmod chown chroot cp expr fdisk gzip killall ln ls mkdir \ - mkfs.ext2 modprobe mount rmmod sed sort rm tar umount - do - cobi ${bbins} bin || echo "Program ${bbins} not found" - done - - # binaries useful for debugging purposes - if [ $IRFSDEBUG -gt 2 ] ; then - for bbins in \ - date lsmod lsof ps strace time - do - cobi ${bbins} bin || echo "Program ${bbins} not found" - done - fi - - # tftp client binary for configuration via file - get machine-setup per - # tftp from dhcp (or specified other) server - for tftp in atftp tftp ; do - binfinder $tftp && break; - done - cobi $tftp bin || echo "Program ${tftp} not found" - cp /lib/libnss_files.so.2 ${INSTDIR}/lib - # one of the dhcp clients - for dhcp in dhclient dhcpcd pump ipconfig ; do - binfinder $dhcp && break; - done - cobi $dhcp bin - - # hotplug/udev type and related stuff - cp -a ${ROOTDIR}/etc/udev ${INSTDIR}/etc - - # type of hotplug/udev/dev (for etc directories see above!!) - for bbins in udev udevd udevstart udevtrigger udevsend ; do - cobi ${bbins} bin &>/dev/null || \ - echo "Program ${bbins} not found; could be most probably ignored" - done - # if nfs is used as clients root filesystem - cobi portmap bin - mkdir -p ${INSTDIR}/var/lib/nfs/state -fi - -# if nbd or dnbd is used as clients root filesystem -if [ -n "${FSMODULES}" ] ; then -for i in ${FSMODULES}; do - case "$i" in - dnbd) - cobi dnbd-client bin - ;; - nbd) - cobi nbd-client bin - ;; - esac -done -fi - -# if unionfs -cobi unionctl bin &>/dev/null || \ - echo "Program unionctl not found; could be ignored ..." - -# if cowloop -cobi cowdev bin &>/dev/null || \ - echo "Program cowdev not found; could be ignored ..." - -# if iscsi (or just with modules)?? -# cobi iscsiadm iscsid bin &>/dev/null || \ -# echo "Program iscsid not found; could be ignored ..." - -# distro specific additional stuff -case "${DISTRO}" in - debian*) - cp ${ROOTDIR}/lib/libnss_compat.so.2 ${INSTDIR}/lib;; -esac - -# copy all libraries that have been determined to be required: -# first we handle all 64-bit libs... -for lib in $(fgrep /lib64/ ${INSTDIR}/tmp/libraries 2>/dev/null|sort -u); do - if ! [ -d ${INSTDIR}/lib64 ] ; then - mkdir ${INSTDIR}/lib64 - fi - cp ${lib} ${INSTDIR}/lib64 -done -# ...now copy 32-bit libs: -for lib in $(fgrep -v /lib64/ ${INSTDIR}/tmp/libraries 2>/dev/null|sort -u); do - cp ${lib} ${INSTDIR}/lib -done -rm -f ${INSTDIR}/tmp/libraries - -# add kernel modules and dependency files -if [ -z "$KERNVER" ] ; then - KERNVER=$(ls -l ${ROOTDIR}/boot/vmlinuz|grep vmlinuz|sed "s/.*vmlinuz-//") -fi -if [ -z "$KERNVER" ] ; then - KERNVER=$(ls -l ${ROOTDIR}/vmlinuz|grep vmlinuz|sed "s/.*vmlinuz-//") -fi -# if no vmlinuz found, go for vmlinuz-x.yz.uv... -if [ -z "$KERNVER" ] ; then - KERNVER=$(ls -lt ${ROOTDIR}/boot/vmlinuz*|grep vmlinuz| \ - sed -n "1,1s/.*vmlinuz-//p") - echo "No vmlinuz-link found. Using kernel version "$KERNVER -fi - -if [ -z "$KERNVER" ] ; then - echo "No kernel version set or detected - please use the -k flag! Exiting..." - exit 1 -fi - -if [ -z "$NWMODULES" ] ; then - NWMODULES="forcedeth e1000 e100 tg3 via-rhine r8169 pcnet32" -fi -if [ -z "$FSMODULES" ] ; then - FSMODULES="nbd nfs" -fi -if [ -z "$INITRD_PATH" ] ; then - INITRD_PATH="${ROOTDIR}/tmp/slxinitramfs.gz" -fi - -# define modules to put into initial ramdisk for debugging -#DEBUGMODULES="uhci_hcd usbhid" -if [ $IRFSDEBUG -gt 1 ] ; then - DEBUGMODULES="uhci-hcd ohci-hcd usbhid" -else - DEBUGMODULES="" -fi - -# put all needed modules into initial ramfs -# fixme: check if ext2 is present in every distro kernel -mkdir -p ${INSTDIR}/lib/modules/${KERNVER} -for module in af_packet unix ${NWMODULES} ${FSMODULES} ${MISCMODULES} \ - ${DEBUGMODULES}; do - mod=`cd /${ROOTDIR}; find "lib/modules/${KERNVER}" -name ${module}.ko \ -2>/dev/null` - - if [ -n "$mod" ] ; then - mpath=${INSTDIR}/${mod%/*} - mkdir -p ${mpath} - cp ${ROOTDIR}/$mod ${mpath} - # fixmee!! selection of dependent modules could be handled a little bit - # more clever - rdirprefix="${ROOTDIR}/lib/modules/${KERNVER}/kernel" - ddirprefix="${INSTDIR}/lib/modules/${KERNVER}/kernel" - case "$module" in - e100|8139too|via-rhine|sis900|epic100|sundance|8139cp|eepro100|pcnet32) - cp ${rdirprefix}/drivers/net/mii.ko \ - ${ddirprefix}/drivers/net &>/dev/null - ;; - nfs) - # create directory structure for modules needed and copy them - # to the proper place (as expected by modprobe/modules.dep) - mkdir -p ${ddirprefix}/net/sunrpc - mkdir -p ${ddirprefix}/fs/lockd ${ddirprefix}/fs/nfs_common - cp ${rdirprefix}/net/sunrpc/sunrpc.ko \ - ${ddirprefix}/net/sunrpc &>/dev/null - cp ${rdirprefix}/fs/lockd/lockd.ko \ - ${ddirprefix}/fs/lockd &>/dev/null - cp ${rdirprefix}/fs/nfs_common/nfs_acl.ko \ - ${ddirprefix}/fs/nfs_common &>/dev/null - ;; - ext3) - mkdir -p ${ddirprefix}/fs/jbd - cp ${rdirprefix}/fs/jbd/jbd.ko \ - ${ddirprefix}/fs/jbd - ;; - netloop) - # needed for xen stuff - cobi brctl bin &>/dev/null || \ - echo "Program brctl not found; could be ignored ..." - mkdir -p ${ddirprefix}/drivers/xen/netback - mkdir -p ${ddirprefix}/net/bridge - cp ${rdirprefix}/drivers/xen/netback/netloop.ko \ - ${ddirprefix}/drivers/xen/netback &>/dev/null - cp ${rdirprefix}/net/bridge/bridge.ko \ - ${ddirprefix}/net/bridge &>/dev/null - ;; - iscsi_tcp) - # iscsi modules - # cobi cobi iscsiadm iscsid bin &>/dev/null - #mkdir -p ${ddirprefix}/drivers/scsi - #for i in scsi_mod scsi_transport_iscsi libiscsi iscsi_tcp; do - # cp ${rdirprefix}/drivers/scsi/$i.ko - # ${ddirprefix}/drivers/scsi - #done - ;; - esac - fi -done -cp ${ROOTDIR}/lib/modules/${KERNVER}/modules.* \ - ${INSTDIR}/lib/modules/${KERNVER} - -# add the common default client configuration file - just to ensure to -# have all major variables defined. !!These settings are most probably -# are overwritten by fileget in stage3 within initramfs!! -if [ -f ${SLX_PRIVATE_PATH}/config/default/initramfs/machine-setup ] ; then - cp ${SLX_PRIVATE_PATH}/config/default/initramfs/machine-setup \ - ${INSTDIR}/etc/machine-setup -# use the installed default machine-setup.default -elif [ -f ${SLX_SHARE_PATH}/templates/machine-setup.default ] ; then - cp ${SLX_SHARE_PATH}/templates/machine-setup.default \ - ${INSTDIR}/etc/machine-setup -else - #inserted password for root for debugging purposes - echo -e "# default for machine-setup does not exist\n# root logins are \ -disabled\nroot_pw='"'$1$T7VD/mmQ$aCP1WEaWplEsHe9khv4kK.'"'" \ - > ${INSTDIR}/etc/machine-setup -fi - -# custom hardware configuration files pcitable.local and Cards.local -# fixme!! New source for these files (instead of templates)! -if [ -f ${SLX_SHARE_PATH}/templates/pcitable.local ] ; then - cat ${SLX_SHARE_PATH}/templates/pcitable.local >> \ - ${INSTDIR}/usr/share/hwdata/pcitable -fi -if [ -f ${SLX_SHARE_PATH}/templates/Cards.local ] ; then - cat ${SLX_SHARE_PATH}/templates/Cards.local >> \ - ${INSTDIR}/usr/share/hwdata/Cards -fi - -# finally copy user-supplied preinit files. The client specific one -# overwrites the system default one. postinit.local may be part of -# fileget tgz (in stage3) -for cfg in default/initramfs/preinit.local \ - ${DISTRO}-${DISTRO_VER}/initramfs/preinit.local \ - default/initramfs/postinit.local \ - ${DISTRO}-${DISTRO_VER}/initramfs/postinit.local ; do - test -f ${SLX_PRIVATE_PATH}/config/$cfg && \ - cp ${SLX_PRIVATE_PATH}/config/$cfg ${INSTDIR}/bin -done - -######################################################################### -# End of file copy procedures - -[ -n "${theme}" ] && add_theme - -# finally create the compressed initial ramdisk cpio archive -pushd . > /dev/null 2>&1 - cd ${INSTDIR} - find . ! -name "*~" | cpio -H newc --create | gzip -9 > $INITRD_PATH -popd > /dev/null 2>&1 - |