Skip to content

Commit

Permalink
kbuild: fix the binrpm-pkg target to work with KBUILD_OUTPUT set
Browse files Browse the repository at this point in the history
The binrpm-pkg target (binary RPM only) fails when called with
KBUILD_OUTPUT set. This patch makes it work.

For the rpm-pkg target (source + binary RPM), building with
KBUILD_OUTPUT set is not possible and also not needed as the
actual build is done in a temporary directory anyway, so check
that KBUILD_OUTPUT is not set in that case to avoid later errors.

Signed-off-by: Frans Pop <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
  • Loading branch information
Frans Pop authored and sravnborg committed Oct 11, 2009
1 parent f144c78 commit db9038c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion scripts/package/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# e) generate the rpm files, based on kernel.spec
# - Use /. to avoid tar packing just the symlink

# Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT,
# but the binrpm-pkg target can; for some reason O= gets ignored.

# 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)
Expand All @@ -33,6 +36,12 @@ $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile
$(CONFIG_SHELL) $(MKSPEC) > $@

rpm-pkg rpm: $(objtree)/kernel.spec FORCE
@if test -n "$(KBUILD_OUTPUT)"; then \
echo "Building source + binary RPM is not possible outside the"; \
echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
echo "binrpm-pkg target instead."; \
false; \
fi
$(MAKE) clean
$(PREV) ln -sf $(srctree) $(KERNELPATH)
$(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion
Expand Down Expand Up @@ -61,7 +70,7 @@ binrpm-pkg: $(objtree)/binkernel.spec FORCE
set -e; \
mv -f $(objtree)/.tmp_version $(objtree)/.version

$(RPM) $(RPMOPTS) --define "_builddir $(srctree)" --target \
$(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \
$(UTS_MACHINE) -bb $<

clean-files += $(objtree)/binkernel.spec
Expand Down
2 changes: 1 addition & 1 deletion scripts/package/mkspec
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
echo "%endif"

echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install'
echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} KBUILD_SRC= modules_install'
echo "%ifarch ia64"
echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
Expand Down

0 comments on commit db9038c

Please sign in to comment.