All of
 help / color / mirror / Atom feed
From: Josh Hunt <>
Subject: [PATCH] Fix 'make rpm' when CONFIG_LOCALVERSION_AUTO=y and using SCM tree
Date: Thu, 12 Feb 2009 10:16:05 -0800	[thread overview]
Message-ID: <20090212181605.GA7696@localhost.localdomain> (raw)

Running 'make rpm' fails when CONFIG_LOCALVERSION_AUTO=y and using a kernel source
tree under SCM.  This is due to KERNELRELEASE being different when the initial make
is run and when make is run from rpmbuild.

mkspec creates kernel.spec using KERNELRELEASE:

echo "%files"
echo '%defattr (-, root, root)'
echo "%dir /lib/modules"
echo "/lib/modules/$KERNELRELEASE"
echo "/lib/firmware"
echo "/boot/*"
echo ""

When CONFIG_LOCALVERSION_AUTO=y scripts/setlocalversion is called and grabs any
additional version info from SCM.  Next, the srctree is tarred up and SCM
information is excluded.

rpmbuild reruns make and in the process generates a new include/config/kernel.release
and thus a new KERNELRELEASE.  However this time the SCM information is gone so
KERNELRELEASE no longer has the additional version information.  When "make modules_install"
runs, it uses the new KERNELRELEASE value to determine where to install the modules.
This conflicts with where the spec file assumes they are going because of the
mis-matching KERNELRELEASE versions.

+ INSTALL_MOD_PATH=/var/tmp/kernel-2.6.29rc4tip01479g5d85422-root
+ make -j16 modules_install
  INSTALL crypto/aead.ko
  INSTALL crypto/cbc.ko
  INSTALL crypto/chainiv.ko
  INSTALL crypto/crc32c.ko
  INSTALL crypto/crypto_algapi.ko
  INSTALL crypto/crypto_blkcipher.ko
  INSTALL crypto/crypto_hash.ko
  INSTALL crypto/cryptomgr.ko
  INSTALL crypto/ecb.ko
  INSTALL crypto/eseqiv.ko
  INSTALL crypto/krng.ko
  INSTALL crypto/md5.ko
  INSTALL crypto/pcbc.ko
  INSTALL crypto/rng.ko
  INSTALL drivers/block/cciss.ko
  INSTALL drivers/hid/hid-dummy.ko
  INSTALL drivers/scsi/iscsi_tcp.ko
  INSTALL drivers/scsi/libiscsi.ko
  INSTALL drivers/scsi/libiscsi_tcp.ko
  INSTALL drivers/scsi/scsi_transport_iscsi.ko
  INSTALL drivers/scsi/scsi_wait_scan.ko
  INSTALL fs/lockd/lockd.ko
  INSTALL fs/nfs/nfs.ko
  INSTALL fs/nfsd/nfsd.ko
  INSTALL lib/libcrc32c.ko
  INSTALL net/sunrpc/sunrpc.ko
  DEPMOD  2.6.29-rc4-tip
+ cp arch/x86/boot/bzImage
+ cp
+ cp .config
+ cp vmlinux vmlinux.orig
+ bzip2 -9 vmlinux
+ mv vmlinux.bz2
+ mv vmlinux.orig vmlinux
+ /usr/lib/rpm/brp-compress
Processing files: kernel-2.6.29rc4tip01479g5d85422-2
error: File not found:

RPM build errors:
    File not found:
make[1]: *** [rpm] Error 1
make: *** [rpm] Error 2

I have tested this patch on git -tip, Linus' git tree, and the tar files, both
with and without CONFIG_LOCALVERSION_AUTO=y.

Signed-off-by: Josh Hunt <>

Index: linux-2.6/Makefile
--- linux-2.6.orig/Makefile     2009-02-10 12:09:16.000000000 -0800
+++ linux-2.6/Makefile  2009-02-11 15:01:33.000000000 -0800
@@ -907,8 +907,17 @@
 # Other SCMs can edit scripts/setlocalversion and add the appropriate
 # checks as needed.
-       _localver-auto = $(shell $(CONFIG_SHELL) \
+scmversion = $(shell cat .autoversion 2> /dev/null)
+ifeq ($(scmversion),)
+       _localver-auto = $(shell  $(CONFIG_SHELL) \
+       _localver-auto = $(shell cat .autoversion 2> /dev/null)
        localver-auto  = $(LOCALVERSION)$(_localver-auto)

Index: linux-2.6/scripts/package/Makefile
--- linux-2.6.orig/scripts/package/Makefile     2009-02-10
12:09:50.000000000 -0800
+++ linux-2.6/scripts/package/Makefile  2009-02-11 16:33:55.000000000
@@ -35,10 +35,17 @@
 rpm-pkg rpm: $(objtree)/kernel.spec FORCE
        $(MAKE) clean
        $(PREV) ln -sf $(srctree) $(KERNELPATH)
+       set -e; \
+       $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion >
        $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz
        $(PREV) rm $(KERNELPATH)

        set -e; \
+       rm $(objtree)/.autoversion
+       set -e; \
        $(CONFIG_SHELL) $(srctree)/scripts/mkversion >
        set -e; \
        mv -f $(objtree)/.tmp_version $(objtree)/.version

             reply	other threads:[~2009-02-12 18:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12 18:16 Josh Hunt [this message]
2009-02-15  9:03 ` [PATCH] Fix 'make rpm' when CONFIG_LOCALVERSION_AUTO=y and using SCM tree Sam Ravnborg
2009-02-17  0:10   ` Josh Hunt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090212181605.GA7696@localhost.localdomain \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.