1 |
commit: 7ae5e10474ef720a50b6ae01574036beaa017c38 |
2 |
Author: Peter Hjalmarsson <xake <AT> rymdraket <DOT> net> |
3 |
AuthorDate: Wed Feb 23 06:10:51 2011 +0000 |
4 |
Commit: Sebastian Pipping <sping <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Feb 24 09:27:10 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=7ae5e104 |
7 |
|
8 |
Introducing MDADM_CONFIG |
9 |
|
10 |
Make it possible to choose a custom mdadm.conf for your ramdisk. |
11 |
If not set, no mdadm.conf will be copied, and ramdisk will auto-detect. |
12 |
This also fixes a regression where genkernel always tried to copy |
13 |
/etc/mdadm.conf to the ramdisk, failing if it was non-existant. |
14 |
|
15 |
--- |
16 |
doc/genkernel.8.txt | 7 +++++-- |
17 |
gen_cmdline.sh | 7 ++++++- |
18 |
gen_determineargs.sh | 1 + |
19 |
gen_initramfs.sh | 15 +++++++++++++-- |
20 |
genkernel.conf | 7 ++++++- |
21 |
5 files changed, 31 insertions(+), 6 deletions(-) |
22 |
|
23 |
diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt |
24 |
index cd276d2..e82f1ec 100644 |
25 |
--- a/doc/genkernel.8.txt |
26 |
+++ b/doc/genkernel.8.txt |
27 |
@@ -246,11 +246,14 @@ INITIALIZATION |
28 |
exist. |
29 |
|
30 |
*--mdadm*:: |
31 |
- Copy '/etc/mdadm.conf' and mdadm/mdmon binaries to initramfs. |
32 |
+ Include mdadm/mdmon support. |
33 |
Without sys-fs/mdadm[static] installed, this will compile mdadm for you. |
34 |
|
35 |
+*--mdadm-config*=<file>:: |
36 |
+ Use <file> as configfile for MDADM. |
37 |
+ |
38 |
*--dmraid*:: |
39 |
- Add DMRAID support. |
40 |
+ Include DMRAID support. |
41 |
|
42 |
*--multipath*:: |
43 |
Include Multipath support |
44 |
|
45 |
diff --git a/gen_cmdline.sh b/gen_cmdline.sh |
46 |
index ebf69ea..506ca3f 100755 |
47 |
--- a/gen_cmdline.sh |
48 |
+++ b/gen_cmdline.sh |
49 |
@@ -79,7 +79,8 @@ longusage() { |
50 |
echo " --> 'emerge evms' in the host operating system" |
51 |
echo " first" |
52 |
echo " --lvm Include LVM support" |
53 |
- echo " --mdadm Copy /etc/mdadm.conf to initramfs" |
54 |
+ echo " --mdadm Include MDADM/MDMON support" |
55 |
+ echo " --mdadm-config=<file> Use file as mdadm.conf in initramfs" |
56 |
echo " --dmraid Include DMRAID support" |
57 |
echo " --multipath Include Multipath support" |
58 |
echo " --iscsi Include iSCSI support" |
59 |
@@ -248,6 +249,10 @@ parse_cmdline() { |
60 |
CMD_MDADM=1 |
61 |
print_info 2 "CMD_MDADM: $CMD_MDADM" |
62 |
;; |
63 |
+ --mdadm-config=*) |
64 |
+ CMD_MDADM_CONFIG=`parse_opt "$*"` |
65 |
+ print_info 2 "CMD_MDADM_CONFIG: $CMD_MDADM_CONFIG" |
66 |
+ ;; |
67 |
--no-busybox) |
68 |
CMD_BUSYBOX=0 |
69 |
print_info 2 "CMD_BUSYBOX: ${CMD_BUSYBOX}" |
70 |
|
71 |
diff --git a/gen_determineargs.sh b/gen_determineargs.sh |
72 |
index a55ccec..e680569 100755 |
73 |
--- a/gen_determineargs.sh |
74 |
+++ b/gen_determineargs.sh |
75 |
@@ -119,6 +119,7 @@ determine_real_args() { |
76 |
set_config_with_override 1 LUKS CMD_LUKS |
77 |
set_config_with_override 1 GPG CMD_GPG |
78 |
set_config_with_override 1 MDADM CMD_MDADM |
79 |
+ set_config_with_override 2 MDADM_CONFIG CMD_MDADM_CONFIG |
80 |
set_config_with_override 1 MULTIPATH CMD_MULTIPATH |
81 |
set_config_with_override 1 FIRMWARE CMD_FIRMWARE |
82 |
set_config_with_override 2 FIRMWARE_DIR CMD_FIRMWARE_DIR "/lib/firmware" |
83 |
|
84 |
diff --git a/gen_initramfs.sh b/gen_initramfs.sh |
85 |
index 582df2c..2d017fd 100755 |
86 |
--- a/gen_initramfs.sh |
87 |
+++ b/gen_initramfs.sh |
88 |
@@ -342,8 +342,19 @@ append_mdadm(){ |
89 |
mkdir -p "${TEMP}/initramfs-mdadm-temp/sbin/" |
90 |
if [ "${MDADM}" = '1' ] |
91 |
then |
92 |
- cp -a /etc/mdadm.conf "${TEMP}/initramfs-mdadm-temp/etc" \ |
93 |
- || gen_die "Could not copy mdadm.conf!" |
94 |
+ if [ -n "${MDADM_CONFIG}" ] |
95 |
+ then |
96 |
+ if [ -f "${MDADM_CONFIG}" ] |
97 |
+ then |
98 |
+ cp -a "${MDADM_CONFIG}" "${TEMP}/initramfs-mdadm-temp/etc/mdadm.conf" \ |
99 |
+ || gen_die "Could not copy mdadm.conf!" |
100 |
+ else |
101 |
+ gen_die '${MDADM_CONFIG} does not exist!' |
102 |
+ fi |
103 |
+ else |
104 |
+ print_info 1 ' MDADM: Skipping inclusion of mdadm.conf' |
105 |
+ fi |
106 |
+ |
107 |
if [ -e '/sbin/mdadm' ] && LC_ALL="C" ldd /sbin/mdadm | grep -q 'not a dynamic executable' \ |
108 |
&& [ -e '/sbin/mdmon' ] && LC_ALL="C" ldd /sbin/mdmon | grep -q 'not a dynamic executable' |
109 |
then |
110 |
|
111 |
diff --git a/genkernel.conf b/genkernel.conf |
112 |
index 779d71f..d510339 100644 |
113 |
--- a/genkernel.conf |
114 |
+++ b/genkernel.conf |
115 |
@@ -70,9 +70,14 @@ USECOLOR="yes" |
116 |
# If included, busybox is rebuilt if the cached copy is out of date. |
117 |
# BUSYBOX="yes" |
118 |
|
119 |
-# Copy /etc/mdadm.conf, mdadm/mdmon binaries to initramfs. |
120 |
+# Includes mdadm/mdmon binaries in initramfs. |
121 |
# Without sys-fs/mdadm[static] installed, this will build a static mdadm. |
122 |
# MDADM="no" |
123 |
+# Specify a custom mdadm.conf. |
124 |
+# If not set the ramdisk will be built without a mdadm.conf and will auto-detect |
125 |
+# arrays during bootup. |
126 |
+# This should generally not be needed. |
127 |
+# MDADM_CONFIG="" |
128 |
|
129 |
# Add Multipath support. |
130 |
# MULTIPATH="no" |