From a20c0e9d68bb57f2d8a9cb8c3a66a64240ba6c44 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mar 13 2013 16:56:38 +0000 Subject: dracut-026-33.git20130313 - add module-load.d modules to the initramfs - add sysctl.d to the initramfs - optimize plymouth module for systemd mode - add new dracut parameter "--regenerate-all" - add new dracut parameter "--noimageifnotneeded" - shutdown: mount move /run /sys /dev /proc out of /oldroot before pre-shutdown - add bash completion for dracut --- diff --git a/0019-systemd-add-modules-load.d-modules-to-the-initramfs.patch b/0019-systemd-add-modules-load.d-modules-to-the-initramfs.patch new file mode 100644 index 0000000..5f52936 --- /dev/null +++ b/0019-systemd-add-modules-load.d-modules-to-the-initramfs.patch @@ -0,0 +1,57 @@ +From 727543c1e65d94be8e2f1540b616a6e87d3053cb Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Mar 2013 10:51:47 +0100 +Subject: [PATCH] systemd: add modules-load.d modules to the initramfs + +--- + modules.d/98systemd/module-setup.sh | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh +index 443481a..6b00be5 100755 +--- a/modules.d/98systemd/module-setup.sh ++++ b/modules.d/98systemd/module-setup.sh +@@ -16,6 +16,7 @@ depends() { + } + + install() { ++ local _mods + + SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; }) + if (( $SYSTEMD_VERSION < 198 )); then +@@ -109,6 +110,26 @@ install() { + dracut_install -o \ + /usr/lib/modules-load.d/*.conf + ++ modules_load_get() { ++ local _line i ++ for i in "$1"/*.conf; do ++ [[ -f $i ]] || continue ++ while read _line; do ++ case $_line in ++ \#*) ++ ;; ++ \;*) ++ ;; ++ *) ++ echo $_line ++ esac ++ done < "$i" ++ done ++ } ++ ++ _mods=$(modules_load_get /usr/lib/modules-load.d) ++ [[ $_mods ]] && instmods $_mods ++ + if [[ $hostonly ]]; then + dracut_install -o \ + /etc/systemd/journald.conf \ +@@ -120,6 +141,8 @@ install() { + + dracut_install -o \ + /etc/modules-load.d/*.conf ++ _mods=$(modules_load_get /etc/modules-load.d) ++ [[ $_mods ]] && instmods $_mods + else + if ! [[ -e "$initdir/etc/machine-id" ]]; then + > "$initdir/etc/machine-id" diff --git a/0020-systemd-add-sysctl.d-and-sysctl.conf.patch b/0020-systemd-add-sysctl.d-and-sysctl.conf.patch new file mode 100644 index 0000000..fb9a400 --- /dev/null +++ b/0020-systemd-add-sysctl.d-and-sysctl.conf.patch @@ -0,0 +1,38 @@ +From b8060ef781a980afebec4412666a5b41c5cada2c Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Mar 2013 11:07:36 +0100 +Subject: [PATCH] systemd: add sysctl.d and sysctl.conf + +--- + modules.d/98systemd/module-setup.sh | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh +index 6b00be5..bc4f63c 100755 +--- a/modules.d/98systemd/module-setup.sh ++++ b/modules.d/98systemd/module-setup.sh +@@ -108,7 +108,8 @@ install() { + journalctl systemctl echo swapoff systemd-cgls + + dracut_install -o \ +- /usr/lib/modules-load.d/*.conf ++ /usr/lib/modules-load.d/*.conf \ ++ /usr/lib/sysctl.d/*.conf + + modules_load_get() { + local _line i +@@ -137,10 +138,11 @@ install() { + /etc/hostname \ + /etc/machine-id \ + /etc/vconsole.conf \ +- /etc/locale.conf ++ /etc/locale.conf \ ++ /etc/modules-load.d/*.conf \ ++ /etc/sysctl.d/*.conf \ ++ /etc/sysctl.conf + +- dracut_install -o \ +- /etc/modules-load.d/*.conf + _mods=$(modules_load_get /etc/modules-load.d) + [[ $_mods ]] && instmods $_mods + else diff --git a/0021-plymouth-do-not-install-hooks-in-systemd-mode.patch b/0021-plymouth-do-not-install-hooks-in-systemd-mode.patch new file mode 100644 index 0000000..4e37eb9 --- /dev/null +++ b/0021-plymouth-do-not-install-hooks-in-systemd-mode.patch @@ -0,0 +1,33 @@ +From 7d17d6c976d705deebf3da46fd546b1fe7e1dd65 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Mar 2013 10:51:17 +0100 +Subject: [PATCH] plymouth: do not install hooks in systemd mode + +--- + modules.d/50plymouth/module-setup.sh | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/modules.d/50plymouth/module-setup.sh b/modules.d/50plymouth/module-setup.sh +index 1c5dad5..f754e24 100755 +--- a/modules.d/50plymouth/module-setup.sh ++++ b/modules.d/50plymouth/module-setup.sh +@@ -17,12 +17,16 @@ install() { + . "$moddir"/plymouth-populate-initrd.sh + else + PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \ +- /usr/libexec/plymouth/plymouth-populate-initrd -t $initdir ++ /usr/libexec/plymouth/plymouth-populate-initrd -t "$initdir" + fi + +- inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh +- inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh + inst_hook emergency 50 "$moddir"/plymouth-emergency.sh ++ + dracut_install readlink ++ ++ if ! dracut_module_included "systemd"; then ++ inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh ++ inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh ++ fi + } + diff --git a/0022-dracut.sh-add-regenerate-all.patch b/0022-dracut.sh-add-regenerate-all.patch new file mode 100644 index 0000000..7118986 --- /dev/null +++ b/0022-dracut.sh-add-regenerate-all.patch @@ -0,0 +1,88 @@ +From 7d848c55a6a820d19bed0bd498d6081929c128ab Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Mar 2013 12:46:39 +0100 +Subject: [PATCH] dracut.sh: add --regenerate-all + +--- + dracut.8.asc | 4 ++++ + dracut.sh | 31 ++++++++++++++++++++++++++++++- + 2 files changed, 34 insertions(+), 1 deletion(-) + +diff --git a/dracut.8.asc b/dracut.8.asc +index 02388e6..6a79d12 100644 +--- a/dracut.8.asc ++++ b/dracut.8.asc +@@ -409,6 +409,10 @@ will not be able to boot. Equivalent to "--compress=xz --check=crc32 + **--keep**:: + Keep the initramfs temporary directory for debugging purposes. + ++**--regenerate-all**:: ++ Regenerate all initramfs images at the default location with the kernel versions found on the system. ++ Additional parameters are passed through. ++ + FILES + ----- + _/var/log/dracut.log_:: +diff --git a/dracut.sh b/dracut.sh +index bb49299..2582f74 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -7,7 +7,7 @@ + # of the various mkinitrd implementations out there + # + +-# Copyright 2005-2010 Red Hat, Inc. All rights reserved. ++# Copyright 2005-2013 Red Hat, Inc. All rights reserved. + # + # This program is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by +@@ -329,6 +329,7 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \ + --long show-modules \ + --long keep \ + --long printsize \ ++ --long regenerate-all \ + -- "$@") + + if (( $? != 0 )); then +@@ -406,6 +407,7 @@ while :; do + ;; + --keep) keep="yes";; + --printsize) printsize="yes";; ++ --regenerate-all) regenerate_all="yes";; + + --) shift; break;; + +@@ -437,6 +439,33 @@ while (($# > 0)); do + shift + done + ++if [[ $regenerate_all == "yes" ]]; then ++ ret=0 ++ if [[ $kernel ]]; then ++ echo "--regenerate-all cannot be called with a kernel version" >&2 ++ exit 1 ++ fi ++ ++ if [[ $outfile ]]; then ++ echo "--regenerate-all cannot be called with a image file" >&2 ++ exit 1 ++ fi ++ ++ ((len=${#dracut_args[@]})) ++ for ((i=0; i < len; i++)); do ++ [[ ${dracut_args[$i]} == "--regenerate-all" ]] && \ ++ unset dracut_args[$i] ++ done ++ ++ cd /lib/modules ++ for i in *; do ++ [[ -f $i/modules.builtin ]] || continue ++ dracut --kver=$i "${dracut_args[@]}" ++ ((ret+=$?)) ++ done ++ exit $ret ++fi ++ + if ! [[ $kernel ]]; then + kernel=$(uname -r) + fi diff --git a/0023-add-dracut-bash-completion.sh.patch b/0023-add-dracut-bash-completion.sh.patch new file mode 100644 index 0000000..66ea7b8 --- /dev/null +++ b/0023-add-dracut-bash-completion.sh.patch @@ -0,0 +1,119 @@ +From 917f3e4d25784cbd1490fc4f27e6246d98987987 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Mar 2013 12:46:16 +0100 +Subject: [PATCH] add dracut-bash-completion.sh + +--- + Makefile | 3 +++ + dracut-bash-completion.sh | 68 +++++++++++++++++++++++++++++++++++++++++++++++ + dracut.spec | 1 + + 3 files changed, 72 insertions(+) + create mode 100644 dracut-bash-completion.sh + +diff --git a/Makefile b/Makefile +index a11689c..644d17d 100644 +--- a/Makefile ++++ b/Makefile +@@ -12,6 +12,7 @@ bindir ?= ${prefix}/bin + mandir ?= ${prefix}/share/man + CFLAGS ?= -O2 -g -Wall + CFLAGS += -std=gnu99 ++bashcompletiondir ?= ${datadir}/bash-completion/completions + + man1pages = lsinitrd.1 + +@@ -119,6 +120,8 @@ endif + mkdir -p $(DESTDIR)${prefix}/lib/kernel/install.d + install -m 0755 50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install + install -m 0755 51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install ++ mkdir -p $(DESTDIR)${bashcompletiondir} ++ install -m 0644 dracut-bash-completion.sh $(DESTDIR)${bashcompletiondir}/dracut + + dracut-version.sh: + @echo "DRACUT_VERSION=$(VERSION)-$(GITVERSION)" > dracut-version.sh +diff --git a/dracut-bash-completion.sh b/dracut-bash-completion.sh +new file mode 100644 +index 0000000..da067c5 +--- /dev/null ++++ b/dracut-bash-completion.sh +@@ -0,0 +1,68 @@ ++#!/bin/bash ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++# ++# Copyright 2013 Red Hat, Inc. All rights reserved. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++# ++ ++__contains_word () { ++ local word=$1; shift ++ for w in $*; do [[ $w = $word ]] && return 0; done ++ return 1 ++} ++ ++_dracut() { ++ local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} ++ local -A OPTS=( ++ [STANDALONE]='-f -v -q -l -H -h -M -N ++ --ro-mnt --force --kernel-only --no-kernel --strip --nostrip ++ --hardlink --nohardlink --noprefix --mdadmconf --nomdadmconf ++ --lvmconf --nolvmconf --debug --profile --verbose --quiet ++ --local --hostonly --no-hostonly --fstab --help --bzip2 --lzma ++ --xz --no-compress --gzip --list-modules --show-modules --keep ++ --printsize --regenerate-all' ++ ++ [ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers ++ --omit-drivers --modules --omit --drivers --filesystems --install ++ --fwdir --libdirs --fscks --add-fstab --mount --device --nofscks ++ --kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix ++ --kernel-cmdline --sshkey' ++ ) ++ ++ if __contains_word "$prev" ${OPTS[ARG]}; then ++ case $prev in ++ --kmoddir|-k|--fwdir|-c|--conf|--confdir|--tmpdir|--sshkey|--add-fstab|--add-device|-I|--install) ++ comps=$(compgen -d -- "$cur") ++ compopt -o filenames ++ ;; ++ -a|-m|-o|--add|--modules|--omit) ++ comps=$(dracut --list-modules 2>/dev/null) ++ ;; ++ *) ++ return 0 ++ ;; ++ esac ++ COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) ++ return 0 ++ fi ++ ++ if [[ $cur = -* ]]; then ++ COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) ++ return 0 ++ fi ++} ++ ++complete -F _dracut dracut +diff --git a/dracut.spec b/dracut.spec +index 06149de..418baf4 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -277,6 +277,7 @@ rm -rf $RPM_BUILD_ROOT + %{_bindir}/dracut + # compat symlink + /sbin/dracut ++%{_datadir}/bash-completion/completions/dracut + %if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999 + %{_bindir}/mkinitrd + %{_bindir}/lsinitrd diff --git a/0024-dracut.spec-fix-requirements.patch b/0024-dracut.spec-fix-requirements.patch new file mode 100644 index 0000000..0291080 --- /dev/null +++ b/0024-dracut.spec-fix-requirements.patch @@ -0,0 +1,39 @@ +From 4a5a9c6d89b938d154b5700a5fb58b5d4365690c Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Mar 2013 12:55:23 +0100 +Subject: [PATCH] dracut.spec: fix requirements + +--- + dracut.spec | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/dracut.spec b/dracut.spec +index 418baf4..b21f220 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -70,7 +70,7 @@ Provides: mkinitrd = 2.6.1 + Obsoletes: dracut-kernel < 005 + Provides: dracut-kernel = %{version}-%{release} + +-Requires: bash ++Requires: bash > 4 + Requires: coreutils + Requires: cpio + Requires: filesystem >= 2.1.0 +@@ -82,14 +82,14 @@ Requires: module-init-tools >= 3.7-9 + Requires: sed + Requires: file + Requires: kpartx +-Requires: udev > 166 + Requires: kbd kbd-misc + + %if 0%{?fedora} || 0%{?rhel} > 6 + Requires: util-linux >= 2.21 +-Conflicts: systemd < 198-4 ++Requires: systemd > 198-4 + Conflicts: grubby < 8.23 + %else ++Requires: udev > 166 + Requires: util-linux-ng >= 2.21 + %endif + diff --git a/0025-dracut-initramfs-restore.sh-also-look-for-image-in-b.patch b/0025-dracut-initramfs-restore.sh-also-look-for-image-in-b.patch new file mode 100644 index 0000000..6b5afd8 --- /dev/null +++ b/0025-dracut-initramfs-restore.sh-also-look-for-image-in-b.patch @@ -0,0 +1,47 @@ +From 449b0e0707ee13c1417c3708ea5f4b6bc5d50216 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Mar 2013 13:09:13 +0100 +Subject: [PATCH] dracut-initramfs-restore.sh: also look for image in boot + loader spec dir + +--- + dracut-initramfs-restore.sh | 19 +++++++++++++++---- + 1 file changed, 15 insertions(+), 4 deletions(-) + +diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh +index 06e2939..33ae6bd 100644 +--- a/dracut-initramfs-restore.sh ++++ b/dracut-initramfs-restore.sh +@@ -1,17 +1,28 @@ +-#!/bin/sh ++#!/bin/bash + # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- + # ex: ts=8 sw=4 sts=4 et filetype=sh + + set -e ++ ++KERNEL_VERSION="$(uname -r)" ++ ++[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id ++ ++if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then ++ IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd" ++fi ++[[ -f $IMG ]] || IMG="/boot/initramfs-${KERNEL_VERSION}.img" ++ + cd /run/initramfs +-IMG="/boot/initramfs-$(uname -r).img" ++ + [ -f .need_shutdown -a -f "$IMG" ] || exit 1 +-if zcat "$IMG" | cpio -id >/dev/null 2>&1; then ++if zcat "$IMG" | cpio -id --quiet >/dev/null; then + rm .need_shutdown +-elif xzcat "$IMG" | cpio -id >/dev/null 2>&1; then ++elif xzcat "$IMG" | cpio -id --quiet >/dev/null; then + rm .need_shutdown + else + # something failed, so we clean up ++ echo "Unpacking of $IMG to /run/initramfs failed" >&2 + rm -f /run/initramfs/shutdown + exit 1 + fi diff --git a/0026-print-memdebug-to-stderr.patch b/0026-print-memdebug-to-stderr.patch new file mode 100644 index 0000000..d3ece46 --- /dev/null +++ b/0026-print-memdebug-to-stderr.patch @@ -0,0 +1,26 @@ +From dff9a66c44db384697801bd2d3b8af00ca6823cb Mon Sep 17 00:00:00 2001 +From: "dyoung@redhat.com" +Date: Wed, 13 Mar 2013 15:59:24 +0800 +Subject: [PATCH] print memdebug to stderr + +memory usage tracing outputs are debug info, so it should be moved to +stderr instead of stdout. + +Signed-off-by: Dave Young +--- + modules.d/99base/dracut-lib.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index d4d1e77..e456b01 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -1041,7 +1041,7 @@ make_trace_mem() + msg="$1" + shift + if [ -n "$DEBUG_MEM_LEVEL" ] && [ "$DEBUG_MEM_LEVEL" -gt 0 ]; then +- make_trace show_memstats $DEBUG_MEM_LEVEL "[debug_mem]" "$msg" "$@" ++ make_trace show_memstats $DEBUG_MEM_LEVEL "[debug_mem]" "$msg" "$@" >&2 + fi + } + diff --git a/0027-Improve-documentation-of-rd.memdebug.patch b/0027-Improve-documentation-of-rd.memdebug.patch new file mode 100644 index 0000000..6d784fb --- /dev/null +++ b/0027-Improve-documentation-of-rd.memdebug.patch @@ -0,0 +1,31 @@ +From 9c322b2f3b5beb623d226d4bf491a33badb99fe7 Mon Sep 17 00:00:00 2001 +From: "dyoung@redhat.com" +Date: Wed, 13 Mar 2013 15:59:25 +0800 +Subject: [PATCH] Improve documentation of rd.memdebug + +Explain more about rd.memdebug verbose level in dracut.cmdline.7.asc. + +Signed-off-by: Dave Young +--- + dracut.cmdline.7.asc | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index 62372a5..f1457d5 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -144,8 +144,12 @@ It should be attached to any report about dracut problems. + If "quiet" is set, it also logs to the console. + + **rd.memdebug=[0-3]**:: +- print memory usage debug info, set the verbose level from 1 to 3 +- print nothing when set rd.memdebug=0 ++ Print memory usage info at various points, set the verbose level from 0 to 3 ++ Higher level means more debugging output: ++ 0 - no output ++ 1 - partial /proc/meminfo ++ 2 - /proc/meminfo ++ 3 - /proc/meminfo + /proc/slabinfo + + **rd.break**:: + drop to a shell at the end diff --git a/0028-Add-memdebug-at-different-points-in-99base-init.sh.patch b/0028-Add-memdebug-at-different-points-in-99base-init.sh.patch new file mode 100644 index 0000000..a16c845 --- /dev/null +++ b/0028-Add-memdebug-at-different-points-in-99base-init.sh.patch @@ -0,0 +1,73 @@ +From bbfff3e58b6d8b3cc104541cb412caed706423a1 Mon Sep 17 00:00:00 2001 +From: "dyoung@redhat.com" +Date: Wed, 13 Mar 2013 15:59:26 +0800 +Subject: [PATCH] Add memdebug at different points in 99base/init.sh + +Previously I added several trace point to the begin of several +init hooks of systemd, old init script also need this debug info. + +Doing same here as what's added in the systemd service scripts: +At cmdline hooks adding trace of "1+:mem 1+:iomem 3+:slab" +For other hooks adding trace of "1:shortmem 2+:mem 3+:slab" + +Signed-off-by: Dave Young +--- + modules.d/99base/init.sh | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh +index 3b17aaa..a5a544e 100755 +--- a/modules.d/99base/init.sh ++++ b/modules.d/99base/init.sh +@@ -109,6 +109,7 @@ fi + source_conf /etc/conf.d + + # run scriptlets to parse the command line ++make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' + getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline" + source_hook cmdline + +@@ -118,6 +119,7 @@ source_hook cmdline + export root rflags fstype netroot NEWROOT + + # pre-udev scripts run before udev starts, and are run only once. ++make_trace_mem "hook pre-udev" '1:shortmem' '2+:mem' '3+:slab' + getarg 'rd.break=pre-udev' -d 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break before pre-udev" + source_hook pre-udev + +@@ -136,6 +138,7 @@ getargbool 0 rd.udev.info -d -y rdudevinfo && udevadm control "$UDEV_LOG_PRIO_AR + getargbool 0 rd.udev.debug -d -y rdudevdebug && udevadm control "$UDEV_LOG_PRIO_ARG=debug" + udevproperty "hookdir=$hookdir" + ++make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' + getarg 'rd.break=pre-trigger' -d 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger" + source_hook pre-trigger + +@@ -144,6 +147,7 @@ udevadm control --reload >/dev/null 2>&1 || : + udevadm trigger --type=subsystems --action=add >/dev/null 2>&1 + udevadm trigger --type=devices --action=add >/dev/null 2>&1 + ++make_trace_mem "hook initqueue" '1:shortmem' '2+:mem' '3+:slab' + getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue" + + RDRETRY=$(getarg rd.retry -d 'rd_retry=') +@@ -204,6 +208,7 @@ unset RDRETRY + + # pre-mount happens before we try to mount the root filesystem, + # and happens once. ++make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' + getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount" + source_hook pre-mount + +@@ -239,9 +244,11 @@ done + + # pre pivot scripts are sourced just before we doing cleanup and switch over + # to the new root. ++make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' + getarg 'rd.break=pre-pivot' -d 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot" + source_hook pre-pivot + ++make_trace_mem "hook cleanup" '1:shortmem' '2+:mem' '3+:slab' + # pre pivot cleanup scripts are sourced just before we switch over to the new root. + getarg 'rd.break=cleanup' -d 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup" + source_hook cleanup diff --git a/0029-systemd-remove-upstream-renamed-old-service-files.patch b/0029-systemd-remove-upstream-renamed-old-service-files.patch new file mode 100644 index 0000000..1deb547 --- /dev/null +++ b/0029-systemd-remove-upstream-renamed-old-service-files.patch @@ -0,0 +1,36 @@ +From a23b368c9240b8bf64d8163dd092351e0c6cfa29 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Mar 2013 14:45:55 +0100 +Subject: [PATCH] systemd: remove upstream renamed old service files + +--- + modules.d/98systemd/module-setup.sh | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh +index bc4f63c..0119291 100755 +--- a/modules.d/98systemd/module-setup.sh ++++ b/modules.d/98systemd/module-setup.sh +@@ -71,14 +71,10 @@ install() { + $systemdsystemunitdir/systemd-journald.socket \ + $systemdsystemunitdir/systemd-ask-password-console.service \ + $systemdsystemunitdir/systemd-modules-load.service \ +- $systemdsystemunitdir/halt.service \ + $systemdsystemunitdir/systemd-halt.service \ +- $systemdsystemunitdir/poweroff.service \ + $systemdsystemunitdir/systemd-poweroff.service \ + $systemdsystemunitdir/systemd-reboot.service \ +- $systemdsystemunitdir/kexec.service \ + $systemdsystemunitdir/systemd-kexec.service \ +- $systemdsystemunitdir/fsck@.service \ + $systemdsystemunitdir/systemd-fsck@.service \ + $systemdsystemunitdir/systemd-udevd.service \ + $systemdsystemunitdir/systemd-udev-trigger.service \ +@@ -97,7 +93,6 @@ install() { + \ + $systemdsystemunitdir/ctrl-alt-del.target \ + $systemdsystemunitdir/syslog.socket \ +- $systemdsystemunitdir/syslog.target \ + $systemdsystemunitdir/initrd-switch-root.target \ + $systemdsystemunitdir/initrd-switch-root.service \ + $systemdsystemunitdir/initrd-cleanup.service \ diff --git a/0030-kernel-modules-move-usb-storage-out-of-fixed-drivers.patch b/0030-kernel-modules-move-usb-storage-out-of-fixed-drivers.patch new file mode 100644 index 0000000..3d37f82 --- /dev/null +++ b/0030-kernel-modules-move-usb-storage-out-of-fixed-drivers.patch @@ -0,0 +1,29 @@ +From 8fdcc1a9b1371b2b1d5c4e4b3ae077546f169459 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Mar 2013 14:46:39 +0100 +Subject: [PATCH] kernel-modules: move usb-storage out of fixed drivers + +--- + modules.d/90kernel-modules/module-setup.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh +index aa1bafc..7d7da83 100755 +--- a/modules.d/90kernel-modules/module-setup.sh ++++ b/modules.d/90kernel-modules/module-setup.sh +@@ -36,13 +36,13 @@ installkernel() { + } + + hostonly='' instmods sr_mod sd_mod scsi_dh ata_piix \ +- pcmcia usb_storage \ + ehci-hcd ehci-pci ehci-platform ohci-hcd uhci-hcd xhci-hcd hid_generic \ + unix + + instmods yenta_socket scsi_dh_rdac scsi_dh_emc \ + atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \ +- hid-logitech-dj hid-microsoft firewire-ohci ++ hid-logitech-dj hid-microsoft firewire-ohci \ ++ pcmcia usb_storage + + if [[ "$(uname -p)" == arm* ]]; then + # arm specific modules diff --git a/0031-dracut.sh-Add-noimageifnotneeded-parameter.patch b/0031-dracut.sh-Add-noimageifnotneeded-parameter.patch new file mode 100644 index 0000000..8c7305c --- /dev/null +++ b/0031-dracut.sh-Add-noimageifnotneeded-parameter.patch @@ -0,0 +1,96 @@ +From 83bb0893edc1c12bbaca20267134b01df2836e1c Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Mar 2013 14:47:24 +0100 +Subject: [PATCH] dracut.sh: Add --noimageifnotneeded parameter + +Do not create an image in host-only mode, if no kernel driver is needed +and no $initdir/etc/cmdline/*.conf is generated. +--- + 50-dracut.install | 19 ++++++++++++++++++- + dracut-bash-completion.sh | 2 +- + dracut.sh | 12 ++++++++++++ + 3 files changed, 31 insertions(+), 2 deletions(-) + +diff --git a/50-dracut.install b/50-dracut.install +index 9e99899..6b63da9 100755 +--- a/50-dracut.install ++++ b/50-dracut.install +@@ -2,10 +2,27 @@ + # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- + # ex: ts=8 sw=4 sts=4 et filetype=sh + ++if [[ -f /etc/kernel/cmdline ]]; then ++ readarray -t BOOT_OPTIONS < /etc/kernel/cmdline ++fi ++ ++if ! [[ "${BOOT_OPTIONS[@]}" ]]; then ++ readarray -t BOOT_OPTIONS < /proc/cmdline ++fi ++ ++unset noimageifnotneeded ++ ++for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do ++ if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then ++ noimageifnotneeded="yes" ++ break ++ fi ++done ++ + ret=0 + case "$1" in + add) +- dracut "$3"/initrd "$2" ++ dracut ${noimageifnotneeded+--noimageifnotneeded} "$3"/initrd "$2" + ret=$? + ;; + remove) +diff --git a/dracut-bash-completion.sh b/dracut-bash-completion.sh +index da067c5..38e2ebd 100644 +--- a/dracut-bash-completion.sh ++++ b/dracut-bash-completion.sh +@@ -33,7 +33,7 @@ _dracut() { + --lvmconf --nolvmconf --debug --profile --verbose --quiet + --local --hostonly --no-hostonly --fstab --help --bzip2 --lzma + --xz --no-compress --gzip --list-modules --show-modules --keep +- --printsize --regenerate-all' ++ --printsize --regenerate-all --noimageifnotneeded' + + [ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers + --omit-drivers --modules --omit --drivers --filesystems --install +diff --git a/dracut.sh b/dracut.sh +index 2582f74..69f5282 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -330,6 +330,7 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \ + --long keep \ + --long printsize \ + --long regenerate-all \ ++ --long noimageifnotneeded \ + -- "$@") + + if (( $? != 0 )); then +@@ -408,6 +409,7 @@ while :; do + --keep) keep="yes";; + --printsize) printsize="yes";; + --regenerate-all) regenerate_all="yes";; ++ --noimageifnotneeded) noimageifnotneeded="yes";; + + --) shift; break;; + +@@ -1020,6 +1022,16 @@ if [[ $no_kernel != yes ]]; then + dinfo "*** Installing kernel module dependencies and firmware ***" + dracut_kernel_post + dinfo "*** Installing kernel module dependencies and firmware done ***" ++ ++ if [[ $noimageifnotneeded == yes ]] && [[ $hostonly ]]; then ++ if [[ ! -f "$initdir/lib/dracut/need-initqueue" ]] && \ ++ [[ -f ${initdir}/lib/modules/$kernel/modules.dep && ! -s ${initdir}/lib/modules/$kernel/modules.dep ]]; then ++ for i in ${initdir}/etc/cmdline.d/*.conf; do ++ # We need no initramfs image and do not generate one. ++ [[ $i == "${initdir}/etc/cmdline.d/*.conf" ]] && exit 0 ++ done ++ fi ++ fi + fi + + if [[ $kernel_only != yes ]]; then diff --git a/0032-shutdown-shutdown.sh-mount-move-all-basic-mounts-out.patch b/0032-shutdown-shutdown.sh-mount-move-all-basic-mounts-out.patch new file mode 100644 index 0000000..23a7fab --- /dev/null +++ b/0032-shutdown-shutdown.sh-mount-move-all-basic-mounts-out.patch @@ -0,0 +1,40 @@ +From fc4e10a8594e8c2d68dba233fa5ecc7d5babb5e1 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Mar 2013 17:45:37 +0100 +Subject: [PATCH] shutdown/shutdown.sh: mount --move all basic mounts out of + /oldroot + +After mount moving /dev away, apps like plymouth can do reexec with fd +passing of devices, which they want to keep open until the very end. +--- + modules.d/99shutdown/shutdown.sh | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/modules.d/99shutdown/shutdown.sh b/modules.d/99shutdown/shutdown.sh +index 202ecb1..6457cb0 100755 +--- a/modules.d/99shutdown/shutdown.sh ++++ b/modules.d/99shutdown/shutdown.sh +@@ -14,6 +14,12 @@ export TERM=linux + export PATH=/usr/sbin:/usr/bin:/sbin:/bin + . /lib/dracut-lib.sh + ++mkdir /oldsys ++for i in sys proc run dev; do ++ mkdir /oldsys/$i ++ mount --move /oldroot/$i /oldsys/$i ++done ++ + # if "kexec" was installed after creating the initramfs, we try to copy it from the real root + # libz normally is pulled in via kmod/modprobe and udevadm + if [ "$ACTION" = "kexec" ] && ! command -v kexec >/dev/null 2>&1; then +@@ -28,10 +34,6 @@ getarg 'rd.break=pre-shutdown' && emergency_shell --shutdown pre-shutdown "Break + + source_hook pre-shutdown + +-if ! ( [ -x /bin/plymouth ] && /bin/plymouth --quit ); then +- [ -x /oldroot/bin/plymouth ] && /oldroot/bin/plymouth --quit +-fi +- + warn "Killing all remaining processes" + + killall_proc_mountpoint /oldroot diff --git a/dracut.spec b/dracut.spec index c9647bd..2ca56dc 100644 --- a/dracut.spec +++ b/dracut.spec @@ -10,7 +10,7 @@ Name: dracut Version: 026 -Release: 19.git20130313%{?dist} +Release: 33.git20130313%{?dist} Summary: Initramfs generator using udev %if 0%{?fedora} || 0%{?rhel} @@ -47,6 +47,20 @@ Patch15: 0015-dracut.spec-add-nohostonly-and-norescue-subpackages.patch Patch16: 0016-lsinitrd.sh-simplify-check-for-boot-loader-spec-dirs.patch Patch17: 0017-51-dracut-rescue.install-create-directory-if-it-does.patch Patch18: 0018-systemd-local-fs.target-is-now-root-fs.target-and-in.patch +Patch19: 0019-systemd-add-modules-load.d-modules-to-the-initramfs.patch +Patch20: 0020-systemd-add-sysctl.d-and-sysctl.conf.patch +Patch21: 0021-plymouth-do-not-install-hooks-in-systemd-mode.patch +Patch22: 0022-dracut.sh-add-regenerate-all.patch +Patch23: 0023-add-dracut-bash-completion.sh.patch +Patch24: 0024-dracut.spec-fix-requirements.patch +Patch25: 0025-dracut-initramfs-restore.sh-also-look-for-image-in-b.patch +Patch26: 0026-print-memdebug-to-stderr.patch +Patch27: 0027-Improve-documentation-of-rd.memdebug.patch +Patch28: 0028-Add-memdebug-at-different-points-in-99base-init.sh.patch +Patch29: 0029-systemd-remove-upstream-renamed-old-service-files.patch +Patch30: 0030-kernel-modules-move-usb-storage-out-of-fixed-drivers.patch +Patch31: 0031-dracut.sh-Add-noimageifnotneeded-parameter.patch +Patch32: 0032-shutdown-shutdown.sh-mount-move-all-basic-mounts-out.patch BuildRequires: dash bash git @@ -89,7 +103,7 @@ Provides: mkinitrd = 2.6.1 Obsoletes: dracut-kernel < 005 Provides: dracut-kernel = %{version}-%{release} -Requires: bash +Requires: bash >= 4 Requires: coreutils Requires: cpio Requires: filesystem >= 2.1.0 @@ -101,14 +115,14 @@ Requires: module-init-tools >= 3.7-9 Requires: sed Requires: file Requires: kpartx -Requires: udev > 166 Requires: kbd kbd-misc %if 0%{?fedora} || 0%{?rhel} > 6 Requires: util-linux >= 2.21 -Conflicts: systemd < 198-4 +Requires: systemd >= 198-4 Conflicts: grubby < 8.23 %else +Requires: udev > 166 Requires: util-linux-ng >= 2.21 %endif @@ -296,6 +310,7 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/dracut # compat symlink /sbin/dracut +%{_datadir}/bash-completion/completions/dracut %if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999 %{_bindir}/mkinitrd %{_bindir}/lsinitrd @@ -435,6 +450,16 @@ rm -rf $RPM_BUILD_ROOT %{dracutlibdir}/dracut.conf.d/02-norescue.conf %changelog +* Wed Mar 13 2013 Harald Hoyer 026-33.git20130313 +- add module-load.d modules to the initramfs +- add sysctl.d to the initramfs +- optimize plymouth module for systemd mode +- add new dracut parameter "--regenerate-all" +- add new dracut parameter "--noimageifnotneeded" +- shutdown: mount move /run /sys /dev /proc out of /oldroot + before pre-shutdown +- add bash completion for dracut + * Wed Mar 13 2013 Harald Hoyer 026-19.git20130313 - fix switch-root and local-fs.target problem - add norescue and nohostonly subpackages