From: Richard Yao Date: Thu, 19 Jul 2012 19:59:03 +0000 (-0400) Subject: Support module options set in /etc/module.d, amend cmdline options patch X-Git-Tag: v3.4.39~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=908a463e07491d3c69aa1daf853b4d699dbb8534;p=genkernel.git Support module options set in /etc/module.d, amend cmdline options patch --- diff --git a/defaults/linuxrc b/defaults/linuxrc index 91a3396..90099c8 100755 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -241,23 +241,13 @@ 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" + echo "${x#*.}" >> "/etc/module_options/${x%%.*}.conf" ;; esac ;; - *.*) - echo "options ${x%%.*} ${x#*.}" >"/etc/modprobe.d/${x%%/*}.conf" - echo "${x#*.}" >"/etc/cmdline/${x%%/*}" - ;; esac done diff --git a/defaults/modprobe b/defaults/modprobe index 1f606bd..6bbe7e4 100755 --- a/defaults/modprobe +++ b/defaults/modprobe @@ -112,7 +112,7 @@ modprobe2() { 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 ] diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index 547b7fe..9a96f32 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -221,6 +221,9 @@ LOW-LEVEL COMPILATION OPTIONS *--bootdir*=:: Set the location of the boot-directory, default is '/boot'. +*--modprobedir*=:: + Set the location of the modprobe.d-directory, default is '/etc/modprobe.d'. + *--makeopts*=:: GNU Make options such as -j2, etc. diff --git a/gen_cmdline.sh b/gen_cmdline.sh index 184db65..938b1a5 100755 --- a/gen_cmdline.sh +++ b/gen_cmdline.sh @@ -75,6 +75,7 @@ longusage() { echo " --mountboot Mount BOOTDIR automatically if mountable" echo " --no-mountboot Don't mount BOOTDIR automatically" echo " --bootdir= Set the location of the boot-directory, default is /boot" + echo " --modprobedir= Set the location of the modprobe.d-directory, default is /etc/modprobe.d" echo " Initialization" echo " --splash= Enable framebuffer splash using " echo " --splash-res= Select splash theme resolutions to install" @@ -248,6 +249,10 @@ parse_cmdline() { 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 diff --git a/gen_determineargs.sh b/gen_determineargs.sh index bbff166..3bc1b29 100755 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -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 MODPROBEDIR CMD_MODPROBEDIR "/etc/modprobe.d" 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 + MODPROBEDIR=${MODPROBEDIR%/} # Remove any trailing slash CACHE_DIR=`arch_replace "${CACHE_DIR}"` BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"` diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 43ef155..ac90830 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -577,6 +577,41 @@ append_modules() { 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 @@ -729,6 +764,8 @@ create_initramfs() { append_data 'splash' "${SPLASH}" + append_data 'modprobed' + if isTrue "${FIRMWARE}" && [ -n "${FIRMWARE_DIR}" ] then append_data 'firmware'