* Re: RFC: build config via DT names [not found] <63f25fea-f163-f9cc-b5b2-f6f291d7f8d2@gmx.de> @ 2018-02-12 23:13 ` Frank Rowand [not found] ` <d55f95cc-228b-e65f-b46c-2f314f4fa582-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Frank Rowand @ 2018-02-12 23:13 UTC (permalink / raw) To: Enrico Weigelt, metux IT consult; +Cc: linux-kernel, devicetree@vger.kernel.org + devicetree mail list On 02/10/18 07:52, Enrico Weigelt, metux IT consult wrote: > Hi folks, > > I've regularily have the task of configuring a kernel for a given DT. > To make this a little bit easier, I'd like to do this automatically. > > The tuff task here is getting a mapping between dt compatible strings > and corresponding CONFIG_* flags. Automatically extracting it from the > source code seems pretty tricky, especially w/ corner cases (eg. some > drivers support groups of devices, depending on config options) - IMHO > it will need some code changes anyways. > > Therefore I propose a simple approach using the existing Kconfig system: > > Add an extra (toplevel) menu and config flag naming scheme which > directly map DT compatible strings to config flags. For example: > >> fsl,mpc5200-gpio <=> CONFIG_DTDEV_FSL_MPC5200_GPIO > >> config CONFIG_DTDEV_FSL_MPC5200_GPIO >> tristate "fsl,mpc5200-gpio" >> select GPIO_MPC5200 > > Note that these flags are separate from the actual drivers - they just > enable them automatically. Of course they'll have to be maintained by > the driver maintainers. > > > What do you think about this idea ? > > > --mtx > ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <d55f95cc-228b-e65f-b46c-2f314f4fa582-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: RFC: build config via DT names [not found] ` <d55f95cc-228b-e65f-b46c-2f314f4fa582-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2018-02-12 23:24 ` Frank Rowand [not found] ` <52140da5-0d49-c861-d752-8de9e4927380-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2018-02-13 15:19 ` Rob Herring 1 sibling, 1 reply; 5+ messages in thread From: Frank Rowand @ 2018-02-12 23:24 UTC (permalink / raw) To: Enrico Weigelt, metux IT consult Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Hi Enrico, On 02/12/18 15:13, Frank Rowand wrote: > + devicetree mail list > > On 02/10/18 07:52, Enrico Weigelt, metux IT consult wrote: >> Hi folks, >> >> I've regularily have the task of configuring a kernel for a given DT. >> To make this a little bit easier, I'd like to do this automatically. >> >> The tuff task here is getting a mapping between dt compatible strings >> and corresponding CONFIG_* flags. Automatically extracting it from the >> source code seems pretty tricky, especially w/ corner cases (eg. some >> drivers support groups of devices, depending on config options) - IMHO >> it will need some code changes anyways. >> >> Therefore I propose a simple approach using the existing Kconfig system: >> >> Add an extra (toplevel) menu and config flag naming scheme which >> directly map DT compatible strings to config flags. For example: >> >>> fsl,mpc5200-gpio <=> CONFIG_DTDEV_FSL_MPC5200_GPIO >> >>> config CONFIG_DTDEV_FSL_MPC5200_GPIO >>> tristate "fsl,mpc5200-gpio" >>> select GPIO_MPC5200 >> >> Note that these flags are separate from the actual drivers - they just >> enable them automatically. Of course they'll have to be maintained by >> the driver maintainers. >> >> >> What do you think about this idea ? >> >> >> --mtx As you note, it can be quite tricky getting the correct kernel configuration for a given devicetree. There is a tool to aid this process: scripts/dtc/dt_to_config. It is not a 100% solution, but it is very helpful. The problem is difficult enough that this tool led to a conference talk. The slides are at https://elinux.org/images/5/50/Dt_debugging_part_2.pdf which is linked to from https://elinux.org/Device_Tree_presentations_papers_articles#linux_kernel_configuration dt_to_config and configuration issues are discussed in slides 33 - 80. -Frank -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <52140da5-0d49-c861-d752-8de9e4927380-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: RFC: build config via DT names [not found] ` <52140da5-0d49-c861-d752-8de9e4927380-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2018-02-13 13:16 ` Enrico Weigelt, metux IT consult 0 siblings, 0 replies; 5+ messages in thread From: Enrico Weigelt, metux IT consult @ 2018-02-13 13:16 UTC (permalink / raw) To: Frank Rowand Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On 12.02.2018 23:24, Frank Rowand wrote: > There is a tool to aid this process: scripts/dtc/dt_to_config. It is not > a 100% solution, but it is very helpful. > > The problem is difficult enough that this tool led to a conference talk. > The slides are at https://elinux.org/images/5/50/Dt_debugging_part_2.pdf > which is linked to from > https://elinux.org/Device_Tree_presentations_papers_articles#linux_kernel_configuration I believe my approach can make this much simpler, at least for most drivers: the maintainers would explicitly add proper config flags, instead of letting the tool guess it. Of course, it would take some amount of work to do that for all drivers, but we could do that step by step. --mtx -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: RFC: build config via DT names [not found] ` <d55f95cc-228b-e65f-b46c-2f314f4fa582-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2018-02-12 23:24 ` Frank Rowand @ 2018-02-13 15:19 ` Rob Herring [not found] ` <CAL_JsqJXJA+Z7b6SoUx=MVK_C=vcMRAibapriOi+Wss6L1ahsw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 1 sibling, 1 reply; 5+ messages in thread From: Rob Herring @ 2018-02-13 15:19 UTC (permalink / raw) To: Frank Rowand Cc: Enrico Weigelt, metux IT consult, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Mon, Feb 12, 2018 at 5:13 PM, Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > + devicetree mail list > > On 02/10/18 07:52, Enrico Weigelt, metux IT consult wrote: >> Hi folks, >> >> I've regularily have the task of configuring a kernel for a given DT. >> To make this a little bit easier, I'd like to do this automatically. >> >> The tuff task here is getting a mapping between dt compatible strings >> and corresponding CONFIG_* flags. Automatically extracting it from the >> source code seems pretty tricky, especially w/ corner cases (eg. some >> drivers support groups of devices, depending on config options) - IMHO >> it will need some code changes anyways. >> >> Therefore I propose a simple approach using the existing Kconfig system: >> >> Add an extra (toplevel) menu and config flag naming scheme which >> directly map DT compatible strings to config flags. For example: >> >>> fsl,mpc5200-gpio <=> CONFIG_DTDEV_FSL_MPC5200_GPIO >> >>> config CONFIG_DTDEV_FSL_MPC5200_GPIO >>> tristate "fsl,mpc5200-gpio" >>> select GPIO_MPC5200 >> >> Note that these flags are separate from the actual drivers - they just >> enable them automatically. Of course they'll have to be maintained by >> the driver maintainers. >> >> >> What do you think about this idea ? Doubling the number of driver config options is not going to fly. How would you handle multiple compatible strings per driver? We want fewer config options, not more. We have all the data, so we should be able to generate this which dt_to_config tries to do. I think part of the problem is dt_to_config works at the source level for everything. Really we need a more robust way to map source files to config options and extracting match tables from drivers. Perhaps doing the latter with coccinelle which can match struct types, using the object files instead, or using module aliases (though that doesn't work for built-in drivers). Rob -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <CAL_JsqJXJA+Z7b6SoUx=MVK_C=vcMRAibapriOi+Wss6L1ahsw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: RFC: build config via DT names [not found] ` <CAL_JsqJXJA+Z7b6SoUx=MVK_C=vcMRAibapriOi+Wss6L1ahsw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2018-02-13 16:21 ` Enrico Weigelt 0 siblings, 0 replies; 5+ messages in thread From: Enrico Weigelt @ 2018-02-13 16:21 UTC (permalink / raw) To: Rob Herring, Frank Rowand Cc: Enrico Weigelt, metux IT consult, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On 13.02.2018 15:19, Rob Herring wrote: > Doubling the number of driver config options is not going to fly. These options would be in their own submenu (which could be disabled completely) and use their own prefix. IMHO, even if they grow into big numbers, the impact should be minimal. > How would you handle multiple compatible strings per driver? Multiple entries in the submenu, each selecting the same driver. > We have all the data, so we should be able to generate this which > dt_to_config tries to do. I guess there're lots of corner cases that would need special magic. > I think part of the problem is dt_to_config > works at the source level for everything. Really we need a more robust > way to map source files to config options and extracting match tables > from drivers. Perhaps doing the latter with coccinelle which can match > struct types, using the object files instead, or using module aliases > (though that doesn't work for built-in drivers). Configure by already compiled binaries ? --mtx -- Enrico Weigelt, metux IT consult Free software and Linux embedded engineering info-EcKl7qYKIbxeoWH0uzbU5w@public.gmane.org -- +49-151-27565287 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-02-13 16:21 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <63f25fea-f163-f9cc-b5b2-f6f291d7f8d2@gmx.de> 2018-02-12 23:13 ` RFC: build config via DT names Frank Rowand [not found] ` <d55f95cc-228b-e65f-b46c-2f314f4fa582-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2018-02-12 23:24 ` Frank Rowand [not found] ` <52140da5-0d49-c861-d752-8de9e4927380-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2018-02-13 13:16 ` Enrico Weigelt, metux IT consult 2018-02-13 15:19 ` Rob Herring [not found] ` <CAL_JsqJXJA+Z7b6SoUx=MVK_C=vcMRAibapriOi+Wss6L1ahsw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2018-02-13 16:21 ` Enrico Weigelt
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).