Re: [Question]: How to disable modules BTF independently?

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

 



On Thu, Apr 4, 2024 at 8:45 AM Vincent Li <vincent.mc.li@xxxxxxxxx> wrote:
>
> On Thu, Apr 4, 2024 at 8:42 AM Vincent Li <vincent.mc.li@xxxxxxxxx> wrote:
> >
> > On Wed, Apr 3, 2024 at 1:01 PM Vincent Li <vincent.mc.li@xxxxxxxxx> wrote:
> > >
> > > On Wed, Apr 3, 2024 at 12:56 PM Andrii Nakryiko
> > > <andrii.nakryiko@xxxxxxxxx> wrote:
> > > >
> > > > On Wed, Apr 3, 2024 at 12:35 PM Vincent Li <vincent.mc.li@xxxxxxxxx> wrote:
> > > > >
> > > > > On Wed, Apr 3, 2024 at 11:56 AM Andrii Nakryiko
> > > > > <andrii.nakryiko@xxxxxxxxx> wrote:
> > > > > >
> > > > > > On Wed, Apr 3, 2024 at 11:34 AM Vincent Li <vincent.mc.li@xxxxxxxxx> wrote:
> > > > > > >
> > > > > > > On Wed, Apr 3, 2024 at 10:56 AM Andrii Nakryiko
> > > > > > > <andrii.nakryiko@xxxxxxxxx> wrote:
> > > > > > > >
> > > > > > > > On Wed, Apr 3, 2024 at 10:06 AM Vincent Li <vincent.mc.li@xxxxxxxxx> wrote:
> > > > > > > > >
> > > > > > > > > Hi,
> > > > > > > > >
> > > > > > > > > Once I enabled the open source firewall IPfire kernel 6.6.15
> > > > > > > > > DEBUG_INFO_BTF, the IPfire ISO image is increased from about 450MB to
> > > > > > > > > about 1.5GB, I suspect because IPfire has many driver modules to
> > > > > > > >
> > > > > > > > BTF can't be that big. I think you just get all the DWARF for modules
> > > > > > > > and vmlinux itself. DWARF is necessary to generate BTF during the
> > > > > > > > build time, but it can be stripped out afterwards, leaving just (much
> > > > > > > > smaller) BTF intact.
> > > > > > >
> > > > > > > ok good to hear that :).  I am new to this, how to strip
> > > > > > > kernel/modules DWARF after kernel/modules being built?
> > > > > > >
> > > > > > > >
> > > > > > > > > support as many hardware as possible, pahole generated BTF for all
> > > > > > > > > these modules, that could increase the size of the ISO image, so I
> > > > > > > > > wonder if I could disable modules BTF only but keep vmlinux BTF, or
> > > > > > > > > maybe selectively enable BTF for some modules, but not other modules?
> > > > > > > > >
> > > > > > > > > I found this discussion [0] making DEBUG_INFO_BTF_MODULES selectable
> > > > > > > > > independently. I am still not sure how to disable modules BTF, I tried
> > > > > > > > > make menuconfig, still not obvious to me how to disable
> > > > > > > > > DEBUG_INFO_BTF_MODULES
> > > > > > > >
> > > > > > > > I think CONFIG_DEBUG_INFO_BTF_MODULES=n should work fine, but see
> > > > > > > > above, I don't think the BTF is a problem here, it's not stripping out
> > > > > > > > DWARF.
> > > > >
> > > > > I  manually change the CONFIG_DEBUG_INFO_BTF_MODULES=y to
> > > > > CONFIG_DEBUG_INFO_BTF_MODULES=n
> > > > > in .config, but make oldconfig always flip it back to y, if I run make
> > > > > bzImage without make oldconfig, it will have "Restart config..."
> > > > > like below and n  flipped to y again when examining the .config
> > > >
> > > > Maybe CONFIG_MODULE_ALLOW_BTF_MISMATCH is auto-selecting it, try
> > > > turning both off.
> > > >
> > >
> > > originally CONFIG_MODULE_ALLOW_BTF_MISMATCH is not set, so I set it to
> > > n, still CONFIG_DEBUG_INFO_BTF_MODULES set back to y, I also tried set
> > > CONFIG_PAHOLE_HAS_SPLIT_BTF and CONFIG_PAHOLE_HAS_LANG_EXCLUDE to n,
> > > no effect, all back to y
> > >
> >
> > I found if I change DEBUG_INFO_BTF_MODULES def_bool to n as below
> > diff, it works, is this the right way?
> >
> >
> > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > index 975a07f9f1cc..98d7a4476d00 100644
> > --- a/lib/Kconfig.debug
> > +++ b/lib/Kconfig.debug
> > @@ -408,7 +408,7 @@ config PAHOLE_HAS_LANG_EXCLUDE
> >           using DEBUG_INFO_BTF_MODULES.
> >
> >  config DEBUG_INFO_BTF_MODULES
> > -       def_bool y
> > +       def_bool n
> >         depends on DEBUG_INFO_BTF && MODULES && PAHOLE_HAS_SPLIT_BTF
> >         help
> >           Generate compact split BTF type information for kernel modules.
> >
>
> this seems  always set DEBUG_INFO_BTF_MODULES to n when I want y, not
> going to work :)
>

this diff seems resolves the problem

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 975a07f9f1cc..31bd799bf3b5 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -408,7 +408,7 @@ config PAHOLE_HAS_LANG_EXCLUDE
          using DEBUG_INFO_BTF_MODULES.

 config DEBUG_INFO_BTF_MODULES
-       def_bool y
+       bool "Generate modules BTF"
        depends on DEBUG_INFO_BTF && MODULES && PAHOLE_HAS_SPLIT_BTF
        help
          Generate compact split BTF type information for kernel modules.

any suggestions ?

> > > > >
> > > > > # make bzImage
> > > > >
> > > > >  SYNC    include/config/auto.conf.cmd
> > > > > *
> > > > > * Restart config...
> > > > > *
> > > > >
> > > > > >
> > > > > > strip -g ? I don't know how this is normally done in Linux distros.
> > > > > >
> > > > > > > >
> > > > > > > > >
> > > > > > > > > [0] https://lore.kernel.org/bpf/CAKH8qBu0ptKbMVvoMpgN2tyk84ZGvwuCJLjesqw-_8QtSRLqpw@xxxxxxxxxxxxxx/T/#m73cee268387358ec645b665951feb931b294ec2d
> > > > > > > > >
> > > > > > > > > Thanks!
> > > > > > > > >





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux