initrd busybox depmod und module-init-tools 3.3

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

initrd busybox depmod und module-init-tools 3.3

Karl Godt
Administrator
This post was updated on .
Recent Slacko has busybox v1.17.y and I think also woof-CE .
It has much more applets enabled .
I like that .

Problem comes, that module-init-tools are still Puppy-4.3 and earlier version .

Both modprobe and modinfo of that version do not like relative path in the modules.dep file .
RELATIVE_PATH=kernel/subdir/driver.ko .

No drivers get loaded using a relative modules.dep file .

Thats why a big bunch of regular depmod-FULL files are in the initrd now - I believe .
Somehow they seem to work .

Using just the standard 3 modules.* files dep, alias, symbols works too, but with absolute path .
ABSOLUTE_PATH=/lib/modules/$KERNELVER/kernel/subdir/driver.ko

Regular Lupu busybox-1.16.y is apparently the last busybox creating the absolute modules.dep file .

module-init-tools --version 3.6 in Slacko64 initrd and in PUPSFS PUPXXXSFS of 4.3 seem to accept both absolute and relative path in the modules.dep file .




This code sed's the absolute path into modules.dep file :
#does this initrd have all the zdrv components inside it?...
ZDRVINIT='no'
[ -d /lib/modules/$KERNELVER ] || mkdir -p /lib/modules/$KERNELVER
touch /lib/modules/$KERNELVER/modules.dep
_depmod(){
[ -x /bin/depmod ] && depmod
grep $Q '^/lib/modules/' /lib/modules/$KERNELVER/modules.dep && return 0
cp /lib/modules/$KERNELVER/modules.* /tmp/
sed -i "s%^%/lib/modules/$KERNELVER/%" /lib/modules/$KERNELVER/modules.dep
# EDIT : dependent modules also need absolute path prepended
sed -i "s% kernel/% /lib/modules/$KERNELVER/kernel/%g" /lib/modules/$KERNELVER/modules.dep
grep $Q '^/lib/modules/' /lib/modules/$KERNELVER/modules.dep || {
    for f in dep alias symbols; do cp /lib/modules/$KERNELVER/modules.$f /tmp/modules.$f.sed; done
    cp /tmp/modules.* /lib/modules/$KERNELVER/; return 1; }
}
_depmod
if [ -s /lib/modules/$KERNELVER/modules.dep ]; then
[ `cat /lib/modules/$KERNELVER/modules.dep  | wc -l` -gt 200 ] && ZDRVINIT='yes'
fi

With my machine BIOS year 2011: Puppy-4.3 still works though 1600x1200 screen on 1920x1080 i915 modeset=0 .

ehci-hcd refuses to load when usbcore is not inserted before with kernel 2.6.30.5 :
#v423 k2.6.29.6 dmesg has warning that ehci-hcd should load before uhci-hcd and ohci-hid...
#[ "`echo "$ELSPCI" | grep '0C0320'`" != "" ] && modprobe ehci-hcd
if [ "`echo "$ELSPCI" | grep '0C0320'`" != "" ]; then
 modinfo usbcore  && modprobe -v usbcore
 modinfo ehci-hcd && modprobe -v ehci-hcd
else true
fi


Here driver loading made into two switchable functions by kernel parameter "player=risky" :
case $player in
risk*) _load_modules;_ass_layerfs;;
*) _load_drivers_main;;
esac

Risky loads all drivers without much code
_load_modules(){
echo -n "Loading all included drivers" > /dev/console #STEP ONE
modprobe -v usbcore
modprobe -v ehci-hcd

oIFS="$IFS"
local IFS=':'
while read m deps;
do
m=`echo "${m##*/}" | cut -f1 -d'.'`
modprobe -v --first-time -b $m
done</lib/modules/$KERNELVER/modules.dep

IFS="$oIFS"
}
This is the traditional code made into functions and sub-functions :
Note : needed to force usbhid loading, so keyboard in RDSH works ( missing aliases )  

_ass_layerfs(){
    local tLAYERFS fs
[ "$layerfs" ] && tLAYERFS=$layerfs
    for fs in $tLAYERFS aufs unionfs
    do
     grep $Q "[[:blank:]]\+${fs}$" /proc/filesystems && { LAYERFS=$fs; break; }
     [ "`modinfo $fs 2>/dev/null`" ] && { LAYERFS=$fs; break; }
    done
[ "$LAYERFS" ] || echo "WARNING:Could not determine LAYERFS variable, which usually is 'aufs' or 'unionfs' file system."
}

