diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index af1c96198f4919c1af966e5fc06dcddb7c405fef..b498d8b7f82e4bafad18267b555a9857c21ad851 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -81,6 +81,26 @@ 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)'" @@ -141,6 +161,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//configs/openeuler_defconfig base on current source code' + @echo ' save_oedefconfig - Save current .config to 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 diff --git a/scripts/kconfig/makeconfig.sh b/scripts/kconfig/makeconfig.sh new file mode 100644 index 0000000000000000000000000000000000000000..c54f4d84ae9b7a428e4656d9200b65d2ae3d4dbc --- /dev/null +++ b/scripts/kconfig/makeconfig.sh @@ -0,0 +1,24 @@ +#!/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