[PATCH V2 2/2] powerpc/configs: Replace pseries_le_defconfig with a Makefile target using merge_config

2015-05-25 Thread Cyril Bur
Rather than continuing to maintain a copy of pseries_defconfig with enabled
CONFIG_CPU_LITTLE_ENDIAN, use the generic merge_config script and use an
le.config to enable little endian on top of pseries_defconfig without the
need for a duplicated _defconfig file.

This method will require less maintenance in the future and will ensure
that both 'defconfigs' are always in sync.

It is worth noting that the seemingly more simple approach of:
pseries_le_defconfig: pseries_defconfig
$(Q)$(MAKE) le.config
Will not work when building using O=builddir.
The obvious fix to that
pseries_le_defconfig:
$(Q)$(MAKE) -f $(srctree)/Makefile pseries_defconfig le.config
Will result in options that get selected by other options having 'select
CONFIG_FOO' in the defconfig file possibly remaining selected after the
merge with le.config, when they would not have been set by using an actual
pseries_le_defconfig file. As a result this has caused differences in the
generated .config files from when there were actual pseries_le_defconfig
and pseries_defconfg files.

The solution is to ensure to only invoke a config target once so that it
has all the information it needs to correctly set all the parameters. This
is done through the explicit call to make olddefconfig

Signed-off-by: Cyril Bur cyril...@gmail.com
---
V2: Rework to have olddefconfig (or equivalent) only called once.
Improved to make writing *_defconfig targets easier and have the
  targets look cleaner.

 arch/powerpc/Makefile |  15 ++
 arch/powerpc/configs/le.config|   1 +
 arch/powerpc/configs/pseries_le_defconfig | 319 --
 3 files changed, 16 insertions(+), 319 deletions(-)
 create mode 100644 arch/powerpc/configs/le.config
 delete mode 100644 arch/powerpc/configs/pseries_le_defconfig

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 07a4808..2cafce6 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -269,6 +269,21 @@ bootwrapper_install:
 %.dtb: scripts
$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
 
+#Used to create 'merged defconfigs'
+#Should be $(call)'ed with the first argument as the defconfig on which to
+#base and with a space separated list of .config files to merge, without
+#the .config suffix.
+define merge_into_defconfig
+$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
+   -m -O $(objtree) $(srctree)/arch/$(SRCARCH)/configs/$(1) \
+   $(foreach 
config,$(2),$(srctree)/arch/$(SRCARCH)/configs/$(config).config)
+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
+endef
+
+PHONY += pseries_le_defconfig
+pseries_le_defconfig:
+   $(call merge_into_defconfig,pseries_defconfig,le)
+
 define archhelp
   @echo '* zImage  - Build default images selected by kernel config'
   @echo '  zImage.*- Compressed kernel image 