_load_drivers_main(){
###################LOAD MODULES TO ACCESS DRIVES#####################
echo -n "Loading drivers needed to access disk drives" > /dev/console #STEP ONE

#_load_serial_removable_driver(){
_load_drive_drivers(){
#100214 one config of 2.6.33 has base floppy and ps/2 mouse support not builtin...
#[ "`modinfo floppy 2>/dev/null`" != "" ]  && modprobe floppy
#[ "`modinfo psmouse 2>/dev/null`" != "" ] && modprobe psmouse

#w462 if present, load it. enables recognition of drives attached to parallel port.
#[ "`modinfo ppa 2>/dev/null`" != "" ] && modprobe ppa #also loads parport.ko
#modprobe sr_mod > /dev/null 2>&1 #v3.93 now built-in to kernel.

for ONEDRVMOD in cdrom ide_cd ide_floppy floppy ppa sr_mod
do
 [ "`modinfo $ONEFSMOD 2>/dev/null`" != "" ] && modprobe $ONEDRVMOD
done
}
_load_drive_drivers
#_load_serial_removable_driver

ELSPCI="`elspci -l`" #jesses great little utility.

_load_pcmcia_drivers(){
#v403 pcmcia drive support. i think this may need extra delay though...
if [ "`echo "$ELSPCI" | grep '060700'`" != "" ];then
 modprobe yenta_socket
 #...may have to add on a couple of seconds, need to test with a pcmcia drive.
 #v412 yeah, my pccard-usb adaptor needs delay before elspci recognises 0C0310 (ohci-hcd) interface...
 echo -n "." > /dev/console
 sleep 2
fi
}
_load_pcmcia_drivers

_load_ehci_drivers(){
#v423 k2.6.29.6 dmesg has warning that ehci-hcd should load before uhci-hcd and ohci-hid...
if [ "`echo "$ELSPCI" | grep '0C0320'`" != "" ]; then
 modinfo usbcore  && modprobe -v usbcore
 modinfo ehci-hcd && modprobe -v ehci-hcd
else true
fi
}
_load_ehci_drivers

_ass_layerfs

_load_fs_drivers(){
#121227 extra f.s. drivers may be modules (quirky6)... 130216 add f2fs...
for ONEFSMOD in ext2 ext3 ext4 fat msdos vfat ntfs reiserfs udf f2fs squashfs $LAYERFS fuse btrfs xfs jfs minix hfs hfsplus
do
 [ "`modinfo $ONEFSMOD 2>/dev/null`" != "" ] && modprobe $ONEFSMOD
done
}
_load_fs_drivers

echo -n "." > /dev/console

_load_other_drivers(){
MODALIASES="`cat /sys/bus/pci/devices/*/modalias`" #important, save to variable before loop.
for ONEMODALIAS in $MODALIASES
do
  modprobe -v $ONEMODALIAS #-v means verbose.
  #[ $? -eq 0 ] && echo -n "." > /dev/console
done
}
_load_other_drivers

_load_mmc_drivers(){
#091222 some mmc/sd interfaces need this...
#(above code loop may have loaded sdhci/sdhci_pci or tifm_core/tifm_7xx1)
[ "`lsmod | grep '^sdhci'`" != "" ] && modprobe mmc_core && modprobe mmc_block
[ "`lsmod | grep '^tifm'`" != "" ]  && modprobe mmc_core && modprobe mmc_block && modprobe tifm_sd
}
_load_mmc_drivers

#modprobe squashfs

#filesystems...
_load_codepage_drivers(){
modprobe nls_cp437     2>/dev/null #needed by windows filesystems.
modprobe nls_iso8859-1 2>/dev/null #needed by linux filesystems.
}
_load_codepage_drivers

#modprobe $LAYERFS #unionfs or aufs.
#modprobe fuse #for ntfs-3g driver.

_load_usb_drivers(){
for m in usbcore ehci_hcd uhci_hcd ohci_hcd usb_storage 
do
grep $Q "^$m" /proc/modules && continue
modinfo "$m" && modprobe -v "$m"
done
}
_load_usb_drivers

_load_hid_drivers(){
for m in usbhid hid evdev psmouse
do
grep $Q "^$m" /proc/modules && continue
modinfo "$m" && modprobe -v "$m"
done
}
[ "$RDSH" ] && _load_hid_drivers

###################LOAD MODULES TO ACCESS DRIVES#####################
}
Reply | Threaded
Open this post in threaded view
|

Re: initrd busybox depmod und module-init-tools 3.3

Karl Godt
Administrator
added
sed -i "s% kernel/% /lib/modules/$KERNELVER/kernel/%g" /lib/modules/$KERNELVER/modules.dep
because dependencies need wholepath also . before only added /lib/modules/$KERNELVER/ to the beginning of line .

Then inserting ehci-hcd works without preload of usbcore .

Problem is always missing dependencies like i915 and intel-agp .
This can only be fixed by a modprobe.conf entry like for example i915.ko :
options i915 modeset=1
install i915 { /sbin/modprobe intel-agp; /sbin/modprobe --ignore-install i915; /sbin/modprobe fbcon; }
--ignore-install is needed to ignore the install line . Otherwise the "modeset" option would not be used .

What I further detected is a wrong layerfs kernel parameter could screw the layerfs mounting .
"aufs" actually is standard in 90-99% of Puppies . I only know of Racy(5.2.2?) that has unionfs .

if [ "$LAYERFS" = "unionfs" ];then
 UMNTRW="`echo -n "$UMNTRW" | sed -e 's/+wh//g'`" #w003 'ro+wh' not accepted by unionfs, change back to 'ro'.
 echo "About to:mount -t unionfs -o dirs=${UMNTRW}${UMNTRO0}${ALAYER}${YLAYER}${UMNTRO1}${ZLAYER}${UMNTRO} unionfs /pup_new"
 mount -t unionfs -o dirs=${UMNTRW}${UMNTRO0}${ALAYER}${YLAYER}${UMNTRO1}${ZLAYER}${UMNTRO} unionfs /pup_new
else #unionfs
 echo "About to:mount -t aufs -o udba=reval,diropq=w,dirs=${UMNTRW}${UMNTRO0}${ALAYER}${YLAYER}${UMNTRO1}${ZLAYER}${UMNTRO} unionfs /pup_new"
 mount -t aufs -o udba=reval,diropq=w,dirs=${UMNTRW}${UMNTRO0}${ALAYER}${YLAYER}${UMNTRO1}${ZLAYER}${UMNTRO} unionfs /pup_new
fi
Testing for unionfs would at layerfs=ext2 kernel parameter else mount aufs in the above if test .
The default in Puppy is upside down : If layerfs would be ext2 , the code would attempt to mount on unionfs , which in 99% of cases would abort the boot with kernel panic .