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

From: Samuel Mendoza-Jonas <[email-masked]>
Date: Tue, 26 May 2015 11:46:06 +1000

Reviewed-by: Samuel Mendoza-Jonas <[email-masked]>

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 <[email-masked]>
> ---
> 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 0000000..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..0000000
> --- 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
> -CONFIG_INET_AH=m
> -CONFIG_INET_ESP=m
> -CONFIG_INET_IPCOMP=m
> -# CONFIG_IPV6 is not set
> -CONFIG_NETFILTER=y
> -# CONFIG_NETFILTER_ADVANCED is not set
> -CONFIG_BRIDGE=m
> -CONFIG_VLAN_8021Q=m
> -CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
> -CONFIG_DEVTMPFS=y
> -CONFIG_DEVTMPFS_MOUNT=y
> -CONFIG_PARPORT=m
> -CONFIG_PARPORT_PC=m
> -CONFIG_BLK_DEV_FD=m
> -CONFIG_BLK_DEV_LOOP=y
> -CONFIG_BLK_DEV_NBD=m
> -CONFIG_BLK_DEV_RAM=y
> -CONFIG_BLK_DEV_RAM_SIZE=65536
> -CONFIG_VIRTIO_BLK=m
> -CONFIG_IDE=y
> -CONFIG_BLK_DEV_IDECD=y
> -CONFIG_BLK_DEV_GENERIC=y
> -CONFIG_BLK_DEV_AMD74XX=y
> -CONFIG_BLK_DEV_SD=y
> -CONFIG_CHR_DEV_ST=y
> -CONFIG_BLK_DEV_SR=y
> -CONFIG_BLK_DEV_SR_VENDOR=y
> -CONFIG_CHR_DEV_SG=y
> -CONFIG_SCSI_CONSTANTS=y
> -CONFIG_SCSI_FC_ATTRS=y
> -CONFIG_SCSI_CXGB3_ISCSI=m
> -CONFIG_SCSI_CXGB4_ISCSI=m
> -CONFIG_SCSI_BNX2_ISCSI=m
> -CONFIG_BE2ISCSI=m
> -CONFIG_SCSI_MPT2SAS=m
> -CONFIG_SCSI_IBMVSCSI=y
> -CONFIG_SCSI_IBMVFC=m
> -CONFIG_SCSI_SYM53C8XX_2=y
> -CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
> -CONFIG_SCSI_IPR=y
> -CONFIG_SCSI_QLA_FC=m
> -CONFIG_SCSI_QLA_ISCSI=m
> -CONFIG_SCSI_LPFC=m
> -CONFIG_SCSI_VIRTIO=m
> -CONFIG_SCSI_DH=m
> -CONFIG_SCSI_DH_RDAC=m
> -CONFIG_SCSI_DH_ALUA=m
> -CONFIG_ATA=y
> -CONFIG_SATA_AHCI=y
> -# CONFIG_ATA_SFF is not set
> -CONFIG_MD=y
> -CONFIG_BLK_DEV_MD=y
> -CONFIG_MD_LINEAR=y
> -CONFIG_MD_RAID0=y
> -CONFIG_MD_RAID1=y
> -CONFIG_MD_RAID10=m
> -CONFIG_MD_RAID456=m
> -CONFIG_MD_MULTIPATH=m
> -CONFIG_MD_FAULTY=m
> -CONFIG_BLK_DEV_DM=y
> -CONFIG_DM_CRYPT=m
> -CONFIG_DM_SNAPSHOT=m
> -CONFIG_DM_THIN_PROVISIONING=m
> -CONFIG_DM_MIRROR=m
> -CONFIG_DM_ZERO=m
> -CONFIG_DM_MULTIPATH=m
> -CONFIG_DM_MULTIPATH_QL=m
> -CONFIG_DM_MULTIPATH_ST=m
> -CONFIG_DM_UEVENT=y
> -CONFIG_BONDING=m
> -CONFIG_DUMMY=m
> -CONFIG_MACVLAN=m
> -CONFIG_MACVTAP=m
> -CONFIG_VXLAN=m
> -CONFIG_NETCONSOLE=y
> -CONFIG_TUN=m
> -CONFIG_VETH=m
> -CONFIG_VIRTIO_NET=m
> -CONFIG_VHOST_NET=m
> -CONFIG_VORTEX=y
> -CONFIG_ACENIC=m
> -CONFIG_ACENIC_OMIT_TIGON_I=y
> -CONFIG_PCNET32=y
> -CONFIG_TIGON3=y
> -CONFIG_CHELSIO_T1=m
> -CONFIG_BE2NET=m
> -CONFIG_S2IO=m
> -CONFIG_IBMVETH=y
> -CONFIG_EHEA=y
> -CONFIG_E100=y
> -CONFIG_E1000=y
> -CONFIG_E1000E=y
> -CONFIG_IXGB=m
> -CONFIG_IXGBE=m
> -CONFIG_MLX4_EN=m
> -CONFIG_MYRI10GE=m
> -CONFIG_QLGE=m
> -CONFIG_NETXEN_NIC=m
> -CONFIG_PPP=m
> -CONFIG_PPP_BSDCOMP=m
> -CONFIG_PPP_DEFLATE=m
> -CONFIG_PPPOE=m
> -CONFIG_PPP_ASYNC=m
> -CONFIG_PPP_SYNC_TTY=m
> -# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
> -CONFIG_INPUT_EVDEV=m
> -CONFIG_INPUT_MISC=y
> -CONFIG_INPUT_PCSPKR=m
> -# CONFIG_SERIO_SERPORT is not set
> -CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
> -CONFIG_SERIAL_8250=y
> -CONFIG_SERIAL_8250_CONSOLE=y
> -CONFIG_SERIAL_ICOM=m
> -CONFIG_SERIAL_JSM=m
> -CONFIG_HVC_CONSOLE=y
> -CONFIG_HVC_RTAS=y
> -CONFIG_HVCS=m
> -CONFIG_VIRTIO_CONSOLE=m
> -CONFIG_IBM_BSR=m
> -CONFIG_GEN_RTC=y
> -CONFIG_RAW_DRIVER=y
> -CONFIG_MAX_RAW_DEVS=1024
> -CONFIG_FB=y
> -CONFIG_FIRMWARE_EDID=y
> -CONFIG_FB_OF=y
> -CONFIG_FB_MATROX=y
> -CONFIG_FB_MATROX_MILLENIUM=y
> -CONFIG_FB_MATROX_MYSTIQUE=y
> -CONFIG_FB_MATROX_G=y
> -CONFIG_FB_RADEON=y
> -CONFIG_FB_IBM_GXT4500=y
> -CONFIG_LCD_PLATFORM=m
> -# CONFIG_VGA_CONSOLE is not set
> -CONFIG_FRAMEBUFFER_CONSOLE=y
> -CONFIG_LOGO=y
> -CONFIG_HID_GYRATION=y
> -CONFIG_HID_PANTHERLORD=y
> -CONFIG_HID_PETALYNX=y
> -CONFIG_HID_SAMSUNG=y
> -CONFIG_HID_SUNPLUS=y
> -CONFIG_USB_HIDDEV=y
> -CONFIG_USB=y
> -CONFIG_USB_MON=m
> -CONFIG_USB_EHCI_HCD=y
> -# CONFIG_USB_EHCI_HCD_PPC_OF is not set
> -CONFIG_USB_OHCI_HCD=y
> -CONFIG_USB_STORAGE=m
> -CONFIG_INFINIBAND=m
> -CONFIG_INFINIBAND_USER_MAD=m
> -CONFIG_INFINIBAND_USER_ACCESS=m
> -CONFIG_INFINIBAND_MTHCA=m
> -CONFIG_INFINIBAND_EHCA=m
> -CONFIG_INFINIBAND_CXGB3=m
> -CONFIG_INFINIBAND_CXGB4=m
> -CONFIG_MLX4_INFINIBAND=m
> -CONFIG_INFINIBAND_IPOIB=m
> -CONFIG_INFINIBAND_IPOIB_CM=y
> -CONFIG_INFINIBAND_SRP=m
> -CONFIG_INFINIBAND_ISER=m
> -CONFIG_VIRTIO_PCI=m
> -CONFIG_VIRTIO_BALLOON=m
> -CONFIG_EXT2_FS=y
> -CONFIG_EXT2_FS_XATTR=y
> -CONFIG_EXT2_FS_POSIX_ACL=y
> -CONFIG_EXT2_FS_SECURITY=y
> -CONFIG_EXT2_FS_XIP=y
> -CONFIG_EXT3_FS=y
> -CONFIG_EXT3_FS_POSIX_ACL=y
> -CONFIG_EXT3_FS_SECURITY=y
> -CONFIG_EXT4_FS=y
> -CONFIG_EXT4_FS_POSIX_ACL=y
> -CONFIG_EXT4_FS_SECURITY=y
> -CONFIG_REISERFS_FS=y
> -CONFIG_REISERFS_FS_XATTR=y
> -CONFIG_REISERFS_FS_POSIX_ACL=y
> -CONFIG_REISERFS_FS_SECURITY=y
> -CONFIG_JFS_FS=m
> -CONFIG_JFS_POSIX_ACL=y
> -CONFIG_JFS_SECURITY=y
> -CONFIG_XFS_FS=m
> -CONFIG_XFS_POSIX_ACL=y
> -CONFIG_BTRFS_FS=m
> -CONFIG_BTRFS_FS_POSIX_ACL=y
> -CONFIG_NILFS2_FS=m
> -CONFIG_AUTOFS4_FS=m
> -CONFIG_FUSE_FS=m
> -CONFIG_OVERLAY_FS=m
> -CONFIG_ISO9660_FS=y
> -CONFIG_UDF_FS=m
> -CONFIG_MSDOS_FS=y
> -CONFIG_VFAT_FS=y
> -CONFIG_PROC_KCORE=y
> -CONFIG_TMPFS=y
> -CONFIG_TMPFS_POSIX_ACL=y
> -CONFIG_HUGETLBFS=y
> -CONFIG_CRAMFS=m
> -CONFIG_SQUASHFS=m
> -CONFIG_SQUASHFS_XATTR=y
> -CONFIG_SQUASHFS_LZO=y
> -CONFIG_SQUASHFS_XZ=y
> -CONFIG_PSTORE=y
> -CONFIG_NFS_FS=y
> -CONFIG_NFS_V3_ACL=y
> -CONFIG_NFS_V4=y
> -CONFIG_NFSD=m
> -CONFIG_NFSD_V3_ACL=y
> -CONFIG_NFSD_V4=y
> -CONFIG_CIFS=m
> -CONFIG_CIFS_XATTR=y
> -CONFIG_CIFS_POSIX=y
> -CONFIG_NLS_DEFAULT="utf8"
> -CONFIG_NLS_CODEPAGE_437=y
> -CONFIG_NLS_ASCII=y
> -CONFIG_NLS_ISO8859_1=y
> -CONFIG_NLS_UTF8=y
> -CONFIG_MAGIC_SYSRQ=y
> -CONFIG_DEBUG_KERNEL=y
> -CONFIG_DEBUG_STACK_USAGE=y
> -CONFIG_DEBUG_STACKOVERFLOW=y
> -CONFIG_LOCKUP_DETECTOR=y
> -CONFIG_LATENCYTOP=y
> -CONFIG_SCHED_TRACER=y
> -CONFIG_BLK_DEV_IO_TRACE=y
> -CONFIG_CODE_PATCHING_SELFTEST=y
> -CONFIG_FTR_FIXUP_SELFTEST=y
> -CONFIG_MSI_BITMAP_SELFTEST=y
> -CONFIG_XMON=y
> -CONFIG_CRYPTO_TEST=m
> -CONFIG_CRYPTO_PCBC=m
> -CONFIG_CRYPTO_HMAC=y
> -CONFIG_CRYPTO_MICHAEL_MIC=m
> -CONFIG_CRYPTO_TGR192=m
> -CONFIG_CRYPTO_WP512=m
> -CONFIG_CRYPTO_ANUBIS=m
> -CONFIG_CRYPTO_BLOWFISH=m
> -CONFIG_CRYPTO_CAST6=m
> -CONFIG_CRYPTO_KHAZAD=m
> -CONFIG_CRYPTO_SALSA20=m
> -CONFIG_CRYPTO_SERPENT=m
> -CONFIG_CRYPTO_TEA=m
> -CONFIG_CRYPTO_TWOFISH=m
> -CONFIG_CRYPTO_LZO=m
> -# CONFIG_CRYPTO_ANSI_CPRNG is not set
> -CONFIG_VIRTUALIZATION=y
> -CONFIG_KVM_BOOK3S_64=m
> -CONFIG_KVM_BOOK3S_64_HV=m
> 

-- 
-----------
LTC Ozlabs
IBM