From c0c24d29dffae4bcd05cea71950a4e7748cb9974 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Wed, 15 Apr 2020 11:31:42 +0800 Subject: [PATCH] boards/Board.mk: use genromfs to make romfs image Change-Id: I77e8af6daf57f3b71abdc918ec7159520cae00bd Signed-off-by: chao.an --- boards/Board.mk | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/boards/Board.mk b/boards/Board.mk index 63a8b225d5..586d9b2a5a 100644 --- a/boards/Board.mk +++ b/boards/Board.mk @@ -37,6 +37,27 @@ -include $(TOPDIR)/Make.defs +ifneq ($(RCSRCS)$(RCRAWS),) +ETCDIR := etctmp +ETCSRC := $(ETCDIR:%=%.c) + +CSRCS += $(ETCSRC) + +RCOBJS = $(RCSRCS:%=$(ETCDIR)$(DELIM)%) + +$(RCOBJS): $(ETCDIR)$(DELIM)%: % + $(Q) mkdir -p $(dir $@) + $(call PREPROCESS, $<, $@) + +$(ETCSRC): $(RCRAWS) $(RCOBJS) + $(foreach raw, $(RCRAWS), \ + $(shell mkdir -p $(dir $(ETCDIR)$(DELIM)$(raw))) \ + $(shell cp -rfp $(raw) $(ETCDIR)$(DELIM)$(raw))) + $(Q) genromfs -f romfs.img -d $(ETCDIR)$(DELIM)$(CONFIG_NSH_ROMFSMOUNTPT) -V "$(basename $<)" + $(Q) xxd -i romfs.img | sed -e "s/^unsigned/const unsigned/g" > $@ + $(Q) rm romfs.img +endif + ifneq ($(ZDSVERSION),) AOBJS = $(ASRCS:.S=$(OBJEXT)) else @@ -119,7 +140,7 @@ ifneq ($(CXXOBJS),) $(call ARCHIVE, $@, $(CXXOBJS)) endif -.depend: Makefile $(SRCS) $(CXXSRCS) +.depend: Makefile $(SRCS) $(CXXSRCS) $(RCSRCS) ifneq ($(ZDSVERSION),) $(Q) $(MKDEP) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep else @@ -127,6 +148,9 @@ else endif ifneq ($(CXXSRCS),) $(Q) $(MKDEP) $(DEPPATH) "$(CXX)" -- $(CXXFLAGS) -- $(CXXSRCS) >>Make.dep +endif +ifneq ($(RCSRCS),) + $(Q) $(MKDEP) $(DEPPATH) "$(CPP)" --obj-path . -- $(CPPFLAGS) -- $(RCSRCS) >>Make.dep endif $(Q) touch $@ @@ -138,6 +162,8 @@ endif clean: $(call DELFILE, libboard$(LIBEXT)) + $(call DELFILE, $(ETCSRC)) + $(call DELDIR, $(ETCDIR)) $(call CLEAN) $(EXTRA_CLEAN)