Signed-off-by: Julio M. Merino Vidal diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 7c434e0..295c0e6 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -16,8 +16,8 @@ TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS # Process to create the rpm files # a) clean the kernel # b) Generate .spec file -# c) Build a tar ball, using symlink to make kernel version -# first entry in the path +# c) Build a tarball, duplicating the whole tree to remove unnecessary +# files and adding the RCS version, if any, to the configuration file. # d) and pack the result to a tar.gz file # e) generate the rpm files, based on kernel.spec # - Use /. to avoid tar packing just the symlink @@ -33,14 +33,27 @@ PREV := set -e; cd ..; # rpm-pkg # --------------------------------------------------------------------------- -$(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile +$(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile FORCE $(CONFIG_SHELL) $(MKSPEC) > $@ +ifdef CONFIG_LOCALVERSION_AUTO +_localver-auto = $(shell $(CONFIG_SHELL) \ + $(srctree)/scripts/setlocalversion $(srctree)) +localver-auto = $(LOCALVERSION)$(_localver-auto) +else +localver-auto = +endif + rpm-pkg rpm: $(objtree)/kernel.spec FORCE $(MAKE) clean - $(PREV) ln -sf $(srctree) $(KERNELPATH) - $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. - $(PREV) rm $(KERNELPATH) + $(PREV) mkdir $(KERNELPATH) + set -e; \ + tar -c $(RCS_TAR_IGNORE) --exclude .config -f - . | \ + ( cd ../$(KERNELPATH) && tar -x -f - ) + sed -e '/CONFIG_LOCALVERSION=/s,"$$,$(localver-auto)",' \ + < $(srctree)/.config > ../$(KERNELPATH)/.config + $(PREV) tar -cz -f $(KERNELPATH).tar.gz $(KERNELPATH)/. + $(PREV) rm -rf $(KERNELPATH) set -e; \ $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version