Adding modules cmdline options for genkernel (module.option[=value]).
[genkernel.git] / defaults / linuxrc
index 6103e23e8e0aa7d2a9bb0745de8f6943cdf28cd1..91a3396b2e703fb879041465765d949da7cfe9b3 100755 (executable)
@@ -39,6 +39,7 @@ FAKE_ROOT=''
 REAL_ROOTFLAGS=''
 ROOTFSTYPE='auto'
 CRYPT_SILENT=0
+mkdir -p /etc/cmdline /etc/modprobe.d
 for x in ${CMDLINE}
 do
        case "${x}" in
@@ -240,6 +241,23 @@ do
                nounionfs)
                        USE_UNIONFS_NORMAL=0
                        ;;
+               ## for "module.param[=val]" we creating
+               ## /etc/modprobe.d/module.param.conf: "options module param[=val]"
+               ## /etc/cmdline/module.param:"param[=val]"
+               ## first for CONFIG_MODPROBE_SMALL=n, next for script modprobe
+               *=*)
+                       case "${x%%=*}" in
+                       *.*)
+                               y="${x%%[=/]*}"
+                               echo "options ${x%%.*} ${x#*.}" >"/etc/modprobe.d/$y.conf"
+                               echo "${x#*.}" >"/etc/cmdline/$y"
+                       ;;
+                       esac
+               ;;
+               *.*)
+                       echo "options ${x%%.*} ${x#*.}" >"/etc/modprobe.d/${x%%/*}.conf"
+                       echo "${x#*.}" >"/etc/cmdline/${x%%/*}"
+               ;;
        esac
 done
 
@@ -250,7 +268,7 @@ fi
 
 # Set variables based on the value of REAL_ROOT
 case "${REAL_ROOT}" in
-       ZFS*)
+       ZFS=*)
                ZFS_POOL=${REAL_ROOT#*=}
                ZFS_POOL=${ZFS_POOL%%/*}
                USE_ZFS=1
@@ -372,7 +390,7 @@ then
                                fi
 
                                if [ ${retval} -ne 0 ]; then
-                                       RESUME_DEV=$(blkid -l -t "${REAL_RESUME}" | cut -d ":" -f 1 2>/dev/null)
+                                       RESUME_DEV=$(blkid -o device -l -t "${REAL_RESUME}")
                                        retval=$?
                                fi
 
@@ -480,7 +498,7 @@ do
                                fi
 
                                if [ ${retval} -ne 0 ]; then
-                                       ROOT_DEV=$(blkid -l -t "${REAL_ROOT}" | cut -d ":" -f 1 2>/dev/null)
+                                       ROOT_DEV=$(blkid -o device -l -t "${REAL_ROOT}")
                                        retval=$?
                                fi
 
@@ -533,6 +551,8 @@ do
                                                
                                                done;
 
+                                       else
+                                               got_good_root=0
                                        fi
 
                                fi
@@ -806,7 +826,7 @@ then
                fi
        done
 
-       mkdir initramfs proc tmp sys 2>/dev/null
+       mkdir initramfs proc tmp sys run 2>/dev/null
        chmod 1777 tmp
 
        fi
@@ -847,8 +867,13 @@ for fs in $fslist; do
        # and not a mountpoint
        [ -z "$dev" ] && continue
        fstype=$(get_mount_fstype $fs)
-       # ro must be trailing, and the options will always contain at least 'defaults'
-       opts="$(get_mount_options $fs | strip_mount_options),ro"
+       if get_mount_options $fs | fgrep -q bind ; then
+               opts='bind'
+               dev=${NEW_ROOT}${dev}
+       else
+               # ro must be trailing, and the options will always contain at least 'defaults'
+               opts="$(get_mount_options $fs | strip_mount_options),ro"
+       fi
        mnt=${NEW_ROOT}${fs}
        cmd="mount -t $fstype -o $opts $dev $mnt"
        good_msg "Mounting $dev as ${fs}: $cmd"
@@ -871,7 +896,7 @@ verbose_kmsg
 echo -ne "${GOOD}>>${NORMAL}${BOLD} Booting (initramfs)${NORMAL}"
 
 cd "${CHROOT}"
-mkdir "${CHROOT}/proc" "${CHROOT}/sys" 2>/dev/null
+mkdir "${CHROOT}/proc" "${CHROOT}/sys" "${CHROOT}/run" 2>/dev/null
 echo -ne "${BOLD}.${NORMAL}"
 
 # If devtmpfs is mounted, try move it to the new root