Accepting request 221992 from Kernel:HEAD

- fixed last submission to actually build. (forwarded request 211750 from msmeissn)

OBS-URL: https://build.opensuse.org/request/show/221992
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kernel-firmware?expand=0&rev=42
This commit is contained in:
Stephan Kulow 2014-02-13 14:01:37 +00:00 committed by Git OBS Bridge
commit d52712df35
4 changed files with 103 additions and 6 deletions

View File

@ -1,8 +1,29 @@
-------------------------------------------------------------------
Thu Dec 19 16:27:35 UTC 2013 - meissner@suse.com
- fixed last submission to actually build.
-------------------------------------------------------------------
Tue Dec 10 15:46:02 UTC 2013 - trenn@suse.de
- Add mkinitrd script to add AMD 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#847158
- mkinitrd scripts:
- mkinitrd_setup-amd_microcode.sh
Adding microcode to the initrd
- mkinitrd_boot-amd_microcode.sh
Triggering the reload at boot
-------------------------------------------------------------------
Mon Dec 9 14:19:50 UTC 2013 - trenn@suse.de
- Correct Supplements string so that the package gets correctly installed
on machines with Intel CPUs
on machines with AMD CPUs
bnc#847158
-------------------------------------------------------------------

View File

@ -16,7 +16,6 @@
#
Name: kernel-firmware
BuildRequires: fdupes
BuildRequires: kernel-default
@ -31,6 +30,8 @@ Source0: linux-firmware-%{version}.tar.bz2
Source1: firmware.sh
Source3: iwlwifi-4965-1.ucode
Source4: carl9170-1.fw
Source5: mkinitrd_setup-amd_microcode.sh
Source6: mkinitrd_boot-amd_microcode.sh
%define __find_supplements bash %_sourcedir/firmware.sh --find-supplements
%define __ksyms_supplements bash %_sourcedir/firmware.sh --cache %{_builddir}/%{?buildsubdir}/find_supplements.cache --find-supplements
@ -88,6 +89,8 @@ cp -v %{S:4} carl9170-1.fw
# nothing to do
%install
install -D -m 0755 %{SOURCE5} %{buildroot}/lib/mkinitrd/scripts/setup-amd_microcode.sh
install -D -m 0755 %{SOURCE6} %{buildroot}/lib/mkinitrd/scripts/boot-amd_microcode.sh
mkdir -p %{buildroot}/lib/firmware
cp -avf * %{buildroot}/lib/firmware
rm -f %{buildroot}/lib/firmware/WHENCE
@ -103,16 +106,45 @@ rm -rf %{buildroot}/lib/firmware/carl9170fw
%clean
rm -rf %{buildroot}
%post -n ucode-amd
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
if [ "${YAST_IS_RUNNING}" != "instsys" ]; then
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
[ -x /sbin/mkinitrd_setup ] && /sbin/mkinitrd_setup
/sbin/mkinitrd || :
fi
fi
%postun -n ucode-amd
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
if [ "${YAST_IS_RUNNING}" != "instsys" ]; then
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
[ -x /sbin/mkinitrd_setup ] && /sbin/mkinitrd_setup
/sbin/mkinitrd || :
fi
fi
%files
%defattr(0644,root,root,0755)
%doc WHENCE README GPL-3 LICENCE.*
%exclude /lib/firmware/amd-ucode/microcode_amd.bin
%exclude /lib/firmware/amd-ucode/microcode_amd_fam15h.bin
%exclude /lib/firmware/amd-ucode/microcode_amd.bin*
%exclude /lib/firmware/amd-ucode/microcode_amd_fam15h.bin*
/lib/firmware/*
%files -n ucode-amd
%defattr(0644,root,root,0755)
/lib/firmware/amd-ucode/microcode_amd.bin
/lib/firmware/amd-ucode/microcode_amd_fam15h.bin
/lib/firmware/amd-ucode/microcode_amd.bin*
/lib/firmware/amd-ucode/microcode_amd_fam15h.bin*
/lib/firmware/amd-ucode/
%dir /lib/mkinitrd
%dir /lib/mkinitrd/scripts
%attr(0755,root,root) /lib/mkinitrd/scripts/setup-amd_microcode.sh
%attr(0755,root,root) /lib/mkinitrd/scripts/boot-amd_microcode.sh
%changelog

View File

@ -0,0 +1,8 @@
#!/bin/bash
#%stage: boot
#%depends: udev
if [ -w /sys/devices/system/cpu/microcode/reload ];then
echo 1 >/sys/devices/system/cpu/microcode/reload
fi

View File

@ -0,0 +1,36 @@
#/bin/bash
#%stage: boot
#
# Adds AMD 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 AuthenticAMD /proc/cpuinfo; then
echo -n "Microcode: "
if [ ! -e /lib/firmware/amd-ucode ];then
echo "AMD microcode not found, amd-ucode package not installed?"
return 0
fi
fam=`head /proc/cpuinfo |sed -n -e 's/cpu family.*: \([0-9]\+\)/\1/p'`
# Only try to update when family >= 16 (0x10, fam 10h)
if [ $fam -ge 16 >& /dev/null ];then
# Family 0x15 firmware is named: microcode_amd_famXXh.bin"
if [ $fam -lt 21 >& /dev/null ];then
file=microcode_amd.bin
else
file=`printf "microcode_amd_fam%xh.bin" $fam`
fi
if [ -e /lib/firmware/amd-ucode ];then
echo "Adding AMD microcode $file"
mkdir -p $tmp_mnt/lib/firmware/amd-ucode
cp /lib/firmware/amd-ucode/"$file"* $tmp_mnt/lib/firmware/amd-ucode
else
echo "No AMD microcode found, amd-ucode package not installed?"
fi
else
printf "AMD CPU family: 0x%x does not support microcode updates" $fam
fi
fi