1 |
# upstream versioning |
2 |
%define kernelversion 4 |
3 |
%define patchlevel 1 |
4 |
# sublevel is now used for -stable patches |
5 |
%define sublevel 5 |
6 |
# extstable is for extended stable patches |
7 |
%define extstable 0 |
8 |
|
9 |
# kernel Makefile extraversion is substituted by |
10 |
# kpatch/kgit wich are either 0 (empty), rc (kpatch), git (kgit) |
11 |
%define kpatch 0 |
12 |
|
13 |
# kernel.org -gitX patch (only the number after "git") |
14 |
%define kgit 0 |
15 |
|
16 |
# this is the releaseversion |
17 |
%define mgarelease 1 |
18 |
|
19 |
# This is only to make life easier for people that creates derivated kernels |
20 |
# a.k.a name it kernel-tmb :) |
21 |
%define kname kernel-linus |
22 |
|
23 |
%define rpmtag %{distsuffix}%{mgaver} |
24 |
%if %kpatch |
25 |
%if %kgit |
26 |
%define rpmrel %mkrel 0.%{kpatch}.%{kgit}.%{mgarelease} |
27 |
%else |
28 |
%define rpmrel %mkrel 0.%{kpatch}.%{mgarelease} |
29 |
%endif |
30 |
%else |
31 |
%define rpmrel %mkrel %{mgarelease} |
32 |
%endif |
33 |
|
34 |
# theese two never change, they are used to fool rpm/urpmi/smart |
35 |
%define fakever 1 |
36 |
%define fakerel %mkrel 1 |
37 |
|
38 |
# When we are using a pre/rc patch, the tarball is a sublevel -1 |
39 |
%if %kpatch |
40 |
%if %sublevel |
41 |
%define tar_ver %{kernelversion}.%{patchlevel} |
42 |
%else |
43 |
%define tar_ver %{kernelversion}.%(expr %{patchlevel} - 1) |
44 |
%endif |
45 |
%else |
46 |
%define tar_ver %{kernelversion}.%{patchlevel} |
47 |
%endif |
48 |
%if %extstable |
49 |
%define kversion %{kernelversion}.%{patchlevel}.%{sublevel}.%{extstable} |
50 |
%else |
51 |
%define kversion %{kernelversion}.%{patchlevel}.%{sublevel} |
52 |
%endif |
53 |
%define kverrel %{kversion}-%{rpmrel} |
54 |
|
55 |
# used for not making too long names for rpms or search paths |
56 |
%if %kpatch |
57 |
%if %kgit |
58 |
%define buildrpmrel 0.%{kpatch}.%{kgit}.%{mgarelease}%{rpmtag} |
59 |
%else |
60 |
%define buildrpmrel 0.%{kpatch}.%{mgarelease}%{rpmtag} |
61 |
%endif |
62 |
%else |
63 |
%define buildrpmrel %{mgarelease}%{rpmtag} |
64 |
%endif |
65 |
|
66 |
%define buildrel %{kversion}-%{buildrpmrel} |
67 |
|
68 |
%define klinus_notice NOTE: This kernel has no Mageia patches and no third-party drivers. |
69 |
|
70 |
# having different top level names for packges means that you have to remove them by hard :( |
71 |
%define top_dir_name %{kname}-%{_arch} |
72 |
|
73 |
%define build_dir ${RPM_BUILD_DIR}/%{top_dir_name} |
74 |
%define src_dir %{build_dir}/linux-%{tar_ver} |
75 |
|
76 |
# disable useless debug rpms... |
77 |
%define _enable_debug_packages %{nil} |
78 |
%define debug_package %{nil} |
79 |
|
80 |
# build defines |
81 |
%define build_doc 1 |
82 |
%define build_source 1 |
83 |
%define build_devel 1 |
84 |
|
85 |
%define build_kernel 1 |
86 |
|
87 |
%define distro_branch %(perl -pe '/(\\d+)\\.(\\d)\\.?(\\d)?/; $_="$1.$2"' /etc/mageia-release) |
88 |
|
89 |
# End of user definitions |
90 |
%{?_without_kernel: %global build_kernel 0} |
91 |
%{?_without_doc: %global build_doc 0} |
92 |
%{?_without_source: %global build_source 0} |
93 |
%{?_without_devel: %global build_devel 0} |
94 |
|
95 |
%{?_with_kernel: %global build_kernel 1} |
96 |
%{?_with_doc: %global build_doc 1} |
97 |
%{?_with_source: %global build_source 1} |
98 |
%{?_with_devel: %global build_devel 1} |
99 |
|
100 |
%if %(if [ -z "$CC" ] ; then echo 0; else echo 1; fi) |
101 |
%define kmake %make CC="$CC" |
102 |
%else |
103 |
%define kmake %make |
104 |
%endif |
105 |
# there are places where parallel make don't work |
106 |
%define smake make |
107 |
|
108 |
# Parallelize xargs invocations on smp machines |
109 |
%define kxargs xargs %([ -z "$RPM_BUILD_NCPUS" ] \\\ |
110 |
&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\ |
111 |
[ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-P $RPM_BUILD_NCPUS") |
112 |
|
113 |
# Aliases for amd64 builds (better make source links?) |
114 |
%define target_cpu %(echo %{_target_cpu} | sed -e "s/amd64/x86_64/") |
115 |
%define target_arch %(echo %{_arch} | sed -e "s/amd64/x86_64/" -e 's/arm.*/arm/') |
116 |
|
117 |
# src.rpm description |
118 |
Summary: The Linux kernel (the core of the Linux operating system) |
119 |
Name: %{kname} |
120 |
Version: %{kversion} |
121 |
Release: %{rpmrel} |
122 |
License: GPLv2 |
123 |
Group: System/Kernel and hardware |
124 |
ExclusiveArch: %{ix86} x86_64 %{arm} |
125 |
ExclusiveOS: Linux |
126 |
URL: http://www.kernel.org/ |
127 |
|
128 |
#################################################################### |
129 |
# |
130 |
# Sources |
131 |
# |
132 |
### This is for full SRC RPM |
133 |
Source0: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/linux-%{tar_ver}.tar.xz |
134 |
Source1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/linux-%{tar_ver}.tar.sign |
135 |
|
136 |
# This is for disabling mrproper and other targets on -devel rpms |
137 |
Source2: disable-mrproper-in-devel-rpms.patch |
138 |
|
139 |
Source4: README.kernel-sources |
140 |
|
141 |
# Kernel defconfigs |
142 |
Source20: i386_defconfig |
143 |
Source21: x86_64_defconfig |
144 |
Source22: arm_defconfig |
145 |
|
146 |
#################################################################### |
147 |
# |
148 |
# Patches |
149 |
|
150 |
# |
151 |
# Patch0 to Patch100 are for core kernel upgrades. |
152 |
# |
153 |
|
154 |
# Pre linus patch: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/testing |
155 |
|
156 |
%if %sublevel |
157 |
Patch1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.xz |
158 |
Source11: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.sign |
159 |
%endif |
160 |
%if %kpatch |
161 |
Patch2: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/testing/patch-%{kernelversion}.%{patchlevel}-%{kpatch}.xz |
162 |
Source12: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/testing/patch-%{kernelversion}.%{patchlevel}-%{kpatch}.sign |
163 |
%endif |
164 |
%if %extstable |
165 |
Patch3: patch-%{kernelversion}.%{patchlevel}.%{sublevel}.%{extstable}.patch |
166 |
%endif |
167 |
|
168 |
# critical fixes |
169 |
|
170 |
#END |
171 |
#################################################################### |
172 |
|
173 |
# global defines |
174 |
Autoreqprov: no |
175 |
BuildRequires: gcc |
176 |
BuildRequires: kmod >= 12-2 |
177 |
BuildRequires: bc |
178 |
BuildRequires: binutils >= 1:2.25.1 |
179 |
%ifarch %{arm} |
180 |
BuildRequires: uboot-mkimage |
181 |
%endif |
182 |
|
183 |
%description |
184 |
Source package to build the Linux kernel. |
185 |
|
186 |
%{klinus_notice} |
187 |
|
188 |
|
189 |
# |
190 |
# kernel: Symmetric MultiProcessing kernel |
191 |
# |
192 |
%if %build_kernel |
193 |
%package -n %{kname}-%{buildrel} |
194 |
Version: %{fakever} |
195 |
Release: %{fakerel} |
196 |
%ifarch %{ix86} |
197 |
Summary: Linux Kernel for desktop use with i586 & 4GB RAM |
198 |
%else |
199 |
%ifarch %{arm} |
200 |
Linux Kernel for Arm machines based on Kirkwood |
201 |
%else |
202 |
Summary: Linux Kernel for desktop use with %{_arch} |
203 |
%endif |
204 |
%endif |
205 |
Group: System/Kernel and hardware |
206 |
Provides: should-restart = system |
207 |
Provides: kernel = %{tar_ver} |
208 |
Provides: alsa |
209 |
Requires: bootloader-utils >= 1.16-1 |
210 |
Requires: dracut >= 038-19 |
211 |
Requires: kmod >= 12-2 |
212 |
Requires: sysfsutils >= 2.1.0-16 |
213 |
Requires: kernel-firmware >= 20150722-1 |
214 |
|
215 |
# conflict dkms packages that dont support kernel-4.1 |
216 |
Conflicts: dkms-broadcom-wl < 6.30.223.248-4 |
217 |
Conflicts: dkms-fglrx < 15.200.1046-2 |
218 |
Conflicts: dkms-nvidia-current < 346.72-1 |
219 |
Conflicts: dkms-nvidia340 < 340.76-2 |
220 |
Conflicts: dkms-nvidia304 < 304.125-5 |
221 |
Conflicts: dkms-virtualbox < 4.3.28-1 |
222 |
Conflicts: dkms-xtables-addons < 2.7-1 |
223 |
# not supported by x11-server-1.16 |
224 |
Conflicts: dkms-nvidia173 <= 173.14.39 |
225 |
# (tmb) nvidia96xx does not support this kernel or x11-server-1.13 |
226 |
Conflicts: dkms-nvidia96xx <= 96.43.23 |
227 |
# (tmb) conflict too old lvm2 rules to make upgrades work (tv, mga #9536) |
228 |
Conflicts: lvm2 < 2.02.98-3 |
229 |
# (tmb) conflict too old drakxtools-backend to avoid bogus root=/dev/ (#9536) |
230 |
Conflicts: drakxtools-backend < 15.37-1 |
231 |
# (tmb) conflict older btrfs-progs to get the new in same transaction and in initrd |
232 |
Conflicts: btrfs-progs < 4.1-1 |
233 |
# (tmb) conflict too old plymouth (mga#15486) |
234 |
Conflicts: plymouth < 0.8.6.1-13 |
235 |
# (tmb) conflict too old radeon-firmware to get the uvd firmwares in initrd |
236 |
Conflicts: radeon-firmware < 20150722-1 |
237 |
# (tmb) conflict old firmware to get the firmwares in initrd |
238 |
Conflicts: kernel-firmware-nonfree < 20150722-1 |
239 |
# (tmb) conflict old theme to get mga5 theme in initrd |
240 |
Conflicts: mageia-gfxboot-theme < 4.5.6.6-1 |
241 |
# (tmb) conflict too old grub2(-efi) |
242 |
Conflicts: grub2 < 2.02-0.git9752.18 |
243 |
Conflicts: grub2-efi < 2.02-0.git9752.18 |
244 |
# (tmb) conflict too old efibootmgr |
245 |
Conflicts: efibootmgr < 0.11.0-7 |
246 |
%ifarch %{ix86} |
247 |
Conflicts: arch(x86_64) |
248 |
%endif |
249 |
|
250 |
%description -n %{kname}-%{buildrel} |
251 |
%ifarch %{ix86} |
252 |
This kernel is compiled for desktop use, single or multiple i586 |
253 |
processor(s)/core(s) and less than 4GB RAM, using HZ_1000, voluntary |
254 |
preempt, CFS cpu scheduler and cfq i/o scheduler. |
255 |
This kernel relies on in-kernel smp alternatives to switch between |
256 |
up & smp mode depending on detected hardware. To force the kernel |
257 |
to boot in single processor mode, use the "nosmp" boot parameter. |
258 |
%else |
259 |
%ifarch %{arm} |
260 |
This kernel is compiled for Arm Kirkwood boxes. It will run on openrd |
261 |
boards. It's configured using HZ_100, preempt, CFS cpu scheduler and |
262 |
cfq i/o scheduler. |
263 |
This kernel relies on in-kernel smp alternatives to switch between |
264 |
up & smp mode depending on detected hardware. To force the kernel |
265 |
to boot in single processor mode, use the "nosmp" boot parameter. |
266 |
%else |
267 |
This kernel is compiled for desktop use, single or multiple %{_arch} |
268 |
processor(s)/core(s), using HZ_1000, voluntary preempt, CFS cpu |
269 |
scheduler and cfq i/o scheduler. |
270 |
This kernel relies on in-kernel smp alternatives to switch between |
271 |
up & smp mode depending on detected hardware. To force the kernel |
272 |
to boot in single processor mode, use the "nosmp" boot parameter. |
273 |
%endif |
274 |
%endif |
275 |
|
276 |
%{klinus_notice} |
277 |
%endif # build_kernel |
278 |
|
279 |
|
280 |
# |
281 |
# kernel-source: kernel sources |
282 |
# |
283 |
%if %build_source |
284 |
%package -n %{kname}-source-%{buildrel} |
285 |
Version: %{fakever} |
286 |
Release: %{fakerel} |
287 |
Provides: %{kname}-source, kernel-source = %{kverrel} |
288 |
Provides: %{kname}-source-%{kernelversion}.%{patchlevel} |
289 |
Requires: glibc-devel, ncurses-devel, make, gcc, perl, diffutils |
290 |
Summary: The source code for the Linux kernel |
291 |
Group: Development/Kernel |
292 |
Autoreqprov: no |
293 |
Buildarch: noarch |
294 |
|
295 |
%description -n %{kname}-source-%{buildrel} |
296 |
The %{kname}-source package contains the source code files for the |
297 |
Linux kernel. Theese source files are only needed if you want to build |
298 |
your own custom kernel that is better tuned to your particular hardware. |
299 |
|
300 |
If you only want the files needed to build 3rdparty (nVidia, Ati, dkms-*,...) |
301 |
drivers against, install the *-devel-* rpm that is matching your kernel. |
302 |
|
303 |
%{klinus_notice} |
304 |
%endif #build_source |
305 |
|
306 |
|
307 |
# |
308 |
# kernel-devel: stripped kernel sources |
309 |
# |
310 |
%if %build_devel |
311 |
%package -n %{kname}-devel-%{buildrel} |
312 |
Version: %{fakever} |
313 |
Release: %{fakerel} |
314 |
Provides: kernel-devel = %{kverrel} |
315 |
Summary: The %{kname} devel files for 3rdparty modules build |
316 |
Group: Development/Kernel |
317 |
Autoreqprov: no |
318 |
Requires: glibc-devel, ncurses-devel, make, gcc, perl |
319 |
%ifarch %{ix86} |
320 |
Conflicts: arch(x86_64) |
321 |
%endif |
322 |
|
323 |
%description -n %{kname}-devel-%{buildrel} |
324 |
This package contains the kernel-devel files that should be enough to build |
325 |
3rdparty drivers against for use with the %{kname}-%{buildrel}. |
326 |
|
327 |
If you want to build your own kernel, you need to install the full |
328 |
%{kname}-source-%{buildrel} rpm. |
329 |
|
330 |
%{klinus_notice} |
331 |
%endif #build_devel |
332 |
|
333 |
|
334 |
# |
335 |
# kernel-doc: documentation for the Linux kernel |
336 |
# |
337 |
%if %build_doc |
338 |
%package -n %{kname}-doc |
339 |
Version: %{kversion} |
340 |
Release: %{rpmrel} |
341 |
Summary: Various documentation bits found in the kernel source |
342 |
Group: Documentation |
343 |
Buildarch: noarch |
344 |
|
345 |
%description -n %{kname}-doc |
346 |
This package contains documentation files form the kernel source. Various |
347 |
bits of information about the Linux kernel and the device drivers shipped |
348 |
with it are documented in these files. You also might want install this |
349 |
package if you need a reference to the options that can be passed to Linux |
350 |
kernel modules at load time. |
351 |
|
352 |
%{klinus_notice} |
353 |
%endif #build_doc |
354 |
|
355 |
|
356 |
# |
357 |
# kernel-latest: virtual rpm |
358 |
# |
359 |
%if %build_kernel |
360 |
%package -n %{kname}-latest |
361 |
Version: %{kversion} |
362 |
Release: %{rpmrel} |
363 |
Summary: Virtual rpm for latest %{kname} |
364 |
Group: System/Kernel and hardware |
365 |
Requires: %{kname}-%{buildrel} |
366 |
%ifarch %{ix86} |
367 |
Conflicts: arch(x86_64) |
368 |
%endif |
369 |
|
370 |
%description -n %{kname}-latest |
371 |
This package is a virtual rpm that aims to make sure you always have the |
372 |
latest %{kname} installed... |
373 |
|
374 |
%{klinus_notice} |
375 |
%endif #build_kernel |
376 |
|
377 |
|
378 |
# |
379 |
# kernel-source-latest: virtual rpm |
380 |
# |
381 |
%if %build_source |
382 |
%package -n %{kname}-source-latest |
383 |
Version: %{kversion} |
384 |
Release: %{rpmrel} |
385 |
Summary: Virtual rpm for latest %{kname}-source |
386 |
Group: System/Kernel and hardware |
387 |
Requires: %{kname}-source-%{buildrel} |
388 |
Buildarch: noarch |
389 |
|
390 |
%description -n %{kname}-source-latest |
391 |
This package is a virtual rpm that aims to make sure you always have the |
392 |
latest %{kname}-source installed... |
393 |
|
394 |
%{klinus_notice} |
395 |
%endif #build_source |
396 |
|
397 |
|
398 |
# |
399 |
# kernel-devel-latest: virtual rpm |
400 |
# |
401 |
%if %build_devel |
402 |
%package -n %{kname}-devel-latest |
403 |
Version: %{kversion} |
404 |
Release: %{rpmrel} |
405 |
Summary: Virtual rpm for latest %{kname}-devel |
406 |
Group: System/Kernel and hardware |
407 |
Requires: %{kname}-devel-%{buildrel} |
408 |
%ifarch %{ix86} |
409 |
Conflicts: arch(x86_64) |
410 |
%endif |
411 |
|
412 |
%description -n %{kname}-devel-latest |
413 |
This package is a virtual rpm that aims to make sure you always have the |
414 |
latest %{kname}-devel installed... |
415 |
|
416 |
%{klinus_notice} |
417 |
%endif #build_devel |
418 |
|
419 |
|
420 |
# |
421 |
# End packages - here begins build stage |
422 |
# |
423 |
%prep |
424 |
%setup -q -n %top_dir_name -c |
425 |
|
426 |
pushd %src_dir |
427 |
|
428 |
%if %sublevel |
429 |
%patch1 -p1 |
430 |
%endif |
431 |
%if %kpatch |
432 |
%patch2 -p1 |
433 |
%endif |
434 |
%if %extstable |
435 |
%patch3 -p1 |
436 |
%endif |
437 |
|
438 |
# critical fixes |
439 |
|
440 |
popd |
441 |
|
442 |
# PATCH END |
443 |
|
444 |
|
445 |
# |
446 |
# Setup Begin |
447 |
# |
448 |
|
449 |
|
450 |
# Install defconfigs... |
451 |
install %{SOURCE20} %{build_dir}/linux-%{tar_ver}/arch/x86/configs/ |
452 |
install %{SOURCE21} %{build_dir}/linux-%{tar_ver}/arch/x86/configs/ |
453 |
install %{SOURCE22} %{build_dir}/linux-%{tar_ver}/arch/arm/configs/ |
454 |
|
455 |
# make sure the kernel has the sublevel we know it has... |
456 |
LC_ALL=C perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" linux-%{tar_ver}/Makefile |
457 |
|
458 |
|
459 |
%build |
460 |
# Common target directories |
461 |
%define _bootdir /boot |
462 |
%define _modulesdir /lib/modules |
463 |
%define _kerneldir /usr/src/%{kname}-%{buildrel} |
464 |
%define _develdir /usr/src/%{kname}-devel-%{buildrel} |
465 |
|
466 |
|
467 |
# Directories definition needed for building |
468 |
%define temp_root %{build_dir}/temp-root |
469 |
%define temp_boot %{temp_root}%{_bootdir} |
470 |
%define temp_modules %{temp_root}%{_modulesdir} |
471 |
%define temp_source %{temp_root}%{_kerneldir} |
472 |
%define temp_devel %{temp_root}%{_develdir} |
473 |
|
474 |
|
475 |
# Create a simulacro of buildroot |
476 |
rm -rf %{temp_root} |
477 |
install -d %{temp_root} |
478 |
|
479 |
|
480 |
# make sure we are in the directory |
481 |
cd %{src_dir} |
482 |
|
483 |
# make sure EXTRAVERSION says what we want it to say |
484 |
%if %extstable |
485 |
LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = .%{extstable}-%{buildrpmrel}/" Makefile |
486 |
%else |
487 |
LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{buildrpmrel}/" Makefile |
488 |
%endif |
489 |
|
490 |
# Prepare the kernel |
491 |
%smake -s mrproper |
492 |
%ifarch %{ix86} x86_64 |
493 |
cp arch/x86/configs/%{target_arch}_defconfig .config |
494 |
%else |
495 |
cp arch/%{target_arch}/%{target_arch}_defconfig .config |
496 |
%endif |
497 |
%smake oldconfig |
498 |
|
499 |
# Build the kernel |
500 |
%kmake -s all |
501 |
%ifarch %{arm} |
502 |
%kmake uImage |
503 |
%endif |
504 |
# Install kernel |
505 |
install -d %{temp_boot} |
506 |
install -m 644 System.map %{temp_boot}/System.map-%{buildrel} |
507 |
install -m 644 .config %{temp_boot}/config-%{buildrel} |
508 |
%ifarch %{arm} |
509 |
cp -f arch/%{target_arch}/boot/uImage %{temp_boot}/uImage-$KernelVer |
510 |
%else |
511 |
cp -f arch/%{target_arch}/boot/bzImage %{temp_boot}/vmlinuz-%{buildrel} |
512 |
%endif |
513 |
|
514 |
# Install modules |
515 |
install -d %{temp_modules}/%{buildrel} |
516 |
%smake INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=%{buildrel} modules_install |
517 |
|
518 |
# remove /lib/firmware, we use a separate kernel-firmware |
519 |
rm -rf %{temp_root}/lib/firmware |
520 |
|
521 |
# Save devel tree |
522 |
%if %build_devel |
523 |
mkdir -p %{temp_devel} |
524 |
for i in $(find . -name 'Makefile*'); do cp -R --parents $i %{temp_devel};done |
525 |
for i in $(find . -name 'Kconfig*' -o -name 'Kbuild*' -o -name config.mk); do cp -R --parents $i %{temp_devel};done |
526 |
cp -fR Documentation/DocBook/media/*.b64 %{temp_devel}/Documentation/DocBook/media/ |
527 |
cp -fR include %{temp_devel} |
528 |
cp -fR scripts %{temp_devel} |
529 |
cp -fR tools/include %{temp_devel}/tools/ |
530 |
%ifarch %{arm} |
531 |
cp -fR arch/%{target_arch}/tools %{temp_devel}/arch/%{target_arch}/ |
532 |
%endif |
533 |
%ifarch %{ix86} x86_64 |
534 |
cp -fR arch/x86/boot/{ctype.h,string.{c,h}} %{temp_devel}/arch/x86/boot/ |
535 |
cp -fR arch/x86/kernel/asm-offsets.{c,s} %{temp_devel}/arch/x86/kernel/ |
536 |
cp -fR arch/x86/kernel/asm-offsets_{32,64}.c %{temp_devel}/arch/x86/kernel/ |
537 |
cp -fR arch/x86/purgatory/* %{temp_devel}/arch/x86/purgatory/ |
538 |
cp -fR arch/x86/syscalls/syscall* %{temp_devel}/arch/x86/syscalls/ |
539 |
cp -fR arch/x86/include %{temp_devel}/arch/x86/ |
540 |
cp -fR arch/x86/tools %{temp_devel}/arch/x86/ |
541 |
%else |
542 |
cp -fR arch/%{target_arch}/kernel/asm-offsets.{c,s} %{temp_devel}/arch/%{target_arch}/kernel/ |
543 |
for f in $(find arch/%{target_arch} -name include); do cp -fR --parents $f %{temp_devel}; done |
544 |
%endif |
545 |
|
546 |
# Needed for generation of kernel/bounds.s |
547 |
cp -fR kernel/bounds.c %{temp_devel}/kernel/ |
548 |
|
549 |
# Needed for lguest |
550 |
cp -fR drivers/lguest/lg.h %{temp_devel}/drivers/lguest/ |
551 |
|
552 |
cp -fR .config Module.symvers %{temp_devel} |
553 |
|
554 |
# Needed for truecrypt build (Danny) |
555 |
cp -fR drivers/md/dm.h %{temp_devel}/drivers/md/ |
556 |
|
557 |
# Needed for external dvb tree (#41418) |
558 |
cp -fR drivers/media/dvb-core/*.h %{temp_devel}/drivers/media/dvb-core/ |
559 |
cp -fR drivers/media/dvb-frontends/lgdt330x.h %{temp_devel}/drivers/media/dvb-frontends/ |
560 |
|
561 |
# add acpica header files, needed for fglrx build |
562 |
cp -fR drivers/acpi/acpica/*.h %{temp_devel}/drivers/acpi/acpica/ |
563 |
|
564 |
# Check and clean the -devel tree |
565 |
pushd %{temp_devel} >/dev/null |
566 |
%smake -s prepare scripts clean |
567 |
rm -f .config.old |
568 |
popd >/dev/null |
569 |
|
570 |
# Disable mrproper and other targets |
571 |
patch -p1 -d %{temp_devel} -i %{SOURCE2} |
572 |
|
573 |
# Fix permissions |
574 |
chmod -R a+rX %{temp_devel} |
575 |
%endif # build_devel |
576 |
|
577 |
#make sure we are in the directory |
578 |
cd %src_dir |
579 |
|
580 |
# kernel-source is shipped as an unprepared tree |
581 |
%smake -s mrproper |
582 |
|
583 |
|
584 |
### |
585 |
### Install |
586 |
### |
587 |
%install |
588 |
install -m 644 %{SOURCE4} . |
589 |
|
590 |
cd %src_dir |
591 |
# Directories definition needed for installing |
592 |
%define target_source %{buildroot}/%{_kerneldir} |
593 |
%define target_boot %{buildroot}%{_bootdir} |
594 |
%define target_modules %{buildroot}%{_modulesdir} |
595 |
%define target_devel %{buildroot}%{_develdir} |
596 |
|
597 |
# We want to be able to test several times the install part |
598 |
rm -rf %{buildroot} |
599 |
cp -a %{temp_root} %{buildroot} |
600 |
|
601 |
# Create directories infastructure |
602 |
%if %build_source |
603 |
install -d %{target_source} |
604 |
|
605 |
tar cf - . | tar xf - -C %{target_source} |
606 |
chmod -R a+rX %{target_source} |
607 |
|
608 |
# we remove all the source files that we don't ship |
609 |
|
610 |
# first architecture files |
611 |
for i in alpha arc avr32 blackfin c6x cris frv hexagon h8300 ia64 m32r mips \ |
612 |
microblaze m68k m68knommu metag mn10300 nios2 openrisc parisc powerpc ppc \ |
613 |
s390 score sh sh64 sparc tile unicore32 v850 xtensa; do |
614 |
rm -rf %{target_source}/arch/$i |
615 |
|
616 |
%if %build_devel |
617 |
rm -rf %{target_devel}/arch/$i |
618 |
%endif |
619 |
done |
620 |
%ifnarch %{arm} |
621 |
rm -rf %{target_source}/include/kvm/arm* |
622 |
%endif |
623 |
|
624 |
# remove arch files based on target arch in -devel rpms |
625 |
%if %build_devel |
626 |
%ifnarch %{ix86} x86_64 |
627 |
rm -rf %{target_devel}/arch/x86 |
628 |
%endif |
629 |
%ifnarch %{arm} |
630 |
rm -rf %{target_devel}/arch/arm |
631 |
rm -rf %{target_devel}/arch/arm64 |
632 |
rm -rf %{target_devel}/include/kvm/arm* |
633 |
rm -rf %{target_devel}/include/soc/tegra |
634 |
%endif |
635 |
%endif |
636 |
|
637 |
|
638 |
# other misc files |
639 |
rm -f %{target_source}/{.config.old,.config.cmd,.tmp_gas_check,.mailmap,.missing-syscalls.d,arch/.gitignore} |
640 |
rm -rf %{target_source}/.tmp_depmod/ |
641 |
|
642 |
#endif %build_source |
643 |
%endif |
644 |
|
645 |
|
646 |
# compressing modules |
647 |
find %{target_modules} -name "*.ko" | %kxargs xz -6e |
648 |
|
649 |
|
650 |
# We used to have a copy of PrepareKernel here |
651 |
# Now, we make sure that the thing in the linux dir is what we want it to be |
652 |
|
653 |
for i in %{target_modules}/*; do |
654 |
rm -f $i/build $i/source |
655 |
done |
656 |
|
657 |
|
658 |
# sniff, if we gzipped all the modules, we change the stamp :( |
659 |
# we really need the depmod -ae here |
660 |
pushd %{target_modules} |
661 |
for i in *; do |
662 |
/sbin/depmod -ae -b %{buildroot} -F %{target_boot}/System.map-$i $i |
663 |
echo $? |
664 |
done |
665 |
|
666 |
for i in *; do |
667 |
pushd $i |
668 |
echo "Creating module.description for $i" |
669 |
modules=`find . -name "*.ko.xz"` |
670 |
echo $modules | %kxargs /sbin/modinfo \ |
671 |
| perl -lne 'print "$name\t$1" if $name && /^description:\s*(.*)/; $name = $1 if m!^filename:\s*(.*)\.k?o!; $name =~ s!.*/!!' > modules.description |
672 |
popd |
673 |
done |
674 |
popd |
675 |
|
676 |
|
677 |
### |
678 |
### Clean |
679 |
### |
680 |
|
681 |
%clean |
682 |
rm -rf %{buildroot} |
683 |
# We don't want to remove this, the whole reason of its existence is to be |
684 |
# able to do several rpm --short-circuit -bi for testing install |
685 |
# phase without repeating compilation phase |
686 |
#rm -rf %{temp_root} |
687 |
|
688 |
|
689 |
### |
690 |
### Scripts |
691 |
### |
692 |
|
693 |
### kernel |
694 |
%if %build_kernel |
695 |
%preun -n %{kname}-%{buildrel} |
696 |
/sbin/installkernel -R %{buildrel} |
697 |
if [ -L /lib/modules/%{buildrel}/build ]; then |
698 |
rm -f /lib/modules/%{buildrel}/build |
699 |
fi |
700 |
if [ -L /lib/modules/%{buildrel}/source ]; then |
701 |
rm -f /lib/modules/%{buildrel}/source |
702 |
fi |
703 |
pushd /boot > /dev/null |
704 |
if [ -L vmlinuz-linus ]; then |
705 |
if [ "$(readlink vmlinuz-linus)" = "vmlinuz-%{buildrel}" ]; then |
706 |
rm -f vmlinuz-linus |
707 |
fi |
708 |
fi |
709 |
if [ -L initrd-linus.img ]; then |
710 |
if [ "$(readlink initrd-linus.img)" = "initrd-%{buildrel}.img" ]; then |
711 |
rm -f initrd-linus.img |
712 |
fi |
713 |
fi |
714 |
popd > /dev/null |
715 |
exit 0 |
716 |
|
717 |
%post -n %{kname}-%{buildrel} |
718 |
/sbin/installkernel -L %{buildrel} |
719 |
if [ -d /usr/src/%{kname}-devel-%{buildrel} ]; then |
720 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build |
721 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source |
722 |
fi |
723 |
pushd /boot > /dev/null |
724 |
if [ -L vmlinuz-linus ]; then |
725 |
rm -f vmlinuz-linus |
726 |
fi |
727 |
ln -sf vmlinuz-%{buildrel} vmlinuz-linus |
728 |
if [ -L initrd-linus.img ]; then |
729 |
rm -f initrd-linus.img |
730 |
fi |
731 |
ln -sf initrd-%{buildrel}.img initrd-linus.img |
732 |
popd > /dev/null |
733 |
|
734 |
%posttrans -n %{kname}-%{buildrel} |
735 |
if [ -x /usr/sbin/dkms_autoinstaller -a -d /usr/src/%{kname}-devel-%{buildrel} ]; then |
736 |
/usr/sbin/dkms_autoinstaller start %{buildrel} |
737 |
fi |
738 |
|
739 |
%postun -n %{kname}-%{buildrel} |
740 |
/sbin/kernel_remove_initrd %{buildrel} |
741 |
rm -rf /lib/modules/%{buildrel} > /dev/null |
742 |
%endif # build_kernel |
743 |
|
744 |
|
745 |
### kernel-devel |
746 |
%if %build_devel |
747 |
%post -n %{kname}-devel-%{buildrel} |
748 |
# place /build and /source symlinks in place. |
749 |
if [ -d /lib/modules/%{buildrel} ]; then |
750 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build |
751 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source |
752 |
fi |
753 |
|
754 |
%preun -n %{kname}-devel-%{buildrel} |
755 |
# we need to delete <modules>/{build,source} at uninstall |
756 |
if [ -L /lib/modules/%{buildrel}/build ]; then |
757 |
rm -f /lib/modules/%{buildrel}/build |
758 |
fi |
759 |
if [ -L /lib/modules/%{buildrel}/source ]; then |
760 |
rm -f /lib/modules/%{buildrel}/source |
761 |
fi |
762 |
exit 0 |
763 |
%endif #build_devel |
764 |
|
765 |
|
766 |
### |
767 |
### file lists |
768 |
### |
769 |
|
770 |
# kernel |
771 |
%if %build_kernel |
772 |
%files -n %{kname}-%{buildrel} |
773 |
%{_bootdir}/config-%{buildrel} |
774 |
%ifarch %{arm} |
775 |
%{_bootdir}/uImage-%{buildrel} |
776 |
%else |
777 |
%{_bootdir}/vmlinuz-%{buildrel} |
778 |
%endif |
779 |
%{_bootdir}/System.map-%{buildrel} |
780 |
%dir %{_modulesdir}/%{buildrel}/ |
781 |
%{_modulesdir}/%{buildrel}/kernel |
782 |
%{_modulesdir}/%{buildrel}/modules.* |
783 |
%doc README.kernel-sources |
784 |
%endif # build_kernel |
785 |
|
786 |
# kernel-source |
787 |
%if %build_source |
788 |
%files -n %{kname}-source-%{buildrel} |
789 |
%dir %{_kerneldir} |
790 |
%dir %{_kerneldir}/arch |
791 |
%dir %{_kerneldir}/include |
792 |
%{_kerneldir}/.gitignore |
793 |
%{_kerneldir}/COPYING |
794 |
%{_kerneldir}/CREDITS |
795 |
%{_kerneldir}/Documentation |
796 |
%{_kerneldir}/Kbuild |
797 |
%{_kerneldir}/Kconfig |
798 |
%{_kerneldir}/MAINTAINERS |
799 |
%{_kerneldir}/Makefile |
800 |
%{_kerneldir}/README |
801 |
%{_kerneldir}/REPORTING-BUGS |
802 |
%{_kerneldir}/arch/Kconfig |
803 |
%{_kerneldir}/arch/arm |
804 |
%{_kerneldir}/arch/arm64 |
805 |
%{_kerneldir}/arch/x86 |
806 |
%{_kerneldir}/arch/um |
807 |
%{_kerneldir}/block |
808 |
%{_kerneldir}/crypto |
809 |
%{_kerneldir}/drivers |
810 |
%{_kerneldir}/firmware |
811 |
%{_kerneldir}/fs |
812 |
%{_kerneldir}/include/Kbuild |
813 |
%{_kerneldir}/include/acpi |
814 |
%{_kerneldir}/include/asm-generic |
815 |
%{_kerneldir}/include/clocksource |
816 |
%{_kerneldir}/include/crypto |
817 |
%{_kerneldir}/include/drm |
818 |
%{_kerneldir}/include/dt-bindings |
819 |
%{_kerneldir}/include/kvm |
820 |
%{_kerneldir}/include/linux |
821 |
%{_kerneldir}/include/math-emu |
822 |
%{_kerneldir}/include/memory |
823 |
%{_kerneldir}/include/net |
824 |
%{_kerneldir}/include/pcmcia |
825 |
%{_kerneldir}/include/ras |
826 |
%{_kerneldir}/include/scsi |
827 |
%{_kerneldir}/include/soc |
828 |
%{_kerneldir}/include/sound |
829 |
%{_kerneldir}/include/target |
830 |
%{_kerneldir}/include/trace |
831 |
%{_kerneldir}/include/uapi |
832 |
%{_kerneldir}/include/video |
833 |
%{_kerneldir}/include/media |
834 |
%{_kerneldir}/include/misc |
835 |
%{_kerneldir}/include/rxrpc |
836 |
%{_kerneldir}/include/keys |
837 |
%{_kerneldir}/include/rdma |
838 |
%{_kerneldir}/include/xen |
839 |
%{_kerneldir}/init |
840 |
%{_kerneldir}/ipc |
841 |
%{_kerneldir}/kernel |
842 |
%{_kerneldir}/lib |
843 |
%{_kerneldir}/mm |
844 |
%{_kerneldir}/net |
845 |
%{_kerneldir}/samples |
846 |
%{_kerneldir}/scripts |
847 |
%{_kerneldir}/security |
848 |
%{_kerneldir}/sound |
849 |
%{_kerneldir}/tools |
850 |
%{_kerneldir}/usr |
851 |
%{_kerneldir}/virt |
852 |
%doc README.kernel-sources |
853 |
%endif # build_source |
854 |
|
855 |
# kernel-devel |
856 |
%if %build_devel |
857 |
%files -n %{kname}-devel-%{buildrel} |
858 |
%dir %{_develdir} |
859 |
%dir %{_develdir}/arch |
860 |
%dir %{_develdir}/include |
861 |
%{_develdir}/.config |
862 |
%{_develdir}/Documentation |
863 |
%{_develdir}/Kbuild |
864 |
%{_develdir}/Kconfig |
865 |
%{_develdir}/Makefile |
866 |
%{_develdir}/Module.symvers |
867 |
%{_develdir}/arch/Kconfig |
868 |
%ifarch %{arm} |
869 |
%{_develdir}/arch/arm |
870 |
%{_develdir}/arch/arm64 |
871 |
%endif |
872 |
%ifarch %{ix86} x86_64 |
873 |
%{_develdir}/arch/x86 |
874 |
%endif |
875 |
%{_develdir}/arch/um |
876 |
%{_develdir}/block |
877 |
%{_develdir}/crypto |
878 |
%{_develdir}/drivers |
879 |
%{_develdir}/firmware |
880 |
%{_develdir}/fs |
881 |
%{_develdir}/include/Kbuild |
882 |
%{_develdir}/include/acpi |
883 |
%{_develdir}/include/asm-generic |
884 |
%{_develdir}/include/clocksource |
885 |
%{_develdir}/include/config |
886 |
%{_develdir}/include/crypto |
887 |
%{_develdir}/include/drm |
888 |
%{_develdir}/include/dt-bindings |
889 |
%{_develdir}/include/generated |
890 |
%{_develdir}/include/keys |
891 |
%{_develdir}/include/kvm |
892 |
%{_develdir}/include/linux |
893 |
%{_develdir}/include/math-emu |
894 |
%{_develdir}/include/memory |
895 |
%{_develdir}/include/misc |
896 |
%{_develdir}/include/net |
897 |
%{_develdir}/include/pcmcia |
898 |
%{_develdir}/include/ras |
899 |
%{_develdir}/include/rdma |
900 |
%{_develdir}/include/scsi |
901 |
%{_develdir}/include/soc |
902 |
%{_develdir}/include/sound |
903 |
%{_develdir}/include/target |
904 |
%{_develdir}/include/trace |
905 |
%{_develdir}/include/uapi |
906 |
%{_develdir}/include/video |
907 |
%{_develdir}/include/media |
908 |
%{_develdir}/include/rxrpc |
909 |
%{_develdir}/include/xen |
910 |
%{_develdir}/init |
911 |
%{_develdir}/ipc |
912 |
%{_develdir}/kernel |
913 |
%{_develdir}/lib |
914 |
%{_develdir}/mm |
915 |
%{_develdir}/net |
916 |
%{_develdir}/samples |
917 |
%{_develdir}/scripts |
918 |
%{_develdir}/security |
919 |
%{_develdir}/sound |
920 |
%{_develdir}/tools |
921 |
%{_develdir}/usr |
922 |
%{_develdir}/virt |
923 |
%doc README.kernel-sources |
924 |
%endif # build_devel |
925 |
|
926 |
|
927 |
%if %build_doc |
928 |
%files -n %{kname}-doc |
929 |
%doc linux-%{tar_ver}/Documentation/* |
930 |
%endif # build_doc |
931 |
|
932 |
%if %build_kernel |
933 |
%files -n %{kname}-latest |
934 |
%endif # build_kernel |
935 |
|
936 |
%if %build_source |
937 |
%files -n %{kname}-source-latest |
938 |
%endif # build_source |
939 |
|
940 |
%if %build_devel |
941 |
%files -n %{kname}-devel-latest |
942 |
%endif # build_devel |