[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7LNAQhsiaumkLF21zTkpOHCpQyCzxdrGX=897Bsc8w=aMapw@mail.gmail.com>
Date: Thu, 21 Jan 2021 04:41:13 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Will McVicker <willmcvicker@...gle.com>
Cc: Jessica Yu <jeyu@...nel.org>,
Michal Marek <michal.lkml@...kovi.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Christoph Hellwig <hch@...radead.org>,
Saravana Kannan <saravanak@...gle.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
"Cc: Android Kernel" <kernel-team@...roid.com>
Subject: Re: [PATCH v5] modules: introduce the MODULE_SCMVERSION config
On Wed, Jan 20, 2021 at 9:19 AM Will McVicker <willmcvicker@...gle.com> wrote:
>
> Hi Masahiro,
>
> After testing your suggestions for module_srcpath, I remembered why I
> needed this:
>
> +ifneq ($(realpath $(srctree)/$(KBUILD_EXTMOD) 2>/dev/null),)
> + module_srcpath := $(srctree)/$(KBUILD_EXTMOD)
> +else
> + module_srcpath := $(KBUILD_EXTMOD)
> +endif
>
> Basically KBUILD_EXTMOD actually has two uses when defined as a relative path:
>
> (1) defines the path to the external module's source relative to $(srctree)
> (2) defines the path to the external module's build artifacts relative
> to $(objtree)
>
> Since setlocalversion is run from $(objtree), we need to use
> $(srctree)/$(KBUILD_EXTMOD) when it's a relative path. Just to note,
> if I do just use KBUILD_EXTMOD, then the script setlocalversion fails
> to find the srctree and returns an empty string.
>
> Please correct me if I'm wrong. I messed around with this by adding
> many prints to Makefile.modpost and setlocalversion to make sure
> everything was defined as expected.
Hmm, you are right.
I did not know the current Kbuild works like that.
But, I do not want to uglify the code
just for supporting this rare use-case.
Rather, I want to apply this
https://lore.kernel.org/patchwork/patch/1368277/
and, still want to see as simple code as the following:
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -66,6 +66,7 @@ ifeq ($(KBUILD_EXTMOD),)
input-symdump := vmlinux.symvers
output-symdump := Module.symvers
+module-srcpath := $(srctree)
else
@@ -82,9 +83,20 @@ MODPOST += -e
input-symdump := Module.symvers $(KBUILD_EXTRA_SYMBOLS)
output-symdump := $(KBUILD_EXTMOD)/Module.symvers
+module-srcpath := $(KBUILD_EXTMOD)
endif
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists