Re: [PATCH 6/8] kbuild: move more module installation code to scripts/Makefile.modinst

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 29 Aug 2023 11:35:41 GMT, Masahiro Yamada wrote:
> On Tue, Aug 29, 2023 at 11:15 AM Nicolas Schier <nicolas@xxxxxxxxx> wrote:
> >
> > On Wed 23 Aug 2023 20:50:46 GMT, Masahiro Yamada wrote:
> > > Move more relevant code to scripts/Makefile.modinst.
> > >
> > > Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> > > ---
> > >
> > >  Makefile                 | 34 +++++++--------------------------
> > >  scripts/Makefile.modinst | 41 +++++++++++++++++++++++++++++++++++++---
> > >  2 files changed, 45 insertions(+), 30 deletions(-)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index 7d9cab3d2186..82d22debf6c9 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -1477,24 +1477,6 @@ endif
> > >
> > >  endif # CONFIG_MODULES
> > >
> > > -modinst_pre :=
> > > -ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
> > > -modinst_pre := __modinst_pre
> > > -endif
> > > -
> > > -modules_install: $(modinst_pre)
> > > -PHONY += __modinst_pre
> > > -__modinst_pre:
> > > -     @rm -rf $(MODLIB)/kernel
> > > -     @rm -f $(MODLIB)/build
> > > -     @mkdir -p $(MODLIB)
> > > -ifdef CONFIG_MODULES
> > > -     @ln -s $(CURDIR) $(MODLIB)/build
> > > -     @sed 's:^\(.*\)\.o$$:kernel/\1.ko:' modules.order > $(MODLIB)/modules.order
> > > -endif
> > > -     @cp -f modules.builtin $(MODLIB)/
> > > -     @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
> > > -
> > >  ###
> > >  # Cleaning is done on three levels.
> > >  # make clean     Delete most generated files
> > > @@ -1836,12 +1818,15 @@ help:
> > >       @echo  '  clean           - remove generated files in module directory only'
> > >       @echo  ''
> > >
> > > +ifndef CONFIG_MODULES
> > > +modules modules_install: __external_modules_error
> > >  __external_modules_error:
> > >       @echo >&2 '***'
> > >       @echo >&2 '*** The present kernel disabled CONFIG_MODULES.'
> > >       @echo >&2 '*** You cannot build or install external modules.'
> > >       @echo >&2 '***'
> > >       @false
> > > +endif
> > >
> > >  endif # KBUILD_EXTMOD
> > >
> > > @@ -1850,6 +1835,9 @@ endif # KBUILD_EXTMOD
> > >
> > >  PHONY += modules modules_install modules_prepare
> > >
> > > +modules_install:
> > > +     $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
> >
> > I was a bit surprised to see 'modules_install' being allowed
> > unconditionally for in-tree usage (thus, even if CONFIG_MODULES=n), but
> > then realised that this is the same behaviour as we had before.  Out of
> > curiosity:  _why_ do we need to install
> > $(MODLIB)/modules.builtin{,.modinfo} also for configs w/
> > CONFIG_MODULES=n?
> 
> 
> I see your tags in commit
> 8ae071fc216a25f4f797f33c56857f4dd6b4408e    :)
> 
> 
> Some drivers need to load firmware.
> 
> To make such drivers working in initrd,
> mkinitramfs needs to copy necessary firmware files
> into the initrd.
> So, the tool needs to know which drivers are enabled.
> 
> That is my understanding why modules.builtin(.modinfo)
> is needed even with CONFIG_MODULES=n.

Ups, yes.  Thanks for the reminder!

Kind regards,
Nicolas

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux