- 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
This commit is contained in:
parent
6768158b81
commit
0c70955c1c
35
mkinitrd_setup-intel_microcode.sh
Normal file
35
mkinitrd_setup-intel_microcode.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/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
|
@ -1,3 +1,15 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Dec 2 14:17:33 UTC 2013 - trenn@suse.de
|
||||
|
||||
- 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
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 25 11:14:51 UTC 2013 - trenn@suse.de
|
||||
|
||||
|
@ -28,6 +28,7 @@ Url: http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=2
|
||||
Source0: microcode-%{version}.tgz
|
||||
Source1: intel-microcode2ucode.c
|
||||
Source2: LICENSE
|
||||
Source3: mkinitrd_setup-intel_microcode.sh
|
||||
Supplements: modalias(x86cpu:vendor%3A0000%3Afamily%3A*%3Amodel%3A*%3Afeature%3A*)
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
ExclusiveArch: %ix86 x86_64
|
||||
@ -44,6 +45,7 @@ cp %{SOURCE2} .
|
||||
./generate_microcode microcode.dat
|
||||
|
||||
%install
|
||||
install -D -m 0755 %{SOURCE3} %{buildroot}/lib/mkinitrd/scripts/setup-intel_microcode.sh
|
||||
install -D -m 0755 generate_microcode %{buildroot}%{_bindir}/generate_microcode
|
||||
for file in intel-ucode/*; do
|
||||
install -D -m 0644 $file %{buildroot}/lib/firmware/$file
|
||||
@ -51,6 +53,13 @@ done
|
||||
|
||||
%post
|
||||
#if this fails, the user must either reboot or reload manually.
|
||||
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
|
||||
if [ -e /var/lib/no_initrd_recreation_by_suspend ]; then
|
||||
echo "Skipping recreation of existing initial ramdisks, due"
|
||||
echo "to presence of /var/lib/no_initrd_recreation_by_suspend"
|
||||
elif [ -x /sbin/mkinitrd ]; then
|
||||
/sbin/mkinitrd
|
||||
fi
|
||||
test -f /sys/devices/system/cpu/microcode/reload && /bin/echo 1 > /sys/devices/system/cpu/microcode/reload || exit 0
|
||||
|
||||
%files
|
||||
@ -58,5 +67,8 @@ test -f /sys/devices/system/cpu/microcode/reload && /bin/echo 1 > /sys/devices/s
|
||||
%doc LICENSE
|
||||
%{_bindir}/generate_microcode
|
||||
/lib/firmware/intel-ucode/
|
||||
%dir /lib/mkinitrd
|
||||
%dir /lib/mkinitrd/scripts
|
||||
/lib/mkinitrd/scripts/setup-intel_microcode.sh
|
||||
|
||||
%changelog
|
||||
|
Loading…
Reference in New Issue
Block a user