From 3210e44b88df21b44069983e6eac66172995f83e76dc58d9ec57799aa7c82884 Mon Sep 17 00:00:00 2001 From: Raymond Wooninck Date: Wed, 2 Oct 2013 12:32:19 +0000 Subject: [PATCH 01/10] Accepting request 201877 from home:trenn:dracut_test - Add ACPI table override ability - Adjust mkinitrd-dracut.sh to SUSE mkinitrd: : Before gives a "usage" error -> now scans /boot for kernels and builds corresponding inirtrds for them -i -k : Pass a list of kernels and initrd targets (not sure it was worth the hassle to be able to pass) -b : Boot directory to search for kernel images -d : Change root file system. Not tested whether dracut's behavior matches exactly what our mkinitrd does. -s : Dummy (should even be obsolete in latest mkinitrd) - Write caller and used parameters to syslog if mkinitrd is called. So that those can easily be fixed and checked for correctness. This should get reverted again before a bigger release. OBS-URL: https://build.opensuse.org/request/show/201877 OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=56 --- acpi_override.patch | 38 +++++++++++++ dracut.changes | 17 ++++++ dracut.spec | 32 ++++++++++- generalize_early_cpio.patch | 62 +++++++++++++++++++++ implement_default | 91 +++++++++++++++++++++++++++++++ microcode_cleanup | 30 +++++++++++ mkinitrd_allow_multiple_args | 98 ++++++++++++++++++++++++++++++++++ mkinitrd_allow_no_option.patch | 88 ++++++++++++++++++++++++++++++ mkinitrd_setup_dummy | 3 ++ quiet_options | 61 +++++++++++++++++++++ root_fs | 31 +++++++++++ suse_host_only | 64 ++++++++++++++++++++++ suse_only_logger | 18 +++++++ 13 files changed, 631 insertions(+), 2 deletions(-) create mode 100644 acpi_override.patch create mode 100644 generalize_early_cpio.patch create mode 100644 implement_default create mode 100644 microcode_cleanup create mode 100644 mkinitrd_allow_multiple_args create mode 100644 mkinitrd_allow_no_option.patch create mode 100644 mkinitrd_setup_dummy create mode 100644 quiet_options create mode 100644 root_fs create mode 100644 suse_host_only create mode 100644 suse_only_logger diff --git a/acpi_override.patch b/acpi_override.patch new file mode 100644 index 0000000..1d85528 --- /dev/null +++ b/acpi_override.patch @@ -0,0 +1,38 @@ +dracut: Implement ACPI table overriding + +An example config file for this feature could be: + +/etc/dracut.conf.d/03-acpi-override.conf + +with this content: +acpi_override="yes" +acpi_table_dir="/etc/dracut.conf.d/acpi_tables" + +Then all files ending with *.aml will be put into the early cpio +(kernel/firmware/acpi) and will be used to replace the BIOS provided tables +if the kernel supports this feature. + +Signed-off-by: Thomas Renninger + +Index: dracut-033/dracut.sh +=================================================================== +--- dracut-033.orig/dracut.sh ++++ dracut-033/dracut.sh +@@ -1322,6 +1322,17 @@ if [[ $early_microcode = yes ]]; then + done + fi + ++if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then ++ dinfo "*** Packaging ACPI tables to override BIOS provided ones ***" ++ _dest_dir="$early_cpio_dir/d/kernel/firmware/acpi" ++ mkdir -p $_dest_dir ++ for table in $acpi_table_dir/*.aml; do ++ dinfo " Adding ACPI table: $table" ++ cp $table $_dest_dir ++ create_early_cpio="yes" ++ done ++fi ++ + rm -f -- "$outfile" + dinfo "*** Creating image file ***" + if [[ $create_early_cpio = yes ]]; then diff --git a/dracut.changes b/dracut.changes index 7b82c28..07769e7 100644 --- a/dracut.changes +++ b/dracut.changes @@ -1,3 +1,20 @@ +------------------------------------------------------------------- +Wed Sep 25 15:17:57 UTC 2013 - trenn@suse.de + +- Add ACPI table override ability +- Adjust mkinitrd-dracut.sh to SUSE mkinitrd: + : Before gives a "usage" error -> now scans /boot for kernels + and builds corresponding inirtrds for them + -i -k : Pass a list of kernels and initrd targets + (not sure it was worth the hassle to be able to pass) + -b : Boot directory to search for kernel images + -d : Change root file system. Not tested whether dracut's behavior + matches exactly what our mkinitrd does. + -s : Dummy (should even be obsolete in latest mkinitrd) +- Write caller and used parameters to syslog if mkinitrd is called. + So that those can easily be fixed and checked for correctness. + This should get reverted again before a bigger release. + ------------------------------------------------------------------- Sat Sep 21 17:36:13 UTC 2013 - crrodriguez@opensuse.org diff --git a/dracut.spec b/dracut.spec index aa236ec..02220c0 100644 --- a/dracut.spec +++ b/dracut.spec @@ -18,7 +18,7 @@ %define dracutlibdir %{_prefix}/lib/dracut -%define replace_mkinitrd 0 +%define replace_mkinitrd 1 Name: dracut Version: 033 @@ -35,6 +35,7 @@ Source0: dracut-%{version}.tar.xz # (not to be upstreamed) Source1: module-setup-initrd.sh Source2: parse-suse-initrd.sh +Source3: mkinitrd_setup_dummy # PATCH-FIX-OPENSUSE correct the paths for openSUSE - tittiatcoke@gmail.com Patch0: correct-paths-for-opensuse.patch # PATCH-FIX-OPENSUSE change the default naming from initramfs to initrd - tittiatcoke@gmail.com @@ -43,6 +44,17 @@ Patch1: use_initrd_insteadof_initramfs.patch Patch2: use_sysconfig_values_correctly.patch # PATCH-FIX-OPENSUSE At the moment we have 2 paths that contain udev files (/lib/udev and /usr/lib/udev) - tittiatcoke@gmail.com Patch3: use_all_paths_udev.patch +Patch4: generalize_early_cpio.patch +Patch5: microcode_cleanup +Patch6: acpi_override.patch +Patch7: mkinitrd_allow_no_option.patch +Patch8: mkinitrd_allow_multiple_args +Patch9: quiet_options +Patch10: implement_default +Patch11: root_fs +Patch12: suse_host_only +Patch13: suse_only_logger + BuildRequires: bash BuildRequires: dash @@ -119,6 +131,16 @@ This package contains tools to assemble the local initrd and host configuration. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 %build %configure\ @@ -172,6 +194,11 @@ rm %{buildroot}%{_bindir}/mkinitrd rm %{buildroot}%{_bindir}/lsinitrd rm %{buildroot}%{_mandir}/man8/mkinitrd* rm %{buildroot}%{_mandir}/man1/lsinitrd* +%else +# moved to /sbin +mkdir -p %{buildroot}/sbin +mv %{buildroot}%{_bindir}/mkinitrd %{buildroot}/sbin/mkinitrd +install -m 0755 %{S:3} %{buildroot}/sbin/mkinitrd_setup %endif mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d @@ -185,7 +212,8 @@ rm -rf %{buildroot} %doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg %{_bindir}/dracut %if %{replace_mkinitrd} -%{_bindir}/mkinitrd +/sbin/mkinitrd +/sbin/mkinitrd_setup %{_bindir}/lsinitrd /etc/bash_completion.d/lsinitrd %endif diff --git a/generalize_early_cpio.patch b/generalize_early_cpio.patch new file mode 100644 index 0000000..010ae54 --- /dev/null +++ b/generalize_early_cpio.patch @@ -0,0 +1,62 @@ +dracut: Generlize microcode early cpio usage + +ACPI early table override also may need to place files into an early cpio. +Reflect this in variable and file names. +This change is renaming only and does not introduce any real change. + +Signed-off-by: Thomas Renninger + +Index: dracut-033/dracut.sh +=================================================================== +--- dracut-033.orig/dracut.sh ++++ dracut-033/dracut.sh +@@ -696,9 +696,9 @@ readonly initdir="$(mktemp --tmpdir="$TM + } + + if [[ $early_microcode = yes ]]; then +- readonly microcode_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_microcode.XXXXXX)" +- [ -d "$microcode_dir" ] || { +- printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t early_microcode.XXXXXX failed." >&2 ++ readonly early_cpio_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_cpio.XXXXXX)" ++ [ -d "$early_cpio_dir" ] || { ++ printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t early_cpio.XXXXXX failed." >&2 + exit 1 + } + fi +@@ -707,7 +707,7 @@ trap ' + ret=$?; + [[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f -- "$outfile.$$"; + [[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; }; +- [[ $keep ]] && echo "Not removing $microcode_dir." >&2 || { [[ $microcode_dir ]] && rm -Rf -- "$microcode_dir"; }; ++ [[ $keep ]] && echo "Not removing $early_cpio_dir." >&2 || { [[ $early_cpio_dir ]] && rm -Rf -- "$early_cpio_dir"; }; + [[ $_dlogdir ]] && rm -Rf -- "$_dlogdir"; + exit $ret; + ' EXIT +@@ -1296,7 +1296,7 @@ if [[ $early_microcode = yes ]]; then + dinfo "*** Generating early-microcode cpio image ***" + ucode_dir=(amd-ucode intel-ucode) + ucode_dest=(AuthenticAMD.bin GenuineIntel.bin) +- _dest_dir="$microcode_dir/d/kernel/x86/microcode" ++ _dest_dir="$early_cpio_dir/d/kernel/x86/microcode" + _dest_idx="0 1" + mkdir -p $_dest_dir + if [[ $hostonly ]]; then +@@ -1316,14 +1316,15 @@ if [[ $early_microcode = yes ]]; then + fi + done + done +- (cd "$microcode_dir/d"; find . -print0 | cpio --null -o -H newc --quiet >../ucode.cpio) ++ create_early_cpio="yes" + fi + + rm -f -- "$outfile" + dinfo "*** Creating image file ***" +-if [[ $early_microcode = yes ]]; then ++if [[ $create_early_cpio = yes ]]; then + # The microcode blob is _before_ the initramfs blob, not after +- mv $microcode_dir/ucode.cpio $outfile.$$ ++ (cd "$early_cpio_dir/d"; find . -print0 | cpio --null -o -H newc --quiet >../early.cpio) ++ mv $early_cpio_dir/early.cpio $outfile.$$ + fi + if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null -R 0:0 -H newc -o --quiet| \ + $compress >> "$outfile.$$"; ); then diff --git a/implement_default b/implement_default new file mode 100644 index 0000000..611999f --- /dev/null +++ b/implement_default @@ -0,0 +1,91 @@ +mkinitrd-dracut.sh: Allow mkinitrd call without passing any parameters + +Before this gave a "usage" error. +Now boot_dir (by default /boot) is scanned for available kernels and sane +initrd default targets get defined and the corresponding initramfs files +are generated. + +Signed-off-by: Thomas Renninger + +Index: dracut-033/mkinitrd-dracut.sh +=================================================================== +--- dracut-033.orig/mkinitrd-dracut.sh ++++ dracut-033/mkinitrd-dracut.sh +@@ -46,6 +46,67 @@ read_arg() { + fi + } + ++# Taken over from SUSE mkinitrd ++default_kernel_images() { ++ local regex kernel_image kernel_version version_version initrd_image ++ local qf='%{NAME}-%{VERSION}-%{RELEASE}\n' ++ ++ case "$(uname -m)" in ++ s390|s390x) ++ regex='image' ++ ;; ++ ppc|ppc64) ++ regex='vmlinux' ++ ;; ++ i386|x86_64) ++ regex='vmlinuz' ++ ;; ++ arm*) ++ regex='[uz]Image' ++ ;; ++ aarch64) ++ regex='Image' ++ ;; ++ *) regex='vmlinu.' ++ ;; ++ esac ++ ++ # user mode linux ++ if grep -q UML /proc/cpuinfo; then ++ regex='linux' ++ fi ++ ++ kernel_images="" ++ initrd_images="" ++ for kernel_image in $(ls $boot_dir \ ++ | sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \ ++ | grep -v kdump$ ) ; do ++ ++ # Note that we cannot check the RPM database here -- this ++ # script is itself called from within the binary kernel ++ # packages, and rpm does not allow recursive calls. ++ ++ [ -L "$boot_dir/$kernel_image" ] && continue ++ [ "${kernel_image%%.gz}" != "$kernel_image" ] && continue ++ kernel_version=$(/usr/bin/get_kernel_version \ ++ $boot_dir/$kernel_image 2> /dev/null) ++ initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|") ++ if [ "$kernel_image" != "$initrd_image" -a \ ++ -n "$kernel_version" -a \ ++ -d "/lib/modules/$kernel_version" ]; then ++ kernel_images="$kernel_images $boot_dir/$kernel_image" ++ initrd_images="$initrd_images $boot_dir/$initrd_image" ++ fi ++ done ++ for kernel_image in $kernel_images;do ++ kernels="$kernels ${kernel_image#*-}" ++ done ++ for initrd_image in $initrd_images;do ++ targets="$targets $initrd_image" ++ done ++ ++} ++ + while (($# > 0)); do + case ${1%%=*} in + --with-usb) read_arg usbmodule "$@" || shift $? +@@ -119,7 +180,8 @@ while (($# > 0)); do + shift + done + +-[[ $targets && $kernels ]] || usage ++[[ $targets && $kernels ]] || default_kernel_images ++[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage) + + # We can have several targets/kernels, transform the list to an array + targets=( $targets ) diff --git a/microcode_cleanup b/microcode_cleanup new file mode 100644 index 0000000..55ff7eb --- /dev/null +++ b/microcode_cleanup @@ -0,0 +1,30 @@ +dracut: Do not create early_cpio if no suitable microcode exist in hostonly +case + +Intel microcodes only exist for very specific family/model/stepping CPUs. +If no microcode gets added, there is no need to create an empty +(only directories) cpio later that gets glued to the initrd. + +This also fixes: + +Index: dracut-033/dracut.sh +=================================================================== +--- dracut-033.orig/dracut.sh ++++ dracut-033/dracut.sh +@@ -1311,12 +1311,15 @@ if [[ $early_microcode = yes ]]; then + dinfo "*** Constructing ${ucode_dest[$idx]} ****" + if [[ $hostonly ]]; then + _src=$(get_ucode_file) ++ if ! [[ -r $_fwdir/$_fw/$_src ]];then ++ break; ++ fi + fi + cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]} ++ create_early_cpio="yes" + fi + done + done +- create_early_cpio="yes" + fi + + rm -f -- "$outfile" diff --git a/mkinitrd_allow_multiple_args b/mkinitrd_allow_multiple_args new file mode 100644 index 0000000..bad2200 --- /dev/null +++ b/mkinitrd_allow_multiple_args @@ -0,0 +1,98 @@ +mkinitrd-dracut.sh: Enhance param parsing: Allow multiple arguments per param + +Currently --with parameter had to be passed as: --with="mod1 mod2". +Now one can pass: --with "mod1 mod2" or even --with mod1 mod2. + +Signed-off-by: Thomas Renninger + +diff --git a/mkinitrd-dracut.sh b/mkinitrd-dracut.sh +index ace7725..d8e92f3 100755 +--- a/mkinitrd-dracut.sh ++++ b/mkinitrd-dracut.sh +@@ -26,36 +26,43 @@ read_arg() { + # $1 = arg name + # $2 = arg value + # $3 = arg parameter +- local rematch='^[^=]*=(.*)$' ++ param="$1" ++ local rematch='^[^=]*=(.*)$' result + if [[ $2 =~ $rematch ]]; then +- read "$1" <<< "${BASH_REMATCH[1]}" +- elif [[ $3 != -* ]]; then +- # Only read next arg if it not an arg itself. +- read "$1" <<< "$3" +- # There is no way to shift our callers args, so +- # return 1 to indicate they should do it instead. +- return 1 ++ read "$param" <<< "${BASH_REMATCH[1]}" ++ else ++ for ((i=3; $i <= $#; i++)); do ++ # Only read next arg if it not an arg itself. ++ if [[ ${@:$i:1} = -* ]];then ++ break ++ fi ++ result="$result ${@:$i:1}" ++ # There is no way to shift our callers args, so ++ # return "no of args" to indicate they should do it instead. ++ done ++ read "$1" <<< "$result" ++ return $(($i - 3)) + fi + } + + while (($# > 0)); do + case ${1%%=*} in +- --with-usb) read_arg usbmodule "$@" || shift ++ --with-usb) read_arg usbmodule "$@" || shift $? + basicmodules="$basicmodules ${usbmodule:-usb-storage}" + unset usbmodule;; +- --with-avail) read_arg modname "$@" || shift ++ --with-avail) read_arg modname "$@" || shift $? + basicmodules="$basicmodules $modname";; +- --with) read_arg modname "$@" || shift ++ --with) read_arg modname "$@" || shift $? + basicmodules="$basicmodules $modname";; + --version) + echo "mkinitrd: dracut compatibility wrapper" + exit 0;; + -v|--verbose) dracut_args="${dracut_args} -v";; + -f|--force) dracut_args="${dracut_args} -f";; +- --preload) read_arg modname "$@" || shift ++ --preload) read_arg modname "$@" || shift $? + basicmodules="$basicmodules $modname";; + --image-version) img_vers=yes;; +- --rootfs) read_arg rootfs "$@" || shift ++ --rootfs) read_arg rootfs "$@" || shift $? + dracut_args="${dracut_args} --filesystems $rootfs";; + --nocompress) dracut_args="$dracut_args --no-compress";; + --help) usage -n;; +@@ -82,24 +89,24 @@ while (($# > 0)); do + --looppath*) ;; + --dsdt*) ;; + --bootchart) ;; +- -b) read_arg boot_dir "$@" || shift ++ -b) read_arg boot_dir "$@" || shift $? + if [ ! -d $boot_dir ];then + error "Boot directory $boot_dir does not exist" + exit 1 + fi + ;; + -k) # Would be nice to get a list of images here +- read_arg kernel_images "$@" || shift ++ read_arg kernel_images "$@" || shift $? + for kernel_image in $kernel_images;do + kernels="$kernels ${kernel_image#*-}" + done + ;; +- -i) read_arg initrd_images "$@" || shift ++ -i) read_arg initrd_images "$@" || shift $? + for initrd_image in $initrd_images;do +- targets="$targets $boot_dir/$initrd_images" ++ targets="$targets $boot_dir/$initrd_image" + done + ;; +- *) if [[ ! $targets ]]; then ++ *) if [[ ! $targets ]]; then + targets=$1 + elif [[ ! $kernels ]]; then + kernels=$1 diff --git a/mkinitrd_allow_no_option.patch b/mkinitrd_allow_no_option.patch new file mode 100644 index 0000000..31896d3 --- /dev/null +++ b/mkinitrd_allow_no_option.patch @@ -0,0 +1,88 @@ +mkinitrd-dracut.sh: Introduce -i -k parameters + +In SUSE, one can pass a list of kernel files via -k parameter. +For each an initrd is generated as passed via -i parameters. + +Make the dracut mkinitrd wrapper compatible to those. +For now only one kernel file and initrd target can be specified. +This will get enhanced with a follow-up patch. + +Signed-off-by: Thomas Renninger + +diff --git a/mkinitrd-dracut.sh b/mkinitrd-dracut.sh +old mode 100644 +new mode 100755 +index ffea2d1..ace7725 +--- a/mkinitrd-dracut.sh ++++ b/mkinitrd-dracut.sh +@@ -1,6 +1,8 @@ + #!/bin/bash --norc + kver=$(uname -r) + ++boot_dir="/boot" ++ + error() { echo "$@" >&2; } + + usage () { +@@ -80,10 +82,27 @@ while (($# > 0)); do + --looppath*) ;; + --dsdt*) ;; + --bootchart) ;; +- *) if [[ ! $target ]]; then +- target=$1 +- elif [[ ! $kernel ]]; then +- kernel=$1 ++ -b) read_arg boot_dir "$@" || shift ++ if [ ! -d $boot_dir ];then ++ error "Boot directory $boot_dir does not exist" ++ exit 1 ++ fi ++ ;; ++ -k) # Would be nice to get a list of images here ++ read_arg kernel_images "$@" || shift ++ for kernel_image in $kernel_images;do ++ kernels="$kernels ${kernel_image#*-}" ++ done ++ ;; ++ -i) read_arg initrd_images "$@" || shift ++ for initrd_image in $initrd_images;do ++ targets="$targets $boot_dir/$initrd_images" ++ done ++ ;; ++ *) if [[ ! $targets ]]; then ++ targets=$1 ++ elif [[ ! $kernels ]]; then ++ kernels=$1 + else + usage + fi;; +@@ -91,11 +110,24 @@ while (($# > 0)); do + shift + done + +-[[ $target && $kernel ]] || usage +-[[ $img_vers ]] && target="$target-$kernel" ++[[ $targets && $kernels ]] || usage ++ ++# We can have several targets/kernels, transform the list to an array ++targets=( $targets ) ++[[ $kernels ]] && kernels=( $kernels ) + +-if [[ $basicmodules ]]; then ++for ((i=0 ; $i<${#targets[@]} ; i++)); do ++ ++ if [[ $img_vers ]];then ++ target="${targets[$i]}-${kernels[$i]}" ++ else ++ target="${targets[$i]}" ++ fi ++ kernel="${kernels[$i]}" ++ ++ if [[ $basicmodules ]]; then + dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel" +-else ++ else + dracut $dracut_args "$target" "$kernel" +-fi ++ fi ++done diff --git a/mkinitrd_setup_dummy b/mkinitrd_setup_dummy new file mode 100644 index 0000000..a5798db --- /dev/null +++ b/mkinitrd_setup_dummy @@ -0,0 +1,3 @@ +#/bin/bash + +true diff --git a/quiet_options b/quiet_options new file mode 100644 index 0000000..25b21ff --- /dev/null +++ b/quiet_options @@ -0,0 +1,61 @@ +mkinitrd-dracut.sh: Implement --quiet|-q option + +Dracut is rather verbose. This optional parameter is to limit the output +to the essential: For each generated initrd show the kernel, target and +possibly additional options passed to dracut. + +Signed-off-by: Thomas Renninger + +diff --git a/mkinitrd-dracut.sh b/mkinitrd-dracut.sh +index d8e92f3..803abc0 100755 +--- a/mkinitrd-dracut.sh ++++ b/mkinitrd-dracut.sh +@@ -2,6 +2,7 @@ + kver=$(uname -r) + + boot_dir="/boot" ++quiet=0 + + error() { echo "$@" >&2; } + +@@ -89,6 +90,7 @@ while (($# > 0)); do + --looppath*) ;; + --dsdt*) ;; + --bootchart) ;; ++ --quiet|-q) quiet=1;; + -b) read_arg boot_dir "$@" || shift $? + if [ ! -d $boot_dir ];then + error "Boot directory $boot_dir does not exist" +@@ -123,6 +125,7 @@ done + targets=( $targets ) + [[ $kernels ]] && kernels=( $kernels ) + ++echo "Creating: target|kernel|dracut args|basicmodules " + for ((i=0 ; $i<${#targets[@]} ; i++)); do + + if [[ $img_vers ]];then +@@ -132,9 +135,21 @@ for ((i=0 ; $i<${#targets[@]} ; i++)); do + fi + kernel="${kernels[$i]}" + +- if [[ $basicmodules ]]; then +- dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel" ++ # Duplicate code: No way found how to redirect output based on $quiet ++ if [[ $quiet == 1 ]];then ++ echo "$target|$kernel|$dracut_args|$basicmodules" ++ if [[ $basicmodules ]]; then ++ dracut $dracut_args --add-drivers "$basicmodules" "$target" \ ++ "$kernel" &>/dev/null ++ else ++ dracut $dracut_args "$target" "$kernel" &>/dev/null ++ fi + else +- dracut $dracut_args "$target" "$kernel" ++ if [[ $basicmodules ]]; then ++ dracut $dracut_args --add-drivers "$basicmodules" "$target" \ ++ "$kernel" ++ else ++ dracut $dracut_args "$target" "$kernel" ++ fi + fi + done diff --git a/root_fs b/root_fs new file mode 100644 index 0000000..3a165c4 --- /dev/null +++ b/root_fs @@ -0,0 +1,31 @@ +mkinitrd-dracut.sh: Also allow -d to specify the root_fs and -s dummy + +-d is the SUSE mkinitrd version option to pass the rootfs. +-s is to enable splash which may not be needed, but some callers rely on it, +not to return an error. + +Make this wrapper compatible to it. + +Signed-off-by: Thomas Renninger + +Index: dracut-033/mkinitrd-dracut.sh +=================================================================== +--- dracut-033.orig/mkinitrd-dracut.sh ++++ dracut-033/mkinitrd-dracut.sh +@@ -124,7 +124,7 @@ while (($# > 0)); do + --preload) read_arg modname "$@" || shift $? + basicmodules="$basicmodules $modname";; + --image-version) img_vers=yes;; +- --rootfs) read_arg rootfs "$@" || shift $? ++ --rootfs|-d) read_arg rootfs "$@" || shift $? + dracut_args="${dracut_args} --filesystems $rootfs";; + --nocompress) dracut_args="$dracut_args --no-compress";; + --help) usage -n;; +@@ -151,6 +151,7 @@ while (($# > 0)); do + --looppath*) ;; + --dsdt*) ;; + --bootchart) ;; ++ -s) ;; + --quiet|-q) quiet=1;; + -b) read_arg boot_dir "$@" || shift $? + if [ ! -d $boot_dir ];then diff --git a/suse_host_only b/suse_host_only new file mode 100644 index 0000000..b9f9ed4 --- /dev/null +++ b/suse_host_only @@ -0,0 +1,64 @@ +mkinitrd-dracut.sh: Build host images for default_kernel_images and -i/-k paths + +default_kernel_images and -i/-k paths are new (SuSE) code paths and +would have resulted in usage errors before. + +There we want to build host only images for faster building and +smaller images. +Also force creation (overriding) of initrd images in these code paths. + +Signed-off-by: Thomas Renninger + +diff --git a/mkinitrd-dracut.sh b/mkinitrd-dracut.sh +index f7b53f1..a1519ea 100755 +--- a/mkinitrd-dracut.sh ++++ b/mkinitrd-dracut.sh +@@ -3,6 +3,8 @@ kver=$(uname -r) + + boot_dir="/boot" + quiet=0 ++host_only=0 ++force=0 + + error() { echo "$@" >&2; } + +@@ -104,7 +106,8 @@ default_kernel_images() { + for initrd_image in $initrd_images;do + targets="$targets $initrd_image" + done +- ++ host_only=1 ++ force=1 + } + + while (($# > 0)); do +@@ -119,8 +122,8 @@ while (($# > 0)); do + --version) + echo "mkinitrd: dracut compatibility wrapper" + exit 0;; +- -v|--verbose) dracut_args="${dracut_args} -v";; +- -f|--force) dracut_args="${dracut_args} -f";; ++ -v|--verbose) dracut_args="${dracut_args} -v --keep";; ++ -f|--force) force=1;; + --preload) read_arg modname "$@" || shift $? + basicmodules="$basicmodules $modname";; + --image-version) img_vers=yes;; +@@ -164,6 +167,8 @@ while (($# > 0)); do + for kernel_image in $kernel_images;do + kernels="$kernels ${kernel_image#*-}" + done ++ host_only=1 ++ force=1 + ;; + -i) read_arg initrd_images "$@" || shift $? + for initrd_image in $initrd_images;do +@@ -188,6 +193,9 @@ done + targets=( $targets ) + [[ $kernels ]] && kernels=( $kernels ) + ++[[ $host_only == 1 ]] && dracut_args="${dracut_args} -H" ++[[ $force == 1 ]] && dracut_args="${dracut_args} -f" ++ + echo "Creating: target|kernel|dracut args|basicmodules " + for ((i=0 ; $i<${#targets[@]} ; i++)); do + diff --git a/suse_only_logger b/suse_only_logger new file mode 100644 index 0000000..f13fb86 --- /dev/null +++ b/suse_only_logger @@ -0,0 +1,18 @@ +diff --git a/mkinitrd-dracut.sh b/mkinitrd-dracut.sh +index a1519ea..dacba60 100755 +--- a/mkinitrd-dracut.sh ++++ b/mkinitrd-dracut.sh +@@ -110,6 +110,13 @@ default_kernel_images() { + force=1 + } + ++if which logger &>/dev/null && which tr &>/dev/null;then ++ self=$(tr "\000" " " 0)); do + case ${1%%=*} in + --with-usb) read_arg usbmodule "$@" || shift $? From aee8513eaa025d16ba83d8ff3e5b1c09d422859ff3b219c6be8ef8d75bb6390a Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Wed, 2 Oct 2013 13:13:53 +0000 Subject: [PATCH 02/10] - Add ACPI table override ability: generalize_early_cpio.patch #PATCH-FIX-UPSTREAM microcode_cleanup #PATCH-FIX-UPSTREAM acpi_override.patch #PATCH-FIX-UPSTREAM - This will replace mkinitrd with dracut as the default initrd generator. Therefore Prefer: dracut tag in the project config of the repo is needed. Otherwise OSC does not know how to build installation-images (needing mkinitrd to build) and which package to take. - To switch back and try mkinitrd instead of dracut will be: Uninstall dracut: - rpm -e dracut --nodeps And install mkinitrd again: - zypper install mkinitrd These patches have been submitted, but now feedback from mainline yet: mkinitrd_allow_no_option.patch mkinitrd_allow_multiple_args quiet_options implement_default root_fs suse_host_only This patch will never show up mainline and should also get reverted from SUSE factory repo before the next release shows up: suse_only_logger OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=57 --- dracut.changes | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/dracut.changes b/dracut.changes index 07769e7..0ac0973 100644 --- a/dracut.changes +++ b/dracut.changes @@ -1,7 +1,19 @@ ------------------------------------------------------------------- Wed Sep 25 15:17:57 UTC 2013 - trenn@suse.de -- Add ACPI table override ability +- Add ACPI table override ability: + generalize_early_cpio.patch #PATCH-FIX-UPSTREAM + microcode_cleanup #PATCH-FIX-UPSTREAM + acpi_override.patch #PATCH-FIX-UPSTREAM +- This will replace mkinitrd with dracut as the default initrd generator. + Therefore Prefer: dracut tag in the project config of the repo is needed. + Otherwise OSC does not know how to build installation-images + (needing mkinitrd to build) and which package to take. +- To switch back and try mkinitrd instead of dracut will be: + Uninstall dracut: + - rpm -e dracut --nodeps + And install mkinitrd again: + - zypper install mkinitrd - Adjust mkinitrd-dracut.sh to SUSE mkinitrd: : Before gives a "usage" error -> now scans /boot for kernels and builds corresponding inirtrds for them @@ -11,9 +23,19 @@ Wed Sep 25 15:17:57 UTC 2013 - trenn@suse.de -d : Change root file system. Not tested whether dracut's behavior matches exactly what our mkinitrd does. -s : Dummy (should even be obsolete in latest mkinitrd) + These patches have been submitted, but now feedback from mainline yet: + mkinitrd_allow_no_option.patch + mkinitrd_allow_multiple_args + quiet_options + implement_default + root_fs + suse_host_only - Write caller and used parameters to syslog if mkinitrd is called. So that those can easily be fixed and checked for correctness. This should get reverted again before a bigger release. + This patch will never show up mainline and should also get reverted + from SUSE factory repo before the next release shows up: + suse_only_logger ------------------------------------------------------------------- Sat Sep 21 17:36:13 UTC 2013 - crrodriguez@opensuse.org From d6401a2720b065a09cadc04841c862ed30627979f1bbc6efce5084a0af99120a Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Wed, 2 Oct 2013 15:23:40 +0000 Subject: [PATCH 03/10] - Remove Provides/Obsoletes: mkinitrd versioning. Simply obsolete and provide all mkinitrd versions. OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=58 --- dracut.changes | 6 ++++++ dracut.spec | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dracut.changes b/dracut.changes index 0ac0973..840a0e4 100644 --- a/dracut.changes +++ b/dracut.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Oct 2 14:54:51 UTC 2013 - trenn@suse.de + +- Remove Provides/Obsoletes: mkinitrd versioning. + Simply obsolete and provide all mkinitrd versions. + ------------------------------------------------------------------- Wed Sep 25 15:17:57 UTC 2013 - trenn@suse.de diff --git a/dracut.spec b/dracut.spec index 02220c0..c10c73f 100644 --- a/dracut.spec +++ b/dracut.spec @@ -65,8 +65,8 @@ BuildRequires: docbook-xsl-stylesheets BuildRequires: libxslt BuildRequires: pkgconfig(systemd) >= 199 %if %{replace_mkinitrd} -Obsoletes: mkinitrd <= 2.7.2 -Provides: mkinitrd = 2.7.2 +Obsoletes: mkinitrd +Provides: mkinitrd %endif Requires: bash From 1c955cd93da670a4ffd0d361f99df6c65e5d34e917bddcc81128ffd42045f043 Mon Sep 17 00:00:00 2001 From: Robert Milasan Date: Thu, 3 Oct 2013 07:37:56 +0000 Subject: [PATCH 04/10] Accepting request 201996 from home:mvyskocil - Mark /etc/dracut.conf.d/02-early-microcode.conf as config file Add following entry to .changes of trenn@suse.de """ - Build host only images for default paths in SUSE for faster build and smaller images. Imply --force in this case as well. * suse_host_only.patch """ It was not documented - Tagged all patches per policy - Add extension .patch to all patches per policy OBS-URL: https://build.opensuse.org/request/show/201996 OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=59 --- dracut.changes | 8 ++++++ dracut.spec | 26 +++++++++++++------ implement_default => implement_default.patch | 0 microcode_cleanup => microcode_cleanup.patch | 0 ...args => mkinitrd_allow_multiple_args.patch | 0 quiet_options => quiet_options.patch | 0 root_fs => root_fs.patch | 0 suse_host_only => suse_host_only.patch | 0 suse_only_logger => suse_only_logger.patch | 0 9 files changed, 26 insertions(+), 8 deletions(-) rename implement_default => implement_default.patch (100%) rename microcode_cleanup => microcode_cleanup.patch (100%) rename mkinitrd_allow_multiple_args => mkinitrd_allow_multiple_args.patch (100%) rename quiet_options => quiet_options.patch (100%) rename root_fs => root_fs.patch (100%) rename suse_host_only => suse_host_only.patch (100%) rename suse_only_logger => suse_only_logger.patch (100%) diff --git a/dracut.changes b/dracut.changes index 840a0e4..2ab0f6d 100644 --- a/dracut.changes +++ b/dracut.changes @@ -4,6 +4,11 @@ Wed Oct 2 14:54:51 UTC 2013 - trenn@suse.de - Remove Provides/Obsoletes: mkinitrd versioning. Simply obsolete and provide all mkinitrd versions. +------------------------------------------------------------------- +Wed Oct 2 13:19:23 UTC 2013 - mvyskocil@suse.com + +- Mark /etc/dracut.conf.d/02-early-microcode.conf as config file + ------------------------------------------------------------------- Wed Sep 25 15:17:57 UTC 2013 - trenn@suse.de @@ -42,6 +47,9 @@ Wed Sep 25 15:17:57 UTC 2013 - trenn@suse.de This patch will never show up mainline and should also get reverted from SUSE factory repo before the next release shows up: suse_only_logger +- Build host only images for default paths in SUSE for faster build and + smaller images. Imply --force in this case as well. + * suse_host_only.patch ------------------------------------------------------------------- Sat Sep 21 17:36:13 UTC 2013 - crrodriguez@opensuse.org diff --git a/dracut.spec b/dracut.spec index c10c73f..8829bd2 100644 --- a/dracut.spec +++ b/dracut.spec @@ -44,16 +44,26 @@ Patch1: use_initrd_insteadof_initramfs.patch Patch2: use_sysconfig_values_correctly.patch # PATCH-FIX-OPENSUSE At the moment we have 2 paths that contain udev files (/lib/udev and /usr/lib/udev) - tittiatcoke@gmail.com Patch3: use_all_paths_udev.patch +# PATCH-FIX-UPSTREAM ACPI early table override support in early cpio - trenn@suse.de Patch4: generalize_early_cpio.patch -Patch5: microcode_cleanup +# PATCH-FIX-UPSTREAM Do not create early_cpio if no suitable microcode exists - trenn@suse.de +Patch5: microcode_cleanup.patch +# PATCH-FIX-UPSTREAM Implement ACPI table overriding - trenn@suse.de Patch6: acpi_override.patch +# PATCH-FIX-OPENSUSE SUSE mkinitrd compatibility: Introduce -i -k parameters - trenn@suse.de Patch7: mkinitrd_allow_no_option.patch -Patch8: mkinitrd_allow_multiple_args -Patch9: quiet_options -Patch10: implement_default -Patch11: root_fs -Patch12: suse_host_only -Patch13: suse_only_logger +# PATCH-FIX-OPENSUSE SUSE mkinitrd compatibility: allow multiple arguments per param - trenn@suse.de +Patch8: mkinitrd_allow_multiple_args.patch +# PATCH-FIX-UPSTREAM Limit an output to essential one implementing --quiet option - trenn@suse.de +Patch9: quiet_options.patch +# PATCH-FIX-OPENSUSE SUSE mkinitrd compatibility: Allow a call w/o passing any parameters - trenn@suse.de +Patch10: implement_default.patch +# PATCH-FIX-OPENSUSE SUSE mkinitrd compatibility: add -d to pass rootfs and dummy -s - trenn@suse.de +Patch11: root_fs.patch +# PATCH-FIX-OPENSUSE Build host only images for default_kernel_images and -i/-k ones - trenn@suse.de +Patch12: suse_host_only.patch +# PATCH-FIX-OPENSUSE Write caller and used parameters to syslog if mkinitrd is called - trenn@suse.de +Patch13: suse_only_logger.patch BuildRequires: bash BuildRequires: dash @@ -230,7 +240,7 @@ rm -rf %{buildroot} %config %{_sysconfdir}/dracut.conf.d/01-dist.conf %endif %ifarch %ix86 x86_64 -%{_sysconfdir}/dracut.conf.d/02-early-microcode.conf +%config %{_sysconfdir}/dracut.conf.d/02-early-microcode.conf %endif %dir %{_sysconfdir}/dracut.conf.d %{_mandir}/man8/dracut.8* diff --git a/implement_default b/implement_default.patch similarity index 100% rename from implement_default rename to implement_default.patch diff --git a/microcode_cleanup b/microcode_cleanup.patch similarity index 100% rename from microcode_cleanup rename to microcode_cleanup.patch diff --git a/mkinitrd_allow_multiple_args b/mkinitrd_allow_multiple_args.patch similarity index 100% rename from mkinitrd_allow_multiple_args rename to mkinitrd_allow_multiple_args.patch diff --git a/quiet_options b/quiet_options.patch similarity index 100% rename from quiet_options rename to quiet_options.patch diff --git a/root_fs b/root_fs.patch similarity index 100% rename from root_fs rename to root_fs.patch diff --git a/suse_host_only b/suse_host_only.patch similarity index 100% rename from suse_host_only rename to suse_host_only.patch diff --git a/suse_only_logger b/suse_only_logger.patch similarity index 100% rename from suse_only_logger rename to suse_only_logger.patch From 7e05737de097c9bf388d537222e1175158fd1f2335369b3324869f8c33c5b160 Mon Sep 17 00:00:00 2001 From: Raymond Wooninck Date: Fri, 4 Oct 2013 09:41:08 +0000 Subject: [PATCH 05/10] OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=60 --- dracut.changes | 6 ++++++ dracut.spec | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dracut.changes b/dracut.changes index 2ab0f6d..3c80ecb 100644 --- a/dracut.changes +++ b/dracut.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Oct 4 09:40:30 UTC 2013 - tittiatcoke@gmail.com + +- Bring back the versioning for mkinitrd Provides/Obsoletes so + that dracut can be installed properly. + ------------------------------------------------------------------- Wed Oct 2 14:54:51 UTC 2013 - trenn@suse.de diff --git a/dracut.spec b/dracut.spec index 8829bd2..8611eab 100644 --- a/dracut.spec +++ b/dracut.spec @@ -75,8 +75,8 @@ BuildRequires: docbook-xsl-stylesheets BuildRequires: libxslt BuildRequires: pkgconfig(systemd) >= 199 %if %{replace_mkinitrd} -Obsoletes: mkinitrd -Provides: mkinitrd +Obsoletes: mkinitrd <= 2.8.2 +Provides: mkinitrd = 2.8.3 %endif Requires: bash @@ -90,7 +90,7 @@ Requires: hardlink Requires: logrotate Requires: modutils Requires: sed -Requires: systemd > 198 +Requires: systemd >= 199 Requires: udev > 166 Requires: util-linux >= 2.21 Requires: xz From 6cdd84caa62db06b108562b83bd9f0c8cd98400be513111faf6dd49386b0a6b1 Mon Sep 17 00:00:00 2001 From: Raymond Wooninck Date: Fri, 4 Oct 2013 09:45:09 +0000 Subject: [PATCH 06/10] OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=61 --- dracut.changes | 6 ------ dracut.spec | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/dracut.changes b/dracut.changes index 3c80ecb..2ab0f6d 100644 --- a/dracut.changes +++ b/dracut.changes @@ -1,9 +1,3 @@ -------------------------------------------------------------------- -Fri Oct 4 09:40:30 UTC 2013 - tittiatcoke@gmail.com - -- Bring back the versioning for mkinitrd Provides/Obsoletes so - that dracut can be installed properly. - ------------------------------------------------------------------- Wed Oct 2 14:54:51 UTC 2013 - trenn@suse.de diff --git a/dracut.spec b/dracut.spec index 8611eab..6779261 100644 --- a/dracut.spec +++ b/dracut.spec @@ -75,8 +75,8 @@ BuildRequires: docbook-xsl-stylesheets BuildRequires: libxslt BuildRequires: pkgconfig(systemd) >= 199 %if %{replace_mkinitrd} -Obsoletes: mkinitrd <= 2.8.2 -Provides: mkinitrd = 2.8.3 +Obsoletes: mkinitrd +Provides: mkinitrd %endif Requires: bash From 77a0e7b8412baeb5d4fca83d7272aadb1c94ae307cd408470b2c0f95e9490b62 Mon Sep 17 00:00:00 2001 From: Raymond Wooninck Date: Fri, 4 Oct 2013 09:52:30 +0000 Subject: [PATCH 07/10] OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=62 --- dracut.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dracut.spec b/dracut.spec index 6779261..9a84b7c 100644 --- a/dracut.spec +++ b/dracut.spec @@ -90,7 +90,7 @@ Requires: hardlink Requires: logrotate Requires: modutils Requires: sed -Requires: systemd >= 199 +Requires: systemd >= 200 Requires: udev > 166 Requires: util-linux >= 2.21 Requires: xz From cc979ea3ace47544622ff0c0940a64259ae19b16cc4de0b81040cf3fdd750188 Mon Sep 17 00:00:00 2001 From: Raymond Wooninck Date: Fri, 4 Oct 2013 09:59:08 +0000 Subject: [PATCH 08/10] OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=63 --- dracut.changes | 7 +++++++ dracut.spec | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dracut.changes b/dracut.changes index 2ab0f6d..2b088e6 100644 --- a/dracut.changes +++ b/dracut.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Oct 4 09:58:17 UTC 2013 - tittiatcoke@gmail.com + +- Bring back the versioned Provides/Obsoletes for mkinitrd. + Otherwise we run into issues as that udev is conflicting with + mkinitrd < 2.7.0 + ------------------------------------------------------------------- Wed Oct 2 14:54:51 UTC 2013 - trenn@suse.de diff --git a/dracut.spec b/dracut.spec index 9a84b7c..6dec870 100644 --- a/dracut.spec +++ b/dracut.spec @@ -75,8 +75,8 @@ BuildRequires: docbook-xsl-stylesheets BuildRequires: libxslt BuildRequires: pkgconfig(systemd) >= 199 %if %{replace_mkinitrd} -Obsoletes: mkinitrd -Provides: mkinitrd +Obsoletes: mkinitrd < 2.8.2 +Provides: mkinitrd = 2.8.2 %endif Requires: bash From dd62f72388a55381a1fe16a766cea56c1ee3d8d598bac734a1fec7e0740ea6ac Mon Sep 17 00:00:00 2001 From: Raymond Wooninck Date: Fri, 4 Oct 2013 16:27:09 +0000 Subject: [PATCH 09/10] OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=64 --- dracut.changes | 6 ++++++ mkinitrd_allow_multiple_args.patch | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dracut.changes b/dracut.changes index 2b088e6..cfdb613 100644 --- a/dracut.changes +++ b/dracut.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Oct 4 16:26:20 UTC 2013 - tittiatcoke@gmail.com + +- Validate that the parameters passed with -i (initrd file) does + not already contain the boot_dir. + ------------------------------------------------------------------- Fri Oct 4 09:58:17 UTC 2013 - tittiatcoke@gmail.com diff --git a/mkinitrd_allow_multiple_args.patch b/mkinitrd_allow_multiple_args.patch index bad2200..333f881 100644 --- a/mkinitrd_allow_multiple_args.patch +++ b/mkinitrd_allow_multiple_args.patch @@ -66,7 +66,7 @@ index ace7725..d8e92f3 100755 dracut_args="${dracut_args} --filesystems $rootfs";; --nocompress) dracut_args="$dracut_args --no-compress";; --help) usage -n;; -@@ -82,24 +89,24 @@ while (($# > 0)); do +@@ -82,24 +89,29 @@ while (($# > 0)); do --looppath*) ;; --dsdt*) ;; --bootchart) ;; @@ -88,7 +88,12 @@ index ace7725..d8e92f3 100755 + -i) read_arg initrd_images "$@" || shift $? for initrd_image in $initrd_images;do - targets="$targets $boot_dir/$initrd_images" -+ targets="$targets $boot_dir/$initrd_image" ++ case $initrd_image in ++ "$boot_dir"*) ++ targets="$targets $initrd_image";; ++ *) ++ targets="$targets $boot_dir/$initrd_image";; ++ esac done ;; - *) if [[ ! $targets ]]; then From 650ca2a2ce0a1619fb01bf782515e4d77bbd118231874af8574a452470aefba0 Mon Sep 17 00:00:00 2001 From: Raymond Wooninck Date: Fri, 4 Oct 2013 17:24:02 +0000 Subject: [PATCH 10/10] OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=65 --- dracut.changes | 7 +++++++ dracut.spec | 3 +++ implement_default.patch | 2 +- mkinitrd_update_bootloader.diff | 14 ++++++++++++++ quiet_options.patch | 4 ++-- suse_host_only.patch | 2 +- 6 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 mkinitrd_update_bootloader.diff diff --git a/dracut.changes b/dracut.changes index cfdb613..4d2ccea 100644 --- a/dracut.changes +++ b/dracut.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Oct 4 17:23:19 UTC 2013 - tittiatcoke@gmail.com + +- Add patch mkinitrd_update_bootloader.diff so that after + generating the initrd, the update-bootloader is called to update + grub2. + ------------------------------------------------------------------- Fri Oct 4 16:26:20 UTC 2013 - tittiatcoke@gmail.com diff --git a/dracut.spec b/dracut.spec index 6dec870..b70fb30 100644 --- a/dracut.spec +++ b/dracut.spec @@ -64,6 +64,8 @@ Patch11: root_fs.patch Patch12: suse_host_only.patch # PATCH-FIX-OPENSUSE Write caller and used parameters to syslog if mkinitrd is called - trenn@suse.de Patch13: suse_only_logger.patch +# PATCH-FIX-OPENSUSE Call the update-bootloader after dracut finished creating the initrd - tittiatcoke@gmail.com +Patch14: mkinitrd_update_bootloader.diff BuildRequires: bash BuildRequires: dash @@ -151,6 +153,7 @@ This package contains tools to assemble the local initrd and host configuration. %patch11 -p1 %patch12 -p1 %patch13 -p1 +%patch14 -p1 %build %configure\ diff --git a/implement_default.patch b/implement_default.patch index 611999f..ce944dc 100644 --- a/implement_default.patch +++ b/implement_default.patch @@ -79,7 +79,7 @@ Index: dracut-033/mkinitrd-dracut.sh while (($# > 0)); do case ${1%%=*} in --with-usb) read_arg usbmodule "$@" || shift $? -@@ -119,7 +180,8 @@ while (($# > 0)); do +@@ -124,7 +185,8 @@ while (($# > 0)); do shift done diff --git a/mkinitrd_update_bootloader.diff b/mkinitrd_update_bootloader.diff new file mode 100644 index 0000000..f71719f --- /dev/null +++ b/mkinitrd_update_bootloader.diff @@ -0,0 +1,14 @@ +diff -urNB dracut-033/mkinitrd-dracut.sh new/mkinitrd-dracut.sh +--- dracut-033/mkinitrd-dracut.sh 2013-10-04 19:12:51.654775024 +0200 ++++ new/mkinitrd-dracut.sh 2013-10-04 19:14:25.088173450 +0200 +@@ -236,3 +236,10 @@ + fi + fi + done ++ ++if [ -z "$(type -p update-bootloader)" ] ; then ++ echo 2>&1 "Did not refresh the bootloader. You might need to refresh it manually." ++else ++ update-bootloader --refresh ++fi ++ diff --git a/quiet_options.patch b/quiet_options.patch index 25b21ff..14b6675 100644 --- a/quiet_options.patch +++ b/quiet_options.patch @@ -26,7 +26,7 @@ index d8e92f3..803abc0 100755 -b) read_arg boot_dir "$@" || shift $? if [ ! -d $boot_dir ];then error "Boot directory $boot_dir does not exist" -@@ -123,6 +125,7 @@ done +@@ -128,6 +130,7 @@ done targets=( $targets ) [[ $kernels ]] && kernels=( $kernels ) @@ -34,7 +34,7 @@ index d8e92f3..803abc0 100755 for ((i=0 ; $i<${#targets[@]} ; i++)); do if [[ $img_vers ]];then -@@ -132,9 +135,21 @@ for ((i=0 ; $i<${#targets[@]} ; i++)); do +@@ -137,9 +140,21 @@ for ((i=0 ; $i<${#targets[@]} ; i++)); do fi kernel="${kernels[$i]}" diff --git a/suse_host_only.patch b/suse_host_only.patch index b9f9ed4..ff4d3a9 100644 --- a/suse_host_only.patch +++ b/suse_host_only.patch @@ -52,7 +52,7 @@ index f7b53f1..a1519ea 100755 ;; -i) read_arg initrd_images "$@" || shift $? for initrd_image in $initrd_images;do -@@ -188,6 +193,9 @@ done +@@ -193,6 +198,9 @@ done targets=( $targets ) [[ $kernels ]] && kernels=( $kernels )