File mkinitrd_setup-intel_microcode.sh of Package ucode-intel.openSUSE_13.1_Update

#!/bin/bash

#%stage: boot
#
#  Adds Intel microcode to the initrd
#
#  If processor(s) are upgraded on the system, mkinitrd has to be re-called
#  manually to include a possible other needed firmware to the initrd
#
if grep -q -i intel /proc/cpuinfo; then
        echo -n "Microcode: "
        if [ ! -e /lib/firmware/intel-ucode ];then
            echo "Intel microcode not found, ucode-intel package not installed?"
            return 0
        fi
        # TBD: Shall we keep this check whether
        # /lib/firmware/intel-ucode/$family-$model-$stepping exists to avoid
        # per cpu file not found messages? Otherwise udev firmware loader rule
        # complaints about not found firmware files in /var/log/messages
        #
        TMP=$(grep -m1 "^cpu family" /proc/cpuinfo)
        # Convert cpu family from /proc/cpuinfo from decimal to a 2 digit hex
        cpu_family=$(printf "%02x" ${TMP#cpu family*: })
        TMP=$(grep -m1 "^model" /proc/cpuinfo)
        model=$(printf "%02x" ${TMP#model*: })
        TMP=$(grep -m1 "^stepping" /proc/cpuinfo)
        stepping=$(printf "%02x" ${TMP#stepping*: })
        if [ -e /lib/firmware/intel-ucode/${cpu_family}-${model}-${stepping} ];then
            mkdir -p "$tmp_mnt"/lib/firmware/intel-ucode
            cp /lib/firmware/intel-ucode/${cpu_family}-${model}-${stepping}*                      "$tmp_mnt"/lib/firmware/intel-ucode
            echo "Adding Intel microcode ${cpu_family}-${model}-${stepping}"
        else
            echo "No microcode available for CPU model: ${cpu_family}-${model}-${stepping}"
        fi
fi
openSUSE Build Service is sponsored by