However, /proc/modules is fundamentally broken because it prevents someone from installing an initrd kernel while running a kernel with the driver built-in.
So what we need is a kernel interface listing all drivers in the sequence they were initialized, their module filenames (even if they are compiled in), the major and minor device numbers, and their driver parameters. Did I miss something?
Sounds easy ;-).
You can't assume that they are all loaded by the initrd. You must consider users with the drivers built-in as well users who load modules after root has been mounted. How else is someone going to install an initrd kernel while running a non-initrd kernel?
But for this case it is impossible to provide the old driver load sequence for the new initrd. You don't know what is compiled into the new kernel, either.
The scsi modules found via /proc/modules are _appended_ to the list of modules found so far. The sequence of modules found before mkinitrd looked into /proc/modules is not changed. It doesn't get worse, AFAICS. ALATBSOL.
This is broken. For example, on a machine that boots of SATA while also having another SCSI card with a disk attached, doing this will cause the non-SATA SCSI disk to become /dev/sda.
I have appended the '|tac'. Attached you can find a new patch. But I agree that the /proc/scsi problem should be investigated. I have already asked the kernel developers about this problem some time ago, but there was no response. Should I ask again?
Regards
Harri
--- /usr/sbin/mkinitrd 2004-08-29 01:34:50.000000000 +0200
+++ mkinitrd 2004-09-16 15:42:22.397543318 +0200
@@ -402,6 +402,7 @@
getroot() {
local major minor device flag soft= setroot=
local OPTIND=1 OPTARG
+ local i
while getopts "rs" flag; do
case $flag in
@@ -538,6 +539,9 @@
s/^esp-oktagon$/octagon_esp/
' | tac
echo sd_mod
+ for i in $(cat /proc/modules | awk '/^[A-Za-z0-9\-_]+
[0-9]+ [0-9]+ -/ {print $1;}'); do
+ test "$(find $MODULEDIR/kernel/drivers/scsi
-name $i.$o)" && echo $i;
+ done | tac
;;
7[2-9])
echo cpqarray

