[dpdk-dev,v3,1/3] mk: add sensible default target with defconfig

Message ID 1496846277-280267-2-git-send-email-david.hunt@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Hunt, David June 7, 2017, 2:37 p.m. UTC
  Users can now use 'make defconfig' to generate a configuration using
the most appropriate defaults for the current machine.

<arch-machine-execenv-toolchain>
  arch taken from uname -m
  machine defaults to native
  execenv is taken from uname, Linux=linuxapp, otherwise bsdapp
  toolchain is taken from $CC -v to see which compiler to use

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 mk/rte.sdkconfig.mk | 28 +++++++++++++++++++++++++---
 mk/rte.sdkroot.mk   |  4 ++--
 2 files changed, 27 insertions(+), 5 deletions(-)
  

Comments

Jerin Jacob June 12, 2017, 8:36 a.m. UTC | #1
-----Original Message-----
> Date: Wed, 7 Jun 2017 15:37:55 +0100
> From: David Hunt <david.hunt@intel.com>
> To: dev@dpdk.org
> CC: thomas@monjalon.net, shreyansh.jain@nxp.com, David Hunt
>  <david.hunt@intel.com>
> Subject: [dpdk-dev] [PATCH v3 1/3] mk: add sensible default target with
>  defconfig
> X-Mailer: git-send-email 2.7.4
> 
> Users can now use 'make defconfig' to generate a configuration using
> the most appropriate defaults for the current machine.
> 
> <arch-machine-execenv-toolchain>
>   arch taken from uname -m
>   machine defaults to native
>   execenv is taken from uname, Linux=linuxapp, otherwise bsdapp
>   toolchain is taken from $CC -v to see which compiler to use
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>
> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>

Tested on a arm64 target:

Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

> ---
>  mk/rte.sdkconfig.mk | 28 +++++++++++++++++++++++++---
>  mk/rte.sdkroot.mk   |  4 ++--
>  2 files changed, 27 insertions(+), 5 deletions(-)
> 
> diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
> index 1f2d6bd..fc03fe3 100644
> --- a/mk/rte.sdkconfig.mk
> +++ b/mk/rte.sdkconfig.mk
> @@ -60,16 +60,38 @@ showconfigs:
>  
>  .PHONY: notemplate
>  notemplate:
> -	@printf "No template specified. "
> -	@echo "Use T=template among the following list:"
> +	@printf "No template specified. Use 'make defconfig' or "
> +	@echo "use T=template from the following list:"
>  	@$(MAKE) -rR showconfigs | sed 's,^,  ,'
>  
> +
> +.PHONY: defconfig
> +defconfig:
> +	@$(MAKE) config T=$(shell \
> +                uname -m | awk '{ \
> +                if ($$0 == "aarch64") { \
> +                        print "arm64-armv8a"} \
> +                else if ($$0 == "armv7l") { \
> +                        print "arm-armv7a"} \
> +                else if ($$0 == "ppc64") { \
> +                        print "ppc_64-power8"} \
> +                else { \
> +                        printf "%s-native", $$0} }')-$(shell \
> +                uname | awk '{ \
> +                if ($$0 == "Linux") { \
> +                        print "linuxapp"} \
> +                else { \
> +                        print "bsdapp"} }')-$(shell \
> +                ${CC} -v 2>&1 | \
> +                grep " version " | cut -d ' ' -f 1)
> +
>  .PHONY: config
>  ifeq ($(RTE_CONFIG_TEMPLATE),)
>  config: notemplate
>  else
>  config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile
> -	@echo "Configuration done"
> +	@echo "Configuration done using "$(shell basename \
> +		$(RTE_CONFIG_TEMPLATE) | sed "s/defconfig_//g")
>  endif
>  
>  $(RTE_OUTPUT):
> diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
> index 2843b7d..076a2d7 100644
> --- a/mk/rte.sdkroot.mk
> +++ b/mk/rte.sdkroot.mk
> @@ -88,8 +88,8 @@ export ROOTDIRS-y ROOTDIRS- ROOTDIRS-n
>  .PHONY: default
>  default: all
>  
> -.PHONY: config showconfigs showversion showversionum
> -config showconfigs showversion showversionum:
> +.PHONY: defconfig config showconfigs showversion showversionum
> +defconfig config showconfigs showversion showversionum:
>  	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk $@
>  
>  .PHONY: cscope gtags tags etags
> -- 
> 2.7.4
>
  
Thomas Monjalon Aug. 3, 2017, 10:39 p.m. UTC | #2
07/06/2017 16:37, David Hunt:
> Users can now use 'make defconfig' to generate a configuration using
> the most appropriate defaults for the current machine.
> 
> <arch-machine-execenv-toolchain>
>   arch taken from uname -m
>   machine defaults to native
>   execenv is taken from uname, Linux=linuxapp, otherwise bsdapp
>   toolchain is taken from $CC -v to see which compiler to use
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>
> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>

Looks to be a good idea if it is really automatic.

> +                ${CC} -v 2>&1 | \
> +                grep " version " | cut -d ' ' -f 1)

Unfortunately, it depends on $CC which is not commonly exported.
What about defaulting to gcc?

> -	@echo "Configuration done"
> +	@echo "Configuration done using "$(shell basename \
> +		$(RTE_CONFIG_TEMPLATE) | sed "s/defconfig_//g")

RTE_CONFIG_TEMPLATE is not defined in this patch
(and I do not see the benefit in next patch).
  
Hunt, David Aug. 4, 2017, 8:22 a.m. UTC | #3
-----Original Message-----
From: Thomas Monjalon [mailto:thomas@monjalon.net] 
Sent: Thursday, 3 August, 2017 11:40 PM
To: Hunt, David <david.hunt@intel.com>
Cc: dev@dpdk.org; shreyansh.jain@nxp.com
Subject: Re: [dpdk-dev] [PATCH v3 1/3] mk: add sensible default target with defconfig

07/06/2017 16:37, David Hunt:
> Users can now use 'make defconfig' to generate a configuration using 
> the most appropriate defaults for the current machine.
> 
> <arch-machine-execenv-toolchain>
>   arch taken from uname -m
>   machine defaults to native
>   execenv is taken from uname, Linux=linuxapp, otherwise bsdapp
>   toolchain is taken from $CC -v to see which compiler to use
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>
> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>

Looks to be a good idea if it is really automatic.

> +                ${CC} -v 2>&1 | \
> +                grep " version " | cut -d ' ' -f 1)

Unfortunately, it depends on $CC which is not commonly exported.
What about defaulting to gcc?

> -	@echo "Configuration done"
> +	@echo "Configuration done using "$(shell basename \
> +		$(RTE_CONFIG_TEMPLATE) | sed "s/defconfig_//g")

RTE_CONFIG_TEMPLATE is not defined in this patch (and I do not see the benefit in next patch).

Thomas, 
     Does this mean that this patch is not going into this release? It has been acked for almost a month now, with no further comment. The one hour between your comment and the release of RC4 did not give me a reasonable amount of time to address your concerns. I also feel that the lack of comments in the last month should mean that the patch should be applied as is. If changes are required, I am happy to address in the next release. 
Regards,
Dave.
  
Thomas Monjalon Aug. 4, 2017, 9:36 a.m. UTC | #4
04/08/2017 10:22, Hunt, David:
> From: Thomas Monjalon [mailto:thomas@monjalon.net] 
> 07/06/2017 16:37, David Hunt:
> > Users can now use 'make defconfig' to generate a configuration using 
> > the most appropriate defaults for the current machine.
> > 
> > <arch-machine-execenv-toolchain>
> >   arch taken from uname -m
> >   machine defaults to native
> >   execenv is taken from uname, Linux=linuxapp, otherwise bsdapp
> >   toolchain is taken from $CC -v to see which compiler to use
> > 
> > Signed-off-by: David Hunt <david.hunt@intel.com>
> > Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> 
> Looks to be a good idea if it is really automatic.
> 
> > +                ${CC} -v 2>&1 | \
> > +                grep " version " | cut -d ' ' -f 1)
> 
> Unfortunately, it depends on $CC which is not commonly exported.
> What about defaulting to gcc?
> 
> > -	@echo "Configuration done"
> > +	@echo "Configuration done using "$(shell basename \
> > +		$(RTE_CONFIG_TEMPLATE) | sed "s/defconfig_//g")
> 
> RTE_CONFIG_TEMPLATE is not defined in this patch (and I do not see the benefit in next patch).
> 
> Thomas, 
>      Does this mean that this patch is not going into this release? It has been acked for almost a month now, with no further comment. The one hour between your comment and the release of RC4 did not give me a reasonable amount of time to address your concerns. I also feel that the lack of comments in the last month should mean that the patch should be applied as is. If changes are required, I am happy to address in the next release. 

You're right, I'm very sorry not taking time to review it before.
I think only the first patch should be integrated, without the comment for
RTE_CONFIG_TEMPLATE.
Opinion?
  
