xref: /openbmc/linux/scripts/package/mkspec (revision c2d5a730)
11da177e4SLinus Torvalds#!/bin/sh
21da177e4SLinus Torvalds#
31da177e4SLinus Torvalds#	Output a simple RPM spec file that uses no fancy features requring
41da177e4SLinus Torvalds#	RPM v4. This is intended to work with any RPM distro.
51da177e4SLinus Torvalds#
61da177e4SLinus Torvalds#	The only gothic bit here is redefining install_post to avoid
71da177e4SLinus Torvalds#	stripping the symbols from files in the kernel which we want
81da177e4SLinus Torvalds#
91da177e4SLinus Torvalds#	Patched for non-x86 by Opencon (L) 2002 <opencon@rio.skydome.net>
101da177e4SLinus Torvalds#
111da177e4SLinus Torvalds
121da177e4SLinus Torvalds# how we were called determines which rpms we build and how we build them
131da177e4SLinus Torvaldsif [ "$1" = "prebuilt" ]; then
141da177e4SLinus Torvalds	PREBUILT=true
151da177e4SLinus Torvaldselse
161da177e4SLinus Torvalds	PREBUILT=false
171da177e4SLinus Torvaldsfi
181da177e4SLinus Torvalds
191da177e4SLinus Torvalds# starting to output the spec
201da177e4SLinus Torvaldsif [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then
211da177e4SLinus Torvalds	PROVIDES=kernel-drm
221da177e4SLinus Torvaldsfi
231da177e4SLinus Torvalds
241da177e4SLinus TorvaldsPROVIDES="$PROVIDES kernel-$KERNELRELEASE"
251da177e4SLinus Torvalds__KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-//g"`
261da177e4SLinus Torvalds
271da177e4SLinus Torvaldsecho "Name: kernel"
281da177e4SLinus Torvaldsecho "Summary: The Linux Kernel"
291da177e4SLinus Torvaldsecho "Version: $__KERNELRELEASE"
301da177e4SLinus Torvalds# we need to determine the NEXT version number so that uname and
311da177e4SLinus Torvalds# rpm -q will agree
321da177e4SLinus Torvaldsecho "Release: `. $srctree/scripts/mkversion`"
331da177e4SLinus Torvaldsecho "License: GPL"
341da177e4SLinus Torvaldsecho "Group: System Environment/Kernel"
351da177e4SLinus Torvaldsecho "Vendor: The Linux Community"
361da177e4SLinus Torvaldsecho "URL: http://www.kernel.org"
371da177e4SLinus Torvalds
381da177e4SLinus Torvaldsif ! $PREBUILT; then
391da177e4SLinus Torvaldsecho "Source: kernel-$__KERNELRELEASE.tar.gz"
401da177e4SLinus Torvaldsfi
411da177e4SLinus Torvalds
42880df92fSJohn Saalwaechterecho "BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root"
431da177e4SLinus Torvaldsecho "Provides: $PROVIDES"
441da177e4SLinus Torvaldsecho "%define __spec_install_post /usr/lib/rpm/brp-compress || :"
451da177e4SLinus Torvaldsecho "%define debug_package %{nil}"
461da177e4SLinus Torvaldsecho ""
471da177e4SLinus Torvaldsecho "%description"
481da177e4SLinus Torvaldsecho "The Linux Kernel, the operating system core itself"
491da177e4SLinus Torvaldsecho ""
501da177e4SLinus Torvalds
511da177e4SLinus Torvaldsif ! $PREBUILT; then
521da177e4SLinus Torvaldsecho "%prep"
531da177e4SLinus Torvaldsecho "%setup -q"
541da177e4SLinus Torvaldsecho ""
551da177e4SLinus Torvaldsfi
561da177e4SLinus Torvalds
571da177e4SLinus Torvaldsecho "%build"
581da177e4SLinus Torvalds
591da177e4SLinus Torvaldsif ! $PREBUILT; then
6013797b77SJeremy Kerrecho "make clean && make %{?_smp_mflags}"
611da177e4SLinus Torvaldsecho ""
621da177e4SLinus Torvaldsfi
631da177e4SLinus Torvalds
641da177e4SLinus Torvaldsecho "%install"
65d2cb1a95SGreg Edwardsecho "%ifarch ia64"
66a5fa393bSRolf Eike Beerecho 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
6746dca86cSEvgeniy Manachkinecho 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
68d2cb1a95SGreg Edwardsecho "%else"
69a5fa393bSRolf Eike Beerecho 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
7046dca86cSEvgeniy Manachkinecho 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
71d2cb1a95SGreg Edwardsecho "%endif"
721da177e4SLinus Torvalds
73c2d5a730SNishanth Aravamudanecho 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= modules_install'
74d2cb1a95SGreg Edwardsecho "%ifarch ia64"
75d2cb1a95SGreg Edwardsecho 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
76d2cb1a95SGreg Edwardsecho 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
77d2cb1a95SGreg Edwardsecho "%else"
781a0f3d42SMike Wolfecho "%ifarch ppc64"
791a0f3d42SMike Wolfecho "cp vmlinux arch/powerpc/boot"
801a0f3d42SMike Wolfecho "cp arch/powerpc/boot/"'$KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
811a0f3d42SMike Wolfecho "%else"
821da177e4SLinus Torvaldsecho 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
83d2cb1a95SGreg Edwardsecho "%endif"
841a0f3d42SMike Wolfecho "%endif"
851da177e4SLinus Torvalds
861da177e4SLinus Torvaldsecho 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"
871da177e4SLinus Torvalds
881da177e4SLinus Torvaldsecho 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE"
89fc370ecfSJosh Hunt
90fc370ecfSJosh Huntecho "%ifnarch ppc64"
91fc370ecfSJosh Huntecho 'cp vmlinux vmlinux.orig'
92fc370ecfSJosh Huntecho 'bzip2 -9 vmlinux'
93fc370ecfSJosh Huntecho 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
94fc370ecfSJosh Huntecho 'mv vmlinux.orig vmlinux'
95fc370ecfSJosh Huntecho "%endif"
96fc370ecfSJosh Hunt
971da177e4SLinus Torvaldsecho ""
981da177e4SLinus Torvaldsecho "%clean"
99a2ebcc7aSJosh Huntecho 'rm -rf $RPM_BUILD_ROOT'
1001da177e4SLinus Torvaldsecho ""
1011da177e4SLinus Torvaldsecho "%files"
1021da177e4SLinus Torvaldsecho '%defattr (-, root, root)'
1031da177e4SLinus Torvaldsecho "%dir /lib/modules"
1041da177e4SLinus Torvaldsecho "/lib/modules/$KERNELRELEASE"
10546dca86cSEvgeniy Manachkinecho "/lib/firmware"
1061da177e4SLinus Torvaldsecho "/boot/*"
1071da177e4SLinus Torvaldsecho ""
108