|
|
a56a5e |
From 81c9e224820fa284806690fc64ac39c58e8760a3 Mon Sep 17 00:00:00 2001
|
|
|
966cef |
From: Harald Hoyer <harald@redhat.com>
|
|
|
966cef |
Date: Tue, 25 Feb 2014 12:35:32 +0100
|
|
|
966cef |
Subject: [PATCH] Add flag to toggle hostonly cmdline storing in the initramfs
|
|
|
966cef |
|
|
|
966cef |
--hostonly-cmdline:
|
|
|
966cef |
Store kernel command line arguments needed in the initramfs
|
|
|
966cef |
|
|
|
966cef |
--no-hostonly-cmdline:
|
|
|
966cef |
Do not store kernel command line arguments needed in the initramfs
|
|
|
966cef |
---
|
|
|
49e6a8 |
dracut.8.asc | 6 +++++
|
|
|
966cef |
dracut.conf.5.asc | 3 +++
|
|
|
49e6a8 |
dracut.sh | 27 ++++++++++++++++-----
|
|
|
49e6a8 |
modules.d/90crypt/module-setup.sh | 6 +++--
|
|
|
49e6a8 |
modules.d/90dmraid/module-setup.sh | 6 +++--
|
|
|
49e6a8 |
modules.d/90lvm/module-setup.sh | 6 +++--
|
|
|
49e6a8 |
modules.d/90mdraid/module-setup.sh | 6 +++--
|
|
|
49e6a8 |
modules.d/95rootfs-block/module-setup.sh | 31 +++++++++++++++---------
|
|
|
966cef |
8 files changed, 66 insertions(+), 25 deletions(-)
|
|
|
966cef |
|
|
|
966cef |
diff --git a/dracut.8.asc b/dracut.8.asc
|
|
|
1755ca |
index b2946753..ba125c0d 100644
|
|
|
966cef |
--- a/dracut.8.asc
|
|
|
966cef |
+++ b/dracut.8.asc
|
|
|
966cef |
@@ -294,6 +294,12 @@ provide a valid _/etc/fstab_.
|
|
|
966cef |
**-N, --no-hostonly**::
|
|
|
966cef |
Disable Host-Only mode
|
|
|
966cef |
|
|
|
966cef |
+**--hostonly-cmdline**:
|
|
|
966cef |
+ Store kernel command line arguments needed in the initramfs
|
|
|
966cef |
+
|
|
|
966cef |
+**--no-hostonly-cmdline**:
|
|
|
966cef |
+ Do not store kernel command line arguments needed in the initramfs
|
|
|
966cef |
+
|
|
|
966cef |
**--persistent-policy** _<policy>_::
|
|
|
966cef |
Use _<policy>_ to address disks and partitions.
|
|
|
966cef |
_<policy>_ can be any directory name found in /dev/disk.
|
|
|
966cef |
diff --git a/dracut.conf.5.asc b/dracut.conf.5.asc
|
|
|
1755ca |
index 5c941188..be62da98 100644
|
|
|
966cef |
--- a/dracut.conf.5.asc
|
|
|
966cef |
+++ b/dracut.conf.5.asc
|
|
|
966cef |
@@ -76,6 +76,9 @@ Configuration files must have the extension .conf; other extensions are ignored.
|
|
|
966cef |
Host-Only mode: Install only what is needed for booting the local host
|
|
|
966cef |
instead of a generic host and generate host-specific configuration.
|
|
|
966cef |
|
|
|
966cef |
+*hostonly_cmdline*"__{yes|no}__"::
|
|
|
966cef |
+ If set, store the kernel command line arguments needed in the initramfs
|
|
|
966cef |
+
|
|
|
966cef |
*persistent_policy=*"__<policy>__"::
|
|
|
966cef |
Use _<policy>_ to address disks and partitions.
|
|
|
966cef |
_<policy>_ can be any directory name found in /dev/disk.
|
|
|
966cef |
diff --git a/dracut.sh b/dracut.sh
|
|
|
1755ca |
index c4bf4ebc..1c5e6889 100755
|
|
|
966cef |
--- a/dracut.sh
|
|
|
966cef |
+++ b/dracut.sh
|
|
|
966cef |
@@ -136,6 +136,10 @@ Creates initial ramdisk images for preloading modules
|
|
|
966cef |
-H, --hostonly Host-Only mode: Install only what is needed for
|
|
|
966cef |
booting the local host instead of a generic host.
|
|
|
966cef |
-N, --no-hostonly Disables Host-Only mode
|
|
|
966cef |
+ --hostonly-cmdline Store kernel command line arguments needed
|
|
|
966cef |
+ in the initramfs
|
|
|
966cef |
+ --no-hostonly-cmdline Do not store kernel command line arguments needed
|
|
|
966cef |
+ in the initramfs
|
|
|
966cef |
--persistent-policy [POLICY]
|
|
|
966cef |
Use [POLICY] to address disks and partitions.
|
|
|
966cef |
POLICY can be any directory name found in /dev/disk.
|
|
|
966cef |
@@ -376,7 +380,8 @@ while :; do
|
|
|
966cef |
-a|--add) push add_dracutmodules_l "$2"; shift;;
|
|
|
966cef |
--force-add) push force_add_dracutmodules_l "$2"; shift;;
|
|
|
966cef |
--add-drivers) push add_drivers_l "$2"; shift;;
|
|
|
966cef |
- --omit-drivers) push omit_drivers_l "$2"; shift;;
|
|
|
966cef |
+ --omit-drivers)
|
|
|
966cef |
+ push omit_drivers_l "$2"; shift;;
|
|
|
966cef |
-m|--modules) push dracutmodules_l "$2"; shift;;
|
|
|
966cef |
-o|--omit) push omit_dracutmodules_l "$2"; shift;;
|
|
|
966cef |
-d|--drivers) push drivers_l "$2"; shift;;
|
|
|
966cef |
@@ -389,7 +394,8 @@ while :; do
|
|
|
966cef |
--mount) push fstab_lines "$2"; shift;;
|
|
|
966cef |
--add-device|--device)
|
|
|
966cef |
push add_device_l "$2"; shift;;
|
|
|
966cef |
- --kernel-cmdline) push kernel_cmdline_l "$2"; shift;;
|
|
|
966cef |
+ --kernel-cmdline)
|
|
|
966cef |
+ push kernel_cmdline_l "$2"; shift;;
|
|
|
966cef |
--nofscks) nofscks_l="yes";;
|
|
|
966cef |
--ro-mnt) ro_mnt_l="yes";;
|
|
|
966cef |
-k|--kmoddir) drivers_dir_l="$2"; shift;;
|
|
|
966cef |
@@ -402,9 +408,12 @@ while :; do
|
|
|
966cef |
-f|--force) force=yes;;
|
|
|
966cef |
--kernel-only) kernel_only="yes"; no_kernel="no";;
|
|
|
966cef |
--no-kernel) kernel_only="no"; no_kernel="yes";;
|
|
|
966cef |
- --print-cmdline) print_cmdline="yes"; hostonly_l="yes"; kernel_only="yes"; no_kernel="yes";;
|
|
|
966cef |
- --early-microcode) early_microcode_l="yes";;
|
|
|
966cef |
- --no-early-microcode) early_microcode_l="no";;
|
|
|
966cef |
+ --print-cmdline)
|
|
|
966cef |
+ print_cmdline="yes"; hostonly_l="yes"; kernel_only="yes"; no_kernel="yes";;
|
|
|
966cef |
+ --early-microcode)
|
|
|
966cef |
+ early_microcode_l="yes";;
|
|
|
966cef |
+ --no-early-microcode)
|
|
|
966cef |
+ early_microcode_l="no";;
|
|
|
966cef |
--strip) do_strip_l="yes";;
|
|
|
966cef |
--nostrip) do_strip_l="no";;
|
|
|
966cef |
--prelink) do_prelink_l="yes";;
|
|
|
966cef |
@@ -430,11 +439,16 @@ while :; do
|
|
|
966cef |
hostonly_l="yes" ;;
|
|
|
966cef |
-N|--no-hostonly|--no-host-only)
|
|
|
966cef |
hostonly_l="no" ;;
|
|
|
966cef |
+ --hostonly-cmdline)
|
|
|
966cef |
+ hostonly_cmdline_l="yes" ;;
|
|
|
966cef |
+ --no-hostonly-cmdline)
|
|
|
966cef |
+ hostonly_cmdline_l="no" ;;
|
|
|
966cef |
--persistent-policy)
|
|
|
966cef |
persistent_policy_l="$2"; shift;;
|
|
|
966cef |
--fstab) use_fstab_l="yes" ;;
|
|
|
966cef |
-h|--help) long_usage; exit 1 ;;
|
|
|
966cef |
- -i|--include) push include_src "$2"
|
|
|
966cef |
+ -i|--include)
|
|
|
966cef |
+ push include_src "$2"
|
|
|
966cef |
shift;;
|
|
|
966cef |
--bzip2) compress_l="bzip2";;
|
|
|
966cef |
--lzma) compress_l="lzma";;
|
|
|
966cef |
@@ -677,6 +691,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
|
|
966cef |
[[ $prefix_l ]] && prefix=$prefix_l
|
|
|
966cef |
[[ $prefix = "/" ]] && unset prefix
|
|
|
966cef |
[[ $hostonly_l ]] && hostonly=$hostonly_l
|
|
|
966cef |
+[[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_l
|
|
|
966cef |
[[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l
|
|
|
966cef |
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
|
|
|
966cef |
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
|
|
|
966cef |
diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh
|
|
|
1755ca |
index 18583915..267d39d5 100755
|
|
|
966cef |
--- a/modules.d/90crypt/module-setup.sh
|
|
|
966cef |
+++ b/modules.d/90crypt/module-setup.sh
|
|
|
966cef |
@@ -46,8 +46,10 @@ cmdline() {
|
|
|
966cef |
|
|
|
966cef |
install() {
|
|
|
966cef |
|
|
|
966cef |
- cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
|
|
966cef |
- echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
|
|
966cef |
+ if [[ $hostonly_cmdline == "yes" ]]; then
|
|
|
966cef |
+ cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
|
|
966cef |
+ echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
|
|
966cef |
+ fi
|
|
|
966cef |
|
|
|
966cef |
inst_multiple cryptsetup rmdir readlink umount
|
|
|
966cef |
inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
|
|
|
966cef |
diff --git a/modules.d/90dmraid/module-setup.sh b/modules.d/90dmraid/module-setup.sh
|
|
|
1755ca |
index 11181cf5..b230cb0e 100755
|
|
|
966cef |
--- a/modules.d/90dmraid/module-setup.sh
|
|
|
966cef |
+++ b/modules.d/90dmraid/module-setup.sh
|
|
|
966cef |
@@ -61,8 +61,10 @@ cmdline() {
|
|
|
966cef |
install() {
|
|
|
966cef |
local _i
|
|
|
966cef |
|
|
|
966cef |
- cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
|
|
966cef |
- echo >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
|
|
966cef |
+ if [[ $hostonly_cmdline == "yes" ]]; then
|
|
|
966cef |
+ cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
|
|
966cef |
+ echo >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
|
|
966cef |
+ fi
|
|
|
966cef |
|
|
|
966cef |
inst_multiple dmraid
|
|
|
966cef |
inst_multiple -o kpartx
|
|
|
966cef |
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
|
|
|
1755ca |
index f0c9b964..1c962d54 100755
|
|
|
966cef |
--- a/modules.d/90lvm/module-setup.sh
|
|
|
966cef |
+++ b/modules.d/90lvm/module-setup.sh
|
|
|
966cef |
@@ -48,8 +48,10 @@ install() {
|
|
|
966cef |
|
|
|
966cef |
inst lvm
|
|
|
966cef |
|
|
|
966cef |
- cmdline >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
|
|
966cef |
- echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
|
|
966cef |
+ if [[ $hostonly_cmdline == "yes" ]]; then
|
|
|
966cef |
+ cmdline >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
|
|
966cef |
+ echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
|
|
966cef |
+ fi
|
|
|
966cef |
|
|
|
966cef |
inst_rules "$moddir/64-lvm.rules"
|
|
|
966cef |
|
|
|
966cef |
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
|
|
|
1755ca |
index 34aae1e3..1e03847f 100755
|
|
|
966cef |
--- a/modules.d/90mdraid/module-setup.sh
|
|
|
966cef |
+++ b/modules.d/90mdraid/module-setup.sh
|
|
|
966cef |
@@ -65,8 +65,10 @@ install() {
|
|
|
966cef |
inst $(command -v partx) /sbin/partx
|
|
|
966cef |
inst $(command -v mdadm) /sbin/mdadm
|
|
|
966cef |
|
|
|
966cef |
- cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
|
|
966cef |
- echo >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
|
|
966cef |
+ if [[ $hostonly_cmdline == "yes" ]]; then
|
|
|
966cef |
+ cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
|
|
966cef |
+ echo >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
|
|
966cef |
+ fi
|
|
|
966cef |
|
|
|
966cef |
#
|
|
|
966cef |
inst_rules 64-md-raid.rules
|
|
|
966cef |
diff --git a/modules.d/95rootfs-block/module-setup.sh b/modules.d/95rootfs-block/module-setup.sh
|
|
|
1755ca |
index 7e714eb0..5bb704a4 100755
|
|
|
966cef |
--- a/modules.d/95rootfs-block/module-setup.sh
|
|
|
966cef |
+++ b/modules.d/95rootfs-block/module-setup.sh
|
|
|
966cef |
@@ -10,17 +10,8 @@ depends() {
|
|
|
966cef |
echo fs-lib
|
|
|
966cef |
}
|
|
|
966cef |
|
|
|
966cef |
-cmdline() {
|
|
|
966cef |
- local dev=/dev/block/$(find_root_block_device)
|
|
|
966cef |
- if [ -e $dev ]; then
|
|
|
966cef |
- printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
|
|
|
966cef |
- printf " rootflags=%s" "$(find_mp_fsopts /)"
|
|
|
966cef |
- printf " rootfstype=%s" "$(find_mp_fstype /)"
|
|
|
966cef |
- fi
|
|
|
966cef |
-}
|
|
|
966cef |
-
|
|
|
966cef |
-install() {
|
|
|
966cef |
|
|
|
966cef |
+cmdline_journal() {
|
|
|
966cef |
if [[ $hostonly ]]; then
|
|
|
966cef |
for dev in "${!host_fs_types[@]}"; do
|
|
|
966cef |
[[ ${host_fs_types[$dev]} = "reiserfs" ]] || [[ ${host_fs_types[$dev]} = "xfs" ]] || continue
|
|
|
966cef |
@@ -32,10 +23,28 @@ install() {
|
|
|
966cef |
fi
|
|
|
966cef |
|
|
|
966cef |
if [ -n "$journaldev" ]; then
|
|
|
966cef |
- printf "%s\n" "root.journaldev=$journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
|
|
|
966cef |
+ printf " root.journaldev=%s" "$journaldev"
|
|
|
966cef |
fi
|
|
|
966cef |
done
|
|
|
966cef |
fi
|
|
|
966cef |
+ return 0
|
|
|
966cef |
+}
|
|
|
966cef |
+
|
|
|
966cef |
+cmdline() {
|
|
|
966cef |
+ local dev=/dev/block/$(find_root_block_device)
|
|
|
966cef |
+ if [ -e $dev ]; then
|
|
|
966cef |
+ printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
|
|
|
966cef |
+ printf " rootflags=%s" "$(find_mp_fsopts /)"
|
|
|
966cef |
+ printf " rootfstype=%s" "$(find_mp_fstype /)"
|
|
|
966cef |
+ fi
|
|
|
966cef |
+ cmdline_journal
|
|
|
966cef |
+}
|
|
|
966cef |
+
|
|
|
966cef |
+install() {
|
|
|
966cef |
+ if [[ $hostonly_cmdline == "yes" ]]; then
|
|
|
966cef |
+ journaldev=$(cmdline_journal)
|
|
|
966cef |
+ [[ $journaldev ]] && printf "%s\n" "$journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
|
|
|
966cef |
+ fi
|
|
|
966cef |
|
|
|
966cef |
inst_multiple umount
|
|
|
966cef |
inst_multiple tr
|