(arch/$(ARCH)/boot/zImage.*)'
diff --git a/arch/powerpc/configs/le.config b/arch/powerpc/configs/le.config
new file mode 100644
index 000..ee43fdb
--- /dev/null
+++ b/arch/powerpc/configs/le.config
@@ -0,0 +1 @@
+CONFIG_CPU_LITTLE_ENDIAN=y
diff --git a/arch/powerpc/configs/pseries_le_defconfig 
b/arch/powerpc/configs/pseries_le_defconfig
deleted file mode 100644
index 09bc96e..000
--- a/arch/powerpc/configs/pseries_le_defconfig
+++ /dev/null
@@ -1,319 +0,0 @@
-CONFIG_PPC64=y
-CONFIG_SMP=y
-CONFIG_NR_CPUS=2048
-CONFIG_CPU_LITTLE_ENDIAN=y
-CONFIG_SYSVIPC=y
-CONFIG_POSIX_MQUEUE=y
-CONFIG_FHANDLE=y
-CONFIG_AUDIT=y
-CONFIG_AUDITSYSCALL=y
-CONFIG_IRQ_DOMAIN_DEBUG=y
-CONFIG_NO_HZ=y
-CONFIG_HIGH_RES_TIMERS=y
-CONFIG_TASKSTATS=y
-CONFIG_TASK_DELAY_ACCT=y
-CONFIG_TASK_XACCT=y
-CONFIG_TASK_IO_ACCOUNTING=y
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_NUMA_BALANCING=y
-CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y
-CONFIG_CGROUPS=y
-CONFIG_CGROUP_FREEZER=y
-CONFIG_CGROUP_DEVICE=y
-CONFIG_CPUSETS=y
-CONFIG_CGROUP_CPUACCT=y
-CONFIG_MEMCG=y
-CONFIG_MEMCG_SWAP=y
-CONFIG_CGROUP_PERF=y
-CONFIG_CGROUP_SCHED=y
-CONFIG_USER_NS=y
-CONFIG_BLK_DEV_INITRD=y
-# CONFIG_COMPAT_BRK is not set
-CONFIG_PROFILING=y
-CONFIG_OPROFILE=y
-CONFIG_KPROBES=y
-CONFIG_JUMP_LABEL=y
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-CONFIG_MODVERSIONS=y
-CONFIG_MODULE_SRCVERSION_ALL=y
-CONFIG_PARTITION_ADVANCED=y
-CONFIG_PPC_SPLPAR=y
-CONFIG_SCANLOG=m
-CONFIG_PPC_SMLPAR=y
-CONFIG_DTL=y
-# CONFIG_PPC_PMAC is not set
-CONFIG_RTAS_FLASH=m
-CONFIG_IBMEBUS=y
-CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
-CONFIG_HZ_100=y
-CONFIG_BINFMT_MISC=m
-CONFIG_PPC_TRANSACTIONAL_MEM=y
-CONFIG_KEXEC=y
-CONFIG_IRQ_ALL_CPUS=y
-CONFIG_MEMORY_HOTPLUG=y
-CONFIG_MEMORY_HOTREMOVE=y
-CONFIG_KSM=y
-CONFIG_TRANSPARENT_HUGEPAGE=y
-CONFIG_PPC_64K_PAGES=y
-CONFIG_PPC_SUBPAGE_PROT=y
-CONFIG_SCHED_SMT=y
-CONFIG_HOTPLUG_PCI=y
-CONFIG_HOTPLUG_PCI_RPA=m
-CONFIG_HOTPLUG_PCI_RPA_DLPAR=m
-CONFIG_NET=y
-CONFIG_PACKET=y
-CONFIG_UNIX=y
-CONFIG_XFRM_USER=m
-CONFIG_NET_KEY=m
-CONFIG_INET=y
-CONFIG_IP_MULTICAST=y
-CONFIG_NET_IPIP=y
-CONFIG_SYN_COOKIES=y

Re: [PATCH V2 2/2] powerpc/configs: Replace pseries_le_defconfig with a Makefile target using merge_config

2015-05-25 Thread Samuel Mendoza-Jonas
Reviewed-by: Samuel Mendoza-Jonas sam...@au1.ibm.com

On 26/05/15 11:36, Cyril Bur wrote:
 Rather than continuing to maintain a copy of pseries_defconfig with enabled
 CONFIG_CPU_LITTLE_ENDIAN, use the generic merge_config script and use an
 le.config to enable little endian on top of pseries_defconfig without the
 need for a duplicated _defconfig file.
 
 This method will require less maintenance in the future and will ensure
 that both 'defconfigs' are always in sync.
 
 It is worth noting that the seemingly more simple approach of:
 pseries_le_defconfig: pseries_defconfig
   $(Q)$(MAKE) le.config
 Will not work when building using O=builddir.
 The obvious fix to that
 pseries_le_defconfig:
   $(Q)$(MAKE) -f $(srctree)/Makefile pseries_defconfig le.config
 Will result in options that get selected by other options having 'select
 CONFIG_FOO' in the defconfig file possibly remaining selected after the
 merge with le.config, when they would not have been set by using an actual
 pseries_le_defconfig file. As a result this has caused differences in the
 generated .config files from when there were actual pseries_le_defconfig
 and pseries_defconfg files.
 
 The solution is to ensure to only invoke a config target once so that it
 has all the information it needs to correctly set all the parameters. This
 is done through the explicit call to make olddefconfig
 
 Signed-off-by: Cyril Bur cyril...@gmail.com
 ---
 V2: Rework to have olddefconfig (or equivalent) only called once.
 Improved to make writing *_defconfig targets easier and have the
   targets look cleaner.
 
  arch/powerpc/Makefile |  15 ++
  arch/powerpc/configs/le.config|   1 +
  arch/powerpc/configs/pseries_le_defconfig | 319 
 --
  3 files changed, 16 insertions(+), 319 deletions(-)
  create mode 100644 arch/powerpc/configs/le.config
  delete mode 100644 arch/powerpc/configs/pseries_le_defconfig
 
 diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
 index 07a4808..2cafce6 100644
 --- a/arch/powerpc/Makefile
 +++ b/arch/powerpc/Makefile
 @@ -269,6 +269,21 @@ bootwrapper_install:
  %.dtb: scripts
   $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
  
 +#Used to create 'merged defconfigs'
 +#Should be $(call)'ed with the first argument as the defconfig on which to
 +#base and with a space separated list of .config files to merge, without
 +#the .config suffix.
 +define merge_into_defconfig
 +$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
 + -m -O $(objtree) $(srctree)/arch/$(SRCARCH)/configs/$(1) \
 + $(foreach 
 config,$(2),$(srctree)/arch/$(SRCARCH)/configs/$(config).config)
 +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
 +endef
 +
 +PHONY += pseries_le_defconfig
 +pseries_le_defconfig:
 + $(call merge_into_defconfig,pseries_defconfig,le)
 +
  define archhelp
