Support module options set in /etc/module.d, amend cmdline options patch
authorRichard Yao <ryao@cs.stonybrook.edu>
Thu, 19 Jul 2012 19:59:03 +0000 (15:59 -0400)
committerRichard Yao <ryao@cs.stonybrook.edu>
Thu, 19 Jul 2012 20:53:59 +0000 (16:53 -0400)
defaults/linuxrc
defaults/modprobe
doc/genkernel.8.txt
gen_cmdline.sh
gen_determineargs.sh
gen_initramfs.sh

index 91a3396b2e703fb879041465765d949da7cfe9b3..90099c854d48a33254f5ef73b7061335b7e956f4 100755 (executable)
@@ -241,23 +241,13 @@ do
                nounionfs)
                        USE_UNIONFS_NORMAL=0
                        ;;
                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
                        *.*)
                *=*)
                        case "${x%%=*}" in
                        *.*)
-                               y="${x%%[=/]*}"
-                               echo "options ${x%%.*} ${x#*.}" >"/etc/modprobe.d/$y.conf"
-                               echo "${x#*.}" >"/etc/cmdline/$y"
+                               echo "${x#*.}" >> "/etc/module_options/${x%%.*}.conf"
                        ;;
                        esac
                ;;
                        ;;
                        esac
                ;;
-               *.*)
-                       echo "options ${x%%.*} ${x#*.}" >"/etc/modprobe.d/${x%%/*}.conf"
-                       echo "${x#*.}" >"/etc/cmdline/${x%%/*}"
-               ;;
        esac
 done
 
        esac
 done
 
index 1f606bd2b7b49603ecfa3488eeb0e440b5c3bcd4..6bbe7e416ab885f4a35fd179d5ed2708dcf90ca6 100755 (executable)
@@ -112,7 +112,7 @@ modprobe2() {
        done
        # placing options into x
        x="${real_path##*/}"
        done
        # placing options into x
        x="${real_path##*/}"
-       x="`cat "/etc/cmdline/${x%.ko*}".* 2>/dev/null`"
+       x="`cat "/etc/module_options/${x%.ko*}".* 2>/dev/null`"
        ${INSMOD} ${real_path} ${x} > /dev/null 2>&1
        ret=$?
        if [ ${ret} -eq 0 ]
        ${INSMOD} ${real_path} ${x} > /dev/null 2>&1
        ret=$?
        if [ ${ret} -eq 0 ]
index 547b7fe4732b22f9a409b5a46e9eeca2a2bfecee..9a96f32c9ca39ab08192b86f21cd8e72fd8702b9 100644 (file)
@@ -221,6 +221,9 @@ LOW-LEVEL COMPILATION OPTIONS
 *--bootdir*=<dir>::
     Set the location of the boot-directory, default is '/boot'.
 
 *--bootdir*=<dir>::
     Set the location of the boot-directory, default is '/boot'.
 
+*--modprobedir*=<dir>::
+    Set the location of the modprobe.d-directory, default is '/etc/modprobe.d'.
+
 *--makeopts*=<makeopts>::
     GNU Make options such as -j2, etc.
 
 *--makeopts*=<makeopts>::
     GNU Make options such as -j2, etc.
 
index 184db65546d7675303a192d0ac5bba816067db9e..938b1a5f7ddda356f9f0b1f2e13f5261038f20ff 100755 (executable)
@@ -75,6 +75,7 @@ longusage() {
   echo "       --mountboot             Mount BOOTDIR automatically if mountable"
   echo "       --no-mountboot          Don't mount BOOTDIR automatically"  
   echo "       --bootdir=<dir>         Set the location of the boot-directory, default is /boot"
   echo "       --mountboot             Mount BOOTDIR automatically if mountable"
   echo "       --no-mountboot          Don't mount BOOTDIR automatically"  
   echo "       --bootdir=<dir>         Set the location of the boot-directory, default is /boot"
+  echo "       --modprobedir=<dir>     Set the location of the modprobe.d-directory, default is /etc/modprobe.d"
   echo "  Initialization"
   echo "       --splash=<theme>        Enable framebuffer splash using <theme>"
   echo "       --splash-res=<res>      Select splash theme resolutions to install"
   echo "  Initialization"
   echo "       --splash=<theme>        Enable framebuffer splash using <theme>"
   echo "       --splash-res=<res>      Select splash theme resolutions to install"
@@ -248,6 +249,10 @@ parse_cmdline() {
                        CMD_BOOTDIR=`parse_opt "$*"`
                        print_info 2 "CMD_BOOTDIR: ${CMD_BOOTDIR}"
                        ;;
                        CMD_BOOTDIR=`parse_opt "$*"`
                        print_info 2 "CMD_BOOTDIR: ${CMD_BOOTDIR}"
                        ;;
+               --modprobedir=*)
+                       CMD_MODPROBEDIR=`parse_opt "$*"`
+                       print_info 2 "CMD_MODPROBEDIR: ${CMD_MODPROBEDIR}"
+                       ;;
                --do-keymap-auto)
                        CMD_DOKEYMAPAUTO=1
                        CMD_KEYMAP=1
                --do-keymap-auto)
                        CMD_DOKEYMAPAUTO=1
                        CMD_KEYMAP=1
