Skip to contentSkip to conversation

kbuild: fix error when building from src rpm

PATCH Superseded Mike Marciniszyn 1 participant 1 message Jun 5, 2013 Kbuild

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 kbuild: fix error when building from src rpm

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

Quoted 5 lines

+ 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.

---
 Makefile               |    6 ++++++
 scripts/package/mkspec |    1 +
 2 files changed, 7 insertions(+)
Makefile +6 -0
index cd11e88..5202db9 100644
@@ -1275,6 +1275,12 @@ clean: $(clean-dirs)
 		-o -name modules.builtin -o -name '.tmp_*.o.*' \
 		-o -name '*.gcno' \) -type f -print | xargs rm -f
 
+# For proping for image name
+# ---------------------------------------------------------------------------
+.PHONY += image_name
+image_name: FORCE
+	@echo $(KBUILD_IMAGE)
+
 # Generate tags for editors
 # ---------------------------------------------------------------------------
 quiet_cmd_tags = GEN     $@
scripts/package/mkspec +1 -0
index fbbfd08..fdd3fbf 100755
@@ -74,6 +74,7 @@ echo ""
 fi
 
 echo "%install"
+echo 'KBUILD_IMAGE=$(make image_name)'
 echo "%ifarch ia64"
 echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
 echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'