From 37d4bc8b1d63cd1751d5e02659958d4dc004eaef Mon Sep 17 00:00:00 2001 From: Brad House Date: Tue, 16 Dec 2003 06:02:02 +0000 Subject: [PATCH] integrate new initrd, and module scanning git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@23 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- gen_initrd.sh | 87 ++++++++---- gen_moddeps.sh | 63 +++++++++ genkernel.sh | 1 + x86_64/initrd.defaults | 29 ++++ x86_64/initrd.scripts | 53 +++++++ x86_64/linuxrc | 313 +++++++++++++++++++++-------------------- x86_64/modprobe | 130 +++++++++++++++++ x86_64/modules_load | 8 +- 8 files changed, 501 insertions(+), 183 deletions(-) create mode 100644 gen_moddeps.sh create mode 100644 x86_64/initrd.defaults create mode 100644 x86_64/initrd.scripts create mode 100755 x86_64/modprobe diff --git a/gen_initrd.sh b/gen_initrd.sh index f455ce0..18bb6bf 100644 --- a/gen_initrd.sh +++ b/gen_initrd.sh @@ -2,20 +2,28 @@ # create_initrd_loop(size) create_initrd_loop() { + local inodes [ "$#" -ne "1" ] && gen_die "invalid use of create_initrd_loop" - mkdir -p ${TEMP}/initrd-temp || gen_die "could not create loopback dir" + mkdir -p ${TEMP}/initrd-mount || gen_die "could not create loopback mount dir" dd if=/dev/zero of=${TEMP}/initrd-loop bs=1k count=${1} >> "${DEBUGFILE}" 2>&1 || gen_die "could not zero initrd-loop" - mke2fs -F -q -N${1} "${TEMP}/initrd-loop" >> "${DEBUGFILE}" 2>&1 || gen_die "could not format initrd-loop" - mount -t ext2 -o loop "${TEMP}/initrd-loop" "${TEMP}/initrd-temp" >> "${DEBUGFILE}" 2>&1 || gen_die "could not mount initrd filesystem" + mke2fs -F -N500 -q "${TEMP}/initrd-loop" >> "${DEBUGFILE}" 2>&1 || gen_die "could not format initrd-loop" + mount -t ext2 -o loop "${TEMP}/initrd-loop" "${TEMP}/initrd-mount" >> "${DEBUGFILE}" 2>&1 || gen_die "could not mount initrd filesystem" } create_initrd_unmount_loop() { cd ${TEMP} - umount "${TEMP}/initrd-temp" || gen_die "could not unmount initrd system" + umount "${TEMP}/initrd-mount" || gen_die "could not unmount initrd system" +} + +move_initrd_to_loop() +{ + cd "${TEMP}/initrd-temp" + mv * "${TEMP}/initrd-mount" > ${DEBUGFILE} } create_base_initrd_sys() { + rm -rf "${TEMP}/initrd-temp" > /dev/null mkdir -p ${TEMP}/initrd-temp/dev mkdir -p ${TEMP}/initrd-temp/bin mkdir -p ${TEMP}/initrd-temp/etc @@ -38,8 +46,8 @@ create_base_initrd_sys() { cd ${TEMP}/initrd-temp/dev - MAKEDEV generic-i386 - MAKEDEV scd + MAKEDEV std + MAKEDEV console cp "${BUSYBOX_BINCACHE}" "${TEMP}/initrd-temp/bin/busybox.bz2" || gen_die "could not copy busybox from bincache" bunzip2 "${TEMP}/initrd-temp/bin/busybox.bz2" || gen_die "could not uncompress busybox" @@ -65,7 +73,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 modprobe more mount mv \ + grep gunzip gzip insmod 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 @@ -80,13 +88,15 @@ create_initrd_modules() { else MOD_EXT=".o" fi - local modc i mods mymod - for modc in storage firewire ataraid pcmcia usb - do - mkdir -p ${TEMP}/initrd-temp/lib/modules/${modc} - mods=`echo $modc | tr [:lower:] [:upper:]`_MODULES - eval mymods=\$$mods - for i in ${mymods} +# local modc i mods mymod +# for modc in storage firewire ataraid pcmcia usb +# do +# for +# mkdir -p ${TEMP}/initrd-temp/lib/modules/${modc} +# mods=`echo $modc | tr [:lower:] [:upper:]`_MODULES +# eval mymods=\$$mods +# for i in ${mymods} + for i in `gen_dep_list` do print_info 2 "$i : module searching" 1 0 mymod=`find /lib/modules/${KV} -name "${i}${MOD_EXT}"` @@ -98,22 +108,37 @@ create_initrd_modules() { print_info 2 "copying ${mymod} to initrd" cp -ax --parents "${mymod}" "${TEMP}/initrd-temp" done - done +# done cp -ax --parents /lib/modules/${KV}/modules* ${TEMP}/initrd-temp - cat ${GK_SHARE}/${ARCH}/linuxrc | sed -e "s/%%STORAGE_MODULES%%/${STORAGE_MODULES}/" \ - -e "s/%%FIREWIRE_MODULES%%/${FIREWIRE_MODULES}/" \ - -e "s/%%ATARAID_MODULES%%/${ATARAID_MODULES}/" \ - -e "s/%%PCMCIA_MODULES%%/${PCMCIA_MODULES}/" \ - -e "s/%%USB_MODULES%%/${USB_MODULES}/" \ - > ${TEMP}/initrd-temp/linuxrc - chmod +x ${TEMP}/initrd-temp/linuxrc + + print_info 1 "WARNING WARNING: Brad, Dont forget to output modules files to autoload" +# cat ${GK_SHARE}/${ARCH}/linuxrc | sed -e "s/%%STORAGE_MODULES%%/${STORAGE_MODULES}/" \ +# -e "s/%%FIREWIRE_MODULES%%/${FIREWIRE_MODULES}/" \ +# -e "s/%%ATARAID_MODULES%%/${ATARAID_MODULES}/" \ +# -e "s/%%PCMCIA_MODULES%%/${PCMCIA_MODULES}/" \ +# -e "s/%%USB_MODULES%%/${USB_MODULES}/" \ +# > ${TEMP}/initrd-temp/linuxrc + + cp "${GK_SHARE}/${ARCH}/linuxrc" "${TEMP}/initrd-temp/linuxrc" + cp "${GK_SHARE}/${ARCH}/initrd.scripts" "${TEMP}/initrd-temp/etc/initrd.scripts" + cp "${GK_SHARE}/${ARCH}/initrd.defaults" "${TEMP}/initrd-temp/etc/initrd.defaults" + cp "${GK_SHARE}/${ARCH}/modprobe" "${TEMP}/initrd-temp/sbin/modprobe" + chmod +x "${TEMP}/initrd-temp/linuxrc" + chmod +x "${TEMP}/initrd-temp/etc/initrd.scripts" + chmod +x "${TEMP}/initrd-temp/etc/initrd.defaults" + chmod +x "${TEMP}/initrd-temp/sbin/modprobe" +} + +calc_initrd_size() { + local TEST + cd ${TEMP}/initrd-temp/ + TEST=`du -sk 2> /dev/null` + echo $TEST | cut "-d " -f1 } create_initrd() { local MOD_EXT - print_info 1 "initrd: creating loopback filesystem" - create_initrd_loop 5000 print_info 1 "initrd: creating base system" create_base_initrd_sys @@ -121,6 +146,20 @@ create_initrd() { print_info 1 "initrd: copying modules" create_initrd_modules + print_info 1 "initrd: calculating initrd size" + INITRD_CALC_SIZE=`calc_initrd_size` + + print_info 1 "initrd: calculated size ${INITRD_CALC_SIZE} + 100k slop for fs overhead" + INITRD_SIZE=`expr ${INITRD_CALC_SIZE} + 100` + + print_info 1 "initrd: real size ${INITRD_SIZE}" + + print_info 1 "initrd: creating loopback filesystem" + create_initrd_loop ${INITRD_SIZE} + + print_info 1 "initrd: moving initrd fs to loopback" + move_initrd_to_loop + print_info 1 "initrd: cleaning up and compressing initrd" create_initrd_unmount_loop diff --git a/gen_moddeps.sh b/gen_moddeps.sh new file mode 100644 index 0000000..1b2c19a --- /dev/null +++ b/gen_moddeps.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +modules_dep_list() +{ + if [ "${PAT}" -gt "4" ] + then + KEXT=".ko" + else + KEXT=".o" + fi + cat /lib/modules/${KV}/modules.dep | grep ${1}${KEXT}\: | cut -d\: -f2 +} + +# Pass module deps list +strip_mod_paths() +{ + local x + local ret + local myret + + for x in ${*} + do + ret=`basename ${x} | cut -d. -f1` + myret="${myret} ${ret}" + done + echo "${myret}" +} + + +gen_deps() +{ + local modlist + local deps + + for x in ${*} + do + echo ${x} >> ${TEMP}/moddeps + modlist=`modules_dep_list ${x}` + if [ "${modlist}" != "" -a "${modlist}" != " " ] + then + deps=`strip_mod_paths ${modlist}` + else + deps="" + fi + for y in ${deps} + do + echo ${y} >> ${TEMP}/moddeps + done + done +} + +gen_dep_list() +{ + rm -f ${TEMP}/moddeps > /dev/null + gen_deps ${STORAGE_MODULES} + gen_deps ${FIREWIRE_MODULES} + gen_deps ${ATARAID_MODULES} + gen_deps ${PCMCIA_MODULES} + gen_deps ${USB_MODULES} + + # Only list each module once + cat ${TEMP}/moddeps | sort | uniq +} diff --git a/genkernel.sh b/genkernel.sh index 6491f7b..5dc9967 100755 --- a/genkernel.sh +++ b/genkernel.sh @@ -18,6 +18,7 @@ source ${GK_BIN}/gen_determineargs.sh || gen_die "could not read ${GK_BIN}/gen_d source ${GK_BIN}/gen_compile.sh || gen_die "could not read ${GK_BIN}/gen_compile.sh" source ${GK_BIN}/gen_configkernel.sh || gen_die "could not read ${GK_BIN}/gen_configkernel.sh" source ${GK_BIN}/gen_initrd.sh || gen_die "could not read ${GK_BIN}/gen_initrd.sh" +source ${GK_BIN}/gen_moddeps.sh || gen_die "could not read ${GK_BIN}/gen_moddeps.sh" # Parse all command line options, and load into memory parse_cmdline $* diff --git a/x86_64/initrd.defaults b/x86_64/initrd.defaults new file mode 100644 index 0000000..02266c4 --- /dev/null +++ b/x86_64/initrd.defaults @@ -0,0 +1,29 @@ +#!/bin/ash +PATH=/usr/sbin:/usr/bin:/sbin:/bin +BACK_UP="\033[1K\033[0G" +HILITE="\033[1m" +NORMAL="\033[0m" +WARN="\033[1m" +BAD="\033[1m" +KV="`uname -r`" +KMAJOR=`echo $KV | cut -f1 -d.` +KMINOR=`echo $KV | cut -f2 -d.` +KVER="${KMAJOR}.${KMINOR}" +MISCOPTS="cdcache idebug detect" +HWOPTS="scsi firewire ataraid pcmcia usb" +MY_HWOPTS="usb" +QUIET=1 +ROOT_LINKS="bin sbin lib lib64 boot usr opt" +ROOT_TREES="etc root home var" +if [ "$KMVER" = "2.6" ] +then + KSUFF=".ko" + INSMOD="insmod.static" +else + KSUFF=".o" + INSMOD="insmod" +fi +REAL_ROOT="" +CDROOT=0 + + diff --git a/x86_64/initrd.scripts b/x86_64/initrd.scripts new file mode 100644 index 0000000..d6e11cf --- /dev/null +++ b/x86_64/initrd.scripts @@ -0,0 +1,53 @@ +#!/bin/ash + +backup() { + echo -ne "\033[0G\033[0K" +} + +parse_opt() { + case "$1" in + *\=*) + echo "$1" | cut -f2 -d= + ;; + esac +} + +modules_scan() { + for x in "`cat /etc/modules/${1}`" + do + echo -ne "${HILITE}---- Scanning for ${x}..." + MODULE=`find /lib/modules -name "${x}.$KSUFF"` + /sbin/modprobe -f ${MODULE} > /dev/null 2>&1 + if [ $? -eq 0 ] + then + backup + echo -e "${GOOD}---- Detected ${x} hardware${NORMAL}" + continue + fi + backup + echo -ne "${NORMAL}" + done +} + +findcdmount() { + if [ "$#" -gt "1" ] + then + for x in "$*" + do + mount -t iso9660 -r ${x} /newroot/mnt/cdrom > /dev/null 2>&1 + if [ "$?" = "0" ] + then + REAL_ROOT="${x}" + break + fi + done + if [ "${REAL_ROOT}" != "" ] + then + echo -e "${HILITE}---- CD medium found on $1${NORMAL}" + fi + fi +} + +kill_devfsd() { + killall devfsd > /dev/null 2>&1 +} diff --git a/x86_64/linuxrc b/x86_64/linuxrc index 8231e81..90ab802 100644 --- a/x86_64/linuxrc +++ b/x86_64/linuxrc @@ -3,187 +3,196 @@ # Copyright 2003 Gentoo Technologies, Inc. # Distributed under the GPL -PATH=/usr/sbin:/usr/bin:/sbin:/bin -BACK_UP="\033[1K\033[0G" -HILITE="\033[1m" -NORMAL="\033[0m" -WARN="\033[1m" -BAD="\033[1m" -#mount -o remount,rw / +. /etc/initrd.defaults +. /etc/initrd.scripts + +USE_DEVFS_NORMAL=1 + +mount -o remount,rw / mount /proc -INITRD="true" -SCSI="yes" -CDCACHE="no" -IDEBUG="no" -FIREWIRE="no" -ATARAID="no" -PCMCIA="no" -DETECT="no" -USB="yes" -KEYMAP="no" -if [ ! -e /dev/.devfsd ] -then - #mount devfs - mount -t devfs devfs /dev -fi -CMDLINE="`cat /proc/cmdline`" -for x in $CMDLINE -do - if [ "$x" = "doscsi" ] - then - SCSI="yes" - elif [ "$x" = "cdcache" ] - then - CDCACHE="yes" - elif [ "$x" = "idebug" ] - then - IDEBUG="yes" - fi -done +[ -n "$QUIET" ] && echo "0" > /proc/sys/kernel/printk -for x in $CMDLINE +echo "${GOOD} Gentoo initrd startup..." +echo "STEP 1: Command-line parsing" +CMDLINE=`cat /proc/cmdline` +# Scan CMDLINE for any specified real_root= or cdroot arguments +for x in ${CMDLINE} do - if [ "$x" = "dofirewire" ] - then - FIREWIRE="yes" - fi -done -for x in $CMDLINE -do - if [ "$x" = "nousb" ] - then - USB="no" - fi + case "${x}" in + real_root\=*) + REAL_ROOT=`parse_opt "${x}"` + ;; + cdroot) + CDROOT=1 + REAL_ROOT="" + ;; + devfs) + USE_DEVFS_NORMAL=1 + ;; + nodevfs) + USE_DEVFS_NORMAL=0 + ;; + *) + ;; + esac done -for x in $CMDLINE -do - if [ "$x" = "doataraid" ] - then - ATARAID="yes" - fi -done -for x in $CMDLINE +# Scan CMDLINE for any "doscsi" or "noscsi"-type arguments +for x in $HWOPTS do - if [ "$x" = "dopcmcia" ] - then - PCMCIA="yes" - fi + for y in $CMDLINE + do + if [ "$y" = "do${x}" ] + then + MY_HWOPTS="MY_HWOPTS $x" + elif [ "$y" = "no${x}" ] + then + MY_HWOPTS="`echo ${MY_HWOPTS} | sed -e 's/${x}//g' -`" + fi + done done -for x in $CMDLINE +echo "STEP 2: Module loading" + +# Load appropriate kernel modules +for x in $MY_HWOPTS do - if [ "$x" = "dokeymap" ] - then - KEYMAP="yes" - fi + modules_scan $x done -blurb() { - echo -ne ${HILITE}${1} -} - -backup() { - echo -ne "\033[0G\033[0K" -} -if [ -e /dev/.devfsd ] - then - RAM_DEVICE="rd" - else - RAM_DEVICE="ram0" +echo "STEP 3: Mounting necessary filesystems per boot options" + +mkdir /newroot +if [ "${CDROOT}" -eq "1" ] +then + mount -t tmpfs tmpfs /newroot + mkdir /newroot/dev /newroot/mnt /newroot/mnt/cdrom /newroot/mnt/.init.d /newroot/mnt/gentoo + [ ! -e /newroot/dev/.devfsd ] && mount -t devfs devfs /newroot/dev + devfsd /newroot/dev + findcdmount /newroot/dev/cdroms/* + if [ "${REAL_ROOT}" = "" ] + then + kill_devfsd + umount /newroot/dev/ + umount /newroot + # shouldn't be anything in here b/c it was on tmpfs + rm -rf /newroot/* + CDROOT=0 + echo "Could not find CD to boot, gonna need something else" + fi +fi + +# Don't do else b/c we set CDROOT=0 if it fails to detect +if [ "${CDROOT}" -eq "0" -a "${USE_DEVFS_NORMAL}" -eq "1" ] +then + [ ! -e /dev/.devfsd ] && mount -t devfs devfs /dev + devfsd /dev fi +echo "STEP 4: Determining root device" -# Create the new root FS +while true +do + while [ "${got_good_root}" != "1" ] + do + + if [ "${REAL_ROOT}" = "shell" ] + then + /bin/ash -mounted="" + #set REAL_ROOT to "" so we get a prompt for the real root after the shell exits. + REAL_ROOT="" + got_good_root=0 + continue + elif [ "${REAL_ROOT}" = "" ] + then + #no REAL_ROOT determined/specified. Prompt user for root block device. + echo "Root block device unspecified or not detected." + echo "Please specify a device to boot, or \"shell\" for a shell." + echo -n ": " + read REAL_ROOT + got_good_root=0 + elif [ -b "${REAL_ROOT}" ] + then + got_good_root=1 + else + REAL_ROOT="" + got_good_root=0 + fi + done -initmsg() { - echo -e "${HILITE}${*}${NORMAL}" -} -getkeymap() { - local mykeymap - echo -ne ${HILITE} - cat /keymaps/key.lst - echo -ne ${NORMAL} - read -p "Keymap selection: " mykeymap - if [ -e /keymaps/${mykeymap}.map ] + if [ "${CDROOT}" -eq "1" -a "${got_good_root}" = "1" ] then - echo -e "${HILITE}---- Loading ${mykeymap} keymap${NORMAL}" - loadkmap < /keymaps/${mykeymap}.map - elif [ "$mykeymap" = "" ] - then - #default keymap is "us" - echo -e "${HILITE}---- Loading default (US) keymap${NORMAL}" - loadkmap < /keymaps/us.map - else - getkeymap - fi -} + break + else + echo "STEP 4a: Mounting root" -modules_scan() { - local type - type=${1}; shift - for x in "$@" - do - blurb "---- Scanning for ${x}..." - insmod.static -f /modules/${type}/${x}.o > /dev/null 2>&1 - if [ $? -eq 0 ] + mount -o ro ${REAL_ROOT} /newroot + if [ "$?" = "0" ] then - backup - echo -e "${GOOD}---- Detected ${x} hardware${NORMAL}" + break else - backup - echo -ne "${NORMAL}" + echo "Could not mount specified ROOT, try again" + got_good_root=0 + REAL_ROOT="" fi - done -} -echo "${GOOD} Initial RAMDISK Loading Starting..." -# Mount the CD + fi +done -if [ "$SCSI" = "yes" ] -then -DEVICE=SCSI - echo -e "${HILITE} ---- Beginning storage detection${NORMAL}" - # This next "%% %%" gets sed tweaked: - modules_scan storage %%STORAGE_MODULES%% -fi +[ -n "$QUIET" ] && echo "6" > /proc/sys/kernel/printk +echo "STEP 5: Finishing up" -if [ "$FIREWIRE" = "yes" ] +if [ "${CDROOT}" = "1" ] then -DEVICE=FIREWIRE - echo -e "${HILITE} ---- Beginning firewire detection${NORMAL}" - # This next "%% %%" gets sed tweaked: - modules_scan firewire %%FIREWIRE_MODULES%% -fi -if [ "$ATARAID" = "yes" ] -then -DEVICE=ATARAID - echo -e "${HILITE} ---- Beginning ata detection${NORMAL}" - # This next "%% %%" gets sed tweaked: - modules_scan ataraid %%ATARAID_MODULES%% + echo "STEP 5a: filling tmpfs filesystem" + cd /newroot + for x in ${ROOT_LINKS} + do + ln -s "mnt/cdrom/${x}" "${x}" + done + mkdir initrd proc tmp sys + chmod 1777 tmp + (cd /newroot/mnt/cdrom; cp -a ${ROOT_TREES} /newroot) + kill_devfsd +else + echo "STEP 5b: setting up stuff for pivot_root" + mkdir /newroot/initrd fi -if [ "$PCMCIA" = "yes" ] -then -DEVICE=PCMCIA - echo -e "${HILITE} ---- Beginning pcmcia detection${NORMAL}" - # This next "%% %%" gets sed tweaked: - modules_scan %%PCMCIA_MODULES%% -fi -if [ "$USB" = "yes" ] -then -DEVICE=USB - echo -e "${HILITE} ---- Beginning usb detection${NORMAL}" - # This next "%% %%" gets sed tweaked: - modules_scan usb %%USB_MODULES%% -fi +echo "STEP 6: pivot_root and exec/chroot real init" -if [ "$KEYMAP" = "yes" ] + +cd /newroot +pivot_root . initrd + +if [ "${USE_DEVFS_NORMAL}" -eq "1" -a "${CDROOT}" -eq "0" ] then -getkeymap + # must mount a new devfs before we can + # umount the old one for some reason + mount -t proc proc /proc + mount -t devfs devfs /dev + kill_devfsd + umount /initrd/proc + umount /initrd/dev + + # Uhh, initrd is wasting memory ... let's + # kill the sucker here and now! + umount /initrd + blockdev --flushbufs /dev/ram0 + + # at this point it lets us umount the new + # devfs, don't know why, just does, stop + # asking questions! + umount /dev + umount /proc fi -exit +# why chroot ?? /usr/src/linux/Documentation/initrd.txt +# says to, but I see no reason to do this .... very odd... +# here's the line it says we should do: +# exec chroot . /sbin/init /dev/console 2>&1 +# not gonna though .... +exec /sbin/init + diff --git a/x86_64/modprobe b/x86_64/modprobe new file mode 100755 index 0000000..7a53679 --- /dev/null +++ b/x86_64/modprobe @@ -0,0 +1,130 @@ +#!/bin/ash + +#KV=`uname -r` +#KMAJOR=`echo ${KV} | cut -d. -f1` +#KMINOR=`echo ${KV} | cut -d. -f2` +#INSMOD="insmod.static" + +#if [ "${KMINOR}" -gt "4" ] +#then +# KEXT=".ko" +#else +# KEXT=".o" +#fi + +. /etc/initrd.defaults + +usage() +{ + echo "modprobe gentoo script v1.0" + echo "Usage:" + echo " modprobe moduleprefix" + echo "" + echo "Ex:" + echo " modprobe eepro100" + echo "" + echo "Note: Do not pass the suffix to modprobe" + exit 1 +} + +# Pass module name to this function +modules_dep_list() +{ + if [ "$#" != "1" ] + then + echo "modules_dep_list(): improper usage" + exit 1 + fi + cat /lib/modules/${KV}/modules.dep | grep ${1}${KEXT}\: | cut -d\: -f2 +} + + +# Pass module deps list +strip_mod_paths() +{ + local x + local ret + local myret + + [ "$#" -lt "1" ] && return + + for x in ${*} + do + ret=`basename ${x} | cut -d. -f1` + myret="${myret} ${ret}" + done + echo "${myret}" +} + +LOADED_MODULES="" + +is_module_already_loaded() +{ + local x + if [ "$#" != "1" ] + then + echo "is_module_already_loaded(): improper usage" + fi + + for x in ${LOADED_MODULES} + do + if [ "${x}" == "${1}" ] + then + # Yep, module is loaded + return 0 + fi + done + return 1 +} + +real_mod_path() +{ + find /lib/modules/${KV}/ -path "*${1}${KEXT}" +} + +modprobe2() +{ + local x + if [ "$#" != "1" ] + then + echo "modprobe(): improper usage" + fi + + modlist=`modules_dep_list ${1}` + if [ "${modlist}" != "" -a "${modlist}" != " " ] + then + deps=`strip_mod_paths ${modlist}` + else + deps="" + fi + + echo "$1 -- DEPS=${deps}" + # Make sure we don't do any endless loops! + + LOADED_MODULES="${LOADED_MODULES} ${1}" + + for x in ${deps} + do + if ! is_module_already_loaded ${x} + then + modprobe2 "${x}" + else + echo "skipping ${x}, module already loaded by us" + fi + done + + real_path=`real_mod_path ${1}` + echo "running insmod on ${real_path}" + ${INSMOD} ${real_path} + return $? +} + + +if [ "$#" != "1" ] +then + usage +fi + +modprobe2 ${1} +return $? + diff --git a/x86_64/modules_load b/x86_64/modules_load index be2b70a..2b6c1bf 100644 --- a/x86_64/modules_load +++ b/x86_64/modules_load @@ -17,11 +17,5 @@ ATARAID_MODULES="ataraid pdcraid hptraid" PCMCIA_MODULES="ide-cs" -USB_MODULES="usbcore ehci-hcd uhci usb-ohci hid usb-storage" - -INITRD_SIZE=5000 - -#BOOT_SPLASH_INITRD="/boot/initrd.bs" - -MRPROPER="yes" +USB_MODULES="ehci-hcd uhci usb-ohci hid usb-storage" -- 2.26.2