SVN: livecd/mklive/templates-liveth/initrd/init

qwiat qwiat at pld-linux.org
Sun Jul 10 12:39:40 CEST 2011


Author: qwiat
Date: Sun Jul 10 12:39:40 2011
New Revision: 12258

Modified:
   livecd/mklive/templates-liveth/initrd/init
Log:
- loading-all-modules method added


Modified: livecd/mklive/templates-liveth/initrd/init
==============================================================================
--- livecd/mklive/templates-liveth/initrd/init	(original)
+++ livecd/mklive/templates-liveth/initrd/init	Sun Jul 10 12:39:40 2011
@@ -15,6 +15,16 @@
 {
 	lsmod | grep -q "^$1\ "
 }
+load_all_drv_modules()
+{
+	find /lib/modules/$kernel_rel/kernel/drivers/ -name \*.ko \
+		| while read module_path
+		do
+			modprobe $module_path \
+			       	&& debug "loaded module: $module_path" \
+				|| echo "Error: module $module_path not loaded!"
+		done
+}
 run_debug_shell()
 {
 	echo "Processing initrd interrupted, dropping to shell."
@@ -32,29 +42,43 @@
 for arg in $@
 do
 	[ "$arg" = 'debuginitrd' ] && debugmode=1
+	[ "$arg" = 'allmodules' ] && loadAllModules=1
 done
 
 mount -t proc  none /proc
 mount -t sysfs none /sys
 echo "0" >/proc/sys/kernel/printk # shut up!
 
-# Loading kernel modules
+# Loading basic kernel modules
 kernel_rel=$(uname -r)
 echo "Kernel: $kernel_rel"
 echo "Loading basic modules..."
-load_module crc16 crc-t10dif loop isofs squashfs
+load_module crc16 crc-t10dif loop isofs squashfs aufs
 echo "Loading hardware modules..."
 load_module cdrom scsi_mod sg sr_mod scsi_wait_scan usbhid hid usbcore usb-storage ehci-hcd ohci-hcd uhci-hcd xhci-hcd
 rmmod scsi_wait_scan
 is_module_loaded aufs && echo "AUFS enabled" || load_module unionfs
 
-echo "Detecting host adapter device..."
-pci_modules=$(/bin/pcimodules)
-[ -z "$pci_modules" ] && echo "Error: No host adapter modules found"
-for module in $pci_modules
-do
-	load_module $module
-done
+# Loading hostadapterl modules
+if [ -z $loadAllModules ] 
+then 
+	echo "Detecting host adapter device..."
+	pci_modules=$(/bin/pcimodules)
+	if [ ! -z "$pci_modules" ]
+	then
+		for module in $pci_modules
+		do
+			load_module $module
+		done
+	else
+		echo "Error: No host adapter modules detected"
+		echo "Loading all modules..."
+		load_all_drv_modules
+	fi
+else
+	echo "Loading all modules..."
+	load_all_drv_modules
+fi
 
 echo 'Starting udev daemon'
 /bin/udevd --daemon
@@ -72,7 +96,7 @@
 cdrom_devices=$(echo /dev/sr*)
 [ -z "$cdrom_devices" ] && echo "Error: Not found any usable CD-ROM block device" && run_debug_shell
 echo "Detected CD-ROM devices: $cdrom_devices"
-mount -t iso9660 LABEL="PLD-Linux LiveCD" $cdrom_mnt
+mount -t iso9660 LABEL="PLD-LiveCD" $cdrom_mnt
 mount | grep -q "\ $cdrom_mnt\ "
 [ $? -ne 0 ] && echo "Fatal: CD-ROM device not mounted" && run_debug_shell
 


More information about the pld-cvs-commit mailing list