linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: rpm-pkg: fix binrpm-pkg breakage when O= is used
@ 2018-11-05  7:51 Masahiro Yamada
  2018-11-09 16:19 ` Masahiro Yamada
  2018-11-17 19:20 ` Laurent Pinchart
  0 siblings, 2 replies; 4+ messages in thread
From: Masahiro Yamada @ 2018-11-05  7:51 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Zhenzhong Duan, Masahiro Yamada, Michal Marek, linux-kernel

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 objtree and srctree were added to
--include-dir, and the wrong code 'make image_name' was working
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 | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index e05646d..009147d 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -12,6 +12,7 @@
 # how we were called determines which rpms we build and how we build them
 if [ "$1" = prebuilt ]; then
 	S=DEL
+	MAKE="$MAKE -f $srctree/Makefile"
 else
 	S=
 fi
@@ -78,19 +79,19 @@ $S	%prep
 $S	%setup -q
 $S
 $S	%build
-$S	make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}
+$S	$MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}
 $S
 	%install
 	mkdir -p %{buildroot}/boot
 	%ifarch ia64
 	mkdir -p %{buildroot}/boot/efi
-	cp \$(make image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE
+	cp \$($MAKE image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE
 	ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/
 	%else
-	cp \$(make image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE
+	cp \$($MAKE image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE
 	%endif
-$M	make %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} KBUILD_SRC= modules_install
-	make %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr KBUILD_SRC= headers_install
+$M	$MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install
+	$MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
 	cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE
 	cp .config %{buildroot}/boot/config-$KERNELRELEASE
 	bzip2 -9 --keep vmlinux
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] kbuild: rpm-pkg: fix binrpm-pkg breakage when O= is used
  2018-11-05  7:51 [PATCH] kbuild: rpm-pkg: fix binrpm-pkg breakage when O= is used Masahiro Yamada
@ 2018-11-09 16:19 ` Masahiro Yamada
  2018-11-17 19:20 ` Laurent Pinchart
  1 sibling, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2018-11-09 16:19 UTC (permalink / raw)
  To: Linux Kbuild mailing list
  Cc: zhenzhong.duan, Michal Marek, Linux Kernel Mailing List

On Mon, Nov 5, 2018 at 4:52 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> 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 objtree and srctree were added to
> --include-dir, and the wrong code 'make image_name' was working
> 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>
> ---

Applied to linux-kbuild/fixes.



>  scripts/package/mkspec | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/package/mkspec b/scripts/package/mkspec
> index e05646d..009147d 100755
> --- a/scripts/package/mkspec
> +++ b/scripts/package/mkspec
> @@ -12,6 +12,7 @@
>  # how we were called determines which rpms we build and how we build them
>  if [ "$1" = prebuilt ]; then
>         S=DEL
> +       MAKE="$MAKE -f $srctree/Makefile"
>  else
>         S=
>  fi
> @@ -78,19 +79,19 @@ $S  %prep
>  $S     %setup -q
>  $S
>  $S     %build
> -$S     make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}
> +$S     $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}
>  $S
>         %install
>         mkdir -p %{buildroot}/boot
>         %ifarch ia64
>         mkdir -p %{buildroot}/boot/efi
> -       cp \$(make image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE
> +       cp \$($MAKE image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE
>         ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/
>         %else
> -       cp \$(make image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE
> +       cp \$($MAKE image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE
>         %endif
> -$M     make %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} KBUILD_SRC= modules_install
> -       make %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr KBUILD_SRC= headers_install
> +$M     $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install
> +       $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
>         cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE
>         cp .config %{buildroot}/boot/config-$KERNELRELEASE
>         bzip2 -9 --keep vmlinux
> --
> 2.7.4
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kbuild: rpm-pkg: fix binrpm-pkg breakage when O= is used
  2018-11-05  7:51 [PATCH] kbuild: rpm-pkg: fix binrpm-pkg breakage when O= is used Masahiro Yamada
  2018-11-09 16:19 ` Masahiro Yamada
@ 2018-11-17 19:20 ` Laurent Pinchart
  2018-11-18  4:15   ` Masahiro Yamada
  1 sibling, 1 reply; 4+ messages in thread
From: Laurent Pinchart @ 2018-11-17 19:20 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild, Zhenzhong Duan, Michal Marek, linux-kernel

Hi Yamada-san,

On Monday, 5 November 2018 09:51:49 EET Masahiro Yamada wrote:
> 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 objtree and srctree were added to
> --include-dir, and the wrong code 'make image_name' was working
> 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.

I (painfully) found out that a similar problem occurs with 'make bindeb-pkg'.

After spending half a day unsuccessfully trying to debug and fix the problem I 
ran across this patch. The naive approach of mimicking the solution and adding 
'MAKE="$MAKE -f $srctree/Makefile"' at the top of scripts/package/builddeb 
didn't work. Reverting commit 80463f1b7bf9 fixed the problem.

Would you be able to give it a look ? I'm afraid my limited skills related to 
the kernel build system don't allow me to submit a fix :-S

> 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 | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/package/mkspec b/scripts/package/mkspec
> index e05646d..009147d 100755
> --- a/scripts/package/mkspec
> +++ b/scripts/package/mkspec
> @@ -12,6 +12,7 @@
>  # how we were called determines which rpms we build and how we build them
>  if [ "$1" = prebuilt ]; then
>  	S=DEL
> +	MAKE="$MAKE -f $srctree/Makefile"
>  else
>  	S=
>  fi
> @@ -78,19 +79,19 @@ $S	%prep
>  $S	%setup -q
>  $S
>  $S	%build
> -$S	make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}
> +$S	$MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}
>  $S
>  	%install
>  	mkdir -p %{buildroot}/boot
>  	%ifarch ia64
>  	mkdir -p %{buildroot}/boot/efi
> -	cp \$(make image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE
> +	cp \$($MAKE image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE
>  	ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/
>  	%else
> -	cp \$(make image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE
> +	cp \$($MAKE image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE
>  	%endif
> -$M	make %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} KBUILD_SRC=
> modules_install -	make %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr
> KBUILD_SRC= headers_install +$M	$MAKE %{?_smp_mflags}
> INSTALL_MOD_PATH=%{buildroot} modules_install +	$MAKE %{?_smp_mflags}
> INSTALL_HDR_PATH=%{buildroot}/usr headers_install cp System.map
> %{buildroot}/boot/System.map-$KERNELRELEASE
>  	cp .config %{buildroot}/boot/config-$KERNELRELEASE
>  	bzip2 -9 --keep vmlinux

-- 
Regards,

Laurent Pinchart




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kbuild: rpm-pkg: fix binrpm-pkg breakage when O= is used
  2018-11-17 19:20 ` Laurent Pinchart
@ 2018-11-18  4:15   ` Masahiro Yamada
  0 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2018-11-18  4:15 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Linux Kbuild mailing list, zhenzhong.duan, Michal Marek,
	Linux Kernel Mailing List

Hi Laurent,

On Sun, Nov 18, 2018 at 4:22 AM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hi Yamada-san,
>
> On Monday, 5 November 2018 09:51:49 EET Masahiro Yamada wrote:
> > 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 objtree and srctree were added to
> > --include-dir, and the wrong code 'make image_name' was working
> > 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.
>
> I (painfully) found out that a similar problem occurs with 'make bindeb-pkg'.
>
> After spending half a day unsuccessfully trying to debug and fix the problem I
> ran across this patch. The naive approach of mimicking the solution and adding
> 'MAKE="$MAKE -f $srctree/Makefile"' at the top of scripts/package/builddeb
> didn't work. Reverting commit 80463f1b7bf9 fixed the problem.
>
> Would you be able to give it a look ? I'm afraid my limited skills related to
> the kernel build system don't allow me to submit a fix :-S

I fixed bindeb-pkg as well for v4.20-rc2

commit 02826a6ba301b72461c3706e1cc66d5571cd327e
Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Date:   Mon Nov 5 16:52:34 2018 +0900

    kbuild: deb-pkg: fix bindeb-pkg breakage when O= is used


If you still see a problem, please let me know.



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-18  4:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-05  7:51 [PATCH] kbuild: rpm-pkg: fix binrpm-pkg breakage when O= is used Masahiro Yamada
2018-11-09 16:19 ` Masahiro Yamada
2018-11-17 19:20 ` Laurent Pinchart
2018-11-18  4:15   ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).