diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-17 20:51:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-17 20:51:33 -0500 |
commit | 2ce079f04d5914dae14fdc8618f804cc0d2a1b8f (patch) | |
tree | 4bafc8b62dc5d334662f8c5e86dec5ba461df3a8 /scripts/package/mkspec | |
parent | 09bd7c75e55cbaa6c731b0c3a5512ad89159f26f (diff) | |
parent | e9e716ff2d4d8618aefac55691a4c4483abecc37 (diff) |
Merge tag 'kbuild-misc-v4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild misc updates from Masahiro Yamada:
- Clean up and fix RPM package build
- Fix a warning in DEB package build
- Improve coccicheck script
- Improve some semantic patches
* tag 'kbuild-misc-v4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
docs: dev-tools: coccinelle: delete out of date wiki reference
coccinelle: orplus: reorganize to improve performance
coccinelle: use exists to improve efficiency
builddeb: Pass the kernel:debarch substvar to dpkg-genchanges
Coccinelle: use false positive annotation
coccinelle: fix verbose message about .cocci file being run
coccinelle: grep Options and Requires fields more precisely
Coccinelle: make DEBUG_FILE option more useful
coccinelle: api: detect identical chip data arrays
coccinelle: Improve setup_timer.cocci matching
Coccinelle: setup_timer: improve messages from setup_timer
kbuild: rpm-pkg: do not force -jN in submake
kbuild: rpm-pkg: keep spec file until make mrproper
kbuild: rpm-pkg: fix jobserver unavailable warning
kbuild: rpm-pkg: replace $RPM_BUILD_ROOT with %{buildroot}
kbuild: rpm-pkg: fix build error when CONFIG_MODULES is disabled
kbuild: rpm-pkg: refactor mkspec with here doc
kbuild: rpm-pkg: clean up mkspec
kbuild: rpm-pkg: install vmlinux.bz2 unconditionally
kbuild: rpm-pkg: remove ppc64 specific image handling
Diffstat (limited to 'scripts/package/mkspec')
-rwxr-xr-x | scripts/package/mkspec | 269 |
1 files changed, 124 insertions, 145 deletions
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index f47f17aae135..280027fad991 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
@@ -10,156 +10,135 @@ | |||
10 | # | 10 | # |
11 | 11 | ||
12 | # how we were called determines which rpms we build and how we build them | 12 | # how we were called determines which rpms we build and how we build them |
13 | if [ "$1" = "prebuilt" ]; then | 13 | if [ "$1" = prebuilt ]; then |
14 | PREBUILT=true | 14 | S=DEL |
15 | else | 15 | else |
16 | PREBUILT=false | 16 | S= |
17 | fi | 17 | fi |
18 | 18 | ||
19 | # starting to output the spec | 19 | if grep -q CONFIG_MODULES=y .config; then |
20 | if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then | 20 | M= |
21 | PROVIDES=kernel-drm | 21 | else |
22 | fi | 22 | M=DEL |
23 | |||
24 | PROVIDES="$PROVIDES kernel-$KERNELRELEASE" | ||
25 | __KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"` | ||
26 | |||
27 | echo "Name: kernel" | ||
28 | echo "Summary: The Linux Kernel" | ||
29 | echo "Version: $__KERNELRELEASE" | ||
30 | echo "Release: $(cat .version 2>/dev/null || echo 1)" | ||
31 | echo "License: GPL" | ||
32 | echo "Group: System Environment/Kernel" | ||
33 | echo "Vendor: The Linux Community" | ||
34 | echo "URL: http://www.kernel.org" | ||
35 | |||
36 | if ! $PREBUILT; then | ||
37 | echo "Source: kernel-$__KERNELRELEASE.tar.gz" | ||
38 | fi | ||
39 | |||
40 | echo "BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root" | ||
41 | echo "Provides: $PROVIDES" | ||
42 | echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :" | ||
43 | echo "%define debug_package %{nil}" | ||
44 | echo "" | ||
45 | echo "%description" | ||
46 | echo "The Linux Kernel, the operating system core itself" | ||
47 | echo "" | ||
48 | echo "%package headers" | ||
49 | echo "Summary: Header files for the Linux kernel for use by glibc" | ||
50 | echo "Group: Development/System" | ||
51 | echo "Obsoletes: kernel-headers" | ||
52 | echo "Provides: kernel-headers = %{version}" | ||
53 | echo "%description headers" | ||
54 | echo "Kernel-headers includes the C header files that specify the interface" | ||
55 | echo "between the Linux kernel and userspace libraries and programs. The" | ||
56 | echo "header files define structures and constants that are needed for" | ||
57 | echo "building most standard programs and are also needed for rebuilding the" | ||
58 | echo "glibc package." | ||
59 | echo "" | ||
60 | echo "%package devel" | ||
61 | echo "Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel" | ||
62 | echo "Group: System Environment/Kernel" | ||
63 | echo "AutoReqProv: no" | ||
64 | echo "%description -n kernel-devel" | ||
65 | echo "This package provides kernel headers and makefiles sufficient to build modules" | ||
66 | echo "against the $__KERNELRELEASE kernel package." | ||
67 | echo "" | ||
68 | |||
69 | if ! $PREBUILT; then | ||
70 | echo "%prep" | ||
71 | echo "%setup -q" | ||
72 | echo "" | ||
73 | fi | 23 | fi |
74 | 24 | ||
75 | echo "%build" | 25 | if grep -q CONFIG_DRM=y .config; then |
76 | 26 | PROVIDES=kernel-drm | |
77 | if ! $PREBUILT; then | ||
78 | echo "make clean && make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}" | ||
79 | echo "" | ||
80 | fi | 27 | fi |
81 | 28 | ||
82 | echo "%install" | 29 | PROVIDES="$PROVIDES kernel-$KERNELRELEASE" |
83 | echo 'KBUILD_IMAGE=$(make image_name)' | 30 | __KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g") |
84 | echo "%ifarch ia64" | 31 | EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \ |
85 | echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' | 32 | --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \ |
86 | echo "%else" | 33 | --exclude=.config.old --exclude=.missing-syscalls.d" |
87 | echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' | ||
88 | echo "%endif" | ||
89 | |||
90 | echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= modules_install' | ||
91 | echo "%ifarch ia64" | ||
92 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" | ||
93 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" | ||
94 | echo "%else" | ||
95 | echo "%ifarch ppc64" | ||
96 | echo "cp vmlinux arch/powerpc/boot" | ||
97 | echo "cp arch/powerpc/boot/"'$KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" | ||
98 | echo "%else" | ||
99 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" | ||
100 | echo "%endif" | ||
101 | echo "%endif" | ||
102 | |||
103 | echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install' | ||
104 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" | ||
105 | |||
106 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" | ||
107 | |||
108 | echo "%ifnarch ppc64" | ||
109 | echo 'bzip2 -9 --keep vmlinux' | ||
110 | echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2" | ||
111 | echo "%endif" | ||
112 | |||
113 | if ! $PREBUILT; then | ||
114 | echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/build" | ||
115 | echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/source" | ||
116 | echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE" | ||
117 | echo "EXCLUDES=\"$RCS_TAR_IGNORE --exclude .tmp_versions --exclude=*vmlinux* --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation --exclude .config.old --exclude .missing-syscalls.d\"" | ||
118 | echo "tar "'$EXCLUDES'" -cf- . | (cd "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE;tar xvf -)" | ||
119 | echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE" | ||
120 | echo "ln -sf /usr/src/kernels/$KERNELRELEASE build" | ||
121 | echo "ln -sf /usr/src/kernels/$KERNELRELEASE source" | ||
122 | fi | ||
123 | 34 | ||
124 | echo "" | 35 | # We can label the here-doc lines for conditional output to the spec file |
125 | echo "%clean" | 36 | # |
126 | echo 'rm -rf $RPM_BUILD_ROOT' | 37 | # Labels: |
127 | echo "" | 38 | # $S: this line is enabled only when building source package |
128 | echo "%post" | 39 | # $M: this line is enabled only when CONFIG_MODULES is enabled |
129 | echo "if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then" | 40 | sed -e '/^DEL/d' -e 's/^\t*//' <<EOF |
130 | echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm" | 41 | Name: kernel |
131 | echo "cp /boot/System.map-$KERNELRELEASE /boot/.System.map-$KERNELRELEASE-rpm" | 42 | Summary: The Linux Kernel |
132 | echo "rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE" | 43 | Version: $__KERNELRELEASE |
133 | echo "/sbin/installkernel $KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm" | 44 | Release: $(cat .version 2>/dev/null || echo 1) |
134 | echo "rm -f /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm" | 45 | License: GPL |
135 | echo "fi" | 46 | Group: System Environment/Kernel |
136 | echo "" | 47 | Vendor: The Linux Community |
137 | echo "%preun" | 48 | URL: http://www.kernel.org |
138 | echo "if [ -x /sbin/new-kernel-pkg ]; then" | 49 | $S Source: kernel-$__KERNELRELEASE.tar.gz |
139 | echo "new-kernel-pkg --remove $KERNELRELEASE --rminitrd --initrdfile=/boot/initramfs-$KERNELRELEASE.img" | 50 | Provides: $PROVIDES |
140 | echo "fi" | 51 | %define __spec_install_post /usr/lib/rpm/brp-compress || : |
141 | echo "" | 52 | %define debug_package %{nil} |
142 | echo "%postun" | 53 | |
143 | echo "if [ -x /sbin/update-bootloader ]; then" | 54 | %description |
144 | echo "/sbin/update-bootloader --remove $KERNELRELEASE" | 55 | The Linux Kernel, the operating system core itself |
145 | echo "fi" | 56 | |
146 | echo "" | 57 | %package headers |
147 | echo "%files" | 58 | Summary: Header files for the Linux kernel for use by glibc |
148 | echo '%defattr (-, root, root)' | 59 | Group: Development/System |
149 | echo "/lib/modules/$KERNELRELEASE" | 60 | Obsoletes: kernel-headers |
150 | echo "%exclude /lib/modules/$KERNELRELEASE/build" | 61 | Provides: kernel-headers = %{version} |
151 | echo "%exclude /lib/modules/$KERNELRELEASE/source" | 62 | %description headers |
152 | echo "/boot/*" | 63 | Kernel-headers includes the C header files that specify the interface |
153 | echo "" | 64 | between the Linux kernel and userspace libraries and programs. The |
154 | echo "%files headers" | 65 | header files define structures and constants that are needed for |
155 | echo '%defattr (-, root, root)' | 66 | building most standard programs and are also needed for rebuilding the |
156 | echo "/usr/include" | 67 | glibc package. |
157 | echo "" | 68 | |
158 | if ! $PREBUILT; then | 69 | $S$M %package devel |
159 | echo "%files devel" | 70 | $S$M Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel |
160 | echo '%defattr (-, root, root)' | 71 | $S$M Group: System Environment/Kernel |
161 | echo "/usr/src/kernels/$KERNELRELEASE" | 72 | $S$M AutoReqProv: no |
162 | echo "/lib/modules/$KERNELRELEASE/build" | 73 | $S$M %description -n kernel-devel |
163 | echo "/lib/modules/$KERNELRELEASE/source" | 74 | $S$M This package provides kernel headers and makefiles sufficient to build modules |
164 | echo "" | 75 | $S$M against the $__KERNELRELEASE kernel package. |
165 | fi | 76 | $S$M |
77 | $S %prep | ||
78 | $S %setup -q | ||
79 | $S | ||
80 | $S %build | ||
81 | $S make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release} | ||
82 | $S | ||
83 | %install | ||
84 | mkdir -p %{buildroot}/boot | ||
85 | %ifarch ia64 | ||
86 | mkdir -p %{buildroot}/boot/efi | ||
87 | cp \$(make image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE | ||
88 | ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/ | ||
89 | %else | ||
90 | cp \$(make image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE | ||
91 | %endif | ||
92 | $M make %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} KBUILD_SRC= modules_install | ||
93 | make %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr KBUILD_SRC= headers_install | ||
94 | cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE | ||
95 | cp .config %{buildroot}/boot/config-$KERNELRELEASE | ||
96 | bzip2 -9 --keep vmlinux | ||
97 | mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2 | ||
98 | $S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build | ||
99 | $S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/source | ||
100 | $S$M mkdir -p %{buildroot}/usr/src/kernels/$KERNELRELEASE | ||
101 | $S$M tar cf - . $EXCLUDES | tar xf - -C %{buildroot}/usr/src/kernels/$KERNELRELEASE | ||
102 | $S$M cd %{buildroot}/lib/modules/$KERNELRELEASE | ||
103 | $S$M ln -sf /usr/src/kernels/$KERNELRELEASE build | ||
104 | $S$M ln -sf /usr/src/kernels/$KERNELRELEASE source | ||
105 | |||
106 | %clean | ||
107 | rm -rf %{buildroot} | ||
108 | |||
109 | %post | ||
110 | if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then | ||
111 | cp /boot/vmlinuz-$KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm | ||
112 | cp /boot/System.map-$KERNELRELEASE /boot/.System.map-$KERNELRELEASE-rpm | ||
113 | rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE | ||
114 | /sbin/installkernel $KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm | ||
115 | rm -f /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm | ||
116 | fi | ||
117 | |||
118 | %preun | ||
119 | if [ -x /sbin/new-kernel-pkg ]; then | ||
120 | new-kernel-pkg --remove $KERNELRELEASE --rminitrd --initrdfile=/boot/initramfs-$KERNELRELEASE.img | ||
121 | fi | ||
122 | |||
123 | %postun | ||
124 | if [ -x /sbin/update-bootloader ]; then | ||
125 | /sbin/update-bootloader --remove $KERNELRELEASE | ||
126 | fi | ||
127 | |||
128 | %files | ||
129 | %defattr (-, root, root) | ||
130 | $M /lib/modules/$KERNELRELEASE | ||
131 | $M %exclude /lib/modules/$KERNELRELEASE/build | ||
132 | $M %exclude /lib/modules/$KERNELRELEASE/source | ||
133 | /boot/* | ||
134 | |||
135 | %files headers | ||
136 | %defattr (-, root, root) | ||
137 | /usr/include | ||
138 | $S$M | ||
139 | $S$M %files devel | ||
140 | $S$M %defattr (-, root, root) | ||
141 | $S$M /usr/src/kernels/$KERNELRELEASE | ||
142 | $S$M /lib/modules/$KERNELRELEASE/build | ||
143 | $S$M /lib/modules/$KERNELRELEASE/source | ||
144 | EOF | ||