File drm.spec of Package drm

# spec file for package drm
# 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

# norootforbuild
# needssslcertforbuild

%define kernel_version 4.6.5

Name:           drm
BuildRequires:  kernel-source %kernel_module_package_buildreqs
License:        GPL-2.0
Group:          System/Kernel
AutoReqProv:    on
Summary:        Backported drm kernel modules
ExclusiveArch:  x86_64
Version:        4.6.5
Release:        0
Source0:        drm-%{kernel_version}.tar.xz
Source1:        Makefile
Source2:        Module.supported
# Upstream fixes
Patch1:         0001-drm-i915-gen9-Fix-DMC-firmware-initialization.patch
Patch2:         0002-drm-i915-csr-Allow-matching-unknown-HW-steppings-wit.patch
Patch3:         0003-drm-i915-bxt-Reject-DMC-firmware-versions-with-known.patch
Patch4:         0004-drm-i915-gen9-Fix-runtime-PM-refcounting-in-case-DMC.patch
Patch5:         0005-drm-i915-kbl-Introduce-the-first-official-DMC-for-Ka.patch
Patch6:         0006-drm-i915-dmc-Step-away-from-symbolic-links.patch
# build fixes
Patch101:       local-headers-hack.diff
Patch103:       apple-gmux-hack.diff
Patch104:       vga_switcheroo-hack.diff
Patch105:       dmabuf-hack.diff
Patch106:       get_user_pages_remote-hack.diff
Patch108:       audio-component-hack.diff
Patch110:       drm-api-hack.diff
Patch113:       async-hack.diff
Patch115:       amd-build-fixes.diff
Patch116:       hda-callback-workaround.diff
Patch117:       suppress-wm-warning.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Backported drm kernel modules for supporting Intel Skylake graphics.

%setup -q -c -n %{name} -T -a 0
mkdir -p build-include/drm
ln -s ../include/uapi build-include/
cp include/drm/i915_pciids.h build-include/drm/
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch101 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch108 -p1
%patch110 -p1
%patch113 -p1
%patch115 -p1
%patch116 -p1
%patch117 -p1
cp %{S:1} .
cp %{S:2} .
ln -s /usr/src/linux/drivers/platform drivers/

# copy to each flavor
set -- *
for flavor in %flavors_to_build; do
  mkdir -p build-$flavor && cp -al "$@" build-$flavor
for flavor in %flavors_to_build; do
  make %{?jobs:-j %jobs} -C /usr/src/linux-obj/%_target_cpu/$flavor \

export INSTALL_MOD_DIR=updates
export BRP_PESIGN_FILES="*.ko"
for flavor in %flavors_to_build; do
  make -C /usr/src/linux-obj/%_target_cpu/$flavor \
    M=$(pwd)/build-$flavor \