kbuild: rpm-pkg: fix binrpm-pkg breakage when O= is used
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 5 Nov 2018 07:51:49 +0000 (16:51 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 5 Nov 2018 16:28:48 +0000 (01:28 +0900)
commit21b42eb46834f6245a55ac77bdf3e14c034e2864
tree70498a925ab036c24467335acc986a20a921b5b4
parent651022382c7f8da46cb4872a545ee1da6d097d2a
kbuild: rpm-pkg: fix binrpm-pkg breakage when O= is used

Zhenzhong Duan reported that running 'make O=/build/kernel binrpm-pkg'
failed with the following errors:

  Running 'make O=/build/kernel binrpm-pkg' failed with below two errors.

  Makefile:600: include/config/auto.conf: No such file or directory

  + cp make -C /mnt/root/kernel O=/build/kernel image_name make -f
  /mnt/root/kernel/Makefile ...
  cp: invalid option -- 'C'
  Try 'cp --help' for more information.

Prior to commit 80463f1b7bf9 ("kbuild: add --include-dir flag only
for out-of-tree build"), both srctree and objtree were added to
--include-dir redundantly, and the wrong code 'make image_name'
was working by relying on that. Now, the potential issue that had
previously been hidden just showed up.

'make image_name' recurses to the generated $(objtree)/Makefile and
ends up with running in srctree, which is incorrect. It should be
invoked with '-f $srctree/Makefile' (or KBUILD_SRC=) to be executed
in objtree.

Fixes: 80463f1b7bf9 ("kbuild: add --include-dir flag only for out-of-tree build")
Reported-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
scripts/package/mkspec