Messages in this thread Patch in this message | | | From | Masahiro Yamada <> | Date | Thu, 21 Jan 2021 04:41:13 +0900 | Subject | Re: [PATCH v5] modules: introduce the MODULE_SCMVERSION config |
| |
On Wed, Jan 20, 2021 at 9:19 AM Will McVicker <willmcvicker@google.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
| |