ucode-intel/mkinitrd_setup-intel_microcode.sh
Thomas Renninger 0c70955c1c - Add mkinitrd script to add Intel microcode to initrd.
This is needed because microcode driver is built in or gets loaded
  automatically via udev early. Therefore the microcode has to be available
  in initrd already.
  This must not be mixed up with early micorcode loading. This feature will
  not be implemented via mkinitrd. Dracut is doing early microcode loading.
- bnc#852007
- mkinitrd script: mkinitrd_setup-intel_microcode.sh

OBS-URL: https://build.opensuse.org/package/show/Base:System/ucode-intel?expand=0&rev=10
2013-12-04 14:43:08 +00:00

36 lines
1.6 KiB
Bash

#!/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