18971c
From ff33b576767d5e020c9f2685a0f5b0acb35a781c Mon Sep 17 00:00:00 2001
18971c
From: Thomas Renninger <trenn@suse.de>
18971c
Date: Fri, 27 Sep 2013 20:10:38 +0200
18971c
Subject: [PATCH] dracut: Do not create early_cpio if no suitable microcode
18971c
 exist in hostonly case
18971c
18971c
Intel microcodes only exist for very specific family/model/stepping CPUs.
18971c
If no microcode gets added, there is no need to create an empty
18971c
(only directories) cpio later that gets glued to the initrd.
18971c
18971c
This also fixes:
18971c
18971c
*** Constructing GenuineIntel.bin ****
18971c
cat: /lib/firmware/intel-ucode/06-3c-03: No such file or directory
18971c
18971c
in hostonly mode if there is no suitable microcode for the CPU.
18971c
18971c
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
18971c
Signed-off-by: Thomas Renninger <trenn@suse.de>
18971c
---
18971c
 dracut.sh | 5 ++++-
18971c
 1 file changed, 4 insertions(+), 1 deletion(-)
18971c
18971c
diff --git a/dracut.sh b/dracut.sh
18971c
index b3b80886..e43227e8 100755
18971c
--- a/dracut.sh
18971c
+++ b/dracut.sh
18971c
@@ -1326,12 +1326,15 @@ if [[ $early_microcode = yes ]]; then
18971c
                 dinfo "*** Constructing ${ucode_dest[$idx]} ****"
18971c
                 if [[ $hostonly ]]; then
18971c
                     _src=$(get_ucode_file)
18971c
+                    if ! [[ -r $_fwdir/$_fw/$_src ]];then
18971c
+                        break;
18971c
+                    fi
18971c
                 fi
18971c
                 cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]}
18971c
+                create_early_cpio="yes"
18971c
             fi
18971c
         done
18971c
     done
18971c
-    create_early_cpio="yes"
18971c
 fi
18971c
 
18971c
 rm -f -- "$outfile"