All of lore.kernel.org
 help / color / mirror / Atom feed
* What CONFIG_ option enables compilation of *.o file?
@ 2021-01-09 18:20 Denis Efremov
  2021-01-14  6:45 ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Denis Efremov @ 2021-01-09 18:20 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Linux Kbuild mailing list

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?

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: What CONFIG_ option enables compilation of *.o file?
  2021-01-09 18:20 What CONFIG_ option enables compilation of *.o file? Denis Efremov
@ 2021-01-14  6:45 ` Masahiro Yamada
  2021-01-14  6:51   ` Randy Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2021-01-14  6:45 UTC (permalink / raw)
  To: Denis Efremov; +Cc: Linux Kbuild mailing list

On Sun, Jan 10, 2021 at 3:21 AM Denis Efremov <efremov@linux.com> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: What CONFIG_ option enables compilation of *.o file?
  2021-01-14  6:45 ` Masahiro Yamada
@ 2021-01-14  6:51   ` Randy Dunlap
  0 siblings, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2021-01-14  6:51 UTC (permalink / raw)
  To: Masahiro Yamada, Denis Efremov; +Cc: Linux Kbuild mailing list

On 1/13/21 10:45 PM, Masahiro Yamada wrote:
> On Sun, Jan 10, 2021 at 3:21 AM Denis Efremov <efremov@linux.com> 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 don't know of anything better. I have scripts (instead of functions)
findconfig and findmakefile, but they are not as nice as your functions.




-- 
~Randy
You can't do anything without having to do something else first.
-- Belefant's Law

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-14  6:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-09 18:20 What CONFIG_ option enables compilation of *.o file? Denis Efremov
2021-01-14  6:45 ` Masahiro Yamada
2021-01-14  6:51   ` Randy Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.