提交 c398ff00 编写于 作者: M Mike Marciniszyn 提交者: Michal Marek

kbuild: fix error when building from src rpm

The following issue can be reproduced with Linus' tree on
an x86_64 server.

>+ cp /home/user/rpmbuild-test/BUILDROOT/kernel-3.9.2.x86_64/boot/vmlinuz-3.9.2
>cp: missing destination file operand after
>/home/user/rpmbuild-test/BUILDROOT/kernel-3.9.2-1.x86_64/boot/vmlinuz-3.9.2'
>Try `cp --help' for more information.
>error: Bad exit status from /var/tmp/rpm-tmp.R4o0iI (%install)

Here are the commands to reproduce:

make defconfig
make rpm-pkg

Use the resulting src rpm to build as follows:

mkdir ~/rpmbuild-test
cd ~/rpmbuild-test
rpmbuild --rebuild --define "_topdir `pwd`" -vv ~/rpmbuild/SRPMS/kernel-3.10.0_rc1+-1.src.rpm

The issue is because the %install script uses $KBUILD_IMAGE and it hasn't
been set since it is only available in the kbuild system and not in the
%install script.

This patch adds a Makefile target to emit the image_name that can be used
and modifies the mkspec to use the dynamic name in %install.
Signed-off-by: NMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: NMichal Marek <mmarek@suse.cz>
上级 cdf2bc63
...@@ -1116,6 +1116,7 @@ help: ...@@ -1116,6 +1116,7 @@ help:
@echo ' gtags - Generate GNU GLOBAL index' @echo ' gtags - Generate GNU GLOBAL index'
@echo ' kernelrelease - Output the release version string' @echo ' kernelrelease - Output the release version string'
@echo ' kernelversion - Output the version stored in Makefile' @echo ' kernelversion - Output the version stored in Makefile'
@echo ' image_name - Output the image name'
@echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \ @echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
echo ' (default: $(INSTALL_HDR_PATH))'; \ echo ' (default: $(INSTALL_HDR_PATH))'; \
echo '' echo ''
...@@ -1310,7 +1311,7 @@ export_report: ...@@ -1310,7 +1311,7 @@ export_report:
endif #ifeq ($(config-targets),1) endif #ifeq ($(config-targets),1)
endif #ifeq ($(mixed-targets),1) endif #ifeq ($(mixed-targets),1)
PHONY += checkstack kernelrelease kernelversion PHONY += checkstack kernelrelease kernelversion image_name
# UML needs a little special treatment here. It wants to use the host # UML needs a little special treatment here. It wants to use the host
# toolchain, so needs $(SUBARCH) passed to checkstack.pl. Everyone # toolchain, so needs $(SUBARCH) passed to checkstack.pl. Everyone
...@@ -1331,6 +1332,9 @@ kernelrelease: ...@@ -1331,6 +1332,9 @@ kernelrelease:
kernelversion: kernelversion:
@echo $(KERNELVERSION) @echo $(KERNELVERSION)
image_name:
@echo $(KBUILD_IMAGE)
# Clear a bunch of variables before executing the submake # Clear a bunch of variables before executing the submake
tools/: FORCE tools/: FORCE
$(Q)mkdir -p $(objtree)/tools $(Q)mkdir -p $(objtree)/tools
......
...@@ -74,6 +74,7 @@ echo "" ...@@ -74,6 +74,7 @@ echo ""
fi fi
echo "%install" echo "%install"
echo 'KBUILD_IMAGE=$(make image_name)'
echo "%ifarch ia64" echo "%ifarch ia64"
echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册