diff options
author | px4dev <px4@purgatory.org> | 2013-01-16 23:40:40 -0800 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2013-02-23 22:00:59 -0800 |
commit | a7a1cc4625ea4097761a9aef88f9f0b4608944a4 (patch) | |
tree | 485d956b313182e5c768682ffe76d91c86e330e1 /makefiles | |
parent | 963621c1f34ce3ed7fd43c9943a0841404431d89 (diff) | |
download | px4-firmware-a7a1cc4625ea4097761a9aef88f9f0b4608944a4.tar.gz px4-firmware-a7a1cc4625ea4097761a9aef88f9f0b4608944a4.tar.bz2 px4-firmware-a7a1cc4625ea4097761a9aef88f9f0b4608944a4.zip |
Add support for per-config ROMFS generation.
Diffstat (limited to 'makefiles')
-rw-r--r-- | makefiles/config_px4fmu_default.mk | 1 | ||||
-rw-r--r-- | makefiles/firmware.mk | 58 | ||||
-rw-r--r-- | makefiles/upload.mk | 2 |
3 files changed, 59 insertions, 2 deletions
diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 45b1170ff..e0c1aff9d 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -4,5 +4,6 @@ CONFIG = px4fmu_default SRCS = $(PX4_BASE)/platforms/empty.c +ROMFS_ROOT = $(PX4_BASE)/ROMFS/$(CONFIG) include $(PX4_BASE)/makefiles/firmware.mk diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 338bda8d3..d64d39ea4 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -23,6 +23,11 @@ # to the directory 'build' under the directory containing the # parent Makefile. # +# ROMFS_ROOT: +# If set to the path to a directory, a ROMFS image will be generated +# containing the files under the directory and linked into the final +# image. +# ################################################################################ # Paths and configuration @@ -71,6 +76,7 @@ MKFW = $(PX4_BASE)/Tools/px_mkfw.py COPY = cp REMOVE = rm -f RMDIR = rm -rf +GENROMFS = genromfs # # Sanity-check the PLATFORM variable and then get the platform config. @@ -135,6 +141,29 @@ LIBS += -lapps -lnuttx LINK_DEPS += $(wildcard $(addsuffix /*.a,$(LIB_DIRS))) ################################################################################ +# ROMFS generation +################################################################################ + +# +# Note that we can't just put romfs.c in SRCS, as it's depended on by the +# NuttX export library. Instead, we have to treat it like a library. +# +ifneq ($(ROMFS_ROOT),) +ROMFS_DEPS += $(wildcard \ + (ROMFS_ROOT)/* \ + (ROMFS_ROOT)/*/* \ + (ROMFS_ROOT)/*/*/* \ + (ROMFS_ROOT)/*/*/*/* \ + (ROMFS_ROOT)/*/*/*/*/* \ + (ROMFS_ROOT)/*/*/*/*/*/*) +ROMFS_IMG = $(WORK_DIR)/romfs.img +ROMFS_CSRC = $(ROMFS_IMG:.img=.c) +ROMFS_OBJ = $(ROMFS_CSRC:.c=.o) +LIBS += $(ROMFS_OBJ) +LINK_DEPS += $(ROMFS_OBJ) +endif + +################################################################################ # Build rules ################################################################################ @@ -159,7 +188,7 @@ all: $(PRODUCT_BUNDLE) OBJS = $(foreach src,$(SRCS),$(WORK_DIR)/$(src).o) # -# Rules +# SRCS -> OBJS rules # $(filter %.c.o,$(OBJS)): $(WORK_DIR)/%.c.o: %.c $(GLOBAL_DEPS) @@ -174,11 +203,19 @@ $(filter %.S.o,$(OBJS)): $(WORK_DIR)/%.S.o: %.S $(GLOBAL_DEPS) @mkdir -p $(dir $@) $(call ASSEMBLE,$<,$@) +# +# Build directory setup rules +# + $(NUTTX_CONFIG_HEADER): $(NUTTX_ARCHIVE) @echo %% Unpacking $(NUTTX_ARCHIVE) $(Q) unzip -q -o -d $(WORK_DIR) $(NUTTX_ARCHIVE) $(Q) touch $@ +# +# Built product rules +# + $(PRODUCT_BUNDLE): $(PRODUCT_BIN) @echo %% Generating $@ $(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(PLATFORM).prototype \ @@ -191,6 +228,25 @@ $(PRODUCT_BIN): $(PRODUCT_SYM) $(PRODUCT_SYM): $(OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) $(call LINK,$@,$(OBJS)) +# +# ROMFS rules +# + +$(ROMFS_OBJ): $(ROMFS_CSRC) + $(call COMPILE,$<,$@) + +$(ROMFS_CSRC): $(ROMFS_IMG) + @echo %% generating $@ + $(Q) (cd $(dir $<) && xxd -i $(notdir $<)) > $@ + +$(ROMFS_IMG): $(ROMFS_DEPS) + @echo %% generating $@ + $(Q) $(GENROMFS) -f $@ -d $(ROMFS_ROOT) -V "NSHInitVol" + +# +# Utility rules +# + upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN) $(Q) make -f $(PX4_MK_INCLUDE)/upload.mk \ METHOD=serial \ diff --git a/makefiles/upload.mk b/makefiles/upload.mk index 15e0e240a..5308aaa3e 100644 --- a/makefiles/upload.mk +++ b/makefiles/upload.mk @@ -1,5 +1,5 @@ # -# Rules and tools for uploading firmware. +# Rules and tools for uploading firmware to various PX4 boards. # UPLOADER = $(PX4_BASE)/Tools/px_uploader.py |