Commit f0d8c63b authored by Greg Edwards's avatar Greg Edwards Committed by Sam Ravnborg

kbuild: build binary rpm from pre-built tree

Many times it would be nice to quickly package up a kernel tree you're
working on, without having to rebuild the whole thing again from a clean
source tree (like the current rpm-pkg target does).  The patch below
adds an "binrpm-pkg" target which uses your existing (already built)
tree.
Modified by me to always do a make and use binrpm-pkg.
Signed-off-by: default avatarGreg Edwards <edwardsg@sgi.com>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 1bb0fa18
...@@ -31,6 +31,7 @@ KERNELPATH := kernel-$(subst -,,$(KERNELRELEASE)) ...@@ -31,6 +31,7 @@ KERNELPATH := kernel-$(subst -,,$(KERNELRELEASE))
MKSPEC := $(srctree)/scripts/package/mkspec MKSPEC := $(srctree)/scripts/package/mkspec
PREV := set -e; cd ..; PREV := set -e; cd ..;
# rpm-pkg
.PHONY: rpm-pkg rpm .PHONY: rpm-pkg rpm
$(objtree)/kernel.spec: $(MKSPEC) $(objtree)/kernel.spec: $(MKSPEC)
...@@ -52,6 +53,22 @@ rpm-pkg rpm: $(objtree)/kernel.spec ...@@ -52,6 +53,22 @@ rpm-pkg rpm: $(objtree)/kernel.spec
clean-rule += rm -f $(objtree)/kernel.spec clean-rule += rm -f $(objtree)/kernel.spec
# binrpm-pkg
.PHONY: binrpm-pkg
$(objtree)/binkernel.spec: $(MKSPEC)
$(CONFIG_SHELL) $(MKSPEC) prebuilt > $@
binrpm-pkg: $(objtree)/binkernel.spec
$(MAKE)
set -e; \
$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
set -e; \
mv -f $(objtree)/.tmp_version $(objtree)/.version
$(RPM) --define "_builddir $(srctree)" --target $(UTS_MACHINE) -bb $<
clean-rule += rm -f $(objtree)/binkernel.spec
# Deb target # Deb target
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# #
...@@ -67,5 +84,6 @@ clean-rule += && rm -rf $(objtree)/debian/ ...@@ -67,5 +84,6 @@ clean-rule += && rm -rf $(objtree)/debian/
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
help: help:
@echo ' rpm-pkg - Build the kernel as an RPM package' @echo ' rpm-pkg - Build the kernel as an RPM package'
@echo ' binrpm-pkg - Build an rpm package containing the compiled kernel & modules'
@echo ' deb-pkg - Build the kernel as an deb package' @echo ' deb-pkg - Build the kernel as an deb package'
...@@ -9,6 +9,13 @@ ...@@ -9,6 +9,13 @@
# Patched for non-x86 by Opencon (L) 2002 <opencon@rio.skydome.net> # 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 # starting to output the spec
if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then
PROVIDES=kernel-drm PROVIDES=kernel-drm
...@@ -26,8 +33,12 @@ echo "License: GPL" ...@@ -26,8 +33,12 @@ echo "License: GPL"
echo "Group: System Environment/Kernel" echo "Group: System Environment/Kernel"
echo "Vendor: The Linux Community" echo "Vendor: The Linux Community"
echo "URL: http://www.kernel.org" echo "URL: http://www.kernel.org"
if ! $PREBUILT; then
echo -n "Source: kernel-$VERSION.$PATCHLEVEL.$SUBLEVEL" echo -n "Source: kernel-$VERSION.$PATCHLEVEL.$SUBLEVEL"
echo "$EXTRAVERSION.tar.gz" | sed -e "s/-//g" echo "$EXTRAVERSION.tar.gz" | sed -e "s/-//g"
fi
echo "BuildRoot: /var/tmp/%{name}-%{PACKAGE_VERSION}-root" echo "BuildRoot: /var/tmp/%{name}-%{PACKAGE_VERSION}-root"
echo "Provides: $PROVIDES" echo "Provides: $PROVIDES"
echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :" echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :"
...@@ -36,12 +47,20 @@ echo "" ...@@ -36,12 +47,20 @@ echo ""
echo "%description" echo "%description"
echo "The Linux Kernel, the operating system core itself" echo "The Linux Kernel, the operating system core itself"
echo "" echo ""
if ! $PREBUILT; then
echo "%prep" echo "%prep"
echo "%setup -q" echo "%setup -q"
echo "" echo ""
fi
echo "%build" echo "%build"
if ! $PREBUILT; then
echo "make clean && make" echo "make clean && make"
echo "" echo ""
fi
echo "%install" echo "%install"
echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules' echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment