mkspec 3.6 KB
Newer Older
L
Linus Torvalds 已提交
1 2
#!/bin/sh
#
3
#	Output a simple RPM spec file that uses no fancy features requiring
L
Linus Torvalds 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#	RPM v4. This is intended to work with any RPM distro.
#
#	The only gothic bit here is redefining install_post to avoid
#	stripping the symbols from files in the kernel which we want
#
#	Patched for non-x86 by Opencon (L) 2002 <opencon@rio.skydome.net>
#

# how we were called determines which rpms we build and how we build them
if [ "$1" = "prebuilt" ]; then
	PREBUILT=true
else
	PREBUILT=false
fi

# starting to output the spec
if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then
	PROVIDES=kernel-drm
fi

PROVIDES="$PROVIDES kernel-$KERNELRELEASE"
25
__KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"`
L
Linus Torvalds 已提交
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

echo "Name: kernel"
echo "Summary: The Linux Kernel"
echo "Version: $__KERNELRELEASE"
# we need to determine the NEXT version number so that uname and
# rpm -q will agree
echo "Release: `. $srctree/scripts/mkversion`"
echo "License: GPL"
echo "Group: System Environment/Kernel"
echo "Vendor: The Linux Community"
echo "URL: http://www.kernel.org"

if ! $PREBUILT; then
echo "Source: kernel-$__KERNELRELEASE.tar.gz"
fi

42
echo "BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root"
L
Linus Torvalds 已提交
43 44 45 46 47 48 49
echo "Provides: $PROVIDES"
echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :"
echo "%define debug_package %{nil}"
echo ""
echo "%description"
echo "The Linux Kernel, the operating system core itself"
echo ""
50 51 52 53 54 55 56 57 58 59 60 61
echo "%package headers"
echo "Summary: Header files for the Linux kernel for use by glibc"
echo "Group: Development/System"
echo "Obsoletes: kernel-headers"
echo "Provides: kernel-headers = %{version}"
echo "%description headers"
echo "Kernel-headers includes the C header files that specify the interface"
echo "between the Linux kernel and userspace libraries and programs.  The"
echo "header files define structures and constants that are needed for"
echo "building most standard programs and are also needed for rebuilding the"
echo "glibc package."
echo ""
L
Linus Torvalds 已提交
62 63 64 65 66 67 68 69 70 71

if ! $PREBUILT; then
echo "%prep"
echo "%setup -q"
echo ""
fi

echo "%build"

if ! $PREBUILT; then
72
echo "make clean && make %{?_smp_mflags}"
L
Linus Torvalds 已提交
73 74 75 76
echo ""
fi

echo "%install"
77
echo 'KBUILD_IMAGE=$(make image_name)'
78
echo "%ifarch ia64"
79
echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
E
Evgeniy Manachkin 已提交
80
echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
81
echo "%else"
82
echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
E
Evgeniy Manachkin 已提交
83
echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
84
echo "%endif"
L
Linus Torvalds 已提交
85

86
echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= modules_install'
87 88 89 90
echo "%ifarch ia64"
echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
echo "%else"
M
Mike Wolf 已提交
91 92 93 94
echo "%ifarch ppc64"
echo "cp vmlinux arch/powerpc/boot"
echo "cp arch/powerpc/boot/"'$KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
echo "%else"
L
Linus Torvalds 已提交
95
echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
96
echo "%endif"
M
Mike Wolf 已提交
97
echo "%endif"
L
Linus Torvalds 已提交
98

99
echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install'
L
Linus Torvalds 已提交
100 101 102
echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"

echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE"
J
Josh Hunt 已提交
103 104 105 106 107 108 109 110

echo "%ifnarch ppc64"
echo 'cp vmlinux vmlinux.orig'
echo 'bzip2 -9 vmlinux'
echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
echo 'mv vmlinux.orig vmlinux'
echo "%endif"

L
Linus Torvalds 已提交
111 112
echo ""
echo "%clean"
113
echo 'rm -rf $RPM_BUILD_ROOT'
L
Linus Torvalds 已提交
114 115 116 117 118
echo ""
echo "%files"
echo '%defattr (-, root, root)'
echo "%dir /lib/modules"
echo "/lib/modules/$KERNELRELEASE"
E
Evgeniy Manachkin 已提交
119
echo "/lib/firmware"
L
Linus Torvalds 已提交
120 121
echo "/boot/*"
echo ""
122 123 124 125
echo "%files headers"
echo '%defattr (-, root, root)'
echo "/usr/include"
echo ""