]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - scripts/package/mkspec
Merge tag 'perf-urgent-for-mingo-4.14-20170928' of git://git.kernel.org/pub/scm/linux...
[mirror_ubuntu-bionic-kernel.git] / scripts / package / mkspec
CommitLineData
1da177e4
LT
1#!/bin/sh
2#
2174d292
MM
3# Output a simple RPM spec file.
4# This version assumes a minimum of RPM 4.0.3.
1da177e4
LT
5#
6# The only gothic bit here is redefining install_post to avoid
7# stripping the symbols from files in the kernel which we want
8#
9# Patched for non-x86 by Opencon (L) 2002 <opencon@rio.skydome.net>
10#
11
12# how we were called determines which rpms we build and how we build them
13if [ "$1" = "prebuilt" ]; then
14 PREBUILT=true
15else
16 PREBUILT=false
17fi
18
19# starting to output the spec
20if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then
21 PROVIDES=kernel-drm
22fi
23
24PROVIDES="$PROVIDES kernel-$KERNELRELEASE"
e1287eb8 25__KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"`
1da177e4
LT
26
27echo "Name: kernel"
28echo "Summary: The Linux Kernel"
29echo "Version: $__KERNELRELEASE"
25b080bd 30echo "Release: $(cat .version 2>/dev/null || echo 1)"
1da177e4
LT
31echo "License: GPL"
32echo "Group: System Environment/Kernel"
33echo "Vendor: The Linux Community"
34echo "URL: http://www.kernel.org"
35
36if ! $PREBUILT; then
37echo "Source: kernel-$__KERNELRELEASE.tar.gz"
38fi
39
880df92f 40echo "BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root"
1da177e4
LT
41echo "Provides: $PROVIDES"
42echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :"
43echo "%define debug_package %{nil}"
44echo ""
45echo "%description"
46echo "The Linux Kernel, the operating system core itself"
47echo ""
0bd41dfc
AS
48echo "%package headers"
49echo "Summary: Header files for the Linux kernel for use by glibc"
50echo "Group: Development/System"
51echo "Obsoletes: kernel-headers"
52echo "Provides: kernel-headers = %{version}"
53echo "%description headers"
54echo "Kernel-headers includes the C header files that specify the interface"
55echo "between the Linux kernel and userspace libraries and programs. The"
56echo "header files define structures and constants that are needed for"
57echo "building most standard programs and are also needed for rebuilding the"
58echo "glibc package."
59echo ""
2174d292
MM
60echo "%package devel"
61echo "Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel"
62echo "Group: System Environment/Kernel"
63echo "AutoReqProv: no"
64echo "%description -n kernel-devel"
65echo "This package provides kernel headers and makefiles sufficient to build modules"
66echo "against the $__KERNELRELEASE kernel package."
67echo ""
1da177e4
LT
68
69if ! $PREBUILT; then
70echo "%prep"
71echo "%setup -q"
72echo ""
73fi
74
75echo "%build"
76
77if ! $PREBUILT; then
25b080bd 78echo "make clean && make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}"
1da177e4
LT
79echo ""
80fi
81
82echo "%install"
c398ff00 83echo 'KBUILD_IMAGE=$(make image_name)'
d2cb1a95 84echo "%ifarch ia64"
a5fa393b 85echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
d2cb1a95 86echo "%else"
a5fa393b 87echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
d2cb1a95 88echo "%endif"
1da177e4 89
9e090074 90echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= modules_install'
d2cb1a95
GE
91echo "%ifarch ia64"
92echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
93echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
94echo "%else"
1a0f3d42
MW
95echo "%ifarch ppc64"
96echo "cp vmlinux arch/powerpc/boot"
97echo "cp arch/powerpc/boot/"'$KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
98echo "%else"
1da177e4 99echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
d2cb1a95 100echo "%endif"
1a0f3d42 101echo "%endif"
1da177e4 102
e0367a61 103echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install'
1da177e4
LT
104echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"
105
106echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE"
fc370ecf
JH
107
108echo "%ifnarch ppc64"
92f43c45 109echo 'bzip2 -9 --keep vmlinux'
fc370ecf 110echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
fc370ecf
JH
111echo "%endif"
112
b9a54424 113if ! $PREBUILT; then
51a5f810
AT
114echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/build"
115echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/source"
2174d292 116echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE"
9e090074 117echo "EXCLUDES=\"$RCS_TAR_IGNORE --exclude .tmp_versions --exclude=*vmlinux* --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation --exclude .config.old --exclude .missing-syscalls.d\""
2174d292
MM
118echo "tar "'$EXCLUDES'" -cf- . | (cd "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE;tar xvf -)"
119echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE"
120echo "ln -sf /usr/src/kernels/$KERNELRELEASE build"
121echo "ln -sf /usr/src/kernels/$KERNELRELEASE source"
b9a54424 122fi
2174d292 123
1da177e4
LT
124echo ""
125echo "%clean"
a2ebcc7a 126echo 'rm -rf $RPM_BUILD_ROOT'
1da177e4 127echo ""
3c9c7a14
MM
128echo "%post"
129echo "if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then"
c8b08ca5
JK
130echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm"
131echo "cp /boot/System.map-$KERNELRELEASE /boot/.System.map-$KERNELRELEASE-rpm"
3c9c7a14 132echo "rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE"
c8b08ca5
JK
133echo "/sbin/installkernel $KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm"
134echo "rm -f /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm"
3c9c7a14
MM
135echo "fi"
136echo ""
6ef41e22
PA
137echo "%preun"
138echo "if [ -x /sbin/new-kernel-pkg ]; then"
139echo "new-kernel-pkg --remove $KERNELRELEASE --rminitrd --initrdfile=/boot/initramfs-$KERNELRELEASE.img"
140echo "fi"
141echo ""
27c3bffd
JK
142echo "%postun"
143echo "if [ -x /sbin/update-bootloader ]; then"
144echo "/sbin/update-bootloader --remove $KERNELRELEASE"
145echo "fi"
146echo ""
1da177e4
LT
147echo "%files"
148echo '%defattr (-, root, root)'
1da177e4 149echo "/lib/modules/$KERNELRELEASE"
2174d292
MM
150echo "%exclude /lib/modules/$KERNELRELEASE/build"
151echo "%exclude /lib/modules/$KERNELRELEASE/source"
1da177e4
LT
152echo "/boot/*"
153echo ""
0bd41dfc
AS
154echo "%files headers"
155echo '%defattr (-, root, root)'
156echo "/usr/include"
157echo ""
b9a54424 158if ! $PREBUILT; then
2174d292
MM
159echo "%files devel"
160echo '%defattr (-, root, root)'
161echo "/usr/src/kernels/$KERNELRELEASE"
162echo "/lib/modules/$KERNELRELEASE/build"
163echo "/lib/modules/$KERNELRELEASE/source"
164echo ""
b9a54424 165fi