Commit 09009772 authored by Sam Ravnborg's avatar Sam Ravnborg

kbuild/rpm: Fix 'make rpm' and enable use of 'make O=dir rpm'

Simplify 'make rpm' a bit, and enable use of rpm in combination with separate
output directory.
Also added kernel.spec to ignore list
parent 5a808876
...@@ -82,12 +82,13 @@ endif ...@@ -82,12 +82,13 @@ endif
ifneq ($(KBUILD_OUTPUT),) ifneq ($(KBUILD_OUTPUT),)
# Invoke a second make in the output directory, passing relevant variables # Invoke a second make in the output directory, passing relevant variables
KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT); /bin/pwd) KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT); /bin/pwd)
%:
@$(MAKE) -C $(KBUILD_OUTPUT) \ .PHONY: $(MAKECMDGOALS) all
KBUILD_SRC=$(CURDIR) \
KBUILD_VERBOSE=$(KBUILD_VERBOSE) \ $(MAKECMDGOALS) all:
KBUILD_CHECK=$(KBUILD_CHECK) \ $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
-f $(CURDIR)/Makefile $(MAKECMDGOALS) KBUILD_SRC=$(CURDIR) KBUILD_VERBOSE=$(KBUILD_VERBOSE) \
KBUILD_CHECK=$(KBUILD_CHECK) -f $(CURDIR)/Makefile $(MAKECMDGOALS)
# Leave processing to above invocation of make # Leave processing to above invocation of make
skip-makefile := 1 skip-makefile := 1
...@@ -97,7 +98,7 @@ endif # ifeq ($(KBUILD_SRC),) ...@@ -97,7 +98,7 @@ endif # ifeq ($(KBUILD_SRC),)
# We process the rest of the Makefile if this is the final invocation of make # We process the rest of the Makefile if this is the final invocation of make
ifeq ($(skip-makefile),) ifeq ($(skip-makefile),)
srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),.) srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
TOPDIR := $(srctree) TOPDIR := $(srctree)
# FIXME - TOPDIR is obsolete, use srctree/objtree # FIXME - TOPDIR is obsolete, use srctree/objtree
objtree := $(CURDIR) objtree := $(CURDIR)
...@@ -120,9 +121,6 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ ...@@ -120,9 +121,6 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
-e s/arm.*/arm/ -e s/sa110/arm/ \ -e s/arm.*/arm/ -e s/sa110/arm/ \
-e s/s390x/s390/ -e s/parisc64/parisc/ ) -e s/s390x/s390/ -e s/parisc64/parisc/ )
# Remove hyphens since they have special meaning in RPM filenames
KERNELPATH=kernel-$(subst -,,$(KERNELRELEASE))
# Cross compiling and selecting different set of gcc/bin-utils # Cross compiling and selecting different set of gcc/bin-utils
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# #
...@@ -835,31 +833,32 @@ tags: FORCE ...@@ -835,31 +833,32 @@ tags: FORCE
.PHONY: rpm .PHONY: rpm
# Remove hyphens since they have special meaning in RPM filenames
KERNELPATH=kernel-$(subst -,,$(KERNELRELEASE))
# If you do a make spec before packing the tarball you can rpm -ta it # If you do a make spec before packing the tarball you can rpm -ta it
spec: spec:
. $(srctree)/scripts/mkspec >kernel.spec $(CONFIG_SHELL) $(srctree)/scripts/mkspec > $(objtree)/kernel.spec
# Build a tar ball, generate an rpm from it and pack the result # a) Build a tar ball
# There are two bits of magic here # b) generate an rpm from it
# 1) The use of /. to avoid tar packing just the symlink # c) and pack the result
# 2) Removing the .dep files as they have source paths in them that # - Use /. to avoid tar packing just the symlink
# will become invalid
rpm: clean spec rpm: clean spec
find . $(RCS_FIND_IGNORE) \
\( -size 0 -o -name .depend -o -name .hdepend \) \
-type f -print | xargs rm -f
set -e; \ set -e; \
cd $(TOPDIR)/.. ; \ cd .. ; \
ln -sf $(TOPDIR) $(KERNELPATH) ; \ ln -sf $(srctree) $(KERNELPATH) ; \
tar -cvz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \ tar -cvz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \
rm $(KERNELPATH) ; \ rm $(KERNELPATH)
cd $(TOPDIR) ; \
$(CONFIG_SHELL) $(srctree)/scripts/mkversion > .tmp_version ; \ set -e; \
mv -f .tmp_version .version; \ $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version;\
$(RPM) -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \ mv -f $(objtree)/.tmp_version $(objtree)/.version;
rm $(TOPDIR)/../$(KERNELPATH).tar.gz
$(RPM) -ta ../$(KERNELPATH).tar.gz
rm ../$(KERNELPATH).tar.gz
# Brief documentation of the typical targets used # Brief documentation of the typical targets used
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
......
...@@ -27,7 +27,7 @@ echo "Summary: The Linux Kernel" ...@@ -27,7 +27,7 @@ echo "Summary: The Linux Kernel"
echo "Version: "$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION | sed -e "s/-//g" echo "Version: "$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION | sed -e "s/-//g"
# we need to determine the NEXT version number so that uname and # we need to determine the NEXT version number so that uname and
# rpm -q will agree # rpm -q will agree
echo "Release: `. scripts/mkversion`" echo "Release: `. $srctree/scripts/mkversion`"
echo "License: GPL" echo "License: GPL"
echo "Group: System Environment/Kernel" echo "Group: System Environment/Kernel"
echo "Vendor: The Linux Community" echo "Vendor: The Linux Community"
...@@ -45,7 +45,7 @@ echo "%prep" ...@@ -45,7 +45,7 @@ echo "%prep"
echo "%setup -q" echo "%setup -q"
echo "" echo ""
echo "%build" echo "%build"
echo "make clean oldconfig all" echo "make clean all"
echo "" echo ""
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