Introducing MDADM_CONFIG
authorPeter Hjalmarsson <xake@rymdraket.net>
Wed, 23 Feb 2011 06:10:51 +0000 (07:10 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Thu, 24 Feb 2011 09:27:10 +0000 (10:27 +0100)
Make it possible to choose a custom mdadm.conf for your ramdisk.
If not set, no mdadm.conf will be copied, and ramdisk will auto-detect.
This also fixes a regression where genkernel always tried to copy
/etc/mdadm.conf to the ramdisk, failing if it was non-existant.

doc/genkernel.8.txt
gen_cmdline.sh
gen_determineargs.sh
gen_initramfs.sh
genkernel.conf

index cd276d2bfb6b57f6b16257764884e7bfabde6fdd..e82f1ec477052ddca5566d0ea1ff6afd83e18a08 100644 (file)
@@ -246,11 +246,14 @@ INITIALIZATION
     exist.
 
 *--mdadm*::
-    Copy '/etc/mdadm.conf' and mdadm/mdmon binaries to initramfs.
+    Include mdadm/mdmon support.
     Without sys-fs/mdadm[static] installed, this will compile mdadm for you.
 
+*--mdadm-config*=<file>::
+    Use <file> as configfile for MDADM.
+
 *--dmraid*::
-    Add DMRAID support.
+    Include DMRAID support.
 
 *--multipath*::
     Include Multipath support
index ebf69ea2c1ce9a6420932a85edd6bf3ac9663b7f..506ca3f658c52a823033e7d85f6f9dbe55b5be46 100755 (executable)
@@ -79,7 +79,8 @@ longusage() {
   echo "                               --> 'emerge evms' in the host operating system"
   echo "                               first"
   echo "       --lvm                   Include LVM support"
-  echo "       --mdadm                 Copy /etc/mdadm.conf to initramfs"
+  echo "       --mdadm                 Include MDADM/MDMON support"
+  echo "       --mdadm-config=<file>   Use file as mdadm.conf in initramfs"
   echo "       --dmraid                Include DMRAID support"
   echo "       --multipath             Include Multipath support"
   echo "       --iscsi                 Include iSCSI support"
@@ -248,6 +249,10 @@ parse_cmdline() {
                        CMD_MDADM=1
                        print_info 2 "CMD_MDADM: $CMD_MDADM"
                        ;;
+               --mdadm-config=*)
+                       CMD_MDADM_CONFIG=`parse_opt "$*"`
+                       print_info 2 "CMD_MDADM_CONFIG: $CMD_MDADM_CONFIG"
+                       ;;
                --no-busybox)
                        CMD_BUSYBOX=0
                        print_info 2 "CMD_BUSYBOX: ${CMD_BUSYBOX}"
index a55ccecf9cc85e39633fe31b02e70f1195f24ff4..e680569ed66ef14cfd954455261cbc5a01623d68 100755 (executable)
@@ -119,6 +119,7 @@ determine_real_args() {
        set_config_with_override 1 LUKS                 CMD_LUKS
        set_config_with_override 1 GPG                  CMD_GPG
        set_config_with_override 1 MDADM                CMD_MDADM
+       set_config_with_override 2 MDADM_CONFIG         CMD_MDADM_CONFIG
        set_config_with_override 1 MULTIPATH            CMD_MULTIPATH
        set_config_with_override 1 FIRMWARE             CMD_FIRMWARE
        set_config_with_override 2 FIRMWARE_DIR         CMD_FIRMWARE_DIR         "/lib/firmware"
index 582df2ccad0992c2d662dd0025895c65deb538e0..2d017fda4b19ff31ac09a0fcaf02c34eb5f2570c 100755 (executable)
@@ -342,8 +342,19 @@ append_mdadm(){
        mkdir -p "${TEMP}/initramfs-mdadm-temp/sbin/"
        if [ "${MDADM}" = '1' ]
        then
-               cp -a /etc/mdadm.conf "${TEMP}/initramfs-mdadm-temp/etc" \
-                       || gen_die "Could not copy mdadm.conf!"
+               if [ -n "${MDADM_CONFIG}" ]
+               then
+                       if [ -f "${MDADM_CONFIG}" ]
+                       then
+                               cp -a "${MDADM_CONFIG}" "${TEMP}/initramfs-mdadm-temp/etc/mdadm.conf" \
+                               || gen_die "Could not copy mdadm.conf!"
+                       else
+                               gen_die '${MDADM_CONFIG} does not exist!'
+                       fi
+               else
+                       print_info 1 '          MDADM: Skipping inclusion of mdadm.conf'
+               fi
+
                if [ -e '/sbin/mdadm' ] && LC_ALL="C" ldd /sbin/mdadm | grep -q 'not a dynamic executable' \
                && [ -e '/sbin/mdmon' ] && LC_ALL="C" ldd /sbin/mdmon | grep -q 'not a dynamic executable'
                then
index 779d71f40d12e23bfbaeb44a9dd81c5a465a4559..d510339fc1221700c26382e0922bbe1c8822803e 100644 (file)
@@ -70,9 +70,14 @@ USECOLOR="yes"
 # If included, busybox is rebuilt if the cached copy is out of date.
 # BUSYBOX="yes"
 
-# Copy /etc/mdadm.conf, mdadm/mdmon binaries to initramfs.
+# Includes mdadm/mdmon binaries in initramfs.
 # Without sys-fs/mdadm[static] installed, this will build a static mdadm.
 # MDADM="no"
+# Specify a custom mdadm.conf.
+# If not set the ramdisk will be built without a mdadm.conf and will auto-detect
+# arrays during bootup.
+# This should generally not be needed.
+# MDADM_CONFIG=""
 
 # Add Multipath support.
 # MULTIPATH="no"