diff mbox series

kbuild: add workaround for Debian make-kpkg

Message ID 1551888035-13329-1-git-send-email-yamada.masahiro@socionext.com (mailing list archive)
State New, archived
Headers show
Series kbuild: add workaround for Debian make-kpkg | expand

Commit Message

Masahiro Yamada March 6, 2019, 4 p.m. UTC
Since commit 3812b8c5c5d5 ("kbuild: make -r/-R effective in top
Makefile for old Make versions"), make-kpkg is not working.

make-kpkg directly includes the top Makefile of Linux kernel, and
appends some debian_* targets.

  /usr/share/kernel-package/ruleset/kernel_version.mk:

    # Include the kernel makefile
    override dot-config := 1
    include Makefile
    dot-config := 1

I did not know the kernel Makefile was used in that way, and it is
hard to guarantee the behavior when the kernel Makefile is included
by another Makefile from a different project.

Looks like Debian Stretch stopped providing make-kpkg (except PowerPC).
Maybe it is obsolete and being replaced with 'make deb-pkg' etc.
but still widely used.

This commit adds a workaround; if the top Makefile is included by
another Makefile, skip sub-make in order to make the main part visible.
'MAKEFLAGS += -rR' does not become effective for GNU Make < 4.0, but
Debian/Ubuntu is already using newer versions.

The effect of this commit:

  Debian 8 (Jessie)  : Fixed
  Debian 9 (Stretch) : make-kpkg (kernel-package) is not provided
  Ubuntu 14.04 LTS   : NOT Fixed
  Ubuntu 16.04 LTS   : Fixed
  Ubuntu 18.04 LTS   : Fixed

This commit cannot fix Ubuntu 14.04 because it installs GNU Make 3.81,
but its support will end in Apr 2019, which is before the Linux v5.1
release.

I added warning so that nobody would try to include the top Makefile.

Fixes: 3812b8c5c5d5 ("kbuild: make -r/-R effective in top Makefile for old Make versions")
Reported-by: Liz Zhang <lizzha@microsoft.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Lili Deng <v-lide@microsoft.com>
---

 Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Ben Hutchings March 6, 2019, 8:59 p.m. UTC | #1
kernel-package is maintained by Manoj Srivastava (cc'd), not by the
Debian kernel team.

On Thu, 2019-03-07 at 01:00 +0900, Masahiro Yamada wrote:
> Since commit 3812b8c5c5d5 ("kbuild: make -r/-R effective in top
> Makefile for old Make versions"), make-kpkg is not working.
> 
> make-kpkg directly includes the top Makefile of Linux kernel, and
> appends some debian_* targets.
> 
>   /usr/share/kernel-package/ruleset/kernel_version.mk:
> 
>     # Include the kernel makefile
>     override dot-config := 1
>     include Makefile
>     dot-config := 1
> 
> I did not know the kernel Makefile was used in that way, and it is
> hard to guarantee the behavior when the kernel Makefile is included
> by another Makefile from a different project.
> 
> Looks like Debian Stretch stopped providing make-kpkg (except PowerPC).

kernel-package is not included in stretch at all.  I'm not sure where
you're seeing it as being present on powerpc - that architecture wasn't
included in the stretch release.

> Maybe it is obsolete and being replaced with 'make deb-pkg' etc.
> but still widely used.
[...]

kernel-package is currently planned to be included in the next release,
though I'm not sure whether it should be.

There is another bug report about kernel-package with current kernel
versions <https://bugs.debian.org/890817> but I don't know whether it
has been worked around already.

Ben.
Ben Hutchings March 6, 2019, 9:01 p.m. UTC | #2
[Trying again with an alternate address for Manoj.]

kernel-package is maintained by Manoj Srivastava (cc'd), not by the
Debian kernel team.

On Thu, 2019-03-07 at 01:00 +0900, Masahiro Yamada wrote:
> Since commit 3812b8c5c5d5 ("kbuild: make -r/-R effective in top
> Makefile for old Make versions"), make-kpkg is not working.
> 
> make-kpkg directly includes the top Makefile of Linux kernel, and
> appends some debian_* targets.
> 
>   /usr/share/kernel-package/ruleset/kernel_version.mk:
> 
>     # Include the kernel makefile
>     override dot-config := 1
>     include Makefile
>     dot-config := 1
> 
> I did not know the kernel Makefile was used in that way, and it is
> hard to guarantee the behavior when the kernel Makefile is included
> by another Makefile from a different project.
> 
> Looks like Debian Stretch stopped providing make-kpkg (except
> PowerPC).

kernel-package is not included in stretch at all.  I'm not sure where
you're seeing it as being present on powerpc - that architecture wasn't
included in the stretch release.

> Maybe it is obsolete and being replaced with 'make deb-pkg' etc.
> but still widely used.
[...]

kernel-package is currently planned to be included in the next release,
though I'm not sure whether it should be.

There is another bug report about kernel-package with current kernel
versions <https://bugs.debian.org/890817> but I don't know whether it
has been worked around already.

Ben.
Masahiro Yamada March 7, 2019, 4:03 a.m. UTC | #3
On Thu, Mar 7, 2019 at 6:02 AM Ben Hutchings <ben@decadent.org.uk> wrote:
>
> [Trying again with an alternate address for Manoj.]
>
> kernel-package is maintained by Manoj Srivastava (cc'd), not by the
> Debian kernel team.
>
> On Thu, 2019-03-07 at 01:00 +0900, Masahiro Yamada wrote:
> > Since commit 3812b8c5c5d5 ("kbuild: make -r/-R effective in top
> > Makefile for old Make versions"), make-kpkg is not working.
> >
> > make-kpkg directly includes the top Makefile of Linux kernel, and
> > appends some debian_* targets.
> >
> >   /usr/share/kernel-package/ruleset/kernel_version.mk:
> >
> >     # Include the kernel makefile
> >     override dot-config := 1
> >     include Makefile
> >     dot-config := 1
> >
> > I did not know the kernel Makefile was used in that way, and it is
> > hard to guarantee the behavior when the kernel Makefile is included
> > by another Makefile from a different project.
> >
> > Looks like Debian Stretch stopped providing make-kpkg (except
> > PowerPC).
>
> kernel-package is not included in stretch at all.  I'm not sure where
> you're seeing it as being present on powerpc - that architecture wasn't
> included in the stretch release.


Actually, I have not checked the powerpc part by myself.


I just read the following page:

https://unix.stackexchange.com/questions/238469/difference-between-make-kpkg-and-make-deb-pkg


"make-kpkg is included in wheezy and jessie but stretch (current
stable) only contains it for powerpc.

Powerpc is no longer supported in buster (testing)"



I will drop the PowerPC part.




> > Maybe it is obsolete and being replaced with 'make deb-pkg' etc.
> > but still widely used.
> [...]
>
> kernel-package is currently planned to be included in the next release,
> though I'm not sure whether it should be.

Hmm, OK.

I checked debian:buster in Docker,
and I see it.


root@3382de16960a:/home/foo# apt-file search  make-kpkg
kernel-package: /usr/bin/make-kpkg
kernel-package: /usr/share/man/man1/make-kpkg.1.gz
zsh-common: /usr/share/zsh/functions/Completion/Debian/_make-kpkg




If make-kpkg will still be included in the future Debian releases,
I'd like to change make-kpkg to make it work more reliably.


The git URL in the control file
"https://anonscm.debian.org/git/users/srivasta/debian/kernel-package.git"
seems stale.

Anyway, I found it in a new place:

$ git clone  https://salsa.debian.org/srivasta/kernel-package


Hmm, the last commit was three years ago.

So, it is almost unmaintained, I guess...


> There is another bug report about kernel-package with current kernel
> versions <https://bugs.debian.org/890817> but I don't know whether it
> has been worked around already.

Probably, not fixed.

It is not stalled actually.
I guess make-kpkg is hiding messages sent to stdout for some reasons.
If you continue pressing "Enter" key,
it will move on to the build stage.

I will take a look if it should be maintained.



Anyway, I want to hear from Manoj.


--
Best Regards
Masahiro Yamada
Ben Hutchings March 7, 2019, 6:36 a.m. UTC | #4
On Thu, 2019-03-07 at 13:03 +0900, Masahiro Yamada wrote:
[...]
> If make-kpkg will still be included in the future Debian releases,
> I'd like to change make-kpkg to make it work more reliably.
> 
> 
> The git URL in the control file
> "https://anonscm.debian.org/git/users/srivasta/debian/kernel-package.git"
> seems stale.
> 
> Anyway, I found it in a new place:
> 
> $ git clone  https://salsa.debian.org/srivasta/kernel-package
> 
> 
> Hmm, the last commit was three years ago.
> 
> So, it is almost unmaintained, I guess...
[...]

Yes, though there was a more recent bug fix by another Debian
developer:
https://tracker.debian.org/news/857223/accepted-kernel-package-13018nmu1-source-into-unstable/

Ben.
Ben Hutchings March 7, 2019, 9:56 p.m. UTC | #5
On Wed, 2019-03-06 at 22:48 -0800, Manoj Srivastava wrote:
> Hi,
> 
>   Does this have any users? I can take a stand at making it work, but I am
> unsure of there are enough people interested in make-kpkg anymore to make
> it worthwhile.
> 
>   There is a man pager that might be of minor interest, but that can be
> taken over by the kernel team if they want
[...]

I assume you're referring to kernel-img.conf.  I would be happy to add
that to linux-base, with some clarification of which settings are
understood by which packages.

I take it that you don't want kernel-package to be included in buster,
so can you open an RC bug to say so?

Ben.
Masahiro Yamada March 8, 2019, 6:42 a.m. UTC | #6
On Fri, Mar 8, 2019 at 6:56 AM Ben Hutchings <ben@decadent.org.uk> wrote:
>
> On Wed, 2019-03-06 at 22:48 -0800, Manoj Srivastava wrote:
> > Hi,
> >
> >   Does this have any users?

Recently, I received a regression report.
So, yes. There are users.


> > I can take a stand at making it work, but I am
> > unsure of there are enough people interested in make-kpkg anymore to make
> > it worthwhile.
> >
> >   There is a man pager that might be of minor interest, but that can be
> > taken over by the kernel team if they want

I do not want to maintain the dying package.



> [...]
>
> I assume you're referring to kernel-img.conf.  I would be happy to add
> that to linux-base, with some clarification of which settings are
> understood by which packages.
>
> I take it that you don't want kernel-package to be included in buster,
> so can you open an RC bug to say so?

Also, could you make sure it won't come back to bullseye or later ?

How about Ubuntu? Is it out of your control?



> Ben.
>
> --
> Ben Hutchings
> friends: People who know you well, but like you anyway.
>
>
Ben Hutchings March 9, 2019, 8:32 p.m. UTC | #7
On Fri, 2019-03-08 at 15:42 +0900, Masahiro Yamada wrote:
> On Fri, Mar 8, 2019 at 6:56 AM Ben Hutchings <ben@decadent.org.uk> wrote:
[...]
> > I take it that you don't want kernel-package to be included in buster,
> > so can you open an RC bug to say so?
> 
> Also, could you make sure it won't come back to bullseye or later ?

An RC (release-critical) bug will normally block a package from being
considered for any future release.

> How about Ubuntu? Is it out of your control?

Ubuntu's release management is independent of Debian's.  I don't know
whether they consider RC bugs in Debian.

Ben.
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index ef4b32c..925d870 100644
--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,16 @@  _all:
 # descending is started. They are now explicitly listed as the
 # prepare rule.
 
+# Ugly workaround for Debian make-kpkg:
+# make-kpkg directly includes the top Makefile of Linux kernel. In such a case,
+# skip sub-make to support debian_* targets in ruleset/kernel_version.mk, but
+# displays warning to discourage such abusage.
+ifneq ($(word 2, $(MAKEFILE_LIST)),)
+$(warning Do not include top Makefile of Linux Kernel)
+sub-make-done := 1
+MAKEFLAGS += -rR
+endif
+
 ifneq ($(sub-make-done),1)
 
 # Do not use make's built-in rules and variables