Hunt, David Aug. 4, 2017, 9:53 a.m. UTC | #5
On 4/8/2017 10:36 AM, Thomas Monjalon wrote:
> 04/08/2017 10:22, Hunt, David:
>> From: Thomas Monjalon [mailto:thomas@monjalon.net]
>> 07/06/2017 16:37, David Hunt:
>>> Users can now use 'make defconfig' to generate a configuration using
>>> the most appropriate defaults for the current machine.
>>>
>>> <arch-machine-execenv-toolchain>
>>>    arch taken from uname -m
>>>    machine defaults to native
>>>    execenv is taken from uname, Linux=linuxapp, otherwise bsdapp
>>>    toolchain is taken from $CC -v to see which compiler to use
>>>
>>> Signed-off-by: David Hunt <david.hunt@intel.com>
>>> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> Looks to be a good idea if it is really automatic.
>>
>>> +                ${CC} -v 2>&1 | \
>>> +                grep " version " | cut -d ' ' -f 1)
>> Unfortunately, it depends on $CC which is not commonly exported.
>> What about defaulting to gcc?
>>
>>> -	@echo "Configuration done"
>>> +	@echo "Configuration done using "$(shell basename \
>>> +		$(RTE_CONFIG_TEMPLATE) | sed "s/defconfig_//g")
>> RTE_CONFIG_TEMPLATE is not defined in this patch (and I do not see the benefit in next patch).
>>
>> Thomas,
>>       Does this mean that this patch is not going into this release? It has been acked for almost a month now, with no further comment. The one hour between your comment and the release of RC4 did not give me a reasonable amount of time to address your concerns. I also feel that the lack of comments in the last month should mean that the patch should be applied as is. If changes are required, I am happy to address in the next release.
> You're right, I'm very sorry not taking time to review it before.
> I think only the first patch should be integrated, without the comment for
> RTE_CONFIG_TEMPLATE.
> Opinion?

OK, I would be OK with the first patch. However, I think the 
RTE_CONFIG_TEMPLATE comment part of the patch is fine, we just tested it 
here. It's only RTE_TEMPLATE I'm introducing in the second patch, nor 
RTE_CONFIG_TEMPLATE. That existed before this patch set. So the echo 
command in the first patch works fine, and shows the user what template 
the script has used to configure itself.

I could upload another patch with just the first patch (and the relevant 
2 lines from the docs patch) as a v4?

Regards,
Dave.
  
Thomas Monjalon Aug. 4, 2017, 10:05 a.m. UTC | #6
04/08/2017 11:53, Hunt, David:
> 
> On 4/8/2017 10:36 AM, Thomas Monjalon wrote:
> > 04/08/2017 10:22, Hunt, David:
> >> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> >> 07/06/2017 16:37, David Hunt:
> >>> Users can now use 'make defconfig' to generate a configuration using
> >>> the most appropriate defaults for the current machine.
> >>>
> >>> <arch-machine-execenv-toolchain>
> >>>    arch taken from uname -m
> >>>    machine defaults to native
> >>>    execenv is taken from uname, Linux=linuxapp, otherwise bsdapp
> >>>    toolchain is taken from $CC -v to see which compiler to use
> >>>
> >>> Signed-off-by: David Hunt <david.hunt@intel.com>
> >>> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> >> Looks to be a good idea if it is really automatic.
> >>
> >>> +                ${CC} -v 2>&1 | \
> >>> +                grep " version " | cut -d ' ' -f 1)
> >> Unfortunately, it depends on $CC which is not commonly exported.
> >> What about defaulting to gcc?
> >>
> >>> -	@echo "Configuration done"
> >>> +	@echo "Configuration done using "$(shell basename \
> >>> +		$(RTE_CONFIG_TEMPLATE) | sed "s/defconfig_//g")
> >> RTE_CONFIG_TEMPLATE is not defined in this patch (and I do not see the benefit in next patch).
> >>
> >> Thomas,
> >>       Does this mean that this patch is not going into this release? It has been acked for almost a month now, with no further comment. The one hour between your comment and the release of RC4 did not give me a reasonable amount of time to address your concerns. I also feel that the lack of comments in the last month should mean that the patch should be applied as is. If changes are required, I am happy to address in the next release.
> > You're right, I'm very sorry not taking time to review it before.
> > I think only the first patch should be integrated, without the comment for
> > RTE_CONFIG_TEMPLATE.
> > Opinion?
> 
> OK, I would be OK with the first patch. However, I think the 
> RTE_CONFIG_TEMPLATE comment part of the patch is fine, we just tested it 
> here. It's only RTE_TEMPLATE I'm introducing in the second patch, nor 
> RTE_CONFIG_TEMPLATE. That existed before this patch set. So the echo 
> command in the first patch works fine, and shows the user what template 
> the script has used to configure itself.

Ah OK I totally missed it :)

> I could upload another patch with just the first patch (and the relevant 
> 2 lines from the docs patch) as a v4?

Yes perfect
  
