Logoj0ke.net Open Build Service > Projects > GFS > kernel-source > kernel-pae.spec
Sign Up | Log In

File kernel-pae.spec of Package kernel-source (Revision 070518fdb2298571a43e02c722b271a2)

Currently displaying revision 070518fdb2298571a43e02c722b271a2, show latest

 
1
#
2
# spec file for package kernel-pae (Version 2.6.27.4)
3
#
4
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
5
# This file and all modifications and additions to the pristine
6
# package are under the same license as the package itself.
7
#
8
# Please submit bugfixes or comments via http://bugs.opensuse.org/
9
#
10
11
# norootforbuild
12
13
%if 0%{?opensuse_bs}
14
# Strip off the build number ("y") from the "x.y" release number
15
%define source_rel %(release=%release; echo ${release%.*})
16
%else
17
# We don't have build numbers internally
18
%define source_rel %release
19
%endif
20
21
# Don't use shell commands in build macros, this won't work outside of rpm
22
%define build_flavor "pae"
23
%define build_kdump 0
24
%define build_xen 0
25
%define build_um 0
26
%define build_vanilla 0
27
28
%if %{build_flavor} == "kdump"
29
%define build_kdump 1
30
%endif
31
%if %{build_flavor} == "xen"
32
%define build_xen 1
33
%endif
34
%if %{build_flavor} == "um"
35
%define build_um 1
36
%endif
37
%if %{build_flavor} == "vanilla"
38
%define build_vanilla 1
39
%endif
40
41
%(chmod +x %_sourcedir/{arch-symbols,guards,config-subst,check-for-config-changes,check-supported-list,built-in-where,find-provides,list-exported-symbols,split-into-symsets,modversions,kabi-checks})
42
43
%define symbols %(set -- kernel-pae pae $(case pae in (rt|rt_*) echo RT ;; esac) $(%_sourcedir/arch-symbols %_target_cpu) $([ -e %_sourcedir/extra-symbols ] && cat %_sourcedir/extra-symbols) ; echo $*)
44
%define subarch_flavor %(%_sourcedir/guards %symbols < %_sourcedir/config.conf | grep '/pae$')
45
46
# Define some CONFIG variables as rpm macros as well. (rpm cannot handle
47
# defining them all at once.)
48
%define config_vars CONFIG_MODULES
49
%{expand:%(eval "$(test -n "%subarch_flavor" && tar xfj %_sourcedir/config.tar.bz2 --to-stdout config/%subarch_flavor)"; for config in %config_vars; do echo "%%global $config ${!config:-n}"; done)}
50
51
%if %build_vanilla || %build_kdump || %CONFIG_MODULES != "y"
52
%define split_packages 0
53
%else
54
%define split_packages 1
55
%endif
56
57
Name:           kernel-pae
58
Summary:        Dummy summary
59
Version:        2.6.27.4
60
Release:        <RELEASE>
61
License:        GPL
62
Group:          System/Kernel
63
Url:            http://www.kernel.org/
64
AutoReqProv:    on
65
BuildRequires:  coreutils module-init-tools sparse
66
BuildRequires:  fdupes
67
%if %split_packages
68
Requires:       kernel-pae-base = %version-%release
69
%endif
70
Requires(pre):  coreutils awk
71
Requires(post): module-init-tools
72
# This Requires is wrong, because the post/postun scripts have a
73
# test -x update-bootloader, having perl-Bootloader is not a hard requirement.
74
# But, there is no way to tell rpm or yast to schedule the installation
75
# of perl-Bootloader before kernel-binary.rpm if both are in the list of
76
# packages to install/update. Likewise, this is true for mkinitrd.
77
# A specific version of perl-Bootloader is not required, because the post/postun
78
# scripts handle the two API versions of 10.1/SLES10 GA and 10.2/SLES10 SP1
79
Requires(post): perl-Bootloader
80
Requires(post): mkinitrd
81
Recommends: kerneloops
82
#!BuildIgnore:  perl-Bootloader mkinitrd
83
84
%if ! 0%{?opensuse_bs}
85
BuildRequires:  kernel-dummy
86
%endif
87
%if %build_um
88
BuildRequires:  libpcap xorg-x11-devel
89
%endif
90
%ifarch ia64
91
# arch/ia64/scripts/unwcheck.py
92
BuildRequires:  python
93
%endif
94
%ifarch ppc ppc64
95
# for PS3 zImage
96
BuildRequires:  dtc
97
%endif
98
%if %build_xen
99
%ifarch %ix86
100
Provides:       kernel-xenpae = 2.6.27.4
101
Obsoletes:      kernel-xenpae <= 2.6.27.4
102
%endif
103
#!BuildIgnore:  xen
104
%endif
105
106
Provides:     kernel-pae-nongpl
107
Obsoletes:    kernel-pae-nongpl
108
%if %build_vanilla
109
# force bzip2 instead of lzma compression to allow install on older dist versions
110
%define _binary_payload w9.bzdio
111
%endif
112
# dead network if installed on SLES10, otherwise it will work (mostly)
113
Conflicts:    sysfsutils < 2.0
114
%if ! %build_vanilla
115
Conflicts:    apparmor-profiles <= 2.1
116
Conflicts:    apparmor-parser < 2.3
117
# root-lvm only works with newer udevs
118
Conflicts:      udev < 118
119
Conflicts:      lvm2 < 2.02.33
120
%endif
121
%ifarch %ix86
122
Conflicts:  libc.so.6()(64bit)
123
%endif
124
%if %build_um
125
#Conflicts:    kernel
126
%else
127
Provides:     kernel = 2.6.27.4-%source_rel
128
%endif
129
Provides:     k_smp4G kernel-bigsmp
130
Obsoletes:    k_smp4G kernel-bigsmp
131
132
Source0:      http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.27.tar.bz2
133
Source10:     preun.sh
134
Source11:     postun.sh
135
Source12:     pre.sh
136
Source13:     post.sh
137
Source20:     series.conf
138
Source21:     config.conf
139
Source22:     supported.conf
140
Source30:     arch-symbols
141
Source31:     guards
142
Source32:     config-subst
143
Source33:     check-for-config-changes
144
Source34:     check-supported-list
145
Source38:     kabi-checks
146
Source40:     build-source-timestamp
147
Source41:     built-in-where
148
Source42:     list-exported-symbols
149
Source43:     split-into-symsets
150
Source44:     find-provides
151
Source45:     module-renames
152
Source46:     modversions
153
Source100:    config.tar.bz2
154
Source101:    patches.arch.tar.bz2
155
Source102:    patches.drivers.tar.bz2
156
Source103:    patches.fixes.tar.bz2
157
Source104:    patches.rpmify.tar.bz2
158
Source105:    patches.suse.tar.bz2
159
Source107:    patches.xen.tar.bz2
160
Source108:    patches.addon.tar.bz2
161
Source109:    patches.kernel.org.tar.bz2
162
Source110:    patches.apparmor.tar.bz2
163
Source111:    patches.rt.tar.bz2
164
Source112:    patches.trace.tar.bz2
165
Source120:    kabi.tar.bz2
166
%define my_builddir %_builddir/%{name}-%{version}
167
BuildRoot:    %{_tmppath}/%{name}-%{version}-build
168
ExclusiveArch: %ix86
169
170
# These files are found in the kernel-source package:
171
NoSource:     0
172
NoSource:     100
173
NoSource:     101
174
NoSource:     102
175
NoSource:     103
176
NoSource:     104
177
NoSource:     105
178
NoSource:     107
179
NoSource:     108
180
NoSource:     109
181
NoSource:     110
182
NoSource:     111
183
NoSource:     120
184
185
# The following KMPs have been integrated into the kernel package.
186
Obsoletes: iwlwifi-kmp
187
Obsoletes: ipw3945-kmp
188
Obsoletes: adm8211-kmp
189
Obsoletes: rt2x00-kmp
190
Obsoletes: rfswitch-kmp
191
Obsoletes: uvcvideo-kmp
192
Obsoletes: atl2-kmp
193
Obsoletes: wlan-ng-kmp
194
Obsoletes: et131x-kmp
195
Obsoletes: ivtv-kmp
196
Obsoletes: at76_usb-kmp
197
Obsoletes: pcc-acpi-kmp
198
Obsoletes: uvcvideo-kmp
199
Obsoletes: ralink-rt2860-kmp
200
201
# Build with bash instead of sh as the shell: this turns on bash
202
# extensions like <(...).
203
%define _buildshell /bin/bash
204
205
# Provide the exported symbols as "ksym(symbol) = hash"
206
%define __find_provides %_sourcedir/find-provides %name
207
208
# Will modules not listed in supported.conf abort the kernel build (0/1)?
209
%define supported_modules_check 0
210
211
%define tolerate_unknown_new_config_options 1
212
213
# kABI change tolerance (default in maintenance should be 4, 6, 8 or 15,
214
# 31 is the maximum; see scripts/kabi-checks)
215
%define tolerate_kabi_changes 31
216
217
%description
218
Dummy description.
219
220
%prep
221
if ! [ -e %_sourcedir/linux-2.6.27.tar.bz2 ]; then
222
    echo "The kernel-pae-2.6.27.4.nosrc.rpm package does not contain the" \
