File kernel-firmware.spec of Package kernel-firmware.openSUSE_13.1_Update

#
# spec file for package kernel-firmware
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           kernel-firmware
BuildRequires:  fdupes
BuildRequires:  kernel-default
Version:        20130714git
Release:        0
Summary:        Linux kernel firmware files
License:        SUSE-Firmware and GPL-2.0 and GPL-2.0+ and MIT
Group:          System/Kernel
Url:            http://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git
# Created with git archive | bzip2
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
# update Intel 3160/7260 WiFi firmware (bnc#880866)
Source7:        iwlwifi-3160-7.ucode
Source8:        iwlwifi-7260-7.ucode
%define __find_supplements bash %_sourcedir/firmware.sh --find-supplements

%define __ksyms_supplements bash %_sourcedir/firmware.sh --cache %{_builddir}/%{?buildsubdir}/find_supplements.cache --find-supplements
%define __ksyms_path ^/lib/firmware
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Provides:       qlogic-firmware
Obsoletes:      qlogic-firmware
Provides:       cxgb3-firmware
Obsoletes:      cxgb3-firmware
Provides:       ralink-firmware
Obsoletes:      ralink-firmware
Provides:       iwl1000-ucode
Obsoletes:      iwl1000-ucode
Provides:       iwl3945-ucode
Obsoletes:      iwl3945-ucode
Provides:       iwl4965-ucode
Obsoletes:      iwl4965-ucode
Provides:       iwl5000-ucode
Obsoletes:      iwl5000-ucode
Provides:       iwl5150-ucode
Obsoletes:      iwl5150-ucode
Provides:       iwl100-ucode
Obsoletes:      iwl100-ucode
Provides:       iwl1000-ucode
Obsoletes:      iwl1000-ucode
Provides:       iwl6000-ucode
Obsoletes:      iwl6000-ucode
Provides:       iwl6050-ucode
Obsoletes:      iwl6050-ucode
Provides:       iwl6000g2-ucode
Obsoletes:      iwl6000g2-ucode
Provides:       ath3k-firmware
Obsoletes:      ath3k-firmware

%description
This package contains the firmware for in-kernel drivers that was
previously included in the kernel. It is shared by all kernels >=
2.6.27-rc1.

%package -n ucode-amd
Supplements:    modalias(x86cpu:vendor%3A0002%3Afamily%3A*%3Amodel%3A*%3Afeature%3A*)
Summary:        Microcode updates for AMD CPUs
Group:          System/Kernel

%description -n ucode-amd
This package contains the microcode files used by AMD CPUs.

%prep
%setup -q -c kernel-firmware
cp -v %{S:3} iwlwifi-4965-1.ucode
cp -v %{S:4} carl9170-1.fw
cp -v %{S:7} iwlwifi-3160-7.ucode
cp -v %{S:8} iwlwifi-7260-7.ucode

%build
# 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
bash %_sourcedir/firmware.sh --kill-duplicates %buildroot/lib/firmware/
%fdupes %{buildroot}
rm -f find_supplements.cache
# In alsa-firmware
rm -f %{buildroot}/lib/firmware/ctefx.bin
rm -f %{buildroot}/lib/firmware/ctspeq.bin
# Devel files
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
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*
/lib/firmware/*
%exclude /lib/firmware/isci/Makefile
%exclude /lib/firmware/isci/README
%exclude /lib/firmware/isci/create_fw.c
%exclude /lib/firmware/isci/create_fw.h
%exclude /lib/firmware/isci/probe_roms.h

%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/
%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
openSUSE Build Service is sponsored by