Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753956AbcD2PyU (ORCPT ); Fri, 29 Apr 2016 11:54:20 -0400 Received: from mail-pf0-f174.google.com ([209.85.192.174]:34870 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753637AbcD2PyQ (ORCPT ); Fri, 29 Apr 2016 11:54:16 -0400 Message-ID: <572383A4.2030808@gmail.com> Date: Fri, 29 Apr 2016 08:54:12 -0700 From: Frank Rowand Reply-To: frowand.list@gmail.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Geert Uytterhoeven CC: Gaurav Minocha , Rob Herring , Grant Likely , "devicetree@vger.kernel.org" , Linux Kernel list , Geert Uytterhoeven , Pavel Machek Subject: Re: [PATCH] scripts/dtc: dt_to_config - report kernel config options for a devicetree References: <572284AB.102@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2405 Lines: 61 On 4/28/2016 11:44 PM, Geert Uytterhoeven wrote: > On Fri, Apr 29, 2016 at 8:39 AM, Gaurav Minocha > wrote: >> On Thu, Apr 28, 2016 at 3:32 PM, Rob Herring wrote: >>> On Thu, Apr 28, 2016 at 4:46 PM, Frank Rowand wrote: >>>> From: Frank Rowand >>>> >>>> Determining which kernel config options need to be enabled for a >>>> given devicetree can be a painful process. Create a new tool to >>>> find the drivers that may match a devicetree node compatible, >>>> find the kernel config options that enable the driver, and >>>> optionally report whether the kernel config option is enabled. >>> >>> I would find this more useful to output a config fragment with all the >>> options enabled. The hard part there is enabling the options a given >>> option is dependent on which I don't think kbuild takes care of. >> >> Do you mean to generate something like .config? If yes, then IMO it would >> not be a correct configuration file. > > A fragment to be appended to your current .config. > > After that, an additional run of "make oldconfig" should (hopefully) bring > everything into good shape. $ scripts/dtc/dt_to_config \ --config=$KBUILD_OUTPUT/.config \ arch/arm/boot/dts/qcom-apq8074-dragonboard.dts \ | grep "^............F" \ | cut -d ":" -f5 \ | sed -e 's| $|=y|' \ | sed -e 's| ||g' CONFIG_ARCH_U300=y CONFIG_SOC_IMX27=y CONFIG_SOC_IMX31=y CONFIG_ARCH_U300=y CONFIG_SOC_IMX27=y CONFIG_SOC_IMX31=y CONFIG_ARM_BIG_LITTLE_CPUIDLE=y CONFIG_QCOM_SMP2P=y CONFIG_QCOM_SMP2P=y CONFIG_QCOM_SMSM=y CONFIG_QCOM_SPMI_TEMP_ALARM=y CONFIG_QCOM_SPMI_IADC=y CONFIG_INPUT_PM8941_PWRKEY=y CONFIG_QCOM_SPMI_TEMP_ALARM=y CONFIG_QCOM_SPMI_VADC=y CONFIG_BACKLIGHT_PM8941_WLED=y But Gaurav is correct. The answer is not this easy. For example, there may be multiple drivers that match a compatible value. But only one of those drivers will be the correct one. That is just one example, some cases become are much more complex. I started writing code to try to score how good each compatible match is so the best match could be picked. At the moment, it is 255 lines and not very functional. I may continue experimenting with scoring in the future. -Frank