diff options
author | Josh Hunt <josh@scalex86.org> | 2009-02-12 13:16:05 -0500 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2009-03-07 07:55:38 -0500 |
commit | b925dbfe3c59b637666670a60473a15d29e0a7a7 (patch) | |
tree | da2ec81cba911ec9ee1b0a55349abdf7e0bba5eb | |
parent | a2ebcc7a863761b6d59a4183c600edf5af63b8d2 (diff) |
kbuild: fix 'make rpm' when CONFIG_LOCALVERSION_AUTO=y and using SCM tree
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:
<mkspec>
echo "%files"
echo '%defattr (-, root, root)'
echo "%dir /lib/modules"
echo "/lib/modules/$KERNELRELEASE"
echo "/lib/firmware"
echo "/boot/*"
echo ""
</mkspec>
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.
<snippet>
+ 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
/var/tmp/kernel-2.6.29rc4tip01479g5d85422-root/boot/vmlinuz-2.6.29-rc4-tip-01479-g5d85422
+ cp System.map
/var/tmp/kernel-2.6.29rc4tip01479g5d85422-root/boot/System.map-2.6.29-rc4-tip-01479-g5d85422
+ cp .config
/var/tmp/kernel-2.6.29rc4tip01479g5d85422-root/boot/config-2.6.29-rc4-tip-01479-g5d85422
+ cp vmlinux vmlinux.orig
+ bzip2 -9 vmlinux
+ mv vmlinux.bz2
/var/tmp/kernel-2.6.29rc4tip01479g5d85422-root/boot/vmlinux-2.6.29-rc4-tip-01479-g5d85422.bz2
+ mv vmlinux.orig vmlinux
+ /usr/lib/rpm/brp-compress
Processing files: kernel-2.6.29rc4tip01479g5d85422-2
error: File not found:
/var/tmp/kernel-2.6.29rc4tip01479g5d85422-root/lib/modules/2.6.29-rc4-tip-01479-g5d85422
RPM build errors:
File not found:
/var/tmp/kernel-2.6.29rc4tip01479g5d85422-root/lib/modules/2.6.29-rc4-tip-01479-g5d85422
make[1]: *** [rpm] Error 1
make: *** [rpm] Error 2
</snippet>
I have tested this patch on git -tip, Linus' git tree, and the kernel.org tar files, both
with and without CONFIG_LOCALVERSION_AUTO=y.
Signed-off-by: Josh Hunt <josh@scalex86.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
----
-rw-r--r-- | Makefile | 16 | ||||
-rw-r--r-- | scripts/package/Makefile | 3 |
2 files changed, 13 insertions, 6 deletions
@@ -904,12 +904,18 @@ localver = $(subst $(space),, $(string) \ | |||
904 | # and if the SCM is know a tag from the SCM is appended. | 904 | # and if the SCM is know a tag from the SCM is appended. |
905 | # The appended tag is determined by the SCM used. | 905 | # The appended tag is determined by the SCM used. |
906 | # | 906 | # |
907 | # Currently, only git is supported. | 907 | # .scmversion is used when generating rpm packages so we do not loose |
908 | # Other SCMs can edit scripts/setlocalversion and add the appropriate | 908 | # the version information from the SCM when we do the build of the kernel |
909 | # checks as needed. | 909 | # from the copied source |
910 | ifdef CONFIG_LOCALVERSION_AUTO | 910 | ifdef CONFIG_LOCALVERSION_AUTO |
911 | _localver-auto = $(shell $(CONFIG_SHELL) \ | 911 | |
912 | $(srctree)/scripts/setlocalversion $(srctree)) | 912 | ifeq ($(wildcard .scmversion),) |
913 | _localver-auto = $(shell $(CONFIG_SHELL) \ | ||
914 | $(srctree)/scripts/setlocalversion $(srctree)) | ||
915 | else | ||
916 | _localver-auto = $(shell cat .scmversion 2> /dev/null) | ||
917 | endif | ||
918 | |||
913 | localver-auto = $(LOCALVERSION)$(_localver-auto) | 919 | localver-auto = $(LOCALVERSION)$(_localver-auto) |
914 | endif | 920 | endif |
915 | 921 | ||
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 8c6b7b09606a..fa4a0a17b7e0 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
@@ -35,9 +35,10 @@ $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile | |||
35 | rpm-pkg rpm: $(objtree)/kernel.spec FORCE | 35 | rpm-pkg rpm: $(objtree)/kernel.spec FORCE |
36 | $(MAKE) clean | 36 | $(MAKE) clean |
37 | $(PREV) ln -sf $(srctree) $(KERNELPATH) | 37 | $(PREV) ln -sf $(srctree) $(KERNELPATH) |
38 | $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion | ||
38 | $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. | 39 | $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. |
39 | $(PREV) rm $(KERNELPATH) | 40 | $(PREV) rm $(KERNELPATH) |
40 | 41 | rm -f $(objtree)/.scmversion | |
41 | set -e; \ | 42 | set -e; \ |
42 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version | 43 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version |
43 | set -e; \ | 44 | set -e; \ |