]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - scripts/package/mkspec
kbuild: rpm-pkg: install vmlinux.bz2 unconditionally
[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"
1da177e4 95echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
d2cb1a95 96echo "%endif"
1da177e4 97
e0367a61 98echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install'
1da177e4
LT
99echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"
100
101echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE"
92f43c45 102echo 'bzip2 -9 --keep vmlinux'
fc370ecf 103echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
fc370ecf 104
b9a54424 105if ! $PREBUILT; then
51a5f810
AT
106echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/build"
107echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/source"
2174d292 108echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE"
9e090074 109echo "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
110echo "tar "'$EXCLUDES'" -cf- . | (cd "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE;tar xvf -)"
111echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE"
112echo "ln -sf /usr/src/kernels/$KERNELRELEASE build"
113echo "ln -sf /usr/src/kernels/$KERNELRELEASE source"
b9a54424 114fi
2174d292 115
1da177e4
LT
116echo ""
117echo "%clean"
a2ebcc7a 118echo 'rm -rf $RPM_BUILD_ROOT'
1da177e4 119echo ""
3c9c7a14
MM
120echo "%post"
121echo "if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then"
c8b08ca5
JK
122echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm"
123echo "cp /boot/System.map-$KERNELRELEASE /boot/.System.map-$KERNELRELEASE-rpm"
3c9c7a14 124echo "rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE"
c8b08ca5
JK
125echo "/sbin/installkernel $KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm"
126echo "rm -f /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm"
3c9c7a14
MM
127echo "fi"
128echo ""
6ef41e22
PA
129echo "%preun"
130echo "if [ -x /sbin/new-kernel-pkg ]; then"
131echo "new-kernel-pkg --remove $KERNELRELEASE --rminitrd --initrdfile=/boot/initramfs-$KERNELRELEASE.img"
132echo "fi"
133echo ""
27c3bffd
JK
134echo "%postun"
135echo "if [ -x /sbin/update-bootloader ]; then"
136echo "/sbin/update-bootloader --remove $KERNELRELEASE"
137echo "fi"
138echo ""
1da177e4
LT
139echo "%files"
140echo '%defattr (-, root, root)'
1da177e4 141echo "/lib/modules/$KERNELRELEASE"
2174d292
MM
142echo "%exclude /lib/modules/$KERNELRELEASE/build"
143echo "%exclude /lib/modules/$KERNELRELEASE/source"
1da177e4
LT
144echo "/boot/*"
145echo ""
0bd41dfc
AS
146echo "%files headers"
147echo '%defattr (-, root, root)'
148echo "/usr/include"
149echo ""
b9a54424 150if ! $PREBUILT; then
2174d292
MM
151echo "%files devel"
152echo '%defattr (-, root, root)'
153echo "/usr/src/kernels/$KERNELRELEASE"
154echo "/lib/modules/$KERNELRELEASE/build"
155echo "/lib/modules/$KERNELRELEASE/source"
156echo ""
b9a54424 157fi