From fd9c9a7f4f73dc77c700edf9a70a8bba5704eba4 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 29 Jun 2016 11:53:00 -0600 Subject: [PATCH] Add logic to support custom board directories that include a Kconfig file. During the context phase of the build, any Kconfig file in the custom board directory is copied into configs/dummy, replacing the existing Kconfig file with the target Kconfig file. --- Directories.mk | 2 +- Makefile.unix | 1 + configs/Kconfig | 3 +++ configs/Makefile | 35 +++++++++++++++++++++++++++++++++-- configs/dummy/.gitignore | 2 ++ configs/dummy/dummy_kconfig | 5 +++++ 6 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 configs/dummy/.gitignore create mode 100644 configs/dummy/dummy_kconfig diff --git a/Directories.mk b/Directories.mk index 2e42a8a435..d627c67706 100644 --- a/Directories.mk +++ b/Directories.mk @@ -74,7 +74,7 @@ endif NONFSDIRS = sched drivers configs $(ARCH_SRC) $(NUTTX_ADDONS) FSDIRS = fs binfmt -CONTEXTDIRS = $(APPDIR) +CONTEXTDIRS = configs $(APPDIR) USERDIRS = OTHERDIRS = lib diff --git a/Makefile.unix b/Makefile.unix index a411eda177..6c0c46b38c 100644 --- a/Makefile.unix +++ b/Makefile.unix @@ -344,6 +344,7 @@ context: check_context include/nuttx/config.h include/nuttx/version.h include/ma # and symbolic links created by the context target. clean_context: + $(Q) $(MAKE) -C configs TOPDIR="$(TOPDIR)" clean_context $(call DELFILE, include/nuttx/config.h) $(call DELFILE, include/nuttx/version.h) $(call DELFILE, include/math.h) diff --git a/configs/Kconfig b/configs/Kconfig index 6c0cec2ba7..778fa220d5 100644 --- a/configs/Kconfig +++ b/configs/Kconfig @@ -1859,6 +1859,9 @@ endif if ARCH_BOARD_SIM source "configs/sim/Kconfig" endif +if ARCH_BOARD_CUSTOM +source "configs/dummy/Kconfig" +endif config BOARD_CRASHDUMP bool "Enable Board level logging of crash dumps" diff --git a/configs/Makefile b/configs/Makefile index 496601da0b..f2adff3e5e 100644 --- a/configs/Makefile +++ b/configs/Makefile @@ -35,6 +35,28 @@ -include $(TOPDIR)/Make.defs +# Determine there is a Kconfig file for the any custom board configuration + +ifeq ($(CONFIG_ARCH_BOARD_CUSTOM),y) + CUSTOM_DIR = $(patsubst "%",%,$(CONFIG_ARCH_BOARD_CUSTOM_DIR)) + ifeq ($(CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH),y) + CUSTOM_KPATH = $(TOPDIR)$(DELIM)$(CUSTOM_DIR)$(DELIM)Kconfig + else + CUSTOM_KPATH = $(CUSTOM_DIR)$(DELIM)Kconfig + endif + CUSTOM_KCONFIG = $(if $(wildcard $(CUSTOM_KPATH)),y,) +else + CUSTOM_KCONFIG = +endif + +ifeq ($(CUSTOM_KCONFIG),y) + BOARD_KCONFIG = $(CUSTOM_KPATH) +else + BOARD_KCONFIG = $(TOPDIR)$(DELIM)configs$(DELIM)dummy$(DELIM)dummy_kconfig +endif + +DUMMY_KCONFIG = $(TOPDIR)$(DELIM)configs$(DELIM)dummy$(DELIM)Kconfig + # Basic CONFIG_ASRCS = @@ -58,7 +80,7 @@ OBJS = $(AOBJS) $(COBJS) BIN = libconfigs$(LIBEXT) all: $(BIN) -.PHONY: depend clean distclean +.PHONY: depend ccontext clean_context clean distclean $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -77,7 +99,16 @@ endif depend: .depend -clean: +$(DUMMY_KCONFIG): $(BOARD_KCONFIG) + $(call DELFILE, $(DUMMY_KCONFIG)) + $(Q) cp -f $(BOARD_KCONFIG) $(DUMMY_KCONFIG) + +context: $(DUMMY_KCONFIG) + +clean_context: + $(call DELFILE, $(DUMMY_KCONFIG)) + +clean: clean_context $(call DELFILE, $(BIN)) $(call CLEAN) diff --git a/configs/dummy/.gitignore b/configs/dummy/.gitignore new file mode 100644 index 0000000000..99f41601fd --- /dev/null +++ b/configs/dummy/.gitignore @@ -0,0 +1,2 @@ +/Kconfig + diff --git a/configs/dummy/dummy_kconfig b/configs/dummy/dummy_kconfig new file mode 100644 index 0000000000..18c7905aed --- /dev/null +++ b/configs/dummy/dummy_kconfig @@ -0,0 +1,5 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# +