Skip to content

Commit f946730

Browse files
kbuild: fix error when building from src rpm
commit-author Mike Marciniszyn <[email protected]> commit c398ff0 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: Mike Marciniszyn <[email protected]> Signed-off-by: Michal Marek <[email protected]> (cherry picked from commit c398ff0) Signed-off-by: Pratham Patel <[email protected]>
1 parent 9a8dee3 commit f946730

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,7 @@ help:
12081208
@echo ' gtags - Generate GNU GLOBAL index'
12091209
@echo ' kernelrelease - Output the release version string'
12101210
@echo ' kernelversion - Output the version stored in Makefile'
1211+
@echo ' image_name - Output the image name'
12111212
@echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
12121213
echo ' (default: $(INSTALL_HDR_PATH))'; \
12131214
echo ''
@@ -1402,7 +1403,7 @@ export_report:
14021403
endif #ifeq ($(config-targets),1)
14031404
endif #ifeq ($(mixed-targets),1)
14041405

1405-
PHONY += checkstack kernelrelease kernelversion
1406+
PHONY += checkstack kernelrelease kernelversion image_name
14061407

14071408
# UML needs a little special treatment here. It wants to use the host
14081409
# toolchain, so needs $(SUBARCH) passed to checkstack.pl. Everyone
@@ -1423,6 +1424,9 @@ kernelrelease:
14231424
kernelversion:
14241425
@echo $(KERNELVERSION)
14251426

1427+
image_name:
1428+
@echo $(KBUILD_IMAGE)
1429+
14261430
# Clear a bunch of variables before executing the submake
14271431
tools/: FORCE
14281432
$(Q)mkdir -p $(objtree)/tools

scripts/package/mkspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ echo ""
7474
fi
7575

7676
echo "%install"
77+
echo 'KBUILD_IMAGE=$(make image_name)'
7778
echo "%ifarch ia64"
7879
echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
7980
echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'

0 commit comments

Comments
 (0)