a56a5e
From 4b1aa19fa0fad0e607961995dbbe971be2ef9f81 Mon Sep 17 00:00:00 2001
90b079
From: Thomas Renninger <trenn@suse.de>
90b079
Date: Fri, 27 Sep 2013 20:10:37 +0200
90b079
Subject: [PATCH] dracut: Generlize microcode early cpio usage
90b079
90b079
ACPI early table override also may need to place files into an early cpio.
90b079
Reflect this in variable and file names.
90b079
This change is renaming only and does not introduce any real change.
90b079
90b079
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
90b079
Signed-off-by: Thomas Renninger <trenn@suse.de>
90b079
---
90b079
 dracut.sh | 17 +++++++++--------
90b079
 1 file changed, 9 insertions(+), 8 deletions(-)
90b079
90b079
diff --git a/dracut.sh b/dracut.sh
1755ca
index 177e66d5..b3b80886 100755
90b079
--- a/dracut.sh
90b079
+++ b/dracut.sh
90b079
@@ -704,9 +704,9 @@ readonly initdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)"
90b079
 }
90b079
 
90b079
 if [[ $early_microcode = yes ]]; then
90b079
-    readonly microcode_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_microcode.XXXXXX)"
90b079
-    [ -d "$microcode_dir" ] || {
90b079
-        printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t early_microcode.XXXXXX failed." >&2
90b079
+    readonly early_cpio_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_cpio.XXXXXX)"
90b079
+    [ -d "$early_cpio_dir" ] || {
90b079
+        printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t early_cpio.XXXXXX failed." >&2
90b079
         exit 1
90b079
     }
90b079
 fi
90b079
@@ -715,7 +715,7 @@ trap '
90b079
     ret=$?;
90b079
     [[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f -- "$outfile.$$";
90b079
     [[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; };
90b079
-    [[ $keep ]] && echo "Not removing $microcode_dir." >&2 || { [[ $microcode_dir ]] && rm -Rf -- "$microcode_dir"; };
90b079
+    [[ $keep ]] && echo "Not removing $early_cpio_dir." >&2 || { [[ $early_cpio_dir ]] && rm -Rf -- "$early_cpio_dir"; };
90b079
     [[ $_dlogdir ]] && rm -Rf -- "$_dlogdir";
90b079
     exit $ret;
90b079
     ' EXIT
90b079
@@ -1311,7 +1311,7 @@ if [[ $early_microcode = yes ]]; then
90b079
     dinfo "*** Generating early-microcode cpio image ***"
90b079
     ucode_dir=(amd-ucode intel-ucode)
90b079
     ucode_dest=(AuthenticAMD.bin GenuineIntel.bin)
90b079
-    _dest_dir="$microcode_dir/d/kernel/x86/microcode"
90b079
+    _dest_dir="$early_cpio_dir/d/kernel/x86/microcode"
90b079
     _dest_idx="0 1"
90b079
     mkdir -p $_dest_dir
90b079
     if [[ $hostonly ]]; then
90b079
@@ -1331,14 +1331,15 @@ if [[ $early_microcode = yes ]]; then
90b079
             fi
90b079
         done
90b079
     done
90b079
-    (cd "$microcode_dir/d"; find . -print0 | cpio --null -o -H newc --quiet >../ucode.cpio)
90b079
+    create_early_cpio="yes"
90b079
 fi
90b079
 
90b079
 rm -f -- "$outfile"
90b079
 dinfo "*** Creating image file ***"
90b079
-if [[ $early_microcode = yes ]]; then
90b079
+if [[ $create_early_cpio = yes ]]; then
90b079
     # The microcode blob is _before_ the initramfs blob, not after
90b079
-    mv $microcode_dir/ucode.cpio $outfile.$$
90b079
+    (cd "$early_cpio_dir/d"; find . -print0 | cpio --null -o -H newc --quiet >../early.cpio)
90b079
+    mv $early_cpio_dir/early.cpio $outfile.$$
90b079
 fi
90b079
 if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null -R 0:0 -H newc -o --quiet| \
90b079
     $compress >> "$outfile.$$"; ); then