Hunt, David Aug. 4, 2017, 10:42 a.m. UTC | #7
On 4/8/2017 11:05 AM, Thomas Monjalon wrote:
> 04/08/2017 11:53, Hunt, David:
>> On 4/8/2017 10:36 AM, Thomas Monjalon wrote:
>>> 04/08/2017 10:22, Hunt, David:
>>>> From: Thomas Monjalon [mailto:thomas@monjalon.net]
>>>> 07/06/2017 16:37, David Hunt:
>>>>> Users can now use 'make defconfig' to generate a configuration using
>>>>> the most appropriate defaults for the current machine.
>>>>>
>>>>> <arch-machine-execenv-toolchain>
>>>>>     arch taken from uname -m
>>>>>     machine defaults to native
>>>>>     execenv is taken from uname, Linux=linuxapp, otherwise bsdapp
>>>>>     toolchain is taken from $CC -v to see which compiler to use
>>>>>
>>>>> Signed-off-by: David Hunt <david.hunt@intel.com>
>>>>> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>>>> Looks to be a good idea if it is really automatic.
>>>>
>>>>> +                ${CC} -v 2>&1 | \
>>>>> +                grep " version " | cut -d ' ' -f 1)
>>>> Unfortunately, it depends on $CC which is not commonly exported.
>>>> What about defaulting to gcc?
>>>>
>>>>> -	@echo "Configuration done"
>>>>> +	@echo "Configuration done using "$(shell basename \
>>>>> +		$(RTE_CONFIG_TEMPLATE) | sed "s/defconfig_//g")
>>>> RTE_CONFIG_TEMPLATE is not defined in this patch (and I do not see the benefit in next patch).
>>>>
>>>> Thomas,
>>>>        Does this mean that this patch is not going into this release? It has been acked for almost a month now, with no further comment. The one hour between your comment and the release of RC4 did not give me a reasonable amount of time to address your concerns. I also feel that the lack of comments in the last month should mean that the patch should be applied as is. If changes are required, I am happy to address in the next release.
>>> You're right, I'm very sorry not taking time to review it before.
>>> I think only the first patch should be integrated, without the comment for
>>> RTE_CONFIG_TEMPLATE.
>>> Opinion?
>> OK, I would be OK with the first patch. However, I think the
>> RTE_CONFIG_TEMPLATE comment part of the patch is fine, we just tested it
>> here. It's only RTE_TEMPLATE I'm introducing in the second patch, nor
>> RTE_CONFIG_TEMPLATE. That existed before this patch set. So the echo
>> command in the first patch works fine, and shows the user what template
>> the script has used to configure itself.
> Ah OK I totally missed it :)
>
>> I could upload another patch with just the first patch (and the relevant
>> 2 lines from the docs patch) as a v4?
> Yes perfect
>

Thomas,
OK, V5 sent. (v4 had 1 line missing in docs). There's just the one patch 
in the set now.
Thanks,
Dave.
  

Patch

diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index 1f2d6bd..fc03fe3 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -60,16 +60,38 @@  showconfigs:
 
 .PHONY: notemplate
 notemplate:
-	@printf "No template specified. "
-	@echo "Use T=template among the following list:"
+	@printf "No template specified. Use 'make defconfig' or "
+	@echo "use T=template from the following list:"
 	@$(MAKE) -rR showconfigs | sed 's,^,  ,'
 
+
+.PHONY: defconfig
+defconfig:
+	@$(MAKE) config T=$(shell \
+                uname -m | awk '{ \
+                if ($$0 == "aarch64") { \
+                        print "arm64-armv8a"} \
+                else if ($$0 == "armv7l") { \
+                        print "arm-armv7a"} \
+                else if ($$0 == "ppc64") { \
+                        print "ppc_64-power8"} \
+                else { \
+                        printf "%s-native", $$0} }')-$(shell \
+                uname | awk '{ \
+                if ($$0 == "Linux") { \
+                        print "linuxapp"} \
+                else { \
+                        print "bsdapp"} }')-$(shell \
+                ${CC} -v 2>&1 | \
+                grep " version " | cut -d ' ' -f 1)
+
 .PHONY: config
 ifeq ($(RTE_CONFIG_TEMPLATE),)
 config: notemplate
 else
 config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile
-	@echo "Configuration done"
+	@echo "Configuration done using "$(shell basename \
+		$(RTE_CONFIG_TEMPLATE) | sed "s/defconfig_//g")
 endif
 
 $(RTE_OUTPUT):
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index 2843b7d..076a2d7 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -88,8 +88,8 @@  export ROOTDIRS-y ROOTDIRS- ROOTDIRS-n
 .PHONY: default
 default: all
 
-.PHONY: config showconfigs showversion showversionum
-config showconfigs showversion showversionum:
+.PHONY: defconfig config showconfigs showversion showversionum
+defconfig config showconfigs showversion showversionum:
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk $@
 
 .PHONY: cscope gtags tags etags