site  contact  subhomenews

USB module loading order

August 04, 2009 — BarryK
Oh, this is interesting. Testing a full hd install of 4.3pre-beta with 2.6.29.6 kernel on my laptop, I am getting some weird errors.

One of those is that sometimes my external USB hd is not detected at bootup, but mostly it is.

Running 'dmesg' (which prints the log of kernel messages), there was a warning that ehci_hcd should be loaded before ohci_hcd and uhci_hcd. The first one is the USB2 driver, the last two are USB1 drivers. Now, my understanding all these years is that ehci_hcd should be loaded last.

I did a quick search, and it seems this warning message was introduced with the 2.6.27 kernel. But, does that means the order is ok for our 2.6.25.16 kernel, but needs ehci_hcd loaded first for the 2.6.27 and later kernels? Dunno.

One person commented that perhaps if uhci_hcd or ohci_hcd load first they might "claim" a USB interface as USB1 only, locking out the ehci_hcd driver. Hmmm, I'm not sure about that, never had that problem. The PCI interface numbers are clearly different so it shouldn't happen.

Anyway, I'll go with the flow. If Linus wants ehci_hcd loaded first, will do. I have modified the 'init' script as per this extract:
#w001 NOTE: in 4.1.2 I use elspci to determine if yenta-socket needs to be loaded.

#if so, need a delay -- i used sleep 2 -- before elspci can be used to detect 0C0310
#pci interface -- in the case of my pccard-usb adaptor, which needs ohci-hcd.
#my new code below will need to be fixed for that situation...

#w003 maybe this will fix... look for 'bc0Csc03i10' in modalias...
MODALIASES="`cat /sys/bus/pci/devices/*/modalias`" #important, save to variable before loop.
if [ "`echo "$MODALIASES" | grep 'bc0Csc03i10'`" != "" ];then
modprobe yenta-socket
[ $? -eq 0 ] && sleep 2
fi
#v423 k2.6.29.6 dmesg has warning that ehci-hcd should load before uhci-hcd and ohci-hid
# this is contrary to my understanding all these years, but oh well, let's do it...
ELSPCI="`elspci -l`" #jesses great little utility.
[ "`echo "$ELSPCI" | grep '0C0320'`" != "" ] && modprobe ehci-hcd
for ONEMODALIAS in $MODALIASES
do
modprobe -v $ONEMODALIAS #-v means verbose.
[ $? -eq 0 ] && echo -n "." > /dev/console
done


The 'init' script is for most cases, but for full hd install there is no initramfs, and rc.sysinit is the first script to execute, so it also needs this:

echo -n "Loading kernel modules..." >/dev/console


MODALIASES="`ls /sys/bus/*/devices/*/modalias`"

BLACKLISTVARS="`echo "$SKIPLIST" | tr '\-' '_' | tr ' ' '\n' | sed -e 's/^/blacklist /' | grep -v ' $'`"
echo "$BLACKLISTVARS" > /tmp/pup_event_modprobe.conf
#...read in /sbin/pup_event_backend_d, and pup_event_backend_modprobe (for udevd).

if [ ! -d /initrd ];then #v423 full hd install.
#v423 have this in 'init', probably need here too...
if [ "`echo "$MODALIASES" | grep 'bc0Csc03i10'`" != "" ];then
modprobe --config /tmp/pup_event_modprobe.conf yenta-socket
[ $? -eq 0 ] && sleep 2
fi
#v423 k2.6.29.6 dmesg has warning that ehci-hcd should load before uhci-hcd and ohci-hid
# this is contrary to my understanding all these years, but oh well, let's do it...
ELSPCI="`elspci -l`" #jesses great little utility.
[ "`echo "$ELSPCI" | grep '0C0320'`" != "" ] && modprobe --config /tmp/pup_event_modprobe.conf ehci-hcd
#...perhaps a udev rule could have done this?
fi

#v405 udevd calls /sbin/pup_event_backend_modprobe, which needs this...
echo -n '0' > /tmp/pup_event_alsa_cnt

#my intention is for puppy to work with either of these...
if [ -f /sbin/udevd ];then
/sbin/udevd --daemon
else
pup_event_backend_d >/tmp/pup_event_backend_errors 2>&1 & #hotplug daemon. my homebrew replacement for udevd.
fi
sleep 0.1

#replay uevents from /sys...
for ONEMODALIAS in $MODALIASES
do
ONEPATH="`dirname $ONEMODALIAS`"
if [ -e ${ONEPATH}/uevent ];then
echo add > ${ONEPATH}/uevent #generates an 'add' uevent.
sleep 0.02
fi
done


Comments

usb module loading order
Username: BarryK
The Debian people have a long thread discussing this problem: https://bugs.launchpad.net/debian/+bug/296710

tmpfs size
Username: linuxcbon
"I was trying to compile latest abiword from livecd but not enough place... I though 2Gb RAM were enough but it has nothing to do with it. Do you plan to leave tmpfs that size ? # df Filesystem 1K-blocks Used Available Use% Mounted on tmpfs 906668 853368 53300 95% /initrd/pup_rw tmpfs 96812 95912 900 100% /initrd/mnt/tmpfs /dev/loop0 95872 95872 0 100% /initrd/pup_ro2 unionfs 906668 853368 53300 95% /

cd remaster
Username: linuxcbon
"I tried and it shows errors : mkdir: unrecognized option `--wrap' mount-FULL: unrecognized option `--wrap

cd remaster
Username: BarryK
"linuxcbon, '--wrap' is only used in /usr/sbin/remasterpup2 as a parameter for Xdialog. The script doesn't even call 'mount-FULL'. Are you using the official remaster program from the Setup menu? Any other remaster program is not supported by me.

remaster and compilation
Username: linuxcbon
"Hi Barry, again me for diverse stuff. Do you plan to let remaster work on fulldisk installs ? It would make it easier for those with little ram. Do you also plan to make compilation on 386 instead of 486 ?

tmpfs size
Username: BarryK
"linuxcbon, My laptop has 512MB RAM and I run from live-cd all the time. You should never compile apps in RAM. You should have a mounted Linux partition and the source packages should be there.

tmpfs size + remaster
Username: linuxcbon
"I could compile mplayer, flac, ffmpeg from RAM. I couldn't do Abiword thought because of full tmpfs. Well I will settle to harddisk instead. I saw it used remasterpup2 but not sure anymore if that's called form default menu...I will check again.

CD remaster
Username: linuxcbon
"I checked again, CD remaster is buggy. The one called from menu is /usr/sbin/remasterpup2 Other question, do you plan to let tmpfs small ? Maybe add an option to select its size...


Tags: woof