-LINUX_CONFCMD=$(if $(LINUX_CONFIG),$(SCRIPT_DIR)/kconfig.pl + $(GENERIC_LINUX_CONFIG) $(if $(LINUX_SUBCONFIG),+ $(LINUX_CONFIG) $(LINUX_SUBCONFIG),$(LINUX_CONFIG)),true)
+
+# select the config file to be cahnged by kernel_menuconfig/kernel_oldconfig
+ifeq ($(CONFIG_TARGET),platform)
+ LINUX_RECONFIG_LIST := $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_TARGET_CONFIG))
+ LINUX_RECONFIG_TARGET := $(LINUX_TARGET_CONFIG)
+endif
+ifeq ($(CONFIG_TARGET),subtarget)
+ ifeq ($(wildcard $(LINUX_SUBTARGET_CONFIG)),)
+ $(error Subtarget not available, cannot reconfigure)
+ else
+ LINUX_RECONFIG_LIST := $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_TARGET_CONFIG) $(LINUX_SUBTARGET_CONFIG))
+ LINUX_RECONFIG_TARGET := $(LINUX_SUBTARGET_CONFIG)
+ endif
+endif
+ifeq ($(CONFIG_TARGET),env)
+ LINUX_RECONFIG_LIST := $(LINUX_KCONFIG_LIST)
+ LINUX_RECONFIG_TARGET := $(TOPDIR)/env/kernel-config
+endif
+
+__linux_confcmd = $(SCRIPT_DIR)/kconfig.pl $(2) $(patsubst %,+,$(wordlist 2,9999,$(1))) $(1)
+
+LINUX_CONF_CMD = $(call __linux_confcmd,$(LINUX_KCONFIG_LIST),)
+LINUX_RECONF_CMD = $(call __linux_confcmd,$(LINUX_RECONFIG_LIST),)
+LINUX_RECONF_DIFF = $(call __linux_confcmd,$(filter-out $(LINUX_RECONFIG_TARGET),$(LINUX_RECONFIG_LIST)),'>')