Re: What CONFIG_ option enables compilation of *.o file?

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

 



On Sun, Jan 10, 2021 at 3:21 AM Denis Efremov <efremov@xxxxxxxxx> wrote:
>
> Hi,
>
> Is there a general way to get information about what CONFIG_ options
> enable compilation of *.o (*.[ch]) file? Maybe with kconfig command or from
> some generated files?


As far as I know, there is no tool or kconfig command to know
what CONFIG option enables which object.

I also check Makefiles as you did below.




This is my workflow.

I have my own utility functions in ~/.bashrc

kgrep - grep only Kconfig files
mgrep - grep only Makefiles

function kgrep()
{
        find . -name .repo -prune -o -name .git -prune -o -type f \
        \( -name 'Kconfig*' -o -name 'Config.in' \) \
        -print0 | xargs -0 grep --color -n "$@"
}

function mgrep()
{
        find . -name .repo -prune -o -name .git -prune -o -type f \
        \( -name 'Makefile*' -o -name 'Kbuild*' -o -name "*.mk" \) \
        -print0 | xargs -0 grep --color -n "$@"
}


Then, I get this:

masahiro@grover:~/ref/linux-next$ mgrep floppy.o
./drivers/block/Makefile:14:obj-$(CONFIG_BLK_DEV_FD) += floppy.o
./drivers/ide/Makefile:92: ide-gd_mod-y += ide-floppy.o ide-floppy_ioctl.o



Maybe, there is a better way...




> I mean, to get information that, for example:
> 1) driver/block/floppy.o depends on CONFIG_BLK_DEV_FD
>
> From driver/block/Makefile:
>         obj-$(CONFIG_BLK_DEV_FD)        += floppy.o
>
> 2) kernel/trace/trace_selftest_dynamic.o depends on CONFIG_FTRACE_SELFTEST
>
> From kernel/trace/Makefile:
>         ifdef CONFIG_FTRACE_SELFTEST
>         obj-y += trace_selftest_dynamic.o
>         endif
>
> 3) kernel/trace/trace_irqsoff.o depends on either CONFIG_IRQSOFF_TRACER
>    or CONFIG_PREEMPT_TRACER
>
> From kernel/trace/Makefile:
>         obj-$(CONFIG_IRQSOFF_TRACER) += trace_irqsoff.o
>         obj-$(CONFIG_PREEMPT_TRACER) += trace_irqsoff.o
>
> 4) drivers/dax/bus.o depends on CONFIG_DAX
>
> From drivers/dax/Makefile:
>         obj-$(CONFIG_DAX) += dax.o
>         dax-y += bus.o
>
> 5) drivers/soc/bcm/brcmstb/common.o depends on CONFIG_SOC_BRCMSTB
>
> From drivers/Makefile:
>         obj-y                           += soc/
> From drivers/soc/Makefile:
>         obj-y                           += bcm/
> From drivers/soc/bcm/Makefile:
>         obj-$(CONFIG_SOC_BRCMSTB)       += brcmstb/
> From drivers/soc/bcm/brcmstb/Makefile
>         obj-y += common.o
>
> Thanks,
> Denis
>


-- 
Best Regards
Masahiro Yamada



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

  Powered by Linux