aboutsummaryrefslogtreecommitdiff
path: root/makefiles/firmware.mk
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-08-22 23:47:55 -0700
committerpx4dev <px4@purgatory.org>2013-08-22 23:47:55 -0700
commitf70a4b3b7045a24baf70e642e9a354a13e5fa7d1 (patch)
treeb80b324bf82e1c12872679c3a764aa59bca2c35f /makefiles/firmware.mk
parent11257cbade5d89d3d2de8101daec11d32f7f74ce (diff)
downloadpx4-firmware-f70a4b3b7045a24baf70e642e9a354a13e5fa7d1.tar.gz
px4-firmware-f70a4b3b7045a24baf70e642e9a354a13e5fa7d1.tar.bz2
px4-firmware-f70a4b3b7045a24baf70e642e9a354a13e5fa7d1.zip
Add support for adding extra files to the ROMFS from the config.
If there is an IO firmware image already built when we build the corresponding FMU ROMFS, copy it into the ROMFS. Note - due to there being no fixed build ordering, to be certain that you have the most current IO firmware, you must build the IO firmware explicitly first.
Diffstat (limited to 'makefiles/firmware.mk')
-rw-r--r--makefiles/firmware.mk22
1 files changed, 19 insertions, 3 deletions
diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk
index 8a027a0a8..b3e50501c 100644
--- a/makefiles/firmware.mk
+++ b/makefiles/firmware.mk
@@ -322,7 +322,7 @@ endif
# a root from several templates. That would be a nice feature.
#
-# Add dependencies on anything in the ROMFS root
+# Add dependencies on anything in the ROMFS root directory
ROMFS_FILES += $(wildcard \
$(ROMFS_ROOT)/* \
$(ROMFS_ROOT)/*/* \
@@ -334,7 +334,14 @@ ifeq ($(ROMFS_FILES),)
$(error ROMFS_ROOT $(ROMFS_ROOT) specifies a directory containing no files)
endif
ROMFS_DEPS += $(ROMFS_FILES)
+
+# Extra files that may be copied into the ROMFS /extras directory
+# ROMFS_EXTRA_FILES are required, ROMFS_OPTIONAL_FILES are optional
+ROMFS_EXTRA_FILES += $(wildcard $(ROMFS_OPTIONAL_FILES))
+ROMFS_DEPS += $(ROMFS_EXTRA_FILES)
+
ROMFS_IMG = romfs.img
+ROMFS_SCRATCH = romfs_scratch
ROMFS_CSRC = $(ROMFS_IMG:.img=.c)
ROMFS_OBJ = $(ROMFS_CSRC:.c=.o)
LIBS += $(ROMFS_OBJ)
@@ -345,9 +352,18 @@ $(ROMFS_OBJ): $(ROMFS_IMG) $(GLOBAL_DEPS)
$(call BIN_TO_OBJ,$<,$@,romfs_img)
# Generate the ROMFS image from the root
-$(ROMFS_IMG): $(ROMFS_DEPS) $(GLOBAL_DEPS)
+$(ROMFS_IMG): $(ROMFS_SCRATCH) $(ROMFS_DEPS) $(GLOBAL_DEPS)
@$(ECHO) "ROMFS: $@"
- $(Q) $(GENROMFS) -f $@ -d $(ROMFS_ROOT) -V "NSHInitVol"
+ $(Q) $(GENROMFS) -f $@ -d $(ROMFS_SCRATCH) -V "NSHInitVol"
+
+# Construct the ROMFS scratch root from the canonical root
+$(ROMFS_SCRATCH): $(ROMFS_DEPS) $(GLOBAL_DEPS)
+ $(Q) $(MKDIR) -p $(ROMFS_SCRATCH)
+ $(Q) $(COPYDIR) $(ROMFS_ROOT)/* $(ROMFS_SCRATCH)
+ifneq ($(ROMFS_EXTRA_FILES),)
+ $(Q) $(MKDIR) -p $(ROMFS_SCRATCH)/extras
+ $(Q) $(COPY) $(ROMFS_EXTRA_FILES) $(ROMFS_SCRATCH)/extras
+endif
EXTRA_CLEANS += $(ROMGS_OBJ) $(ROMFS_IMG)