aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/package
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-11-05 02:51:49 -0500
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-11-05 11:28:48 -0500
commit21b42eb46834f6245a55ac77bdf3e14c034e2864 (patch)
tree70498a925ab036c24467335acc986a20a921b5b4 /scripts/package
parent651022382c7f8da46cb4872a545ee1da6d097d2a (diff)
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>
Diffstat (limited to 'scripts/package')
-rwxr-xr-xscripts/package/mkspec11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index e05646dc24dc..009147d4718e 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -12,6 +12,7 @@
12# how we were called determines which rpms we build and how we build them 12# how we were called determines which rpms we build and how we build them
13if [ "$1" = prebuilt ]; then 13if [ "$1" = prebuilt ]; then
14 S=DEL 14 S=DEL
15 MAKE="$MAKE -f $srctree/Makefile"
15else 16else
16 S= 17 S=
17fi 18fi
@@ -78,19 +79,19 @@ $S %prep
78$S %setup -q 79$S %setup -q
79$S 80$S
80$S %build 81$S %build
81$S make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release} 82$S $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}
82$S 83$S
83 %install 84 %install
84 mkdir -p %{buildroot}/boot 85 mkdir -p %{buildroot}/boot
85 %ifarch ia64 86 %ifarch ia64
86 mkdir -p %{buildroot}/boot/efi 87 mkdir -p %{buildroot}/boot/efi
87 cp \$(make image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE 88 cp \$($MAKE image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE
88 ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/ 89 ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/
89 %else 90 %else
90 cp \$(make image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE 91 cp \$($MAKE image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE
91 %endif 92 %endif
92$M make %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} KBUILD_SRC= modules_install 93$M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install
93 make %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr KBUILD_SRC= headers_install 94 $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
94 cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE 95 cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE
95 cp .config %{buildroot}/boot/config-$KERNELRELEASE 96 cp .config %{buildroot}/boot/config-$KERNELRELEASE
96 bzip2 -9 --keep vmlinux 97 bzip2 -9 --keep vmlinux