commit:     1f1a4409da8dcd38aa0ec27f7f07d07ed866bc0b
Author:     Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 27 15:09:30 2016 +0000
Commit:     Richard Farina <zerochaos <AT> gentoo <DOT> org>
CommitDate: Thu Oct 27 15:09:30 2016 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=1f1a4409

enhance early microcode by actually checking if it will work

 gen_initramfs.sh | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index fb74929..1f62f5c 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -1042,26 +1042,26 @@ create_initramfs() {
                fi
                ## To early load microcode we need to follow some pretty 
specific steps
                ## mostly laid out in 
linux/Documentation/x86/early-microcode.txt
-               #if CONFIG_MICROCODE=y; then
+               if grep -sq '^CONFIG_MICROCODE=y' 
"${KERNEL_OUTPUTDIR}"/.config; then
                        print_info 1 "early-microcode: >> Preparing..."
                        UCODEDIR="${TMPDIR}/ucode_tmp/kernel/x86/microcode/"
                        mkdir -p "${UCODEDIR}"
-                       #if CONFIG_MICROCODE_INTEL=y; then
+                       if grep -sq '^CONFIG_MICROCODE_INTEL=y' 
"${KERNEL_OUTPUTDIR}"/.config; then
                                if [ "$(ls -A /lib/firmware/intel-ucode)" ]; 
then
                                        print_info 1 "                 >> 
adding GenuineIntel.bin"
                                        cat /lib/firmware/intel-ucode/* > 
"${UCODEDIR}/GenuineIntel.bin" || gen_die "Failed to concat intel cpu ucode"
-                               #else
-                                       #print_info 1 "CONFIG_MICROCODE_INTEL=y 
set but no ucode available. Please install 
sys-firmware/intel-microcode[split-ucode]"
+                               else
+                                       print_info 1 "CONFIG_MICROCODE_INTEL=y 
set but no ucode available. Please install 
sys-firmware/intel-microcode[split-ucode]"
                                fi
-                       #fi
-                       #if CONFIG_MICROCODE_AMD=y; then
+                       fi
+                       if grep -sq '^CONFIG_MICROCODE_AMD=y' 
"${KERNEL_OUTPUTDIR}"/.config; then
                                if [ "$(ls -A /lib/firmware/amd-ucode)" ]; then
                                        print_info 1 "                 >> 
adding AuthenticAMD.bin"
                                        cat /lib/firmware/amd-ucode/*.bin > 
"${UCODEDIR}/AuthenticAMD.bin" || gen_dir "Failed to concat amd cpu ucode"
-                               #else
-                                       #print_info 1 "CONFIG_MICROCODE_AMD=y 
set but no ucode available.  Please install sys-firmware/linux-firmware"
+                               else
+                                       print_info 1 "CONFIG_MICROCODE_AMD=y 
set but no ucode available.  Please install sys-firmware/linux-firmware"
                                fi
-                       #fi
+                       fi
                        if [ "$(ls -A ${UCODE})" ]; then
                                print_info 1 "early-microcode: >> Creating 
cpio..."
                                pushd "${TMPDIR}/ucode_tmp" > /dev/null
@@ -1070,10 +1070,10 @@ create_initramfs() {
                                print_info 1 "early-microcode: >> Prepending 
early-microcode to initramfs"
                                cat "${TMPDIR}/ucode.cpio" "${CPIO}" > 
"${CPIO}.early-microcode" || gen_die "Failed to prepend early-microcode to 
initramfs"
                                mv -f "${CPIO}.early-microcode" "${CPIO}" || 
gen_die "Rename failed"
-                       #else
-                               #print_info 1 "CONFIG_MICROCODE=y is set but no 
microcode found"
+                       else
+                               print_info 1 "CONFIG_MICROCODE=y is set but no 
microcode found"
                        fi
-               #fi
+               fi
                if isTrue "${WRAP_INITRD}"
                then
                        local mkimage_cmd=$(type -p mkimage)

Reply via email to