LanMan

Untitled

Jul 11th, 2014
1,211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 73.65 KB | None | 0 0
  1. # We have to override the new %%install behavior because, well... the kernel is special.
  2. %global __spec_install_pre %{___build_pre}
  3.  
  4. Summary: The Linux kernel
  5.  
  6. # For a stable, released kernel, released_kernel should be 1. For rawhide
  7. # and/or a kernel built from an rc or git snapshot, released_kernel should
  8. # be 0.
  9. %global released_kernel 1
  10.  
  11. # Sign modules on x86.  Make sure the config files match this setting if more
  12. # architectures are added.
  13. %ifarch %{ix86} x86_64
  14. %global signmodules 1
  15. %else
  16. %global signmodules 0
  17. %endif
  18.  
  19. # Save original buildid for later if it's defined
  20. %if 0%{?buildid:1}
  21. %global orig_buildid %{buildid}
  22. %undefine buildid
  23. %endif
  24.  
  25. ###################################################################
  26. # Polite request for people who spin their own kernel rpms:
  27. # please modify the "buildid" define in a way that identifies
  28. # that the kernel isn't the stock distribution kernel, for example,
  29. # by setting the define to ".local" or ".bz123456". This will be
  30. # appended to the full kernel version.
  31. #
  32. # (Uncomment the '#' and both spaces below to set the buildid.)
  33. #
  34. %define buildid .cust_edition
  35. ###################################################################
  36.  
  37. # The buildid can also be specified on the rpmbuild command line
  38. # by adding --define="buildid .whatever". If both the specfile and
  39. # the environment define a buildid they will be concatenated together.
  40. %if 0%{?orig_buildid:1}
  41. %if 0%{?buildid:1}
  42. %global srpm_buildid %{buildid}
  43. %define buildid %{srpm_buildid}%{orig_buildid}
  44. %else
  45. %define buildid %{orig_buildid}
  46. %endif
  47. %endif
  48.  
  49. # baserelease defines which build revision of this kernel version we're
  50. # building.  We used to call this fedora_build, but the magical name
  51. # baserelease is matched by the rpmdev-bumpspec tool, which you should use.
  52. #
  53. # We used to have some extra magic weirdness to bump this automatically,
  54. # but now we don't.  Just use: rpmdev-bumpspec -c 'comment for changelog'
  55. # When changing base_sublevel below or going from rc to a final kernel,
  56. # reset this by hand to 1 (or to 0 and then use rpmdev-bumpspec).
  57. # scripts/rebase.sh should be made to do that for you, actually.
  58. #
  59. # NOTE: baserelease must be > 0 or bad things will happen if you switch
  60. #       to a released kernel (released version will be < rc version)
  61. #
  62. # For non-released -rc kernels, this will be appended after the rcX and
  63. # gitX tags, so a 3 here would become part of release "0.rcX.gitX.3"
  64. #
  65. %global baserelease 301
  66. %global fedora_build %{baserelease}
  67.  
  68. # base_sublevel is the kernel version we're starting with and patching
  69. # on top of -- for example, 3.1-rc7-git1 starts with a 3.0 base,
  70. # which yields a base_sublevel of 0.
  71. %define base_sublevel 11
  72.  
  73. ## If this is a released kernel ##
  74. %if 0%{?released_kernel}
  75.  
  76. # Do we have a -stable update to apply?
  77. %define stable_update 10
  78. # Is it a -stable RC?
  79. %define stable_rc 0
  80. # Set rpm version accordingly
  81. %if 0%{?stable_update}
  82. %define stablerev %{stable_update}
  83. %define stable_base %{stable_update}
  84. %if 0%{?stable_rc}
  85. # stable RCs are incremental patches, so we need the previous stable patch
  86. %define stable_base %(echo $((%{stable_update} - 1)))
  87. %endif
  88. %endif
  89. %define rpmversion 3.%{base_sublevel}.%{stable_update}
  90.  
  91. ## The not-released-kernel case ##
  92. %else
  93. # The next upstream release sublevel (base_sublevel+1)
  94. %define upstream_sublevel %(echo $((%{base_sublevel} + 1)))
  95. # The rc snapshot level
  96. %define rcrev 0
  97. # The git snapshot level
  98. %define gitrev 0
  99. # Set rpm version accordingly
  100. %define rpmversion 3.%{upstream_sublevel}.0
  101. %endif
  102. # Nb: The above rcrev and gitrev values automagically define Patch00 and Patch01 below.
  103.  
  104. # What parts do we want to build?  We must build at least one kernel.
  105. # These are the kernels that are built IF the architecture allows it.
  106. # All should default to 1 (enabled) and be flipped to 0 (disabled)
  107. # by later arch-specific checks.
  108.  
  109. # The following build options are enabled by default.
  110. # Use either --without <opt> in your rpmbuild command or force values
  111. # to 0 in here to disable them.
  112. #
  113. # standard kernel
  114. %define with_up        %{?_without_up:        0} %{?!_without_up:        1}
  115. # kernel-smp (only valid for ppc 32-bit)
  116. %define with_smp       %{?_without_smp:       0} %{?!_without_smp:       1}
  117. # kernel PAE (only valid for i686 (PAE) and ARM (lpae))
  118. %define with_pae       %{?_without_pae:       0} %{?!_without_pae:       1}
  119. # kernel-debug
  120. %define with_debug     %{?_without_debug:     0} %{?!_without_debug:     1}
  121. # kernel-doc
  122. %define with_doc       %{?_without_doc:       0} %{?!_without_doc:       1}
  123. # kernel-headers
  124. %define with_headers   %{?_without_headers:   0} %{?!_without_headers:   1}
  125. # kernel-modules-extra
  126. %define with_extra     %{?_without_extra:     0} %{?!_without_extra:     1}
  127. # perf
  128. %define with_perf      %{?_without_perf:      0} %{?!_without_perf:      1}
  129. # tools
  130. %define with_tools     %{?_without_tools:     0} %{?!_without_tools:     1}
  131. # kernel-debuginfo
  132. %define with_debuginfo %{?_without_debuginfo: 0} %{?!_without_debuginfo: 1}
  133. # kernel-bootwrapper (for creating zImages from kernel + initrd)
  134. %define with_bootwrapper %{?_without_bootwrapper: 0} %{?!_without_bootwrapper: 1}
  135. # Want to build a the vsdo directories installed
  136. %define with_vdso_install %{?_without_vdso_install: 0} %{?!_without_vdso_install: 1}
  137. #
  138. # Additional options for user-friendly one-off kernel building:
  139. #
  140. # Only build the base kernel (--with baseonly):
  141. %define with_baseonly  %{?_with_baseonly:     1} %{?!_with_baseonly:     0}
  142. # Only build the smp kernel (--with smponly):
  143. %define with_smponly   %{?_with_smponly:      1} %{?!_with_smponly:      0}
  144. # Only build the pae kernel (--with paeonly):
  145. %define with_paeonly   %{?_with_paeonly:      1} %{?!_with_paeonly:      0}
  146. # Only build the debug kernel (--with dbgonly):
  147. %define with_dbgonly   %{?_with_dbgonly:      1} %{?!_with_dbgonly:      0}
  148. #
  149. # should we do C=1 builds with sparse
  150. %define with_sparse    %{?_with_sparse:       1} %{?!_with_sparse:       0}
  151. #
  152. # Cross compile requested?
  153. %define with_cross    %{?_with_cross:         1} %{?!_with_cross:        0}
  154. #
  155. # build a release kernel on rawhide
  156. %define with_release   %{?_with_release:      1} %{?!_with_release:      0}
  157.  
  158. # Set debugbuildsenabled to 1 for production (build separate debug kernels)
  159. #  and 0 for rawhide (all kernels are debug kernels).
  160. # See also 'make debug' and 'make release'.
  161. %define debugbuildsenabled 1
  162.  
  163. # Want to build a vanilla kernel build without any non-upstream patches?
  164. %define with_vanilla %{?_with_vanilla: 1} %{?!_with_vanilla: 0}
  165.  
  166. # Build the kernel-doc package, but don't fail the build if it botches.
  167. # Here "true" means "continue" and "false" means "fail the build".
  168. %if 0%{?released_kernel}
  169. %define doc_build_fail false
  170. %else
  171. %define doc_build_fail true
  172. %endif
  173.  
  174. %define rawhide_skip_docs 0
  175. %if 0%{?rawhide_skip_docs}
  176. %define with_doc 0
  177. %define doc_build_fail true
  178. %endif
  179.  
  180. # pkg_release is what we'll fill in for the rpm Release: field
  181. %if 0%{?released_kernel}
  182.  
  183. %if 0%{?stable_rc}
  184. %define stable_rctag .rc%{stable_rc}
  185. %define pkg_release 0%{stable_rctag}.%{fedora_build}%{?buildid}%{?dist}
  186. %else
  187. %define pkg_release %{fedora_build}%{?buildid}%{?dist}
  188. %endif
  189.  
  190. %else
  191.  
  192. # non-released_kernel
  193. %if 0%{?rcrev}
  194. %define rctag .rc%rcrev
  195. %else
  196. %define rctag .rc0
  197. %endif
  198. %if 0%{?gitrev}
  199. %define gittag .git%gitrev
  200. %else
  201. %define gittag .git0
  202. %endif
  203. %define pkg_release 0%{?rctag}%{?gittag}.%{fedora_build}%{?buildid}%{?dist}
  204.  
  205. %endif
  206.  
  207. # The kernel tarball/base version
  208. %define kversion 3.%{base_sublevel}
  209.  
  210. %define make_target bzImage
  211.  
  212. %define KVERREL %{version}-%{release}.%{_target_cpu}
  213. %define hdrarch %_target_cpu
  214. %define asmarch %_target_cpu
  215.  
  216. %if 0%{!?nopatches:1}
  217. %define nopatches 0
  218. %endif
  219.  
  220. %if %{with_vanilla}
  221. %define nopatches 1
  222. %endif
  223.  
  224. %if %{nopatches}
  225. %define with_bootwrapper 0
  226. %define variant -vanilla
  227. %else
  228. %define variant_fedora -fedora
  229. %endif
  230.  
  231. %define using_upstream_branch 0
  232. %if 0%{?upstream_branch:1}
  233. %define stable_update 0
  234. %define using_upstream_branch 1
  235. %define variant -%{upstream_branch}%{?variant_fedora}
  236. %define pkg_release 0.%{fedora_build}%{upstream_branch_tag}%{?buildid}%{?dist}
  237. %endif
  238.  
  239. %if !%{debugbuildsenabled}
  240. %define with_debug 0
  241. %endif
  242.  
  243. %if !%{with_debuginfo}
  244. %define _enable_debug_packages 0
  245. %endif
  246. %define debuginfodir /usr/lib/debug
  247.  
  248. # kernel PAE is only built on i686 and ARMv7.
  249. %ifnarch i686 armv7hl
  250. %define with_pae 0
  251. %endif
  252.  
  253. # if requested, only build base kernel
  254. %if %{with_baseonly}
  255. %define with_smp 0
  256. %define with_pae 0
  257. %define with_debug 0
  258. %endif
  259.  
  260. # if requested, only build smp kernel
  261. %if %{with_smponly}
  262. %define with_up 0
  263. %define with_pae 0
  264. %define with_debug 0
  265. %endif
  266.  
  267. # if requested, only build pae kernel
  268. %if %{with_paeonly}
  269. %define with_up 0
  270. %define with_smp 0
  271. %define with_debug 0
  272. %endif
  273.  
  274. # if requested, only build debug kernel
  275. %if %{with_dbgonly}
  276. %if %{debugbuildsenabled}
  277. %define with_up 0
  278. %define with_pae 0
  279. %endif
  280. %define with_smp 0
  281. %define with_pae 0
  282. %define with_tools 0
  283. %define with_perf 0
  284. %endif
  285.  
  286. %define all_x86 i386 i686
  287.  
  288. %if %{with_vdso_install}
  289. # These arches install vdso/ directories.
  290. %define vdso_arches %{all_x86} x86_64 ppc ppc64 ppc64p7 s390 s390x aarch64
  291. %endif
  292.  
  293. # Overrides for generic default options
  294.  
  295. # only ppc needs a separate smp kernel
  296. %ifnarch ppc
  297. %define with_smp 0
  298. %endif
  299.  
  300. # don't do debug builds on anything but i686 and x86_64
  301. %ifnarch i686 x86_64
  302. %define with_debug 0
  303. %endif
  304.  
  305. # only package docs noarch
  306. %ifnarch noarch
  307. %define with_doc 0
  308. %endif
  309.  
  310. # don't build noarch kernels or headers (duh)
  311. %ifarch noarch
  312. %define with_up 0
  313. %define with_headers 0
  314. %define with_tools 0
  315. %define with_perf 0
  316. %define all_arch_configs kernel-%{version}-*.config
  317. %endif
  318.  
  319. # bootwrapper is only on ppc
  320. %ifnarch ppc ppc64 ppc64p7
  321. %define with_bootwrapper 0
  322. %endif
  323.  
  324. # sparse blows up on ppc64 and sparc64
  325. %ifarch ppc64 ppc ppc64p7
  326. %define with_sparse 0
  327. %endif
  328.  
  329. # Per-arch tweaks
  330.  
  331. %ifarch %{all_x86}
  332. %define asmarch x86
  333. %define hdrarch i386
  334. %define pae PAE
  335. %define all_arch_configs kernel-%{version}-i?86*.config
  336. %define image_install_path boot
  337. %define kernel_image arch/x86/boot/bzImage
  338. %endif
  339.  
  340. %ifarch x86_64
  341. %define asmarch x86
  342. %define all_arch_configs kernel-%{version}-x86_64*.config
  343. %define image_install_path boot
  344. %define kernel_image arch/x86/boot/bzImage
  345. %endif
  346.  
  347. %ifarch ppc64 ppc64p7
  348. %define asmarch powerpc
  349. %define hdrarch powerpc
  350. %define all_arch_configs kernel-%{version}-ppc64*.config
  351. %define image_install_path boot
  352. %define make_target vmlinux
  353. %define kernel_image vmlinux
  354. %define kernel_image_elf 1
  355. %endif
  356.  
  357. %ifarch s390x
  358. %define asmarch s390
  359. %define hdrarch s390
  360. %define all_arch_configs kernel-%{version}-s390x.config
  361. %define image_install_path boot
  362. %define make_target image
  363. %define kernel_image arch/s390/boot/image
  364. %define with_tools 0
  365. %endif
  366.  
  367. %ifarch ppc
  368. %define asmarch powerpc
  369. %define hdrarch powerpc
  370. %define all_arch_configs kernel-%{version}-ppc{-,.}*config
  371. %define image_install_path boot
  372. %define make_target vmlinux
  373. %define kernel_image vmlinux
  374. %define kernel_image_elf 1
  375. %endif
  376.  
  377. %ifarch %{arm}
  378. %define all_arch_configs kernel-%{version}-arm*.config
  379. %define image_install_path boot
  380. %define asmarch arm
  381. %define hdrarch arm
  382. %define pae lpae
  383. %define make_target bzImage
  384. %define kernel_image arch/arm/boot/zImage
  385. # http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/091404.html
  386. %define kernel_mflags KALLSYMS_EXTRA_PASS=1
  387. # we only build headers/perf/tools on the base arm arches
  388. # just like we used to only build them on i386 for x86
  389. %ifnarch armv7hl
  390. %define with_headers 0
  391. %define with_perf 0
  392. %define with_tools 0
  393. %endif
  394. %endif
  395.  
  396. %ifarch aarch64
  397. %define all_arch_configs kernel-%{version}-arm64.config
  398. %define asmarch arm64
  399. %define hdrarch arm64
  400. %define make_target Image.gz
  401. %define kernel_image arch/arm64/boot/Image.gz
  402. %define image_install_path boot
  403. %endif
  404.  
  405. # Should make listnewconfig fail if there's config options
  406. # printed out?
  407. %if %{nopatches}%{using_upstream_branch}
  408. %define listnewconfig_fail 0
  409. %else
  410. %define listnewconfig_fail 1
  411. %endif
  412.  
  413. # To temporarily exclude an architecture from being built, add it to
  414. # %%nobuildarches. Do _NOT_ use the ExclusiveArch: line, because if we
  415. # don't build kernel-headers then the new build system will no longer let
  416. # us use the previous build of that package -- it'll just be completely AWOL.
  417. # Which is a BadThing(tm).
  418.  
  419. # We only build kernel-headers on the following...
  420. %define nobuildarches i386 s390
  421.  
  422. %ifarch %nobuildarches
  423. %define with_up 0
  424. %define with_smp 0
  425. %define with_pae 0
  426. %define with_debuginfo 0
  427. %define with_perf 0
  428. %define with_tools 0
  429. %define _enable_debug_packages 0
  430. %endif
  431.  
  432. %define with_pae_debug 0
  433. %if %{with_pae}
  434. %define with_pae_debug %{with_debug}
  435. %endif
  436.  
  437. # Architectures we build tools/cpupower on
  438. %define cpupowerarchs %{ix86} x86_64 ppc ppc64 ppc64p7 %{arm} aarch64
  439.  
  440. #
  441. # Packages that need to be installed before the kernel is, because the %%post
  442. # scripts use them.
  443. #
  444. %define kernel_prereq  fileutils, systemd >= 203-2
  445. %define initrd_prereq  dracut >= 027
  446.  
  447. #
  448. # This macro does requires, provides, conflicts, obsoletes for a kernel package.
  449. #   %%kernel_reqprovconf <subpackage>
  450. # It uses any kernel_<subpackage>_conflicts and kernel_<subpackage>_obsoletes
  451. # macros defined above.
  452. #
  453. %define kernel_reqprovconf \
  454. Provides: kernel = %{rpmversion}-%{pkg_release}\
  455. Provides: kernel-%{_target_cpu} = %{rpmversion}-%{pkg_release}%{?1:+%{1}}\
  456. Provides: kernel-drm = 4.3.0\
  457. Provides: kernel-drm-nouveau = 16\
  458. Provides: kernel-modeset = 1\
  459. Provides: kernel-uname-r = %{KVERREL}%{?1:+%{1}}\
  460. Provides: kernel-highbank\
  461. Provides: kernel-highbank-uname-r = %{KVERREL}%{?1:+%{1}}\
  462. Provides: kernel-omap\
  463. Provides: kernel-omap-uname-r = %{KVERREL}%{?1:+%{1}}\
  464. Provides: kernel-tegra\
  465. Provides: kernel-tegra-uname-r = %{KVERREL}%{?1:+%{1}}\
  466. Requires(pre): %{kernel_prereq}\
  467. Requires(pre): %{initrd_prereq}\
  468. Requires(pre): linux-firmware >= 20130724-29.git31f6b30\
  469. Requires(preun): systemd >= 200\
  470. %{expand:%%{?kernel%{?1:_%{1}}_conflicts:Conflicts: %%{kernel%{?1:_%{1}}_conflicts}}}\
  471. %{expand:%%{?kernel%{?1:_%{1}}_obsoletes:Obsoletes: %%{kernel%{?1:_%{1}}_obsoletes}}}\
  472. %{expand:%%{?kernel%{?1:_%{1}}_provides:Provides: %%{kernel%{?1:_%{1}}_provides}}}\
  473. # We can't let RPM do the dependencies automatic because it'll then pick up\
  474. # a correct but undesirable perl dependency from the module headers which\
  475. # isn't required for the kernel proper to function\
  476. AutoReq: no\
  477. AutoProv: yes\
  478. %{nil}
  479.  
  480. Name: kernel%{?variant}
  481. Group: System Environment/Kernel
  482. License: GPLv2 and Redistributable, no modification permitted
  483. URL: http://www.kernel.org/
  484. Version: %{rpmversion}
  485. Release: %{pkg_release}
  486. # DO NOT CHANGE THE 'ExclusiveArch' LINE TO TEMPORARILY EXCLUDE AN ARCHITECTURE BUILD.
  487. # SET %%nobuildarches (ABOVE) INSTEAD
  488. ExclusiveArch: noarch %{all_x86} x86_64 ppc ppc64 ppc64p7 s390 s390x %{arm} aarch64
  489. ExclusiveOS: Linux
  490.  
  491. %kernel_reqprovconf
  492.  
  493. #
  494. # List the packages used during the kernel build
  495. #
  496. BuildRequires: module-init-tools, patch >= 2.5.4, bash >= 2.03, sh-utils, tar
  497. BuildRequires: bzip2, xz, findutils, gzip, m4, perl, perl-Carp, make >= 3.78, diffutils, gawk
  498. BuildRequires: gcc >= 3.4.2, binutils >= 2.12, redhat-rpm-config, hmaccalc
  499. BuildRequires: net-tools, hostname, bc
  500. BuildRequires: xmlto, asciidoc
  501. %if %{with_sparse}
  502. BuildRequires: sparse >= 0.4.1
  503. %endif
  504. %if %{with_perf}
  505. BuildRequires: elfutils-devel zlib-devel binutils-devel newt-devel python-devel perl(ExtUtils::Embed) bison
  506. BuildRequires: audit-libs-devel
  507. %endif
  508. %if %{with_tools}
  509. BuildRequires: pciutils-devel gettext
  510. %endif
  511. BuildConflicts: rhbuildsys(DiskFree) < 500Mb
  512. %if %{with_debuginfo}
  513. # Fancy new debuginfo generation introduced in Fedora 8/RHEL 6.
  514. # The -r flag to find-debuginfo.sh invokes eu-strip --reloc-debug-sections
  515. # which reduces the number of relocations in kernel module .ko.debug files and
  516. # was introduced with rpm 4.9 and elfutils 0.153.
  517. BuildRequires: rpm-build >= 4.9.0-1, elfutils >= elfutils-0.153-1
  518. %define debuginfo_args --strict-build-id -r
  519. %endif
  520.  
  521. %if %{signmodules}
  522. BuildRequires: openssl
  523. BuildRequires: pesign >= 0.10-4
  524. %endif
  525.  
  526. %if %{with_cross}
  527. BuildRequires: binutils-%{_build_arch}-linux-gnu, gcc-%{_build_arch}-linux-gnu
  528. %define cross_opts CROSS_COMPILE=%{_build_arch}-linux-gnu-
  529. %endif
  530.  
  531. Source0: ftp://ftp.kernel.org/pub/linux/kernel/v3.0/linux-%{kversion}.tar.xz
  532.  
  533. Source11: x509.genkey
  534.  
  535. Source15: merge.pl
  536. Source16: mod-extra.list
  537. Source17: mod-extra.sh
  538. Source18: mod-sign.sh
  539. %define modsign_cmd %{SOURCE18}
  540.  
  541. Source19: Makefile.release
  542. Source20: Makefile.config
  543. Source21: config-debug
  544. Source22: config-nodebug
  545. Source23: config-generic
  546.  
  547. Source30: config-x86-generic
  548. Source31: config-i686-PAE
  549. Source32: config-x86-32-generic
  550.  
  551. Source40: config-x86_64-generic
  552.  
  553. Source50: config-powerpc-generic
  554. Source51: config-powerpc32-generic
  555. Source52: config-powerpc32-smp
  556. Source53: config-powerpc64
  557. Source54: config-powerpc64p7
  558.  
  559. Source70: config-s390x
  560.  
  561. Source100: config-arm-generic
  562.  
  563. # Unified ARM kernels
  564. Source101: config-armv7-generic
  565. Source102: config-armv7
  566. Source103: config-armv7-lpae
  567.  
  568. Source110: config-arm64
  569.  
  570. # This file is intentionally left empty in the stock kernel. Its a nicety
  571. # added for those wanting to do custom rebuilds with altered config opts.
  572. Source1000: config-local
  573.  
  574. # Sources for kernel-tools
  575. Source2000: cpupower.service
  576. Source2001: cpupower.config
  577.  
  578. # Here should be only the patches up to the upstream canonical Linus tree.
  579.  
  580. # For a stable release kernel
  581. %if 0%{?stable_update}
  582. %if 0%{?stable_base}
  583. %define    stable_patch_00  patch-3.%{base_sublevel}.%{stable_base}.xz
  584. Patch00: %{stable_patch_00}
  585. %endif
  586. %if 0%{?stable_rc}
  587. %define    stable_patch_01  patch-3.%{base_sublevel}.%{stable_update}-rc%{stable_rc}.xz
  588. Patch01: %{stable_patch_01}
  589. %endif
  590.  
  591. # non-released_kernel case
  592. # These are automagically defined by the rcrev and gitrev values set up
  593. # near the top of this spec file.
  594. %else
  595. %if 0%{?rcrev}
  596. Patch00: patch-3.%{upstream_sublevel}-rc%{rcrev}.xz
  597. %if 0%{?gitrev}
  598. Patch01: patch-3.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev}.xz
  599. %endif
  600. %else
  601. # pre-{base_sublevel+1}-rc1 case
  602. %if 0%{?gitrev}
  603. Patch00: patch-3.%{base_sublevel}-git%{gitrev}.xz
  604. %endif
  605. %endif
  606. %endif
  607.  
  608. %if %{using_upstream_branch}
  609. ### BRANCH PATCH ###
  610. %endif
  611.  
  612. # we also need compile fixes for -vanilla
  613. Patch04: compile-fixes.patch
  614.  
  615. # build tweak for build ID magic, even for -vanilla
  616. Patch05: makefile-after_link.patch
  617.  
  618. %if !%{nopatches}
  619.  
  620.  
  621. # revert upstream patches we get via other methods
  622. Patch09: upstream-reverts.patch
  623. # Git trees.
  624.  
  625. # Standalone patches
  626.  
  627. #drop with next rebase
  628. Patch100: taint-vbox.patch
  629.  
  630. #drop with next rebase
  631. Patch110: vmbugon-warnon.patch
  632.  
  633. #drop with next rebase
  634. Patch201: debug-bad-pte-modules.patch
  635.  
  636. Patch390: defaults-acpi-video.patch
  637. Patch396: acpi-sony-nonvs-blacklist.patch
  638.  
  639. Patch450: input-kill-stupid-messages.patch
  640. Patch452: no-pcspkr-modalias.patch
  641.  
  642. Patch460: serial-460800.patch
  643.  
  644. Patch470: die-floppy-die.patch
  645.  
  646. Patch510: silence-noise.patch
  647. Patch530: silence-fbcon-logo.patch
  648.  
  649. Patch800: crash-driver.patch
  650.  
  651. # crypto/
  652.  
  653. # keys
  654. Patch900: keys-expand-keyring.patch
  655. Patch901: keys-krb-support.patch
  656. Patch902: keys-x509-improv.patch
  657. Patch903: keys-fixes.patch
  658.  
  659. # secure boot
  660. Patch1000: secure-modules.patch
  661. Patch1001: modsign-uefi.patch
  662. Patch1002: sb-hibernate.patch
  663. Patch1003: sysrq-secure-boot.patch
  664.  
  665. # virt + ksm patches
  666.  
  667. # DRM
  668.  
  669. # nouveau + drm fixes
  670. # intel drm is all merged upstream
  671. Patch1824: drm-intel-next.patch
  672. Patch1825: drm-i915-dp-stfu.patch
  673. Patch1826: drm-i915-hush-check-crtc-state.patch
  674.  
  675. # Quiet boot fixes
  676. # silence the ACPI blacklist code
  677. Patch2802: silence-acpi-blacklist.patch
  678.  
  679. # media patches
  680. Patch2899: v4l-dvb-fixes.patch
  681. Patch2900: v4l-dvb-update.patch
  682. Patch2901: v4l-dvb-experimental.patch
  683.  
  684. # fs fixes
  685.  
  686. # NFSv4
  687.  
  688. # patches headed upstream
  689. Patch10000: fs-proc-devtree-remove_proc_entry.patch
  690.  
  691. Patch12016: disable-i8042-check-on-apple-mac.patch
  692.  
  693. Patch14000: hibernate-freeze-filesystems.patch
  694.  
  695. Patch14010: lis3-improve-handling-of-null-rate.patch
  696.  
  697. Patch15000: nowatchdog-on-virt.patch
  698.  
  699. # ARM64
  700.  
  701. # ARM
  702.  
  703. # lpae
  704. Patch21001: arm-lpae-ax88796.patch
  705. Patch21004: arm-sound-soc-samsung-dma-avoid-another-64bit-division.patch
  706. Patch21005: arm-exynos-mp.patch
  707. Patch21006: arm-highbank-for-3.12.patch
  708.  
  709. # ARM omap
  710. Patch21010: arm-omap-load-tfp410.patch
  711.  
  712. # ARM tegra
  713. Patch21020: arm-tegra-usb-no-reset-linux33.patch
  714.  
  715. # ARM wandboard
  716. Patch21030: arm-wandboard-quad.patch
  717. # https://git.kernel.org/cgit/linux/kernel/git/broonie/sound.git/patch/?id=3f1a91aa25579ba5e7268a47a73d2a83e4802c62
  718.  
  719. # AM33xx
  720. Patch21100: am335x-bone.patch
  721.  
  722. #rhbz 754518
  723. Patch21235: scsi-sd_revalidate_disk-prevent-NULL-ptr-deref.patch
  724.  
  725. # https://fedoraproject.org/wiki/Features/Checkpoint_Restore
  726. Patch21242: criu-no-expert.patch
  727.  
  728. #rhbz 892811
  729. Patch21247: ath9k_rx_dma_stop_check.patch
  730.  
  731. Patch22000: weird-root-dentry-name-debug.patch
  732.  
  733. #rhbz 927469
  734. Patch23006: fix-child-thread-introspection.patch
  735.  
  736. Patch25047: drm-radeon-Disable-writeback-by-default-on-ppc.patch
  737.  
  738. #rhbz 977040
  739. Patch25056: iwl3945-better-skb-management-in-rx-path.patch
  740. Patch25057: iwl4965-better-skb-management-in-rx-path.patch
  741.  
  742. #rhbz 963715
  743. Patch25077: media-cx23885-Fix-TeVii-S471-regression-since-introduction-of-ts2020.patch
  744.  
  745. #rhbz 985522
  746. Patch25107: ntp-Make-periodic-RTC-update-more-reliable.patch
  747.  
  748. #rhbz 971893
  749. Patch25109: bonding-driver-alb-learning.patch
  750.  
  751. #rhbz 902012
  752. Patch25114: elevator-Fix-a-race-in-elevator-switching-and-md.patch
  753. Patch25115: elevator-acquire-q-sysfs_lock-in-elevator_change.patch
  754.  
  755. #rhbz 974072
  756. Patch25117: rt2800-add-support-for-rf3070.patch
  757.  
  758. #rhbz 1015989
  759. Patch25122: netfilter-nf_conntrack-use-RCU-safe-kfree-for-conntr.patch
  760.  
  761. #rhbz 982153
  762. Patch25123: iommu-Remove-stack-trace-from-broken-irq-remapping-warning.patch
  763.  
  764. #rhbz 998732
  765. Patch25125: vfio-iommu-Fixed-interaction-of-VFIO_IOMMU_MAP_DMA.patch
  766.  
  767. #rhbz 896695
  768. Patch25126: 0001-iwlwifi-don-t-WARN-on-host-commands-sent-when-firmwa.patch
  769. Patch25127: 0002-iwlwifi-don-t-WARN-on-bad-firmware-state.patch
  770.  
  771. #rhbz 993744
  772. Patch25128: dm-cache-policy-mq_fix-large-scale-table-allocation-bug.patch
  773.  
  774. #rhbz 1000439
  775. Patch25129: cpupower-Fix-segfault-due-to-incorrect-getopt_long-a.patch
  776.  
  777. #rhbz 1010679
  778. Patch25130: fix-radeon-sound.patch
  779. Patch25149: drm-radeon-24hz-audio-fixes.patch
  780.  
  781. #rhbz 984696
  782. Patch25132: rt2800usb-slow-down-TX-status-polling.patch
  783.  
  784. #rhbz 1023413
  785. Patch25135: alps-Support-for-Dell-XT2-model.patch
  786.  
  787. #rhbz 1011621
  788. Patch25137: cifs-Allow-LANMAN-auth-for-unencapsulated-auth-methods.patch
  789.  
  790. #rhbz 1025769
  791. Patch25142: iwlwifi-dvm-dont-override-mac80211-queue-setting.patch
  792.  
  793. Patch25143: drm-qxl-backport-fixes-for-Fedora.patch
  794. Patch25160: drm-qxl-fix-memory-leak-in-release-list-handling.patch
  795.  
  796. Patch25144: Input-evdev-fall-back-to-vmalloc-for-client-event-buffer.patch
  797.  
  798. #CVE-2013-4563 rhbz 1030015 1030017
  799. Patch25145: ipv6-fix-headroom-calculation-in-udp6_ufo_fragment.patch
  800.  
  801. #rhbz 1015905
  802. Patch25146: 0001-ip6_output-fragment-outgoing-reassembled-skb-properl.patch
  803. Patch25147: 0002-netfilter-push-reasm-skb-through-instead-of-original.patch
  804.  
  805. #rhbz 1011362
  806. Patch25148: alx-Reset-phy-speed-after-resume.patch
  807.  
  808. #rhbz 1031086
  809. Patch25150: slab_common-Do-not-check-for-duplicate-slab-names.patch
  810.  
  811. #rhbz 967652
  812. Patch25151: KVM-x86-fix-emulation-of-movzbl-bpl-eax.patch
  813.  
  814. # Fix 15sec NFS mount delay
  815. Patch25152: sunrpc-create-a-new-dummy-pipe-for-gssd-to-hold-open.patch
  816. Patch25153: sunrpc-replace-gssd_running-with-more-reliable-check.patch
  817. Patch25154: nfs-check-gssd-running-before-krb5i-auth.patch
  818.  
  819. #CVE-2013-6382 rhbz 1033603 1034670
  820. Patch25157: xfs-underflow-bug-in-xfs_attrlist_by_handle.patch
  821.  
  822. #rhbz 1022733
  823. Patch25158: via-velocity-fix-netif_receive_skb-use-in-irq-disable.patch
  824.  
  825. #rhbz 998342
  826. Patch25159: usbnet-fix-status-interrupt-urb-handling.patch
  827.  
  828. #CVE-2013-6405 rhbz 1035875 1035887
  829. Patch25161: inet-prevent-leakage-of-uninitialized-memory-to-user.patch
  830. Patch25162: inet-fix-addr_len-msg_namelen-assignment-in-recv_error-and-rxpmtu-functions.patch
  831.  
  832. #rhbz 958826
  833. Patch25164: dell-laptop.patch
  834.  
  835. # END OF PATCH DEFINITIONS
  836.  
  837. %endif
  838.  
  839. BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
  840.  
  841. %description
  842. The kernel package contains the Linux kernel (vmlinuz), the core of any
  843. Linux operating system.  The kernel handles the basic functions
  844. of the operating system: memory allocation, process allocation, device
  845. input and output, etc.
  846.  
  847.  
  848. %package doc
  849. Summary: Various documentation bits found in the kernel source
  850. Group: Documentation
  851. %description doc
  852. This package contains documentation files from the kernel
  853. source. Various bits of information about the Linux kernel and the
  854. device drivers shipped with it are documented in these files.
  855.  
  856. You'll want to install this package if you need a reference to the
  857. options that can be passed to Linux kernel modules at load time.
  858.  
  859.  
  860. %package headers
  861. Summary: Header files for the Linux kernel for use by glibc
  862. Group: Development/System
  863. Obsoletes: glibc-kernheaders < 3.0-46
  864. Provides: glibc-kernheaders = 3.0-46
  865. %description headers
  866. Kernel-headers includes the C header files that specify the interface
  867. between the Linux kernel and userspace libraries and programs.  The
  868. header files define structures and constants that are needed for
  869. building most standard programs and are also needed for rebuilding the
  870. glibc package.
  871.  
  872. %package bootwrapper
  873. Summary: Boot wrapper files for generating combined kernel + initrd images
  874. Group: Development/System
  875. Requires: gzip binutils
  876. %description bootwrapper
  877. Kernel-bootwrapper contains the wrapper code which makes bootable "zImage"
  878. files combining both kernel and initial ramdisk.
  879.  
  880. %package debuginfo-common-%{_target_cpu}
  881. Summary: Kernel source files used by %{name}-debuginfo packages
  882. Group: Development/Debug
  883. %description debuginfo-common-%{_target_cpu}
  884. This package is required by %{name}-debuginfo subpackages.
  885. It provides the kernel source files common to all builds.
  886.  
  887. %if %{with_perf}
  888. %package -n perf
  889. Summary: Performance monitoring for the Linux kernel
  890. Group: Development/System
  891. License: GPLv2
  892. %description -n perf
  893. This package contains the perf tool, which enables performance monitoring
  894. of the Linux kernel.
  895.  
  896. %package -n perf-debuginfo
  897. Summary: Debug information for package perf
  898. Group: Development/Debug
  899. Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
  900. AutoReqProv: no
  901. %description -n perf-debuginfo
  902. This package provides debug information for the perf package.
  903.  
  904. # Note that this pattern only works right to match the .build-id
  905. # symlinks because of the trailing nonmatching alternation and
  906. # the leading .*, because of find-debuginfo.sh's buggy handling
  907. # of matching the pattern against the symlinks file.
  908. %{expand:%%global debuginfo_args %{?debuginfo_args} -p '.*%%{_bindir}/perf(\.debug)?|.*%%{_libexecdir}/perf-core/.*|XXX' -o perf-debuginfo.list}
  909.  
  910. %package -n python-perf
  911. Summary: Python bindings for apps which will manipulate perf events
  912. Group: Development/Libraries
  913. %description -n python-perf
  914. The python-perf package contains a module that permits applications
  915. written in the Python programming language to use the interface
  916. to manipulate perf events.
  917.  
  918. %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
  919.  
  920. %package -n python-perf-debuginfo
  921. Summary: Debug information for package perf python bindings
  922. Group: Development/Debug
  923. Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
  924. AutoReqProv: no
  925. %description -n python-perf-debuginfo
  926. This package provides debug information for the perf python bindings.
  927.  
  928. # the python_sitearch macro should already be defined from above
  929. %{expand:%%global debuginfo_args %{?debuginfo_args} -p '.*%%{python_sitearch}/perf.so(\.debug)?|XXX' -o python-perf-debuginfo.list}
  930.  
  931.  
  932. %endif # with_perf
  933.  
  934. %if %{with_tools}
  935. %package -n kernel-tools
  936. Summary: Assortment of tools for the Linux kernel
  937. Group: Development/System
  938. License: GPLv2
  939. Provides:  cpupowerutils = 1:009-0.6.p1
  940. Obsoletes: cpupowerutils < 1:009-0.6.p1
  941. Provides:  cpufreq-utils = 1:009-0.6.p1
  942. Provides:  cpufrequtils = 1:009-0.6.p1
  943. Obsoletes: cpufreq-utils < 1:009-0.6.p1
  944. Obsoletes: cpufrequtils < 1:009-0.6.p1
  945. Obsoletes: cpuspeed < 1:1.5-16
  946. Requires: kernel-tools-libs = %{version}-%{release}
  947. %description -n kernel-tools
  948. This package contains the tools/ directory from the kernel source
  949. and the supporting documentation.
  950.  
  951. %package -n kernel-tools-libs
  952. Summary: Libraries for the kernels-tools
  953. Group: Development/System
  954. License: GPLv2
  955. %description -n kernel-tools-libs
  956. This package contains the libraries built from the tools/ directory
  957. from the kernel source.
  958.  
  959. %package -n kernel-tools-libs-devel
  960. Summary: Assortment of tools for the Linux kernel
  961. Group: Development/System
  962. License: GPLv2
  963. Requires: kernel-tools = %{version}-%{release}
  964. Provides:  cpupowerutils-devel = 1:009-0.6.p1
  965. Obsoletes: cpupowerutils-devel < 1:009-0.6.p1
  966. Requires: kernel-tools-libs = %{version}-%{release}
  967. Provides: kernel-tools-devel
  968. %description -n kernel-tools-libs-devel
  969. This package contains the development files for the tools/ directory from
  970. the kernel source.
  971.  
  972. %package -n kernel-tools-debuginfo
  973. Summary: Debug information for package kernel-tools
  974. Group: Development/Debug
  975. Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
  976. AutoReqProv: no
  977. %description -n kernel-tools-debuginfo
  978. This package provides debug information for package kernel-tools.
  979.  
  980. # Note that this pattern only works right to match the .build-id
  981. # symlinks because of the trailing nonmatching alternation and
  982. # the leading .*, because of find-debuginfo.sh's buggy handling
  983. # of matching the pattern against the symlinks file.
  984. %{expand:%%global debuginfo_args %{?debuginfo_args} -p '.*%%{_bindir}/centrino-decode(\.debug)?|.*%%{_bindir}/powernow-k8-decode(\.debug)?|.*%%{_bindir}/cpupower(\.debug)?|.*%%{_libdir}/libcpupower.*|.*%%{_bindir}/turbostat(\.debug)?|.*%%{_bindir}/x86_energy_perf_policy(\.debug)?|XXX' -o kernel-tools-debuginfo.list}
  985.  
  986. %endif # with_tools
  987.  
  988.  
  989. #
  990. # This macro creates a kernel-<subpackage>-debuginfo package.
  991. #   %%kernel_debuginfo_package <subpackage>
  992. #
  993. %define kernel_debuginfo_package() \
  994. %package %{?1:%{1}-}debuginfo\
  995. Summary: Debug information for package %{name}%{?1:-%{1}}\
  996. Group: Development/Debug\
  997. Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}\
  998. Provides: %{name}%{?1:-%{1}}-debuginfo-%{_target_cpu} = %{version}-%{release}\
  999. AutoReqProv: no\
  1000. %description -n %{name}%{?1:-%{1}}-debuginfo\
  1001. This package provides debug information for package %{name}%{?1:-%{1}}.\
  1002. This is required to use SystemTap with %{name}%{?1:-%{1}}-%{KVERREL}.\
  1003. %{expand:%%global debuginfo_args %{?debuginfo_args} -p '/.*/%%{KVERREL}%{?1:[+]%{1}}/.*|/.*%%{KVERREL}%{?1:\+%{1}}(\.debug)?' -o debuginfo%{?1}.list}\
  1004. %{nil}
  1005.  
  1006. #
  1007. # This macro creates a kernel-<subpackage>-devel package.
  1008. #   %%kernel_devel_package <subpackage> <pretty-name>
  1009. #
  1010. %define kernel_devel_package() \
  1011. %package %{?1:%{1}-}devel\
  1012. Summary: Development package for building kernel modules to match the %{?2:%{2} }kernel\
  1013. Group: System Environment/Kernel\
  1014. Provides: kernel%{?1:-%{1}}-devel-%{_target_cpu} = %{version}-%{release}\
  1015. Provides: kernel-devel-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
  1016. Provides: kernel-devel = %{version}-%{release}%{?1:+%{1}}\
  1017. Provides: kernel-devel-uname-r = %{KVERREL}%{?1:+%{1}}\
  1018. AutoReqProv: no\
  1019. Requires(pre): /usr/bin/find\
  1020. Requires: perl\
  1021. %description -n kernel%{?variant}%{?1:-%{1}}-devel\
  1022. This package provides kernel headers and makefiles sufficient to build modules\
  1023. against the %{?2:%{2} }kernel package.\
  1024. %{nil}
  1025.  
  1026. #
  1027. # This macro creates a kernel-<subpackage>-modules-extra package.
  1028. #   %%kernel_modules_extra_package <subpackage> <pretty-name>
  1029. #
  1030. %define kernel_modules_extra_package() \
  1031. %package %{?1:%{1}-}modules-extra\
  1032. Summary: Extra kernel modules to match the %{?2:%{2} }kernel\
  1033. Group: System Environment/Kernel\
  1034. Provides: kernel%{?1:-%{1}}-modules-extra-%{_target_cpu} = %{version}-%{release}\
  1035. Provides: kernel-modules-extra-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
  1036. Provides: kernel-modules-extra = %{version}-%{release}%{?1:+%{1}}\
  1037. Provides: installonlypkg(kernel-module)\
  1038. Provides: kernel-modules-extra-uname-r = %{KVERREL}%{?1:+%{1}}\
  1039. Requires: kernel-uname-r = %{KVERREL}%{?1:+%{1}}\
  1040. AutoReqProv: no\
  1041. %description -n kernel%{?variant}%{?1:-%{1}}-modules-extra\
  1042. This package provides less commonly used kernel modules for the %{?2:%{2} }kernel package.\
  1043. %{nil}
  1044.  
  1045. #
  1046. # This macro creates a kernel-<subpackage> and its -devel and -debuginfo too.
  1047. #   %%define variant_summary The Linux kernel compiled for <configuration>
  1048. #   %%kernel_variant_package [-n <pretty-name>] <subpackage>
  1049. #
  1050. %define kernel_variant_package(n:) \
  1051. %package %1\
  1052. Summary: %{variant_summary}\
  1053. Group: System Environment/Kernel\
  1054. %kernel_reqprovconf\
  1055. %{expand:%%kernel_devel_package %1 %{!?-n:%1}%{?-n:%{-n*}}}\
  1056. %if %{with_extra}\
  1057. %{expand:%%kernel_modules_extra_package %1 %{!?-n:%1}%{?-n:%{-n*}}}\
  1058. %endif\
  1059. %{expand:%%kernel_debuginfo_package %1}\
  1060. %{nil}
  1061.  
  1062.  
  1063. # First the auxiliary packages of the main kernel package.
  1064. %kernel_devel_package
  1065. %if %{with_extra}
  1066. %kernel_modules_extra_package
  1067. %endif
  1068. %kernel_debuginfo_package
  1069.  
  1070.  
  1071. # Now, each variant package.
  1072.  
  1073. %define variant_summary The Linux kernel compiled for SMP machines
  1074. %kernel_variant_package -n SMP smp
  1075. %description smp
  1076. This package includes a SMP version of the Linux kernel. It is
  1077. required only on machines with two or more CPUs as well as machines with
  1078. hyperthreading technology.
  1079.  
  1080. Install the kernel-smp package if your machine uses two or more CPUs.
  1081.  
  1082.  
  1083. %ifnarch armv7hl
  1084. %define variant_summary The Linux kernel compiled for PAE capable machines
  1085. %kernel_variant_package %{pae}
  1086. %description %{pae}
  1087. This package includes a version of the Linux kernel with support for up to
  1088. 64GB of high memory. It requires a CPU with Physical Address Extensions (PAE).
  1089. The non-PAE kernel can only address up to 4GB of memory.
  1090. Install the kernel-PAE package if your machine has more than 4GB of memory.
  1091. %else
  1092. %define variant_summary The Linux kernel compiled for Cortex-A15
  1093. %kernel_variant_package %{pae}
  1094. %description %{pae}
  1095. This package includes a version of the Linux kernel with support for
  1096. Cortex-A15 devices with LPAE and HW virtualisation support
  1097. %endif
  1098.  
  1099.  
  1100. %define variant_summary The Linux kernel compiled with extra debugging enabled for PAE capable machines
  1101. %kernel_variant_package %{pae}debug
  1102. Obsoletes: kernel-PAE-debug
  1103. %description %{pae}debug
  1104. This package includes a version of the Linux kernel with support for up to
  1105. 64GB of high memory. It requires a CPU with Physical Address Extensions (PAE).
  1106. The non-PAE kernel can only address up to 4GB of memory.
  1107. Install the kernel-PAE package if your machine has more than 4GB of memory.
  1108.  
  1109. This variant of the kernel has numerous debugging options enabled.
  1110. It should only be installed when trying to gather additional information
  1111. on kernel bugs, as some of these options impact performance noticably.
  1112.  
  1113.  
  1114. %define variant_summary The Linux kernel compiled with extra debugging enabled
  1115. %kernel_variant_package debug
  1116. %description debug
  1117. The kernel package contains the Linux kernel (vmlinuz), the core of any
  1118. Linux operating system.  The kernel handles the basic functions
  1119. of the operating system:  memory allocation, process allocation, device
  1120. input and output, etc.
  1121.  
  1122. This variant of the kernel has numerous debugging options enabled.
  1123. It should only be installed when trying to gather additional information
  1124. on kernel bugs, as some of these options impact performance noticably.
  1125.  
  1126.  
  1127. %prep
  1128. # do a few sanity-checks for --with *only builds
  1129. %if %{with_baseonly}
  1130. %if !%{with_up}%{with_pae}
  1131. echo "Cannot build --with baseonly, up build is disabled"
  1132. exit 1
  1133. %endif
  1134. %endif
  1135.  
  1136. %if %{with_smponly}
  1137. %if !%{with_smp}
  1138. echo "Cannot build --with smponly, smp build is disabled"
  1139. exit 1
  1140. %endif
  1141. %endif
  1142.  
  1143. %if "%{baserelease}" == "0"
  1144. echo "baserelease must be greater than zero"
  1145. exit 1
  1146. %endif
  1147.  
  1148. # more sanity checking; do it quietly
  1149. if [ "%{patches}" != "%%{patches}" ] ; then
  1150.   for patch in %{patches} ; do
  1151.     if [ ! -f $patch ] ; then
  1152.       echo "ERROR: Patch  ${patch##/*/}  listed in specfile but is missing"
  1153.       exit 1
  1154.     fi
  1155.   done
  1156. fi 2>/dev/null
  1157.  
  1158. patch_command='patch -p1 -F1 -s'
  1159. ApplyPatch()
  1160. {
  1161.   local patch=$1
  1162.   shift
  1163.   if [ ! -f $RPM_SOURCE_DIR/$patch ]; then
  1164.     exit 1
  1165.   fi
  1166. %if !%{using_upstream_branch}
  1167.   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME%%%%%{?variant}}.spec ; then
  1168.     if [ "${patch:0:8}" != "patch-3." ] ; then
  1169.       echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
  1170.       exit 1
  1171.     fi
  1172.   fi 2>/dev/null
  1173. %endif
  1174.   case "$patch" in
  1175.   *.bz2) bunzip2 < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
  1176.   *.gz)  gunzip  < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
  1177.   *.xz)  unxz    < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
  1178.   *) $patch_command ${1+"$@"} < "$RPM_SOURCE_DIR/$patch" ;;
  1179.   esac
  1180. }
  1181.  
  1182. # don't apply patch if it's empty
  1183. ApplyOptionalPatch()
  1184. {
  1185.   local patch=$1
  1186.   shift
  1187.   if [ ! -f $RPM_SOURCE_DIR/$patch ]; then
  1188.     exit 1
  1189.   fi
  1190.   local C=$(wc -l $RPM_SOURCE_DIR/$patch | awk '{print $1}')
  1191.   if [ "$C" -gt 9 ]; then
  1192.     ApplyPatch $patch ${1+"$@"}
  1193.   fi
  1194. }
  1195.  
  1196. # First we unpack the kernel tarball.
  1197. # If this isn't the first make prep, we use links to the existing clean tarball
  1198. # which speeds things up quite a bit.
  1199.  
  1200. # Update to latest upstream.
  1201. %if 0%{?released_kernel}
  1202. %define vanillaversion 3.%{base_sublevel}
  1203. # non-released_kernel case
  1204. %else
  1205. %if 0%{?rcrev}
  1206. %define vanillaversion 3.%{upstream_sublevel}-rc%{rcrev}
  1207. %if 0%{?gitrev}
  1208. %define vanillaversion 3.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev}
  1209. %endif
  1210. %else
  1211. # pre-{base_sublevel+1}-rc1 case
  1212. %if 0%{?gitrev}
  1213. %define vanillaversion 3.%{base_sublevel}-git%{gitrev}
  1214. %else
  1215. %define vanillaversion 3.%{base_sublevel}
  1216. %endif
  1217. %endif
  1218. %endif
  1219.  
  1220. # %%{vanillaversion} : the full version name, e.g. 2.6.35-rc6-git3
  1221. # %%{kversion}       : the base version, e.g. 2.6.34
  1222.  
  1223. # Use kernel-%%{kversion}%%{?dist} as the top-level directory name
  1224. # so we can prep different trees within a single git directory.
  1225.  
  1226. # Build a list of the other top-level kernel tree directories.
  1227. # This will be used to hardlink identical vanilla subdirs.
  1228. sharedirs=$(find "$PWD" -maxdepth 1 -type d -name 'kernel-3.*' \
  1229.             | grep -x -v "$PWD"/kernel-%{kversion}%{?dist}) ||:
  1230.  
  1231. # Delete all old stale trees.
  1232. if [ -d kernel-%{kversion}%{?dist} ]; then
  1233.   cd kernel-%{kversion}%{?dist}
  1234.   for i in linux-*
  1235.   do
  1236.      if [ -d $i ]; then
  1237.        # Just in case we ctrl-c'd a prep already
  1238.        rm -rf deleteme.%{_target_cpu}
  1239.        # Move away the stale away, and delete in background.
  1240.        mv $i deleteme-$i
  1241.        rm -rf deleteme* &
  1242.      fi
  1243.   done
  1244.   cd ..
  1245. fi
  1246.  
  1247. # Generate new tree
  1248. if [ ! -d kernel-%{kversion}%{?dist}/vanilla-%{vanillaversion} ]; then
  1249.  
  1250.   if [ -d kernel-%{kversion}%{?dist}/vanilla-%{kversion} ]; then
  1251.  
  1252.     # The base vanilla version already exists.
  1253.     cd kernel-%{kversion}%{?dist}
  1254.  
  1255.     # Any vanilla-* directories other than the base one are stale.
  1256.     for dir in vanilla-*; do
  1257.       [ "$dir" = vanilla-%{kversion} ] || rm -rf $dir &
  1258.     done
  1259.  
  1260.   else
  1261.  
  1262.     rm -f pax_global_header
  1263.     # Look for an identical base vanilla dir that can be hardlinked.
  1264.     for sharedir in $sharedirs ; do
  1265.       if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{kversion} ]] ; then
  1266.         break
  1267.       fi
  1268.     done
  1269.     if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{kversion} ]] ; then
  1270. %setup -q -n kernel-%{kversion}%{?dist} -c -T
  1271.       cp -rl $sharedir/vanilla-%{kversion} .
  1272.     else
  1273. %setup -q -n kernel-%{kversion}%{?dist} -c
  1274.       mv linux-%{kversion} vanilla-%{kversion}
  1275.     fi
  1276.  
  1277.   fi
  1278.  
  1279. %if "%{kversion}" != "%{vanillaversion}"
  1280.  
  1281.   for sharedir in $sharedirs ; do
  1282.     if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{vanillaversion} ]] ; then
  1283.       break
  1284.     fi
  1285.   done
  1286.   if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{vanillaversion} ]] ; then
  1287.  
  1288.     cp -rl $sharedir/vanilla-%{vanillaversion} .
  1289.  
  1290.   else
  1291.  
  1292.     # Need to apply patches to the base vanilla version.
  1293.     cp -rl vanilla-%{kversion} vanilla-%{vanillaversion}
  1294.     cd vanilla-%{vanillaversion}
  1295.  
  1296. # Update vanilla to the latest upstream.
  1297. # (non-released_kernel case only)
  1298. %if 0%{?rcrev}
  1299.     ApplyPatch patch-3.%{upstream_sublevel}-rc%{rcrev}.xz
  1300. %if 0%{?gitrev}
  1301.     ApplyPatch patch-3.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev}.xz
  1302. %endif
  1303. %else
  1304. # pre-{base_sublevel+1}-rc1 case
  1305. %if 0%{?gitrev}
  1306.     ApplyPatch patch-3.%{base_sublevel}-git%{gitrev}.xz
  1307. %endif
  1308. %endif
  1309.  
  1310.     cd ..
  1311.  
  1312.   fi
  1313.  
  1314. %endif
  1315.  
  1316. else
  1317.  
  1318.   # We already have all vanilla dirs, just change to the top-level directory.
  1319.   cd kernel-%{kversion}%{?dist}
  1320.  
  1321. fi
  1322.  
  1323. # Now build the fedora kernel tree.
  1324. cp -rl vanilla-%{vanillaversion} linux-%{KVERREL}
  1325.  
  1326. cd linux-%{KVERREL}
  1327.  
  1328. # released_kernel with possible stable updates
  1329. %if 0%{?stable_base}
  1330. ApplyPatch %{stable_patch_00}
  1331. %endif
  1332. %if 0%{?stable_rc}
  1333. ApplyPatch %{stable_patch_01}
  1334. %endif
  1335.  
  1336. %if %{using_upstream_branch}
  1337. ### BRANCH APPLY ###
  1338. %endif
  1339.  
  1340. # Drop some necessary files from the source dir into the buildroot
  1341. cp $RPM_SOURCE_DIR/config-* .
  1342. cp %{SOURCE15} .
  1343.  
  1344. %if !%{debugbuildsenabled}
  1345. %if %{with_release}
  1346. # The normal build is a really debug build and the user has explicitly requested
  1347. # a release kernel. Change the config files into non-debug versions.
  1348. make -f %{SOURCE19} config-release
  1349. %endif
  1350. %endif
  1351.  
  1352. # Dynamically generate kernel .config files from config-* files
  1353. make -f %{SOURCE20} VERSION=%{version} configs
  1354.  
  1355. # Merge in any user-provided local config option changes
  1356. for i in kernel-%{version}-*.config
  1357. do
  1358.   mv $i $i.tmp
  1359.   ./merge.pl %{SOURCE1000} $i.tmp > $i
  1360.   rm $i.tmp
  1361. done
  1362.  
  1363. ApplyPatch makefile-after_link.patch
  1364.  
  1365. #
  1366. # misc small stuff to make things compile
  1367. #
  1368. ApplyOptionalPatch compile-fixes.patch
  1369.  
  1370. %if !%{nopatches}
  1371.  
  1372. # revert patches from upstream that conflict or that we get via other means
  1373. ApplyOptionalPatch upstream-reverts.patch -R
  1374.  
  1375. #drop with next rebase
  1376. ApplyPatch taint-vbox.patch
  1377.  
  1378. #drop with next rebase
  1379. ApplyPatch vmbugon-warnon.patch
  1380.  
  1381. #drop with next rebase
  1382. ApplyPatch debug-bad-pte-modules.patch
  1383.  
  1384. # Architecture patches
  1385. # x86(-64)
  1386.  
  1387. # ARM64
  1388.  
  1389. #
  1390. # ARM
  1391. #
  1392. ApplyPatch arm-lpae-ax88796.patch
  1393. ApplyPatch arm-sound-soc-samsung-dma-avoid-another-64bit-division.patch
  1394. ApplyPatch arm-exynos-mp.patch
  1395. ApplyPatch arm-highbank-for-3.12.patch
  1396. ApplyPatch arm-omap-load-tfp410.patch
  1397. ApplyPatch arm-tegra-usb-no-reset-linux33.patch
  1398. ApplyPatch arm-wandboard-quad.patch
  1399.  
  1400. # Fix OMAP and AM33xx (BeagleBone)
  1401. ApplyPatch am335x-bone.patch
  1402.  
  1403. #
  1404. # bugfixes to drivers and filesystems
  1405. #
  1406.  
  1407. # ext4
  1408.  
  1409. # xfs
  1410.  
  1411. # btrfs
  1412.  
  1413. # eCryptfs
  1414.  
  1415. # NFSv4
  1416.  
  1417. # USB
  1418.  
  1419. # WMI
  1420.  
  1421. # ACPI
  1422. ApplyPatch defaults-acpi-video.patch
  1423. ApplyPatch acpi-sony-nonvs-blacklist.patch
  1424.  
  1425. #
  1426. # PCI
  1427. #
  1428.  
  1429. #
  1430. # SCSI Bits.
  1431. #
  1432.  
  1433. # ACPI
  1434.  
  1435. # ALSA
  1436.  
  1437. # Networking
  1438.  
  1439. # Misc fixes
  1440. # The input layer spews crap no-one cares about.
  1441. ApplyPatch input-kill-stupid-messages.patch
  1442.  
  1443. # stop floppy.ko from autoloading during udev...
  1444. ApplyPatch die-floppy-die.patch
  1445.  
  1446. ApplyPatch no-pcspkr-modalias.patch
  1447.  
  1448. # Allow to use 480600 baud on 16C950 UARTs
  1449. ApplyPatch serial-460800.patch
  1450.  
  1451. # Silence some useless messages that still get printed with 'quiet'
  1452. ApplyPatch silence-noise.patch
  1453.  
  1454. # Make fbcon not show the penguins with 'quiet'
  1455. ApplyPatch silence-fbcon-logo.patch
  1456.  
  1457. # Changes to upstream defaults.
  1458.  
  1459.  
  1460. # /dev/crash driver.
  1461. ApplyPatch crash-driver.patch
  1462.  
  1463. # crypto/
  1464.  
  1465. # keys
  1466. ApplyPatch keys-expand-keyring.patch
  1467. ApplyPatch keys-krb-support.patch
  1468. ApplyPatch keys-x509-improv.patch
  1469. ApplyPatch keys-fixes.patch
  1470.  
  1471. # secure boot
  1472. ApplyPatch secure-modules.patch
  1473. ApplyPatch modsign-uefi.patch
  1474. ApplyPatch sb-hibernate.patch
  1475. ApplyPatch sysrq-secure-boot.patch
  1476.  
  1477. # Assorted Virt Fixes
  1478.  
  1479. # DRM core
  1480.  
  1481. # Nouveau DRM
  1482.  
  1483. # Intel DRM
  1484. ApplyOptionalPatch drm-intel-next.patch
  1485. ApplyPatch drm-i915-dp-stfu.patch
  1486. ApplyPatch drm-i915-hush-check-crtc-state.patch
  1487.  
  1488. # Radeon DRM
  1489.  
  1490. # silence the ACPI blacklist code
  1491. ApplyPatch silence-acpi-blacklist.patch
  1492.  
  1493. # V4L/DVB updates/fixes/experimental drivers
  1494. #  apply if non-empty
  1495. ApplyOptionalPatch v4l-dvb-fixes.patch
  1496. ApplyOptionalPatch v4l-dvb-update.patch
  1497. ApplyOptionalPatch v4l-dvb-experimental.patch
  1498.  
  1499. # Patches headed upstream
  1500. ApplyPatch fs-proc-devtree-remove_proc_entry.patch
  1501.  
  1502. ApplyPatch disable-i8042-check-on-apple-mac.patch
  1503.  
  1504. # FIXME: REBASE
  1505. #ApplyPatch hibernate-freeze-filesystems.patch
  1506.  
  1507. ApplyPatch lis3-improve-handling-of-null-rate.patch
  1508.  
  1509. # Disable watchdog on virtual machines.
  1510. ApplyPatch nowatchdog-on-virt.patch
  1511.  
  1512. #rhbz 754518
  1513. ApplyPatch scsi-sd_revalidate_disk-prevent-NULL-ptr-deref.patch
  1514.  
  1515. ApplyPatch weird-root-dentry-name-debug.patch
  1516.  
  1517. # https://fedoraproject.org/wiki/Features/Checkpoint_Restore
  1518. ApplyPatch criu-no-expert.patch
  1519.  
  1520. #rhbz 892811
  1521. ApplyPatch ath9k_rx_dma_stop_check.patch
  1522.  
  1523. #rhbz 927469
  1524. ApplyPatch fix-child-thread-introspection.patch
  1525.  
  1526. ApplyPatch drm-radeon-Disable-writeback-by-default-on-ppc.patch
  1527.  
  1528. #rhbz 977040
  1529. ApplyPatch iwl3945-better-skb-management-in-rx-path.patch
  1530. ApplyPatch iwl4965-better-skb-management-in-rx-path.patch
  1531.  
  1532. #rhbz 963715
  1533. ApplyPatch media-cx23885-Fix-TeVii-S471-regression-since-introduction-of-ts2020.patch
  1534.  
  1535. #rhbz 985522
  1536. ApplyPatch ntp-Make-periodic-RTC-update-more-reliable.patch
  1537.  
  1538. #rhbz 971893
  1539. ApplyPatch bonding-driver-alb-learning.patch
  1540.  
  1541. #rhbz 902012
  1542. ApplyPatch elevator-Fix-a-race-in-elevator-switching-and-md.patch
  1543. ApplyPatch elevator-acquire-q-sysfs_lock-in-elevator_change.patch
  1544.  
  1545. #rhbz 974072
  1546. ApplyPatch rt2800-add-support-for-rf3070.patch
  1547.  
  1548. #rhbz 1015989
  1549. ApplyPatch netfilter-nf_conntrack-use-RCU-safe-kfree-for-conntr.patch
  1550.  
  1551. #rhbz 982153
  1552. ApplyPatch iommu-Remove-stack-trace-from-broken-irq-remapping-warning.patch
  1553.  
  1554. #rhbz 998732
  1555. ApplyPatch vfio-iommu-Fixed-interaction-of-VFIO_IOMMU_MAP_DMA.patch
  1556.  
  1557. #rhbz 896695
  1558. ApplyPatch 0001-iwlwifi-don-t-WARN-on-host-commands-sent-when-firmwa.patch
  1559. ApplyPatch 0002-iwlwifi-don-t-WARN-on-bad-firmware-state.patch
  1560.  
  1561. #rhbz 993744
  1562. ApplyPatch dm-cache-policy-mq_fix-large-scale-table-allocation-bug.patch
  1563.  
  1564. #rhbz 1000439
  1565. ApplyPatch cpupower-Fix-segfault-due-to-incorrect-getopt_long-a.patch
  1566.  
  1567. #rhbz 1010679
  1568. ApplyPatch fix-radeon-sound.patch
  1569. ApplyPatch drm-radeon-24hz-audio-fixes.patch
  1570.  
  1571. #rhbz 984696
  1572. ApplyPatch rt2800usb-slow-down-TX-status-polling.patch
  1573.  
  1574. #rhbz 1023413
  1575. ApplyPatch alps-Support-for-Dell-XT2-model.patch
  1576.  
  1577. #rhbz 1011621
  1578. ApplyPatch cifs-Allow-LANMAN-auth-for-unencapsulated-auth-methods.patch
  1579.  
  1580. #rhbz 1025769
  1581. ApplyPatch iwlwifi-dvm-dont-override-mac80211-queue-setting.patch
  1582.  
  1583. ApplyPatch drm-qxl-backport-fixes-for-Fedora.patch
  1584. ApplyPatch drm-qxl-fix-memory-leak-in-release-list-handling.patch
  1585.  
  1586. ApplyPatch Input-evdev-fall-back-to-vmalloc-for-client-event-buffer.patch
  1587.  
  1588. #CVE-2013-4563 rhbz 1030015 1030017
  1589. ApplyPatch ipv6-fix-headroom-calculation-in-udp6_ufo_fragment.patch
  1590.  
  1591. #rhbz 1015905
  1592. ApplyPatch 0001-ip6_output-fragment-outgoing-reassembled-skb-properl.patch
  1593. ApplyPatch 0002-netfilter-push-reasm-skb-through-instead-of-original.patch
  1594.  
  1595. #rhbz 1011362
  1596. ApplyPatch alx-Reset-phy-speed-after-resume.patch
  1597.  
  1598. #rhbz 1031086
  1599. ApplyPatch slab_common-Do-not-check-for-duplicate-slab-names.patch
  1600.  
  1601. #rhbz 967652
  1602. ApplyPatch KVM-x86-fix-emulation-of-movzbl-bpl-eax.patch
  1603.  
  1604. # Fix 15sec NFS mount delay
  1605. ApplyPatch sunrpc-create-a-new-dummy-pipe-for-gssd-to-hold-open.patch
  1606. ApplyPatch sunrpc-replace-gssd_running-with-more-reliable-check.patch
  1607. ApplyPatch nfs-check-gssd-running-before-krb5i-auth.patch
  1608.  
  1609. #CVE-2013-6382 rhbz 1033603 1034670
  1610. ApplyPatch xfs-underflow-bug-in-xfs_attrlist_by_handle.patch
  1611.  
  1612. #rhbz 1022733
  1613. ApplyPatch via-velocity-fix-netif_receive_skb-use-in-irq-disable.patch
  1614.  
  1615. #rhbz 998342
  1616. ApplyPatch usbnet-fix-status-interrupt-urb-handling.patch
  1617.  
  1618. #CVE-2013-6405 rhbz 1035875 1035887
  1619. ApplyPatch inet-prevent-leakage-of-uninitialized-memory-to-user.patch
  1620. ApplyPatch inet-fix-addr_len-msg_namelen-assignment-in-recv_error-and-rxpmtu-functions.patch
  1621.  
  1622. #rhbz 958826
  1623. ApplyPatch dell-laptop.patch
  1624.  
  1625. # END OF PATCH APPLICATIONS
  1626.  
  1627. %endif
  1628.  
  1629. # Any further pre-build tree manipulations happen here.
  1630.  
  1631. chmod +x scripts/checkpatch.pl
  1632.  
  1633. # This Prevents scripts/setlocalversion from mucking with our version numbers.
  1634. touch .scmversion
  1635.  
  1636. # only deal with configs if we are going to build for the arch
  1637. %ifnarch %nobuildarches
  1638.  
  1639. mkdir configs
  1640.  
  1641. %if !%{debugbuildsenabled}
  1642. rm -f kernel-%{version}-*debug.config
  1643. %endif
  1644.  
  1645. %define make make %{?cross_opts}
  1646.  
  1647. # now run oldconfig over all the config files
  1648. for i in *.config
  1649. do
  1650.   mv $i .config
  1651.   Arch=`head -1 .config | cut -b 3-`
  1652.   make ARCH=$Arch listnewconfig | grep -E '^CONFIG_' >.newoptions || true
  1653. %if %{listnewconfig_fail}
  1654.   if [ -s .newoptions ]; then
  1655.     cat .newoptions
  1656.     exit 1
  1657.   fi
  1658. %endif
  1659.   rm -f .newoptions
  1660.   make ARCH=$Arch oldnoconfig
  1661.   echo "# $Arch" > configs/$i
  1662.   cat .config >> configs/$i
  1663. done
  1664. # end of kernel config
  1665. %endif
  1666.  
  1667. # get rid of unwanted files resulting from patch fuzz
  1668. find . \( -name "*.orig" -o -name "*~" \) -exec rm -f {} \; >/dev/null
  1669.  
  1670. # remove unnecessary SCM files
  1671. find . -name .gitignore -exec rm -f {} \; >/dev/null
  1672.  
  1673. cd ..
  1674.  
  1675. ###
  1676. ### build
  1677. ###
  1678. %build
  1679.  
  1680. %if %{with_sparse}
  1681. %define sparse_mflags   C=1
  1682. %endif
  1683.  
  1684. %if %{with_debuginfo}
  1685. # This override tweaks the kernel makefiles so that we run debugedit on an
  1686. # object before embedding it.  When we later run find-debuginfo.sh, it will
  1687. # run debugedit again.  The edits it does change the build ID bits embedded
  1688. # in the stripped object, but repeating debugedit is a no-op.  We do it
  1689. # beforehand to get the proper final build ID bits into the embedded image.
  1690. # This affects the vDSO images in vmlinux, and the vmlinux image in bzImage.
  1691. export AFTER_LINK=\
  1692. 'sh -xc "/usr/lib/rpm/debugedit -b $$RPM_BUILD_DIR -d /usr/src/debug \
  1693.                     -i $@ > [email protected]"'
  1694. %endif
  1695.  
  1696. cp_vmlinux()
  1697. {
  1698.   eu-strip --remove-comment -o "$2" "$1"
  1699. }
  1700.  
  1701. BuildKernel() {
  1702.     MakeTarget=$1
  1703.     KernelImage=$2
  1704.     Flavour=$3
  1705.     Flav=${Flavour:++${Flavour}}
  1706.     InstallName=${4:-vmlinuz}
  1707.  
  1708.     # Pick the right config file for the kernel we're building
  1709.     Config=kernel-%{version}-%{_target_cpu}${Flavour:+-${Flavour}}.config
  1710.     DevelDir=/usr/src/kernels/%{KVERREL}${Flav}
  1711.  
  1712.     # When the bootable image is just the ELF kernel, strip it.
  1713.     # We already copy the unstripped file into the debuginfo package.
  1714.     if [ "$KernelImage" = vmlinux ]; then
  1715.       CopyKernel=cp_vmlinux
  1716.     else
  1717.       CopyKernel=cp
  1718.     fi
  1719.  
  1720.     KernelVer=%{version}-%{release}.%{_target_cpu}${Flav}
  1721.     echo BUILDING A KERNEL FOR ${Flavour} %{_target_cpu}...
  1722.  
  1723.     %if 0%{?stable_update}
  1724.     # make sure SUBLEVEL is incremented on a stable release.  Sigh 3.x.
  1725.     perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{?stablerev}/" Makefile
  1726.     %endif
  1727.  
  1728.     # make sure EXTRAVERSION says what we want it to say
  1729.     perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}.%{_target_cpu}${Flav}/" Makefile
  1730.  
  1731.     # if pre-rc1 devel kernel, must fix up PATCHLEVEL for our versioning scheme
  1732.     %if !0%{?rcrev}
  1733.     %if 0%{?gitrev}
  1734.     perl -p -i -e 's/^PATCHLEVEL.*/PATCHLEVEL = %{upstream_sublevel}/' Makefile
  1735.     %endif
  1736.     %endif
  1737.  
  1738.     # and now to start the build process
  1739.  
  1740.     make -s mrproper
  1741.     cp configs/$Config .config
  1742.  
  1743.     %if %{signmodules}
  1744.     cp %{SOURCE11} .
  1745.     %endif
  1746.  
  1747.     chmod +x scripts/sign-file
  1748.  
  1749.     Arch=`head -1 .config | cut -b 3-`
  1750.     echo USING ARCH=$Arch
  1751.  
  1752.     make -s ARCH=$Arch oldnoconfig >/dev/null
  1753.     %{make} -s ARCH=$Arch V=1 %{?_smp_mflags} $MakeTarget %{?sparse_mflags} %{?kernel_mflags}
  1754.     %{make} -s ARCH=$Arch V=1 %{?_smp_mflags} modules %{?sparse_mflags} || exit 1
  1755.  
  1756. %ifarch %{arm} aarch64
  1757.     %{make} -s ARCH=$Arch V=1 dtbs
  1758.     mkdir -p $RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer
  1759.     install -m 644 arch/$Arch/boot/dts/*.dtb $RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer/
  1760.     rm -f arch/$Arch/boot/dts/*.dtb
  1761. %endif
  1762.  
  1763.     # Start installing the results
  1764. %if %{with_debuginfo}
  1765.     mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/boot
  1766.     mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/%{image_install_path}
  1767. %endif
  1768.     mkdir -p $RPM_BUILD_ROOT/%{image_install_path}
  1769.     install -m 644 .config $RPM_BUILD_ROOT/boot/config-$KernelVer
  1770.     install -m 644 System.map $RPM_BUILD_ROOT/boot/System.map-$KernelVer
  1771.  
  1772.     # We estimate the size of the initramfs because rpm needs to take this size
  1773.     # into consideration when performing disk space calculations. (See bz #530778)
  1774.     dd if=/dev/zero of=$RPM_BUILD_ROOT/boot/initramfs-$KernelVer.img bs=1M count=20
  1775.  
  1776.     if [ -f arch/$Arch/boot/zImage.stub ]; then
  1777.       cp arch/$Arch/boot/zImage.stub $RPM_BUILD_ROOT/%{image_install_path}/zImage.stub-$KernelVer || :
  1778.     fi
  1779.     %if %{signmodules}
  1780.     # Sign the image if we're using EFI
  1781.     %pesign -s -i $KernelImage -o vmlinuz.signed
  1782.     if [ ! -s vmlinuz.signed ]; then
  1783.         echo "pesigning failed"
  1784.         exit 1
  1785.     fi
  1786.     mv vmlinuz.signed $KernelImage
  1787.     %endif
  1788.     $CopyKernel $KernelImage \
  1789.             $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
  1790.     chmod 755 $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
  1791.  
  1792.     # hmac sign the kernel for FIPS
  1793.     echo "Creating hmac file: $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac"
  1794.     ls -l $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
  1795.     sha512hmac $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer | sed -e "s,$RPM_BUILD_ROOT,," > $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac;
  1796.  
  1797.     mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer
  1798.     # Override $(mod-fw) because we don't want it to install any firmware
  1799.     # we'll get it from the linux-firmware package and we don't want conflicts
  1800.     %{make} -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer mod-fw=
  1801.  
  1802. %ifarch %{vdso_arches}
  1803.     %{make} -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install KERNELRELEASE=$KernelVer
  1804.     if [ ! -s ldconfig-kernel.conf ]; then
  1805.       echo > ldconfig-kernel.conf "\
  1806. # Placeholder file, no vDSO hwcap entries used in this kernel."
  1807.     fi
  1808.     %{__install} -D -m 444 ldconfig-kernel.conf \
  1809.         $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernel-$KernelVer.conf
  1810. %endif
  1811.  
  1812.     # And save the headers/makefiles etc for building modules against
  1813.     #
  1814.     # This all looks scary, but the end result is supposed to be:
  1815.     # * all arch relevant include/ files
  1816.     # * all Makefile/Kconfig files
  1817.     # * all script/ files
  1818.  
  1819.     rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
  1820.     rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/source
  1821.     mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
  1822.     (cd $RPM_BUILD_ROOT/lib/modules/$KernelVer ; ln -s build source)
  1823.     # dirs for additional modules per module-init-tools, kbuild/modules.txt
  1824.     mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/extra
  1825.     mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/updates
  1826.     # first copy everything
  1827.     cp --parents `find  -type f -name "Makefile*" -o -name "Kconfig*"` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
  1828.     cp Module.symvers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
  1829.     cp System.map $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
  1830.     if [ -s Module.markers ]; then
  1831.       cp Module.markers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
  1832.     fi
  1833.     # then drop all but the needed Makefiles/Kconfig files
  1834.     rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/Documentation
  1835.     rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts
  1836.     rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
  1837.     cp .config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
  1838.     cp -a scripts $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
  1839.     if [ -d arch/$Arch/scripts ]; then
  1840.       cp -a arch/$Arch/scripts $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/arch/%{_arch} || :
  1841.     fi
  1842.     if [ -f arch/$Arch/*lds ]; then
  1843.       cp -a arch/$Arch/*lds $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/arch/%{_arch}/ || :
  1844.     fi
  1845.     rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*.o
  1846.     rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*/*.o
  1847. %ifarch ppc ppc64 ppc64p7
  1848.     cp -a --parents arch/powerpc/lib/crtsavres.[So] $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
  1849. %endif
  1850.     if [ -d arch/%{asmarch}/include ]; then
  1851.       cp -a --parents arch/%{asmarch}/include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
  1852.     fi
  1853.     # include the machine specific headers for ARM variants, if available.
  1854. %ifarch %{arm}
  1855.     if [ -d arch/%{asmarch}/mach-${Flavour}/include ]; then
  1856.       cp -a --parents arch/%{asmarch}/mach-${Flavour}/include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
  1857.     fi
  1858. %endif
  1859.     cp -a include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
  1860.  
  1861.     # Make sure the Makefile and version.h have a matching timestamp so that
  1862.     # external modules can be built
  1863.     touch -r $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/Makefile $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/generated/uapi/linux/version.h
  1864.  
  1865.     # Copy .config to include/config/auto.conf so "make prepare" is unnecessary.
  1866.     cp $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/.config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/config/auto.conf
  1867.  
  1868. %if %{with_debuginfo}
  1869.     if test -s vmlinux.id; then
  1870.       cp vmlinux.id $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/vmlinux.id
  1871.     else
  1872.       echo >&2 "*** ERROR *** no vmlinux build ID! ***"
  1873.       exit 1
  1874.     fi
  1875.  
  1876.     #
  1877.     # save the vmlinux file for kernel debugging into the kernel-debuginfo rpm
  1878.     #
  1879.     mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/lib/modules/$KernelVer
  1880.     cp vmlinux $RPM_BUILD_ROOT%{debuginfodir}/lib/modules/$KernelVer
  1881. %endif
  1882.  
  1883.     find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name "*.ko" -type f >modnames
  1884.  
  1885.     # mark modules executable so that strip-to-file can strip them
  1886.     xargs --no-run-if-empty chmod u+x < modnames
  1887.  
  1888.     # Generate a list of modules for block and networking.
  1889.  
  1890.     grep -F /drivers/ modnames | xargs --no-run-if-empty nm -upA |
  1891.     sed -n 's,^.*/\([^/]*\.ko\):  *U \(.*\)$,\1 \2,p' > drivers.undef
  1892.  
  1893.     collect_modules_list()
  1894.     {
  1895.       sed -r -n -e "s/^([^ ]+) \\.?($2)\$/\\1/p" drivers.undef |
  1896.         LC_ALL=C sort -u > $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1
  1897.       if [ ! -z "$3" ]; then
  1898.         sed -r -e "/^($3)\$/d" -i $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1
  1899.       fi
  1900.     }
  1901.  
  1902.     collect_modules_list networking \
  1903.                  'register_netdev|ieee80211_register_hw|usbnet_probe|phy_driver_register|rt(l_|2x00)(pci|usb)_probe|register_netdevice'
  1904.     collect_modules_list block \
  1905.                  'ata_scsi_ioctl|scsi_add_host|scsi_add_host_with_dma|blk_alloc_queue|blk_init_queue|register_mtd_blktrans|scsi_esp_register|scsi_register_device_handler|blk_queue_physical_block_size' 'pktcdvd.ko|dm-mod.ko'
  1906.     collect_modules_list drm \
  1907.                  'drm_open|drm_init'
  1908.     collect_modules_list modesetting \
  1909.                  'drm_crtc_init'
  1910.  
  1911.     # detect missing or incorrect license tags
  1912.     ( find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name '*.ko' | xargs /sbin/modinfo -l | \
  1913.         grep -E -v 'GPL( v2)?$|Dual BSD/GPL$|Dual MPL/GPL$|GPL and additional rights$' ) && exit 1
  1914.  
  1915.     # remove files that will be auto generated by depmod at rpm -i time
  1916.     pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/
  1917.         rm -f modules.{alias*,builtin.bin,dep*,*map,symbols*,devname,softdep}
  1918.     popd
  1919.  
  1920. %if %{with_extra}
  1921.     # Call the modules-extra script to move things around
  1922.     %{SOURCE17} $RPM_BUILD_ROOT/lib/modules/$KernelVer %{SOURCE16}
  1923. %endif
  1924.  
  1925. %if %{signmodules}
  1926.     # Save the signing keys so we can sign the modules in __modsign_install_post
  1927.     cp signing_key.priv signing_key.priv.sign${Flav}
  1928.     cp signing_key.x509 signing_key.x509.sign${Flav}
  1929. %endif
  1930.  
  1931.     # Move the devel headers out of the root file system
  1932.     mkdir -p $RPM_BUILD_ROOT/usr/src/kernels
  1933.     mv $RPM_BUILD_ROOT/lib/modules/$KernelVer/build $RPM_BUILD_ROOT/$DevelDir
  1934.  
  1935.     # This is going to create a broken link during the build, but we don't use
  1936.     # it after this point.  We need the link to actually point to something
  1937.     # when kernel-devel is installed, and a relative link doesn't work across
  1938.     # the F17 UsrMove feature.
  1939.     ln -sf $DevelDir $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
  1940.  
  1941.     # prune junk from kernel-devel
  1942.     find $RPM_BUILD_ROOT/usr/src/kernels -name ".*.cmd" -exec rm -f {} \;
  1943. }
  1944.  
  1945. ###
  1946. # DO it...
  1947. ###
  1948.  
  1949. # prepare directories
  1950. rm -rf $RPM_BUILD_ROOT
  1951. mkdir -p $RPM_BUILD_ROOT/boot
  1952. mkdir -p $RPM_BUILD_ROOT%{_libexecdir}
  1953.  
  1954. cd linux-%{KVERREL}
  1955.  
  1956. %if %{with_debug}
  1957. BuildKernel %make_target %kernel_image debug
  1958. %endif
  1959.  
  1960. %if %{with_pae_debug}
  1961. BuildKernel %make_target %kernel_image %{pae}debug
  1962. %endif
  1963.  
  1964. %if %{with_pae}
  1965. BuildKernel %make_target %kernel_image %{pae}
  1966. %endif
  1967.  
  1968. %if %{with_up}
  1969. BuildKernel %make_target %kernel_image
  1970. %endif
  1971.  
  1972. %if %{with_smp}
  1973. BuildKernel %make_target %kernel_image smp
  1974. %endif
  1975.  
  1976. %global perf_make \
  1977.   make -s %{?cross_opts} %{?_smp_mflags} -C tools/perf V=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_LIBNUMA=1 NO_STRLCPY=1 prefix=%{_prefix}
  1978. %if %{with_perf}
  1979. # perf
  1980. %{perf_make} all
  1981. %{perf_make} man || %{doc_build_fail}
  1982. %endif
  1983.  
  1984. %if %{with_tools}
  1985. %ifarch %{cpupowerarchs}
  1986. # cpupower
  1987. # make sure version-gen.sh is executable.
  1988. chmod +x tools/power/cpupower/utils/version-gen.sh
  1989. %{make} %{?_smp_mflags} -C tools/power/cpupower CPUFREQ_BENCH=false
  1990. %ifarch %{ix86}
  1991.     pushd tools/power/cpupower/debug/i386
  1992.     %{make} %{?_smp_mflags} centrino-decode powernow-k8-decode
  1993.     popd
  1994. %endif
  1995. %ifarch x86_64
  1996.     pushd tools/power/cpupower/debug/x86_64
  1997.     %{make} %{?_smp_mflags} centrino-decode powernow-k8-decode
  1998.     popd
  1999. %endif
  2000. %ifarch %{ix86} x86_64
  2001.    pushd tools/power/x86/x86_energy_perf_policy/
  2002.    %{make}
  2003.    popd
  2004.    pushd tools/power/x86/turbostat
  2005.    %{make}
  2006.    popd
  2007. %endif #turbostat/x86_energy_perf_policy
  2008. %endif
  2009. %endif
  2010.  
  2011. %if %{with_doc}
  2012. # Make the HTML pages.
  2013. make htmldocs || %{doc_build_fail}
  2014.  
  2015. # sometimes non-world-readable files sneak into the kernel source tree
  2016. chmod -R a=rX Documentation
  2017. find Documentation -type d | xargs chmod u+w
  2018. %endif
  2019.  
  2020. # In the modsign case, we do 3 things.  1) We check the "flavour" and hard
  2021. # code the value in the following invocations.  This is somewhat sub-optimal
  2022. # but we're doing this inside of an RPM macro and it isn't as easy as it
  2023. # could be because of that.  2) We restore the .tmp_versions/ directory from
  2024. # the one we saved off in BuildKernel above.  This is to make sure we're
  2025. # signing the modules we actually built/installed in that flavour.  3) We
  2026. # grab the arch and invoke mod-sign.sh command to actually sign the modules.
  2027. #
  2028. # We have to do all of those things _after_ find-debuginfo runs, otherwise
  2029. # that will strip the signature off of the modules.
  2030.  
  2031. %define __modsign_install_post \
  2032.   if [ "%{signmodules}" -eq "1" ]; then \
  2033.     if [ "%{with_pae}" -ne "0" ]; then \
  2034.       %{modsign_cmd} signing_key.priv.sign+%{pae} signing_key.x509.sign+%{pae} $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+%{pae}/ \
  2035.     fi \
  2036.     if [ "%{with_debug}" -ne "0" ]; then \
  2037.       %{modsign_cmd} signing_key.priv.sign+debug signing_key.x509.sign+debug $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+debug/ \
  2038.     fi \
  2039.     if [ "%{with_pae_debug}" -ne "0" ]; then \
  2040.       %{modsign_cmd} signing_key.priv.sign+%{pae}debug signing_key.x509.sign+%{pae}debug $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+%{pae}debug/ \
  2041.     fi \
  2042.     if [ "%{with_up}" -ne "0" ]; then \
  2043.       %{modsign_cmd} signing_key.priv.sign signing_key.x509.sign $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/ \
  2044.     fi \
  2045.   fi \
  2046. %{nil}
  2047.  
  2048. ###
  2049. ### Special hacks for debuginfo subpackages.
  2050. ###
  2051.  
  2052. # This macro is used by %%install, so we must redefine it before that.
  2053. %define debug_package %{nil}
  2054.  
  2055. %if %{with_debuginfo}
  2056.  
  2057. %define __debug_install_post \
  2058.   /usr/lib/rpm/find-debuginfo.sh %{debuginfo_args} %{_builddir}/%{?buildsubdir}\
  2059. %{nil}
  2060.  
  2061. %ifnarch noarch
  2062. %global __debug_package 1
  2063. %files -f debugfiles.list debuginfo-common-%{_target_cpu}
  2064. %defattr(-,root,root)
  2065. %endif
  2066.  
  2067. %endif
  2068.  
  2069. #
  2070. # Disgusting hack alert! We need to ensure we sign modules *after* all
  2071. # invocations of strip occur, which is in __debug_install_post if
  2072. # find-debuginfo.sh runs, and __os_install_post if not.
  2073. #
  2074. %define __spec_install_post \
  2075.   %{?__debug_package:%{__debug_install_post}}\
  2076.   %{__arch_install_post}\
  2077.   %{__os_install_post}\
  2078.   %{__modsign_install_post}
  2079.  
  2080. ###
  2081. ### install
  2082. ###
  2083.  
  2084. %install
  2085.  
  2086. cd linux-%{KVERREL}
  2087.  
  2088. %if %{with_doc}
  2089. docdir=$RPM_BUILD_ROOT%{_datadir}/doc/kernel-doc-%{rpmversion}
  2090.  
  2091. # copy the source over
  2092. mkdir -p $docdir
  2093. tar -h -f - --exclude=man --exclude='.*' -c Documentation | tar xf - -C $docdir
  2094.  
  2095. %endif # with_doc
  2096.  
  2097. # We have to do the headers install before the tools install because the
  2098. # kernel headers_install will remove any header files in /usr/include that
  2099. # it doesn't install itself.
  2100.  
  2101. %if %{with_headers}
  2102. # Install kernel headers
  2103. make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install
  2104.  
  2105. # Do headers_check but don't die if it fails.
  2106. make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_check \
  2107.      > hdrwarnings.txt || :
  2108. if grep -q exist hdrwarnings.txt; then
  2109.    sed s:^$RPM_BUILD_ROOT/usr/include/:: hdrwarnings.txt
  2110.    # Temporarily cause a build failure if header inconsistencies.
  2111.    # exit 1
  2112. fi
  2113.  
  2114. find $RPM_BUILD_ROOT/usr/include \
  2115.      \( -name .install -o -name .check -o \
  2116.         -name ..install.cmd -o -name ..check.cmd \) | xargs rm -f
  2117.  
  2118. %endif
  2119.  
  2120. %if %{with_perf}
  2121. # perf tool binary and supporting scripts/binaries
  2122. %{perf_make} DESTDIR=$RPM_BUILD_ROOT install
  2123.  
  2124. # python-perf extension
  2125. %{perf_make} DESTDIR=$RPM_BUILD_ROOT install-python_ext
  2126.  
  2127. # perf man pages (note: implicit rpm magic compresses them later)
  2128. %{perf_make} DESTDIR=$RPM_BUILD_ROOT install-man || %{doc_build_fail}
  2129. %endif
  2130.  
  2131. %if %{with_tools}
  2132. %ifarch %{cpupowerarchs}
  2133. %{make} -C tools/power/cpupower DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install
  2134. rm -f %{buildroot}%{_libdir}/*.{a,la}
  2135. %find_lang cpupower
  2136. mv cpupower.lang ../
  2137. %ifarch %{ix86}
  2138.     pushd tools/power/cpupower/debug/i386
  2139.     install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode
  2140.     install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode
  2141.     popd
  2142. %endif
  2143. %ifarch x86_64
  2144.     pushd tools/power/cpupower/debug/x86_64
  2145.     install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode
  2146.     install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode
  2147.     popd
  2148. %endif
  2149. chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
  2150. mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
  2151. install -m644 %{SOURCE2000} %{buildroot}%{_unitdir}/cpupower.service
  2152. install -m644 %{SOURCE2001} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
  2153. %endif
  2154. %ifarch %{ix86} x86_64
  2155.    mkdir -p %{buildroot}%{_mandir}/man8
  2156.    pushd tools/power/x86/x86_energy_perf_policy
  2157.    make DESTDIR=%{buildroot} install
  2158.    popd
  2159.    pushd tools/power/x86/turbostat
  2160.    make DESTDIR=%{buildroot} install
  2161.    popd
  2162. %endif #turbostat/x86_energy_perf_policy
  2163. %endif
  2164.  
  2165. %if %{with_bootwrapper}
  2166. make DESTDIR=$RPM_BUILD_ROOT bootwrapper_install WRAPPER_OBJDIR=%{_libdir}/kernel-wrapper WRAPPER_DTSDIR=%{_libdir}/kernel-wrapper/dts
  2167. %endif
  2168.  
  2169.  
  2170. ###
  2171. ### clean
  2172. ###
  2173.  
  2174. %clean
  2175. rm -rf $RPM_BUILD_ROOT
  2176.  
  2177. ###
  2178. ### scripts
  2179. ###
  2180.  
  2181. %if %{with_tools}
  2182. %post -n kernel-tools
  2183. /sbin/ldconfig
  2184.  
  2185. %postun -n kernel-tools
  2186. /sbin/ldconfig
  2187. %endif
  2188.  
  2189. #
  2190. # This macro defines a %%post script for a kernel*-devel package.
  2191. #   %%kernel_devel_post [<subpackage>]
  2192. #
  2193. %define kernel_devel_post() \
  2194. %{expand:%%post %{?1:%{1}-}devel}\
  2195. if [ -f /etc/sysconfig/kernel ]\
  2196. then\
  2197.     . /etc/sysconfig/kernel || exit $?\
  2198. fi\
  2199. if [ "$HARDLINK" != "no" -a -x /usr/sbin/hardlink ]\
  2200. then\
  2201.     (cd /usr/src/kernels/%{KVERREL}%{?1:+%{1}} &&\
  2202.      /usr/bin/find . -type f | while read f; do\
  2203.        hardlink -c /usr/src/kernels/*.fc*.*/$f $f\
  2204.      done)\
  2205. fi\
  2206. %{nil}
  2207.  
  2208. #
  2209. # This macro defines a %%post script for a kernel*-modules-extra package.
  2210. #   %%kernel_modules_extra_post [<subpackage>]
  2211. #
  2212. %define kernel_modules_extra_post() \
  2213. %{expand:%%post %{?1:%{1}-}modules-extra}\
  2214. /sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
  2215. %{nil}
  2216.  
  2217. # This macro defines a %%posttrans script for a kernel package.
  2218. #   %%kernel_variant_posttrans [<subpackage>]
  2219. # More text can follow to go at the end of this variant's %%post.
  2220. #
  2221. %define kernel_variant_posttrans() \
  2222. %{expand:%%posttrans %{?1}}\
  2223. /bin/kernel-install add %{KVERREL}%{?1:+%{1}} /%{image_install_path}/vmlinuz-%{KVERREL}%{?1:+%{1}} || exit $?\
  2224. %{nil}
  2225.  
  2226. #
  2227. # This macro defines a %%post script for a kernel package and its devel package.
  2228. #   %%kernel_variant_post [-v <subpackage>] [-r <replace>]
  2229. # More text can follow to go at the end of this variant's %%post.
  2230. #
  2231. %define kernel_variant_post(v:r:) \
  2232. %{expand:%%kernel_devel_post %{?-v*}}\
  2233. %if %{with_extra}\
  2234. %{expand:%%kernel_modules_extra_post %{?-v*}}\
  2235. %endif\
  2236. %{expand:%%kernel_variant_posttrans %{?-v*}}\
  2237. %{expand:%%post %{?-v*}}\
  2238. %{-r:\
  2239. if [ `uname -i` == "x86_64" -o `uname -i` == "i386" ] &&\
  2240.    [ -f /etc/sysconfig/kernel ]; then\
  2241.   /bin/sed -r -i -e 's/^DEFAULTKERNEL=%{-r*}$/DEFAULTKERNEL=kernel%{?-v:-%{-v*}}/' /etc/sysconfig/kernel || exit $?\
  2242. fi}\
  2243. %{nil}
  2244.  
  2245. #
  2246. # This macro defines a %%preun script for a kernel package.
  2247. #   %%kernel_variant_preun <subpackage>
  2248. #
  2249. %define kernel_variant_preun() \
  2250. %{expand:%%preun %{?1}}\
  2251. /bin/kernel-install remove %{KVERREL}%{?1:+%{1}} /%{image_install_path}/vmlinuz-%{KVERREL}%{?1:+%{1}} || exit $?\
  2252. %{nil}
  2253.  
  2254. %kernel_variant_preun
  2255. %kernel_variant_post -r kernel-smp
  2256.  
  2257. %kernel_variant_preun smp
  2258. %kernel_variant_post -v smp
  2259.  
  2260. %kernel_variant_preun %{pae}
  2261. %kernel_variant_post -v %{pae} -r (kernel|kernel-smp)
  2262.  
  2263. %kernel_variant_post -v %{pae}debug -r (kernel|kernel-smp)
  2264. %kernel_variant_preun %{pae}debug
  2265.  
  2266. %kernel_variant_preun debug
  2267. %kernel_variant_post -v debug
  2268.  
  2269. if [ -x /sbin/ldconfig ]
  2270. then
  2271.     /sbin/ldconfig -X || exit $?
  2272. fi
  2273.  
  2274. ###
  2275. ### file lists
  2276. ###
  2277.  
  2278. %if %{with_headers}
  2279. %files headers
  2280. %defattr(-,root,root)
  2281. /usr/include/*
  2282. %endif
  2283.  
  2284. %if %{with_bootwrapper}
  2285. %files bootwrapper
  2286. %defattr(-,root,root)
  2287. /usr/sbin/*
  2288. %{_libdir}/kernel-wrapper
  2289. %endif
  2290.  
  2291. # only some architecture builds need kernel-doc
  2292. %if %{with_doc}
  2293. %files doc
  2294. %defattr(-,root,root)
  2295. %{_datadir}/doc/kernel-doc-%{rpmversion}/Documentation/*
  2296. %dir %{_datadir}/doc/kernel-doc-%{rpmversion}/Documentation
  2297. %dir %{_datadir}/doc/kernel-doc-%{rpmversion}
  2298. %endif
  2299.  
  2300. %if %{with_perf}
  2301. %files -n perf
  2302. %defattr(-,root,root)
  2303. %{_bindir}/perf
  2304. %dir %{_libexecdir}/perf-core
  2305. %{_libexecdir}/perf-core/*
  2306. %{_mandir}/man[1-8]/perf*
  2307. %{_sysconfdir}/bash_completion.d/perf
  2308. %doc linux-%{KVERREL}/tools/perf/Documentation/examples.txt
  2309.  
  2310. %files -n python-perf
  2311. %defattr(-,root,root)
  2312. %{python_sitearch}
  2313.  
  2314. %if %{with_debuginfo}
  2315. %files -f perf-debuginfo.list -n perf-debuginfo
  2316. %defattr(-,root,root)
  2317.  
  2318. %files -f python-perf-debuginfo.list -n python-perf-debuginfo
  2319. %defattr(-,root,root)
  2320. %endif
  2321. %endif # with_perf
  2322.  
  2323. %if %{with_tools}
  2324. %files -n kernel-tools -f cpupower.lang
  2325. %defattr(-,root,root)
  2326. %ifarch %{cpupowerarchs}
  2327. %{_bindir}/cpupower
  2328. %ifarch %{ix86} x86_64
  2329. %{_bindir}/centrino-decode
  2330. %{_bindir}/powernow-k8-decode
  2331. %endif
  2332. %{_unitdir}/cpupower.service
  2333. %{_mandir}/man[1-8]/cpupower*
  2334. %config(noreplace) %{_sysconfdir}/sysconfig/cpupower
  2335. %ifarch %{ix86} x86_64
  2336. %{_bindir}/x86_energy_perf_policy
  2337. %{_mandir}/man8/x86_energy_perf_policy*
  2338. %{_bindir}/turbostat
  2339. %{_mandir}/man8/turbostat*
  2340. %endif
  2341. %endif
  2342.  
  2343. %if %{with_debuginfo}
  2344. %files -f kernel-tools-debuginfo.list -n kernel-tools-debuginfo
  2345. %defattr(-,root,root)
  2346. %endif
  2347.  
  2348. %ifarch %{cpupowerarchs}
  2349. %files -n kernel-tools-libs
  2350. %{_libdir}/libcpupower.so.0
  2351. %{_libdir}/libcpupower.so.0.0.0
  2352.  
  2353. %files -n kernel-tools-libs-devel
  2354. %{_libdir}/libcpupower.so
  2355. %{_includedir}/cpufreq.h
  2356. %endif
  2357. %endif # with_perf
  2358.  
  2359. # This is %%{image_install_path} on an arch where that includes ELF files,
  2360. # or empty otherwise.
  2361. %define elf_image_install_path %{?kernel_image_elf:%{image_install_path}}
  2362.  
  2363. #
  2364. # This macro defines the %%files sections for a kernel package
  2365. # and its devel and debuginfo packages.
  2366. #   %%kernel_variant_files [-k vmlinux] <condition> <subpackage>
  2367. #
  2368. %define kernel_variant_files(k:) \
  2369. %if %{1}\
  2370. %{expand:%%files %{?2}}\
  2371. %defattr(-,root,root)\
  2372. /%{image_install_path}/%{?-k:%{-k*}}%{!?-k:vmlinuz}-%{KVERREL}%{?2:+%{2}}\
  2373. /%{image_install_path}/.vmlinuz-%{KVERREL}%{?2:+%{2}}.hmac \
  2374. %ifarch %{arm} aarch64\
  2375. /%{image_install_path}/dtb-%{KVERREL}%{?2:+%{2}} \
  2376. %endif\
  2377. %attr(600,root,root) /boot/System.map-%{KVERREL}%{?2:+%{2}}\
  2378. /boot/config-%{KVERREL}%{?2:+%{2}}\
  2379. %dir /lib/modules/%{KVERREL}%{?2:+%{2}}\
  2380. /lib/modules/%{KVERREL}%{?2:+%{2}}/kernel\
  2381. /lib/modules/%{KVERREL}%{?2:+%{2}}/build\
  2382. /lib/modules/%{KVERREL}%{?2:+%{2}}/source\
  2383. /lib/modules/%{KVERREL}%{?2:+%{2}}/updates\
  2384. %ifarch %{vdso_arches}\
  2385. /lib/modules/%{KVERREL}%{?2:+%{2}}/vdso\
  2386. /etc/ld.so.conf.d/kernel-%{KVERREL}%{?2:+%{2}}.conf\
  2387. %endif\
  2388. /lib/modules/%{KVERREL}%{?2:+%{2}}/modules.*\
  2389. %ghost /boot/initramfs-%{KVERREL}%{?2:+%{2}}.img\
  2390. %{expand:%%files %{?2:%{2}-}devel}\
  2391. %defattr(-,root,root)\
  2392. /usr/src/kernels/%{KVERREL}%{?2:+%{2}}\
  2393. %if %{with_extra}\
  2394. %{expand:%%files %{?2:%{2}-}modules-extra}\
  2395. %endif\
  2396. %defattr(-,root,root)\
  2397. /lib/modules/%{KVERREL}%{?2:+%{2}}/extra\
  2398. %if %{with_debuginfo}\
  2399. %ifnarch noarch\
  2400. %{expand:%%files -f debuginfo%{?2}.list %{?2:%{2}-}debuginfo}\
  2401. %defattr(-,root,root)\
  2402. %endif\
  2403. %endif\
  2404. %endif\
  2405. %{nil}
  2406.  
  2407.  
  2408. %kernel_variant_files %{with_up}
  2409. %kernel_variant_files %{with_smp} smp
  2410. %kernel_variant_files %{with_debug} debug
  2411. %kernel_variant_files %{with_pae} %{pae}
  2412. %kernel_variant_files %{with_pae_debug} %{pae}debug
  2413.  
  2414. # plz don't put in a version string unless you're going to tag
  2415. # and build.
  2416.  
  2417. #  ___________________________________________________________
  2418. # / This branch is for Fedora 20. You probably want to commit \
  2419. # \ to the F-19 branch instead, or in addition to this one.   /
  2420. #  -----------------------------------------------------------
  2421. #         \   ^__^
  2422. #          \  (@@)\_______
  2423. #             (__)\       )\/\
  2424. #                 ||----w |
  2425. #                 ||     ||
  2426. %changelog
Advertisement
Add Comment
Please, Sign In to add comment