From d2dc99dfd828de9c0244fe2f96e9e3927ffbe5f2 Mon Sep 17 00:00:00 2001 From: Brad House Date: Wed, 17 Dec 2003 04:42:06 +0000 Subject: [PATCH] fixes git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@26 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- README | 4 ---- gen_initrd.sh | 2 +- gen_moddeps.sh | 2 +- generic/initrd.defaults | 3 ++- generic/initrd.scripts | 9 ++++++--- generic/linuxrc | 6 +++--- generic/modprobe | 31 ++++++++++++++++++++----------- x86_64/modules_load | 2 +- 8 files changed, 34 insertions(+), 25 deletions(-) diff --git a/README b/README index 1735896..d68d548 100644 --- a/README +++ b/README @@ -1,9 +1,5 @@ VERY EXPERIMENTAL seems to work so far on amd64 and x86 -I've only tested with 2.6 kernels, it's possible that -the module-init-tools we use doesn't work with 2.4 in -which case we need to compile modutils as well and -provide a static binary for that.... DEPENDANCIES: - bootsplash diff --git a/gen_initrd.sh b/gen_initrd.sh index ce99418..c61d0d6 100644 --- a/gen_initrd.sh +++ b/gen_initrd.sh @@ -74,7 +74,7 @@ create_base_initrd_sys() { # bunzip2 "${TEMP}/initrd-temp/etc/devfsd.conf.bz2" || gen_die "could not uncompress devfsd.conf" for i in '[' ash basename cat chroot clear cp dirname echo env false find \ - grep gunzip gzip insmod ln ls loadkmap losetup lsmod mkdir mknod more mount mv \ + grep gunzip gzip ln ls loadkmap losetup lsmod mkdir mknod more mount mv \ pivot_root ps awk pwd rm rmdir rmmod sh sleep tar test touch true umount uname \ xargs yes zcat chmod chown cut kill killall; do rm -f ${TEMP}/initrd-temp/bin/$i > /dev/null diff --git a/gen_moddeps.sh b/gen_moddeps.sh index 1b2c19a..197633e 100644 --- a/gen_moddeps.sh +++ b/gen_moddeps.sh @@ -52,7 +52,7 @@ gen_deps() gen_dep_list() { rm -f ${TEMP}/moddeps > /dev/null - gen_deps ${STORAGE_MODULES} + gen_deps ${SCSI_MODULES} gen_deps ${FIREWIRE_MODULES} gen_deps ${ATARAID_MODULES} gen_deps ${PCMCIA_MODULES} diff --git a/generic/initrd.defaults b/generic/initrd.defaults index 4ccbe2b..2fe9c89 100644 --- a/generic/initrd.defaults +++ b/generic/initrd.defaults @@ -15,7 +15,7 @@ MY_HWOPTS="usb firewire" QUIET=1 ROOT_LINKS="bin sbin lib lib64 boot usr opt" ROOT_TREES="etc root home var" -if [ "$KMVER" = "2.6" ] +if [ "${KMINOR}" -gt "4" ] then KSUFF=".ko" INSMOD="insmod" @@ -23,6 +23,7 @@ else KSUFF=".o" INSMOD="insmod" fi + REAL_ROOT="" CDROOT=0 diff --git a/generic/initrd.scripts b/generic/initrd.scripts index d6e11cf..14eba4e 100644 --- a/generic/initrd.scripts +++ b/generic/initrd.scripts @@ -13,11 +13,14 @@ parse_opt() { } modules_scan() { - for x in "`cat /etc/modules/${1}`" + local MODS + MODS=`cat /etc/modules/${1}` + for x in ${MODS} do echo -ne "${HILITE}---- Scanning for ${x}..." - MODULE=`find /lib/modules -name "${x}.$KSUFF"` - /sbin/modprobe -f ${MODULE} > /dev/null 2>&1 +# MODULE=`find /lib/modules -name "${x}.$KSUFF"` + modprobe ${x} +# > /dev/null 2>&1 if [ $? -eq 0 ] then backup diff --git a/generic/linuxrc b/generic/linuxrc index c6525b0..1269ada 100644 --- a/generic/linuxrc +++ b/generic/linuxrc @@ -129,7 +129,7 @@ do else echo "STEP 4a: Mounting root" - mount -o ro ${REAL_ROOT} /newroot + mount -o rw ${REAL_ROOT} /newroot if [ "$?" = "0" ] then break @@ -174,8 +174,8 @@ then mount -t proc proc /proc mount -t devfs devfs /dev kill_devfsd - umount /initrd/proc - umount /initrd/dev + umount /tmp/.initrd/proc + umount /tmp/.initrd/dev # Uhh, initrd is wasting memory ... let's # kill the sucker here and now! diff --git a/generic/modprobe b/generic/modprobe index 7a53679..ceffdc7 100755 --- a/generic/modprobe +++ b/generic/modprobe @@ -35,7 +35,7 @@ modules_dep_list() echo "modules_dep_list(): improper usage" exit 1 fi - cat /lib/modules/${KV}/modules.dep | grep ${1}${KEXT}\: | cut -d\: -f2 + cat /lib/modules/${KV}/modules.dep | grep ${1}${KSUFF}\: | cut -d\: -f2 } @@ -68,7 +68,7 @@ is_module_already_loaded() for x in ${LOADED_MODULES} do - if [ "${x}" == "${1}" ] + if [ "${x}" = "${1}" ] then # Yep, module is loaded return 0 @@ -79,7 +79,8 @@ is_module_already_loaded() real_mod_path() { - find /lib/modules/${KV}/ -path "*${1}${KEXT}" + # find doesn't work like we expect, let's add a grep to it + find /lib/modules | grep "${1}${KSUFF}" } modprobe2() @@ -88,8 +89,14 @@ modprobe2() if [ "$#" != "1" ] then echo "modprobe(): improper usage" + exit 1 + fi + real_path=`real_mod_path ${1}` + if [ "${real_path}" = "" -o "${real_path}" = " " ] + then + echo "no such module found" + exit 1 fi - modlist=`modules_dep_list ${1}` if [ "${modlist}" != "" -a "${modlist}" != " " ] then @@ -97,8 +104,8 @@ modprobe2() else deps="" fi - - echo "$1 -- DEPS=${deps}" +# echo "" +# echo "$1 -- DEPS='${deps}'" # Make sure we don't do any endless loops! LOADED_MODULES="${LOADED_MODULES} ${1}" @@ -107,15 +114,17 @@ modprobe2() do if ! is_module_already_loaded ${x} then - modprobe2 "${x}" + if [ "${x}" != "" -a "${x}" != " " ] + then + modprobe2 "${x}" + fi else echo "skipping ${x}, module already loaded by us" fi done +# echo "running insmod on '${real_path}'" + ${INSMOD} ${real_path} > /dev/null 2>&1 - real_path=`real_mod_path ${1}` - echo "running insmod on ${real_path}" - ${INSMOD} ${real_path} return $? } @@ -126,5 +135,5 @@ then fi modprobe2 ${1} -return $? +exit $? diff --git a/x86_64/modules_load b/x86_64/modules_load index 809f4cd..1a2d136 100644 --- a/x86_64/modules_load +++ b/x86_64/modules_load @@ -11,7 +11,7 @@ aacraid sym53c8xx a100u2w cpqfc \ dmx3191d dpt_i2o imm in2000 ips qla1280 \ sim710 sym53c416" -FIREWIRE_MODULES="ieee1394 ohci1394 eth1394 sbp2" +FIREWIRE_MODULES="ieee1394 ohci1394 sbp2" ATARAID_MODULES="ataraid pdcraid hptraid" -- 2.26.2