mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-26 22:24:09 +08:00
b925dbfe3c
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> ----
97 lines
3.4 KiB
Makefile
97 lines
3.4 KiB
Makefile
# Makefile for the different targets used to generate full packages of a kernel
|
|
# It uses the generic clean infrastructure of kbuild
|
|
|
|
# RPM target
|
|
# ---------------------------------------------------------------------------
|
|
# The rpm target generates two rpm files:
|
|
# /usr/src/packages/SRPMS/kernel-2.6.7rc2-1.src.rpm
|
|
# /usr/src/packages/RPMS/i386/kernel-2.6.7rc2-1.<arch>.rpm
|
|
# The src.rpm files includes all source for the kernel being built
|
|
# The <arch>.rpm includes kernel configuration, modules etc.
|
|
#
|
|
# 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
|
|
# 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
|
|
|
|
# Do we have rpmbuild, otherwise fall back to the older rpm
|
|
RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
|
|
else echo rpm; fi)
|
|
|
|
# Remove hyphens since they have special meaning in RPM filenames
|
|
KERNELPATH := kernel-$(subst -,,$(KERNELRELEASE))
|
|
MKSPEC := $(srctree)/scripts/package/mkspec
|
|
PREV := set -e; cd ..;
|
|
|
|
# rpm-pkg
|
|
# ---------------------------------------------------------------------------
|
|
$(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile
|
|
$(CONFIG_SHELL) $(MKSPEC) > $@
|
|
|
|
rpm-pkg rpm: $(objtree)/kernel.spec FORCE
|
|
$(MAKE) clean
|
|
$(PREV) ln -sf $(srctree) $(KERNELPATH)
|
|
$(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion
|
|
$(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/.
|
|
$(PREV) rm $(KERNELPATH)
|
|
rm -f $(objtree)/.scmversion
|
|
set -e; \
|
|
$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
|
|
set -e; \
|
|
mv -f $(objtree)/.tmp_version $(objtree)/.version
|
|
|
|
$(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz
|
|
rm ../$(KERNELPATH).tar.gz
|
|
|
|
clean-files := $(objtree)/kernel.spec
|
|
|
|
# binrpm-pkg
|
|
# ---------------------------------------------------------------------------
|
|
$(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile
|
|
$(CONFIG_SHELL) $(MKSPEC) prebuilt > $@
|
|
|
|
binrpm-pkg: $(objtree)/binkernel.spec FORCE
|
|
$(MAKE) KBUILD_SRC=
|
|
set -e; \
|
|
$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
|
|
set -e; \
|
|
mv -f $(objtree)/.tmp_version $(objtree)/.version
|
|
|
|
$(RPM) $(RPMOPTS) --define "_builddir $(srctree)" --target \
|
|
$(UTS_MACHINE) -bb $<
|
|
|
|
clean-files += $(objtree)/binkernel.spec
|
|
|
|
# Deb target
|
|
# ---------------------------------------------------------------------------
|
|
deb-pkg: FORCE
|
|
$(MAKE) KBUILD_SRC=
|
|
$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
|
|
|
|
clean-dirs += $(objtree)/debian/
|
|
|
|
|
|
# tarball targets
|
|
# ---------------------------------------------------------------------------
|
|
tar%pkg: FORCE
|
|
$(MAKE) KBUILD_SRC=
|
|
$(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@
|
|
|
|
clean-dirs += $(objtree)/tar-install/
|
|
|
|
|
|
# Help text displayed when executing 'make help'
|
|
# ---------------------------------------------------------------------------
|
|
help: FORCE
|
|
@echo ' rpm-pkg - Build both source and binary RPM kernel packages'
|
|
@echo ' binrpm-pkg - Build only the binary kernel package'
|
|
@echo ' deb-pkg - Build the kernel as an deb package'
|
|
@echo ' tar-pkg - Build the kernel as an uncompressed tarball'
|
|
@echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
|
|
@echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'
|
|
|