index bbff16654e386d9856b777344953246ee8a650d6..3bc1b29e8a7cef2ac9ebc187a49eb176d3ab8f89 100755 (executable)
@@ -90,6 +90,7 @@ determine_real_args() {
        set_config_with_override STRING KERNEL_CROSS_COMPILE CMD_KERNEL_CROSS_COMPILE
        set_config_with_override STRING UTILS_CROSS_COMPILE  CMD_UTILS_CROSS_COMPILE
        set_config_with_override STRING BOOTDIR              CMD_BOOTDIR              "/boot"
        set_config_with_override STRING KERNEL_CROSS_COMPILE CMD_KERNEL_CROSS_COMPILE
        set_config_with_override STRING UTILS_CROSS_COMPILE  CMD_UTILS_CROSS_COMPILE
        set_config_with_override STRING BOOTDIR              CMD_BOOTDIR              "/boot"
+       set_config_with_override STRING MODPROBEDIR          CMD_MODPROBEDIR              "/etc/modprobe.d"
 
        set_config_with_override BOOL   SPLASH               CMD_SPLASH
        set_config_with_override BOOL   POSTCLEAR            CMD_POSTCLEAR
 
        set_config_with_override BOOL   SPLASH               CMD_SPLASH
        set_config_with_override BOOL   POSTCLEAR            CMD_POSTCLEAR
@@ -135,6 +136,7 @@ determine_real_args() {
 
        BOOTDIR=`arch_replace "${BOOTDIR}"`
        BOOTDIR=${BOOTDIR%/}    # Remove any trailing slash
 
        BOOTDIR=`arch_replace "${BOOTDIR}"`
        BOOTDIR=${BOOTDIR%/}    # Remove any trailing slash
+       MODPROBEDIR=${MODPROBEDIR%/}    # Remove any trailing slash
 
        CACHE_DIR=`arch_replace "${CACHE_DIR}"`
        BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"`
 
        CACHE_DIR=`arch_replace "${CACHE_DIR}"`
        BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"`
index 43ef1550526288ba0e741adeb050cc8a389c0c6c..ac90830d200eeea66db4469e830211dfd6d72004 100755 (executable)
@@ -577,6 +577,41 @@ append_modules() {
        rm -r "${TEMP}/initramfs-modules-${KV}-temp/"   
 }
 
        rm -r "${TEMP}/initramfs-modules-${KV}-temp/"   
 }
 
+append_modprobed() {
+       local TDIR="${TEMP}/initramfs-modprobe.d-temp"
+       if [ -d "${TDIR}" ]
+       then
+               rm -r "${TDIR}"
+       fi
+
+       mkdir -p "${TDIR}/etc/module_options/"
+
+       # Load module parameters
+       for dir in $(find "${MODPROBEDIR}"/*)
+       do
+               while read x
+               do
+                       case "${x}" in
+                               options*)
+                                       module_name="$(echo "$x" | cut -d ' ' -f 2)"
+                                       [ "${module_name}" != "$(echo)" ] || continue
+                                       module_options="$(echo "$x" | cut -d ' ' -f 3-)"
+                                       [ "${module_options}" != "$(echo)" ] || continue
+                                       echo "${module_options}" >> "${TDIR}/etc/module_options/${module_name}.conf"
+                               ;;
+                       esac
+               done < "${dir}"
+       done
+
+       cd "${TDIR}"
+       log_future_cpio_content
+       find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
+                       || gen_die "compressing modprobe.d cpio"
+
+       cd "${TEMP}"
+       rm -rf "${TDIR}" > /dev/null
+}
+
 # check for static linked file with objdump
 is_static() {
        LANG="C" LC_ALL="C" objdump -T $1 2>&1 | grep "not a dynamic object" > /dev/null
 # check for static linked file with objdump
 is_static() {
        LANG="C" LC_ALL="C" objdump -T $1 2>&1 | grep "not a dynamic object" > /dev/null
@@ -729,6 +764,8 @@ create_initramfs() {
 
        append_data 'splash' "${SPLASH}"
 
 
        append_data 'splash' "${SPLASH}"
 
+       append_data 'modprobed'
+
        if isTrue "${FIRMWARE}" && [ -n "${FIRMWARE_DIR}" ]
        then
                append_data 'firmware'
        if isTrue "${FIRMWARE}" && [ -n "${FIRMWARE_DIR}" ]
        then
                append_data 'firmware'