@echo '* zImage  - Build default images selected by kernel config'
@echo '  zImage.*- Compressed kernel image 
 (arch/$(ARCH)/boot/zImage.*)'
 diff --git a/arch/powerpc/configs/le.config b/arch/powerpc/configs/le.config
 new file mode 100644
 index 000..ee43fdb
 --- /dev/null
 +++ b/arch/powerpc/configs/le.config
 @@ -0,0 +1 @@
 +CONFIG_CPU_LITTLE_ENDIAN=y
 diff --git a/arch/powerpc/configs/pseries_le_defconfig 
 b/arch/powerpc/configs/pseries_le_defconfig
 deleted file mode 100644
 index 09bc96e..000
 --- a/arch/powerpc/configs/pseries_le_defconfig
 +++ /dev/null
 @@ -1,319 +0,0 @@
 -CONFIG_PPC64=y
 -CONFIG_SMP=y
 -CONFIG_NR_CPUS=2048
 -CONFIG_CPU_LITTLE_ENDIAN=y
 -CONFIG_SYSVIPC=y
 -CONFIG_POSIX_MQUEUE=y
 -CONFIG_FHANDLE=y
 -CONFIG_AUDIT=y
 -CONFIG_AUDITSYSCALL=y
 -CONFIG_IRQ_DOMAIN_DEBUG=y
 -CONFIG_NO_HZ=y
 -CONFIG_HIGH_RES_TIMERS=y
 -CONFIG_TASKSTATS=y
 -CONFIG_TASK_DELAY_ACCT=y
 -CONFIG_TASK_XACCT=y
 -CONFIG_TASK_IO_ACCOUNTING=y
 -CONFIG_IKCONFIG=y
 -CONFIG_IKCONFIG_PROC=y
 -CONFIG_NUMA_BALANCING=y
 -CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y
 -CONFIG_CGROUPS=y
 -CONFIG_CGROUP_FREEZER=y
 -CONFIG_CGROUP_DEVICE=y
 -CONFIG_CPUSETS=y
 -CONFIG_CGROUP_CPUACCT=y
 -CONFIG_MEMCG=y
 -CONFIG_MEMCG_SWAP=y
 -CONFIG_CGROUP_PERF=y
 -CONFIG_CGROUP_SCHED=y
 -CONFIG_USER_NS=y
 -CONFIG_BLK_DEV_INITRD=y
 -# CONFIG_COMPAT_BRK is not set
 -CONFIG_PROFILING=y
 -CONFIG_OPROFILE=y
 -CONFIG_KPROBES=y
 -CONFIG_JUMP_LABEL=y
 -CONFIG_MODULES=y
 -CONFIG_MODULE_UNLOAD=y
 -CONFIG_MODVERSIONS=y
 -CONFIG_MODULE_SRCVERSION_ALL=y
 -CONFIG_PARTITION_ADVANCED=y
 -CONFIG_PPC_SPLPAR=y
 -CONFIG_SCANLOG=m
 -CONFIG_PPC_SMLPAR=y
 -CONFIG_DTL=y
 -# CONFIG_PPC_PMAC is not set
 -CONFIG_RTAS_FLASH=m
 -CONFIG_IBMEBUS=y
 -CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
 -CONFIG_HZ_100=y
 -CONFIG_BINFMT_MISC=m
 -CONFIG_PPC_TRANSACTIONAL_MEM=y
 -CONFIG_KEXEC=y
 -CONFIG_IRQ_ALL_CPUS=y
 -CONFIG_MEMORY_HOTPLUG=y
 -CONFIG_MEMORY_HOTREMOVE=y
 -CONFIG_KSM=y
 -CONFIG_TRANSPARENT_HUGEPAGE=y
 -CONFIG_PPC_64K_PAGES=y
 -CONFIG_PPC_SUBPAGE_PROT=y
 -CONFIG_SCHED_SMT=y
 -CONFIG_HOTPLUG_PCI=y