Subject: Re: new way of writing defconfigs for freescale's powerpc platforms

From: Scott Wood <[email-masked]>
Date: Thu, 16 Apr 2015 23:13:20 -0500

On Fri, 2015-04-17 at 10:54 +1000, Michael Ellerman wrote:
> On Thu, 2015-04-09 at 21:52 +0000, Lijun Pan wrote:
> > Hi Maintainers,
> > 
> > We have a proposal for writing the defconfigs for freescale's powperpc platforms in a new way.
> > Can you take a look and provide some feedback?
> > 
> > You know currently we have mpc85xx_defconfig, corenet32_defconfig, bsc913x_defconfig, *fman*_defconfig, etc.
> > We are going to extract some common parts from the existing defconfigs, and name it, say, fsl_basic_defconfig.
> > Then, we could create some defconfigs targeting specific features or specific platforms.
> > Say, features specific: kvm_defconfig, fman_defconfig, etc.
> > Platforms specific: p1_defconfig, p2_defcongfig, p4_defconfig, t1_defconfig, t2_defconfig, t2_defconfig, b4_defconfig, etc
> > When we want to make a kernel image for p1 platform,
> > Using the following steps:
> > 
> > make ./scripts/kconfig/merge_config.sh arch/powerpc/configs/fsl_basic_config p1_defconfig
> > make
> > 
> > What do you think of this new approach?
> 
> I don't like that the user has to manually run merge_config.sh.
> 
> How does a user even know that it's an option?
> 
> It also breaks scripts that auto build the kernel, which expect to be able to do:
> 
>   $ make foo_defconfig
>   $ make
> 
> Scripts like mine for example :)
> 
>   http://kisskb.ellerman.id.au/kisskb/head/8734/
> 
> What I'd be happy with is something that does merge_config under the covers. So
> a user still runs 'make fsl_plat_foo_defconfig', but under the covers it does a
> merge config.
> 
> kvmconfig and tinyconfig are implemented that way already, so with a bit more
> work hopefully you can do that for arch configs also.

kvmconfig and tinyconfig are still separate user-visible steps to be
applied after running a base defconfig.

For breaking a platform defconfig into components, we could do something
like this in arch/powerpc/Makefile:

# Can't call mergeconfig directly as it isn't defined at this point
define domerge
       @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile $(1).config
endef

corenet64_smp_defconfig: corenet64_basic_defconfig
	$(call domerge,smp)
	$(call domerge,altivec)
	$(call domerge,corenet_drivers)
	$(call domerge,embedded_misc) # filesystems etc

And this in scripts/kconfig/Makefile:

%.config:
       $(call mergeconfig,$*)

One issue with this is that we'd lose the ability to use savedefconfig
(at least without manual manipulation of the results) to maintain the
defconfigs/fragments.

-Scott