Commit 5e15fcfc authored by Xie XiuQi's avatar Xie XiuQi Committed by Jialin Zhang
Browse files

kconfig: Add script to check & update openeuler_defconfig

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8JANU

Reference: https://gitee.com/openeuler/kernel/pulls/286



-----------------------------------------

If new options are introduced, but openeuler_defconfig is not explicitly
configured, the actual compiled version may be configured according to
the default settings, which may be different from the author's expectation.
Therefore, some commands/scripts are added to help developers to check and
update the defconfig. It is also convenient for continuous integration tools to
check the consistency of defconfig.

```
Usage:
  make check_oedefconfig
  #
  # New options might needs to be updated to the default configuration
  # file. Use the following command:
  # 'make openeuler_defconfig/menuconfig/update_oedefconfig/save_oedefconfig'
  # !!! DO NOT EDIT !!!
  #
  # defconfig: arch/arm64/configs/openeuler_defconfig
  #
  CONFIG_MEMCG=n
  CONFIG_BLK_CGROUP=n
  CONFIG_CFS_BANDWIDTH=n
  CONFIG_RT_GROUP_SCHED=n
  CONFIG_CGROUP_PIDS=n
  CONFIG_CGROUP_RDMA=n
  CONFIG_CGROUP_FREEZER=n
  CONFIG_CGROUP_HUGETLB=n
  CONFIG_CPUSETS=n

  make update_oedefconfig
  # Update openeuler_defconfig base on current source code

  make save_oedefconfig
  # Save current .config to openeuler_defconfig'
```

If someone adds a new Kconfig, he should also explicitly update
openeuler_defconfig, whether it's enabled or disabled.

Again, do *NOT* edit openeuler_defconfig directly.

Signed-off-by: default avatarLiu Chao <liuchao173@huawei.com>
Cc: Jason Zeng <jason.zeng@intel.com>
Signed-off-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>

 Conflicts:
	scripts/kconfig/Makefile

Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parent 90b6f5ae
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -75,6 +75,25 @@ PHONY += savedefconfig defconfig
savedefconfig: $(obj)/conf
	$(Q)$< $(silent) --$@=defconfig $(Kconfig)

update_oedefconfig: $(obj)/conf
	$(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/openeuler_defconfig $(Kconfig)
	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/makeconfig.sh $(SRCARCH)

save_oedefconfig: $(obj)/conf
	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/makeconfig.sh $(SRCARCH)

check_oedefconfig: $(obj)/conf
	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m arch/$(SRCARCH)/configs/openeuler_defconfig > /dev/null
	@$(kecho) "#"
	@$(kecho) "# New options might needs to be updated to the default configuration file."
	@$(kecho) "# Use the following command:"
	@$(kecho) "# 'make openeuler_defconfig/menuconfig/update_oedefconfig/save_oedefconfig'"
	@$(kecho) "# !!! DO NOT EDIT !!!"
	@$(kecho) "#"
	@$(kecho) "# defconfig: arch/$(SRCARCH)/configs/openeuler_defconfig"
	@$(kecho) "#"
	$(Q)$(MAKE) -f $(srctree)/Makefile listnewconfig

defconfig: $(obj)/conf
ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
	@$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
@@ -143,6 +162,9 @@ help:
	@echo  '                    default value without prompting'
	@echo  '  tinyconfig	  - Configure the tiniest possible kernel'
	@echo  '  testconfig	  - Run Kconfig unit tests (requires python3 and pytest)'
	@echo  '  update_oedefconfig  - Update arch/<ARCH>/configs/openeuler_defconfig base on current source code'
	@echo  '  save_oedefconfig    - Save current .config to arch/<ARCH>/configs/openeuler_defconfig'
	@echo  '  check_oedefconfig   - Check whether new options need to be added to the defdefault file'

# ===========================================================================
# object files used by all kconfig flavours
+24 −0
Original line number Diff line number Diff line
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0

if [ ! -f .config ]; then
	echo ".config does not exist"
	exit 1
fi

sed -e '/CONFIG_CC_VERSION_TEXT/d' \
    -e '/CONFIG_CC_IS_GCC/d' \
    -e '/CONFIG_GCC_VERSION/d' \
    -e '/CONFIG_LD_VERSION/d' \
    -e '/CONFIG_LD_IS/d' \
    -e '/CONFIG_CLANG_VERSION/d' \
    -e '/CONFIG_LLD_VERSION/d' \
    -e '/CONFIG_CC_CAN/d' \
    -e '/CONFIG_CC_HAS/d' \
    -e '/CONFIG_AS_VERSION/d' \
    -e '/CONFIG_AS_HAS/d' \
    -e '/CONFIG_AS_IS/d' \
    -e '/CONFIG_PAHOLE_VERSION/d' \
    -i .config

cp .config arch/$1/configs/openeuler_defconfig