223
     "complete sources. Please install kernel-source-2.6.27.4.src.rpm."
224
    exit 1
225
fi
226
227
echo "Architecture symbol(s):" %symbols
228
229
# Unpack all sources and patches
230
%setup -q -c -T -a 0 -a 100 -a 101 -a 102 -a 103 -a 104 -a 105 -a 107 -a 108 -a 109 -a 110 -a 111 -a 112 -a 120
231
232
supported_conf() {
233
    %_sourcedir/guards %symbols $* < %_sourcedir/supported.conf | sort -u
234
}
235
236
# Generate the list of modules to be marked as supported
237
{   supported_conf base
238
    for how in external; do
239
    comm -2 -3 <(supported_conf base $how) <(supported_conf base) \
240
        | sed -e 's:$: '"$how"':'
241
    done
242
} | sed -e 's,.*/,,' -e 's,\.ko$,,' > linux-2.6.27/Module.supported
243
244
# Create grep pattern file for the modules to end up in the base package
245
comm -2 -3 <(supported_conf base) <(supported_conf) \
246
    | sed -e 's:.*/::' -e 's:^:\\/:' -e 's:$:\.ko$:' \
247
    > %my_builddir/grep-for-base-modules
248
249
cd linux-2.6.27
250
251
# Find out for which architecture to build. We do this here, and use the
252
# result in the %build and %install sections.
253
#
254
# On architectures with a bi-arch or cross compiler, we can compile for
255
# an architecture different from %arch. The location of the config file
256
# tells us for which architecture to compile.
257
set -- %subarch_flavor
258
if [ $# -ne 1 ]; then
259
    echo "$# config files found for this spec file (but one needed)" >&2
260
    exit 1
261
fi
262
subarch=${1%/*}
263
264
# Apply the patches needed for this architecture.
265
%if ! %build_vanilla
266
for patch in $(%_sourcedir/guards %symbols < %_sourcedir/series.conf); do
267
    if ! patch -s -F0 -E -p1 --no-backup-if-mismatch -i ../$patch; then
268
    echo "*** Patch $patch failed ***"
269
    exit 1
270
    fi
271
done
272
%else
273
for patch in $(%_sourcedir/guards %symbols < %_sourcedir/series.conf | egrep kernel.org\|rpmify); do
274
    if ! patch -s -F0 -E -p1 --no-backup-if-mismatch -i ../$patch; then
275
    echo "*** Patch $patch failed ***"
276
    exit 1
277
    fi
278
done
279
%endif
280
281
# Release number without the EXTRAVERSION
282
RELEASE=%source_rel
283
while [ "$RELEASE" != "${RELEASE#[^0-9]*.}" ]; do
284
    RELEASE=${RELEASE#[^0-9]*.}
285
done
286
287
if [ -f %_sourcedir/localversion ] ; then
288
    cat %_sourcedir/localversion > localversion
289
fi
290
291
cat ../config/%subarch_flavor \
292
| %_sourcedir/config-subst CONFIG_LOCALVERSION '"'-$RELEASE-pae'"' \
293
| %_sourcedir/config-subst CONFIG_SUSE_KERNEL y \
294
%if 0%{?__debug_package:1}
295
    | %_sourcedir/config-subst CONFIG_DEBUG_INFO y \
296
%endif
297
    > .config
298
299
# We compile for this sub-architecture (i.e., machine architecture):
300
%if %build_um
301
cat > ../.rpm-defs <<EOF
302
ARCH=pae
303
SUBARCH=$subarch
304
MAKE_ARGS="ARCH=pae SUBARCH=$subarch"
305
EOF
306
%else
307
cat > ../.rpm-defs <<EOF
308
ARCH=$subarch
309
SUBARCH=$subarch
310
MAKE_ARGS="ARCH=$subarch"
311
EOF
312
%endif
313
314
cat >> ../.rpm-defs <<EOF
315
KERNELRELEASE=2.6.27.4-$RELEASE-pae
316
EOF
317
318
%if 0%{?__debug_package:1}
319
cat >> ../.rpm-defs <<EOF
320
MAKE_ARGS="\$MAKE_ARGS CONFIG_DEBUG_INFO=y"
321
EOF
322
%endif
323
324
echo CONFIG_MODULES=%CONFIG_MODULES >> ../.rpm-defs
325
326
%build
327
source .rpm-defs
328
329
cd linux-2.6.27
330
cp .config .config.orig
331
%if %{tolerate_unknown_new_config_options}
332
MAKE_ARGS="$MAKE_ARGS -k"
333
yes '' | make oldconfig $MAKE_ARGS
334
%else
335
make silentoldconfig $MAKE_ARGS < /dev/null
336
%_sourcedir/check-for-config-changes .config.orig .config
337
rm .config.orig
338
%endif
339
340
make prepare $MAKE_ARGS
341
krel=$(make -s kernelrelease $MAKE_ARGS)
342
343
if [ "$krel" != "$KERNELRELEASE" ]; then
344
    echo "Kernel release mismatch: $krel != $KERNELRELEASE" >&2
345
    exit 1
346
fi
347
348
349
cat > .kernel-binary.spec.buildenv <<EOF
350
# Override the timestamp 'uname -v' reports with the build
351
# timestamp.
352
export KBUILD_BUILD_VERSION="$(grep SHA1_ID %_sourcedir/build-source-timestamp | awk '{ print $2 }')"
353
export KBUILD_BUILD_TIMESTAMP="$(head -n 1 %_sourcedir/build-source-timestamp)"
354
355
# The following branch/timestamp will end up in Oopses.
356
export OOPS_TIMESTAMP="$(
357
    echo -n $(sed -ne 's/^CVS Branch: \(.*\)/\1-/p' \
358
          %_sourcedir/build-source-timestamp)
359
    head -n 1 %_sourcedir/build-source-timestamp \
360
    | tr -dc 0-9)"
361
362
export KBUILD_VERBOSE=0
363
export KBUILD_SYMTYPES=1
364
EOF
365
source .kernel-binary.spec.buildenv
366
make %{?jobs:-j%jobs} all $MAKE_ARGS CONFIG_DEBUG_SECTION_MISMATCH=y
367
368
%install
369
source .rpm-defs
370
371
# get rid of /usr/lib/rpm/brp-strip-debug
372
# strip removes too much from the vmlinux ELF binary
373
export NO_BRP_STRIP_DEBUG=true
374
375
# /lib/modules/$KERNELRELEASE/build will be a stale symlink until the
376
# kernel-source package is installed. Don't check for stale symlinks
377
# in the brp-symlink check:
378
export NO_BRP_STALE_LINK_ERROR=yes
379
380
cd linux-2.6.27
381
382
mkdir %buildroot/boot
383
# (Could strip out non-public symbols.)
384
cp -p System.map %buildroot/boot/System.map-$KERNELRELEASE
385
386
add_vmlinux()
387
{
388
    local vmlinux=boot/vmlinux-$KERNELRELEASE
389
%if 0%{?__debug_package:1}
390
    local vmlinux_debug=usr/lib/debug/$vmlinux.debug
391
    mkdir -p $(dirname %buildroot/$vmlinux_debug)
392
    cp vmlinux %buildroot/$vmlinux
393
    /usr/lib/rpm/debugedit -b $RPM_BUILD_DIR -d /usr/src/debug \
394
               -l vmlinux.sourcefiles %buildroot/$vmlinux
395
    objcopy --only-keep-debug \
396
        %buildroot/$vmlinux \
397
        %buildroot/$vmlinux_debug || :
398
    objcopy --add-gnu-debuglink=%buildroot/$vmlinux_debug \
399
        --strip-debug \
400
        %buildroot/$vmlinux || :
401
    mkdir -p %buildroot/usr/src/debug
402
    LANG=C sort -z -u vmlinux.sourcefiles | grep -z -v "<built-in>" \
403
    | ( cd %_builddir && cpio -pd0m %buildroot/usr/src/debug )
404
    find %buildroot/usr/src/debug -type d -print0 | xargs -0 -r chmod 0755
405
    find %buildroot/usr/src/debug -type f -print0 | xargs -0 -r chmod 0644
406
%else
407
    cp vmlinux %buildroot/$vmlinux
408
%endif
409
    if [ "$1" = --compressed ]; then
410
    gzip -9 %buildroot/$vmlinux
411
        chmod a-x %buildroot/$vmlinux.gz
412
    fi
413
}
414
415
%if %build_kdump
416
    add_vmlinux
417
    chmod 644 %buildroot/boot/vmlinux-$KERNELRELEASE
418
    image=vmlinux
419
%else
420
%if %build_um
421
    add_vmlinux
422
    chmod 755 %buildroot/boot/vmlinux-$KERNELRELEASE
423
    image=linux
424
%else
425
426
# architecture specifics
427
%ifarch %ix86 x86_64
428
    add_vmlinux --compressed
429
%if %build_xen
430
    image=vmlinuz
431
%else
432
    image=bzImage
433
%endif
434
    cp -p arch/x86/boot/$image %buildroot/boot/vmlinuz-$KERNELRELEASE
435
    image=vmlinuz
436
%endif
437
%ifarch alpha
438
    add_vmlinux --compressed
439
    cp -p arch/alpha/boot/vmlinux.gz %buildroot/boot/vmlinuz-$KERNELRELEASE
440
    image=vmlinuz
441
%endif
442
%ifarch ppc ppc64
443
    add_vmlinux
444
    chmod 644 %buildroot/boot/vmlinux-$KERNELRELEASE
445
    image=vmlinux
446
%endif
447
%ifarch ia64
448
    add_vmlinux --compressed
449
    mv %buildroot/boot/vmlinux-$KERNELRELEASE.gz \
450
       %buildroot/boot/vmlinuz-$KERNELRELEASE
451
    image=vmlinuz
452
%endif
453
%ifarch s390 s390x
454
    add_vmlinux --compressed
455
    cp -p arch/s390/boot/image %buildroot/boot/image-$KERNELRELEASE
456
    image=image
457
%endif
458
    if [ -e init/kerntypes.o ]; then
459
    cp init/kerntypes.o %buildroot/boot/Kerntypes-$KERNELRELEASE
460
    fi
461
462
# end of build_um
463
%endif
464
# end of build_kdump
465
%endif
466
467
for sub in '-base' '' '-extra'; do
468
%if %split_packages
469
    if [ "x$sub" = "x-base" ]; then
470
        base_package=1
471
    else
472
        base_package=0
473
    fi
474
%else
475
    base_package=1
476
%endif
477
    for script in preun postun pre post; do
478
        sed -e "s:@KERNELRELEASE@:$KERNELRELEASE:g" \
479
            -e "s:@IMAGE@:$image:g" \
480
            -e "s:@FLAVOR""@:pae:g" \
481
            -e "s:@SUBPACKAGE@:kernel-pae$sub:g" \
482
            -e "s:@BASE_PACKAGE@:$base_package:g" \
483
            -e "s:@RPM_VERSION_RELEASE@:%version-%release:g" \
484
            %_sourcedir/$script.sh > ../$script$sub.sh
485
    done
486
done
487
488
489
%if %build_kdump || %build_um || %build_xen || %build_vanilla
490
suffix=-pae
491
%endif
492
ln -s $image$suffix %buildroot/boot/$image$suffix
493
ln -s initrd$suffix %buildroot/boot/initrd$suffix
494
495
cp .config %buildroot/boot/config-$KERNELRELEASE
496
497
# Figure out where the symbols that vmlinux exports are defined.
498
# (We need this information below as well as in find-provides; we "annotate"
499
#  the original Module.symvers here to make sure that we are consistent in
500
#  both places.)
501
%_sourcedir/built-in-where < Module.symvers > Module.symvers.split
502
mv Module.symvers.split Module.symvers
503
504
gzip -c9 < Module.symvers > %buildroot/boot/symvers-$KERNELRELEASE.gz
505
506
if [ $CONFIG_MODULES = y ]; then
507
    make modules_install $MAKE_ARGS INSTALL_MOD_PATH=%buildroot
508
509
    if ! %_sourcedir/check-supported-list \
510
        %_sourcedir %buildroot/lib/modules/$KERNELRELEASE; then
511
%if %supported_modules_check
512
    exit 1
513
%endif
514
    echo "Consistency check error: please update supported.conf."
515
    fi
516
517
    # Also put the resulting file in $obj_dir/$SUBARCH/pae
518
    # so that kernel-source + kernel-pae is sufficient for building
519
    # modules that have modversions as well.
520
    obj_dir=usr/src/linux-${KERNELRELEASE%%-pae}-obj
521
    mkdir -p %buildroot/$obj_dir/$SUBARCH/pae
522
    cp Module.symvers %buildroot/$obj_dir/$SUBARCH/pae
523
524
    # Table of types used in exported symbols (for modversion debugging).
525
    %_sourcedir/modversions --pack . > %buildroot/boot/symtypes-$KERNELRELEASE
526
    if [ -s %buildroot/boot/symtypes-$KERNELRELEASE ]; then
527
    gzip -9 %buildroot/boot/symtypes-$KERNELRELEASE
528
    else
529
    rm -f %buildroot/boot/symtypes-$KERNELRELEASE
530
    fi
531
532
    # Some architecture's $(uname -m) output is different from the ARCH
533
    # parameter that needs to be passed to kbuild. Create symlinks from
534
    # $(uname -m) to the ARCH directory.
535
    [ -e %buildroot/$obj_dir/%_target_cpu ] \
536
    || ln -sf $SUBARCH %buildroot/$obj_dir/%_target_cpu
537
%ifarch ppc ppc64
538
    [ -e %buildroot/$obj_dir/ppc ] \
539
    || ln -s $SUBARCH %buildroot/$obj_dir/ppc
540
    [ -e %buildroot/$obj_dir/ppc64 ] \
541
    || ln -s $SUBARCH %buildroot/$obj_dir/ppc64
542
%endif
543
544
    # Check for kABI changes
545
    KABI=0
546
    if [ -e %my_builddir/kabi/$SUBARCH/symvers-pae ]; then
547
    %_sourcedir/kabi-checks \
548
        %my_builddir/kabi/$SUBARCH/symvers-pae \
549
        Module.symvers \
550
        %my_builddir/kabi/commonsyms \
551
        %my_builddir/kabi/usedsyms \
552
    || KABI=$?
553
    fi
554
    if [ $KABI -gt %tolerate_kabi_changes ]; then
555
    echo "kABI changes of badness $KABI exceed the maximum allowed badness" \
556
         "of %tolerate_kabi_changes. Please try to avoid the kABI changes."
557
    if [ ! -e %my_builddir/kabi/$SUBARCH/ignore-pae -a \
558
         ! -e %_sourcedir/IGNORE-KABI-BADNESS ]; then
559
        echo "Create a file IGNORE-KABI-BADNESS in the kernel-source" \
560
         "directory to build this kernel even though its badness is" \
561
         "higher than allowed for an official kernel."
562
       exit 1
563
    fi
564
565
    # Indicate the ABI badness in build result emails.
566
    echo "KABI BADNESS $KABI" > %_rpmdir/%_arch/mbuild_subject.tag
567
    fi
568
    if [ $KABI -ge 8 ]; then
569
    echo "To find out which types have changed relative to the reference" \
570
         "symbols, diff the symtypes.gz files of the reference kernel" \
571
         "against the symtypes.gz file from this build."
572
    fi
573
574
    # We were building in %my_builddir/linux-2.6.27, but the sources will
575
    # later be installed in /usr/src/linux-2.6.27-%source_rel. Fix up the
576
    # build symlink.
577
    rm -f %buildroot/lib/modules/$KERNELRELEASE/{source,build}
578
    ln -s /usr/src/linux-${KERNELRELEASE%%-pae} \
579
    %buildroot/lib/modules/$KERNELRELEASE/source
580
    ln -s /$obj_dir/$SUBARCH/pae \
581
    %buildroot/lib/modules/$KERNELRELEASE/build
582
583
    # Abort if there are any undefined symbols
584
    msg="$(/sbin/depmod -F %buildroot/boot/System.map-$KERNELRELEASE \
585
            -b %buildroot -ae $KERNELRELEASE 2>&1)"
586
    if [ $? -ne 0 ] || echo "$msg" | grep  'needs unknown symbol'; then
587
    exit 1
588
    fi
589
590
    # Create a dummy initrd with roughly the size the real one will have.
591
    # That way, YaST will know that this package requires some additional
592
    # space in /boot.
593
    dd if=/dev/zero of=%buildroot/boot/initrd-$KERNELRELEASE \
594
    bs=1024 seek=2047 count=1
595
596
%if %split_packages
597
    # Generate the lists of supported and unsupported modules.
598
    (   cd %buildroot
599
    : > %my_builddir/supported-modules
600
    : > %my_builddir/unsupported-modules
601
    for module in $(find lib/modules/$KERNELRELEASE -type f -name '*.ko'); do
602
        case "$(/sbin/modinfo -F supported $module)" in
603
        (yes|external)
604
        modname=$(basename $module .ko)
605
        deps=$(/sbin/modinfo -F depends $module|tr ',' ' ')
606
        echo "$modname: $deps" >> %my_builddir/Makefile.supported
607
        echo "/$module" >> %my_builddir/supported-modules
608
        ;;
609
        (*)
610
        echo "/$module" >> %my_builddir/unsupported-modules
611
        ;;
612
        esac
613
    done
614
    )
615
616
    add_dependent_modules() {
617
    local modules_dep=$1
618
619
    xargs make -rRs -f <(echo -e '%:\n\t@echo $@' ; cat $modules_dep)
620
    }
621
622
    modules_dep=%buildroot/lib/modules/$KERNELRELEASE/modules.dep
623
624
    # Make sure that no supported modules depend on any unsupported modules.
625
    dependent_unsupported_modules=$(
626
    OUT=$(mktemp)
627
    sed -e 's/:.*//g' < %my_builddir/Makefile.supported | \
628
            xargs make -rRsk -f %my_builddir/Makefile.supported > $OUT
629
    sed -ne '/No rule/s/^.*No rule to make target//p' < $OUT | tr -d "\`'"
630
    )
631
    if [ -n "$dependent_unsupported_modules" ]; then
632
    echo "The following unsupported modules are used by supported modules:"
633
    echo "$dependent_unsupported_modules"
634
    echo "Please fix supported.conf."
635
    if [ ! -e %_sourcedir/IGNORE-UNSUPPORTED-DEPS ]; then
636
        exit 1
637
    fi
638
    fi
639
640
    # Compute the list of base modules: modules that core modules depend on
641
    # implicitly are also core modules.
642
    grep -f %my_builddir/grep-for-base-modules %my_builddir/supported-modules \
643
    | add_dependent_modules $modules_dep > %my_builddir/base-modules
644
645
    # All supported modules which are not core modules belong in kernel-pae.
646
    comm -3 <(sort %my_builddir/supported-modules) \
647
        <(sort %my_builddir/base-modules) \
648
    > %my_builddir/main-modules
649
%else
650
    (   cd %buildroot
651
    find lib/modules/$KERNELRELEASE -type f -name '*.ko' -printf '/%%p\n'
652
    ) > %my_builddir/base-modules
653
%endif
654
655
    exported_by_modules() {
656
    local module
657
658
    while read module; do
659
        %_sourcedir/list-exported-symbols $RPM_BUILD_ROOT$module
660
    done
661
    }
662
663
    mkdir %my_builddir/{base,main,extra}
664
    (   awk '$3 == "vmlinux" || $3 ~ /\/built-in$/ { print }' Module.symvers
665
    exported_by_modules < %my_builddir/base-modules
666
    ) | %_sourcedir/split-into-symsets %my_builddir/base
667
%if %split_packages
668
    exported_by_modules < %my_builddir/main-modules \
669
    | %_sourcedir/split-into-symsets %my_builddir/main
670
    exported_by_modules < %my_builddir/unsupported-modules \
671
    | %_sourcedir/split-into-symsets %my_builddir/extra
672
%endif
673
674
    # Notes:
675
    # - We rely on list-exported-symbols to correctly extract all exported
676
    #   symbols from modules; Module.symvers is disregarded for that.
677
    # - We recompute the symsets in find-provides. Take care to keep the
678
    #   algorithm the same in both places.
679
680
    ## Preserve exports from previous kernels when possible.
681
    #old_symsets=%my_builddir/kabi/$SUBARCH/symsets-pae.tar.gz
682
    #[ -e $old_symsets ] || old_symsets=
683
    # FIXME: implement
684
685
    symsets=%my_builddir/symsets-$KERNELRELEASE
686
    mkdir $symsets
687
    find %my_builddir/{base,main,extra} -type f \
688
    | xargs --replace='{}' cp '{}' $symsets/
689
    tar c -C ${symsets%/*} ${symsets##*/} \
690
    | gzip -9 \
691
    > %buildroot/boot/symsets-$KERNELRELEASE.tar.gz
692
693
    # FIXME: check for abi changes
694
695
    # Set up some module aliases
696
    install -d -m 755 %buildroot/etc/modprobe.d/
697
    install -m 644 %_sourcedir/module-renames %buildroot/etc/modprobe.d/
698
fi
699
700
add_dirs_to_filelist() {
701
    local filelist
702
703
    filelist=$(cat "$@")
704
    echo "$filelist"
705
706
    # Below, we do this:
707
    # - remove filelist macros
708
    # - remove last pathname component
709
    # - generate all parents and make the list unique
710
    # - skip directories owned be other packages
711
    # - add the %dir prefix (double-escaped for find and rpm)
712
713
    echo "$filelist" \
714
    | sed -re 's:%%%%[a-z]+(\([^)]+\))? ?::g' \
715
    | sed -re 's:/[^/]+$::' \
716
    | sed -nre ':a; p; s:/[^/]+$::; ta' \
717
    | sort -u \
718
    | sed -r -e '\:^(|/boot|/etc|/lib(/modules|/firmware)?|/usr(/src)?)$:d' \
719
    | sed -e 's:^:%%%%dir :'
720
}
721
722
# Collect the file lists.
723
{   cd %buildroot
724
    find boot \
725
    \( -type l -o -name 'initrd-*' \) -printf '%%%%%%%%ghost /%%p\n' -o \
726
    -type f -printf '/%%p\n'
727
728
    # Add the auto-generated (by mkdumprd) kdump initrd to %ghost so that
729
    # the file gets removed when uninstalling the kernel.
730
    echo '%%%%ghost /boot/initrd-'${KERNELRELEASE}'-kdump'
731
    touch $RPM_BUILD_ROOT/boot/initrd-${KERNELRELEASE}-kdump
732
733
    if [ $CONFIG_MODULES = y ]; then
734
    find lib/modules/$KERNELRELEASE \
735
        -type d -o \
736
        -path '*/modules.*' -printf '%%%%%%%%ghost /%%p\n' -o \
737
        -name '*.ko' -prune -o \
738
        -printf '/%%p\n'
739
    cat %my_builddir/base-modules
740
    echo '%%%%config /etc/modprobe.d/module-renames'
741
    find $obj_dir \
742
        -type d -o \
743
        -printf '/%%p\n'
744
    fi
745
    test -d lib/firmware/$KERNELRELEASE && \
746
    find lib/firmware/$KERNELRELEASE \
747
    -type d -o \
748
    -printf '/%%p\n'
749
    if [ -e .%_docdir/%name ]; then
750
    echo "%%%%doc %_docdir/%name"
751
    fi
752
} | add_dirs_to_filelist > %my_builddir/kernel-base.files
753
754
%if %split_packages
755
    add_dirs_to_filelist %my_builddir/main-modules > %my_builddir/kernel-main.files
756
    add_dirs_to_filelist %my_builddir/unsupported-modules > %my_builddir/kernel-extra.files
757
%endif
758
759
# Hardlink duplicate files automatically (from package fdupes): It doesn't save
760
# much, but it keeps rpmlint from breaking the package build.
761
%fdupes $RPM_BUILD_ROOT
762
763
%preun -f preun.sh
764
%postun -f postun.sh
765
%pre -f pre.sh
766
%post -f post.sh
767
768
769
%if %split_packages
770
%files -f kernel-main.files
771
%else
772
%files -f kernel-base.files
773
%endif
774
%defattr(-, root, root)
775
776
%package -n kernel-pae-base
777
Summary: Base kernel package
778
License:        GPL
779
Group:          System/Kernel
780
Url:            http://www.kernel.org/
781
AutoReqProv:    on
782
Requires(pre):  coreutils awk
783
Requires(post): module-init-tools
784
Requires(post): perl-Bootloader
785
Requires(post): mkinitrd
786
787
%description -n kernel-pae-base
788
Dummy description.
789
790
%preun base -f preun-base.sh
791
%postun base -f postun-base.sh
792
%pre base -f pre-base.sh
793
%post base -f post-base.sh
794
795
%if %split_packages
796
%files -n kernel-pae-base -f kernel-base.files
797
%defattr(-, root, root)
798
%endif
799
800
%package -n kernel-pae-extra
801
Summary: Unsupported kernel modules
802
License:        GPL
803
Group:          System/Kernel
804
Url:            http://www.kernel.org/
805
AutoReqProv:    on
806
Requires:       kernel-pae = %version-%release
807
Requires(pre):  coreutils awk
808
Requires(post): module-init-tools
809
Requires(post): perl-Bootloader
810
Requires(post): mkinitrd
811
Supplements:    packageand(product(SUSE_SLED):kernel-pae)
812
Supplements:    packageand(product(openSUSE):kernel-pae)
813
814
%description -n kernel-pae-extra
815
Dummy description.
816
817
%preun extra -f preun-extra.sh
818
%postun extra -f postun-extra.sh
819
%pre extra -f pre-extra.sh
820
%post extra -f post-extra.sh
821
822
%if %split_packages
823
%files -n kernel-pae-extra -f kernel-extra.files
824
%defattr(-, root, root)
825
%endif
826