forked from Archive/PX4-Autopilot
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.
This commit is contained in:
parent
11257cbade
commit
f70a4b3b70
26
Makefile
26
Makefile
|
@ -114,8 +114,8 @@ $(FIRMWARES): $(BUILD_DIR)%.build/firmware.px4:
|
||||||
@$(ECHO) %%%%
|
@$(ECHO) %%%%
|
||||||
@$(ECHO) %%%% Building $(config) in $(work_dir)
|
@$(ECHO) %%%% Building $(config) in $(work_dir)
|
||||||
@$(ECHO) %%%%
|
@$(ECHO) %%%%
|
||||||
$(Q) mkdir -p $(work_dir)
|
$(Q) $(MKDIR) -p $(work_dir)
|
||||||
$(Q) make -r -C $(work_dir) \
|
$(Q) $(MAKE) -r -C $(work_dir) \
|
||||||
-f $(PX4_MK_DIR)firmware.mk \
|
-f $(PX4_MK_DIR)firmware.mk \
|
||||||
CONFIG=$(config) \
|
CONFIG=$(config) \
|
||||||
WORK_DIR=$(work_dir) \
|
WORK_DIR=$(work_dir) \
|
||||||
|
@ -147,12 +147,12 @@ $(ARCHIVE_DIR)%.export: configuration = nsh
|
||||||
$(NUTTX_ARCHIVES): $(ARCHIVE_DIR)%.export: $(NUTTX_SRC)
|
$(NUTTX_ARCHIVES): $(ARCHIVE_DIR)%.export: $(NUTTX_SRC)
|
||||||
@$(ECHO) %% Configuring NuttX for $(board)
|
@$(ECHO) %% Configuring NuttX for $(board)
|
||||||
$(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export)
|
$(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export)
|
||||||
$(Q) make -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) distclean
|
$(Q) $(MAKE) -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) distclean
|
||||||
$(Q) (cd $(NUTTX_SRC)/configs && $(COPYDIR) $(PX4_BASE)nuttx-configs/$(board) .)
|
$(Q) (cd $(NUTTX_SRC)/configs && $(COPYDIR) $(PX4_BASE)nuttx-configs/$(board) .)
|
||||||
$(Q) (cd $(NUTTX_SRC)tools && ./configure.sh $(board)/$(configuration))
|
$(Q) (cd $(NUTTX_SRC)tools && ./configure.sh $(board)/$(configuration))
|
||||||
@$(ECHO) %% Exporting NuttX for $(board)
|
@$(ECHO) %% Exporting NuttX for $(board)
|
||||||
$(Q) make -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) CONFIG_ARCH_BOARD=$(board) export
|
$(Q) $(MAKE) -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) CONFIG_ARCH_BOARD=$(board) export
|
||||||
$(Q) mkdir -p $(dir $@)
|
$(Q) $(MKDIR) -p $(dir $@)
|
||||||
$(Q) $(COPY) $(NUTTX_SRC)nuttx-export.zip $@
|
$(Q) $(COPY) $(NUTTX_SRC)nuttx-export.zip $@
|
||||||
$(Q) (cd $(NUTTX_SRC)/configs && $(RMDIR) $(board))
|
$(Q) (cd $(NUTTX_SRC)/configs && $(RMDIR) $(board))
|
||||||
|
|
||||||
|
@ -168,11 +168,11 @@ BOARD = $(BOARDS)
|
||||||
menuconfig: $(NUTTX_SRC)
|
menuconfig: $(NUTTX_SRC)
|
||||||
@$(ECHO) %% Configuring NuttX for $(BOARD)
|
@$(ECHO) %% Configuring NuttX for $(BOARD)
|
||||||
$(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export)
|
$(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export)
|
||||||
$(Q) make -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) distclean
|
$(Q) $(MAKE) -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) distclean
|
||||||
$(Q) (cd $(NUTTX_SRC)/configs && $(COPYDIR) $(PX4_BASE)nuttx-configs/$(BOARD) .)
|
$(Q) (cd $(NUTTX_SRC)/configs && $(COPYDIR) $(PX4_BASE)nuttx-configs/$(BOARD) .)
|
||||||
$(Q) (cd $(NUTTX_SRC)tools && ./configure.sh $(BOARD)/nsh)
|
$(Q) (cd $(NUTTX_SRC)tools && ./configure.sh $(BOARD)/nsh)
|
||||||
@$(ECHO) %% Running menuconfig for $(BOARD)
|
@$(ECHO) %% Running menuconfig for $(BOARD)
|
||||||
$(Q) make -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) menuconfig
|
$(Q) $(MAKE) -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) menuconfig
|
||||||
@$(ECHO) %% Saving configuration file
|
@$(ECHO) %% Saving configuration file
|
||||||
$(Q)$(COPY) $(NUTTX_SRC).config $(PX4_BASE)nuttx-configs/$(BOARD)/nsh/defconfig
|
$(Q)$(COPY) $(NUTTX_SRC).config $(PX4_BASE)nuttx-configs/$(BOARD)/nsh/defconfig
|
||||||
else
|
else
|
||||||
|
@ -191,7 +191,7 @@ $(NUTTX_SRC):
|
||||||
# Testing targets
|
# Testing targets
|
||||||
#
|
#
|
||||||
testbuild:
|
testbuild:
|
||||||
$(Q) (cd $(PX4_BASE) && make distclean && make archives && make -j8)
|
$(Q) (cd $(PX4_BASE) && $(MAKE) distclean && $(MAKE) archives && $(MAKE) -j8)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Cleanup targets. 'clean' should remove all built products and force
|
# Cleanup targets. 'clean' should remove all built products and force
|
||||||
|
@ -206,8 +206,8 @@ clean:
|
||||||
.PHONY: distclean
|
.PHONY: distclean
|
||||||
distclean: clean
|
distclean: clean
|
||||||
$(Q) $(REMOVE) $(ARCHIVE_DIR)*.export
|
$(Q) $(REMOVE) $(ARCHIVE_DIR)*.export
|
||||||
$(Q) make -C $(NUTTX_SRC) -r $(MQUIET) distclean
|
$(Q) $(MAKE) -C $(NUTTX_SRC) -r $(MQUIET) distclean
|
||||||
$(Q) (cd $(NUTTX_SRC)/configs && find . -maxdepth 1 -type l -delete)
|
$(Q) (cd $(NUTTX_SRC)/configs && $(FIND) . -maxdepth 1 -type l -delete)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Print some help text
|
# Print some help text
|
||||||
|
@ -229,9 +229,9 @@ help:
|
||||||
@$(ECHO) " A limited set of configs can be built with CONFIGS=<list-of-configs>"
|
@$(ECHO) " A limited set of configs can be built with CONFIGS=<list-of-configs>"
|
||||||
@$(ECHO) ""
|
@$(ECHO) ""
|
||||||
@for config in $(CONFIGS); do \
|
@for config in $(CONFIGS); do \
|
||||||
echo " $$config"; \
|
$(ECHO) " $$config"; \
|
||||||
echo " Build just the $$config firmware configuration."; \
|
$(ECHO) " Build just the $$config firmware configuration."; \
|
||||||
echo ""; \
|
$(ECHO) ""; \
|
||||||
done
|
done
|
||||||
@$(ECHO) " clean"
|
@$(ECHO) " clean"
|
||||||
@$(ECHO) " Remove all firmware build pieces."
|
@$(ECHO) " Remove all firmware build pieces."
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
# Use the configuration's ROMFS.
|
# Use the configuration's ROMFS.
|
||||||
#
|
#
|
||||||
ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common
|
ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common
|
||||||
|
ROMFS_OPTIONAL_FILES = $(PX4_BASE)/Images/px4io-v1_default.bin
|
||||||
|
|
||||||
#
|
#
|
||||||
# Board support modules
|
# Board support modules
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
#
|
#
|
||||||
# Use the configuration's ROMFS.
|
# Use the configuration's ROMFS, copy the px4iov2 firmware into
|
||||||
|
# the ROMFS if it's available
|
||||||
#
|
#
|
||||||
ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common
|
ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common
|
||||||
|
ROMFS_OPTIONAL_FILES = $(PX4_BASE)/Images/px4io-v2_default.bin
|
||||||
|
|
||||||
#
|
#
|
||||||
# Board support modules
|
# Board support modules
|
||||||
|
|
|
@ -322,7 +322,7 @@ endif
|
||||||
# a root from several templates. That would be a nice feature.
|
# 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_FILES += $(wildcard \
|
||||||
$(ROMFS_ROOT)/* \
|
$(ROMFS_ROOT)/* \
|
||||||
$(ROMFS_ROOT)/*/* \
|
$(ROMFS_ROOT)/*/* \
|
||||||
|
@ -334,7 +334,14 @@ ifeq ($(ROMFS_FILES),)
|
||||||
$(error ROMFS_ROOT $(ROMFS_ROOT) specifies a directory containing no files)
|
$(error ROMFS_ROOT $(ROMFS_ROOT) specifies a directory containing no files)
|
||||||
endif
|
endif
|
||||||
ROMFS_DEPS += $(ROMFS_FILES)
|
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_IMG = romfs.img
|
||||||
|
ROMFS_SCRATCH = romfs_scratch
|
||||||
ROMFS_CSRC = $(ROMFS_IMG:.img=.c)
|
ROMFS_CSRC = $(ROMFS_IMG:.img=.c)
|
||||||
ROMFS_OBJ = $(ROMFS_CSRC:.c=.o)
|
ROMFS_OBJ = $(ROMFS_CSRC:.c=.o)
|
||||||
LIBS += $(ROMFS_OBJ)
|
LIBS += $(ROMFS_OBJ)
|
||||||
|
@ -345,9 +352,18 @@ $(ROMFS_OBJ): $(ROMFS_IMG) $(GLOBAL_DEPS)
|
||||||
$(call BIN_TO_OBJ,$<,$@,romfs_img)
|
$(call BIN_TO_OBJ,$<,$@,romfs_img)
|
||||||
|
|
||||||
# Generate the ROMFS image from the root
|
# Generate the ROMFS image from the root
|
||||||
$(ROMFS_IMG): $(ROMFS_DEPS) $(GLOBAL_DEPS)
|
$(ROMFS_IMG): $(ROMFS_SCRATCH) $(ROMFS_DEPS) $(GLOBAL_DEPS)
|
||||||
@$(ECHO) "ROMFS: $@"
|
@$(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)
|
EXTRA_CLEANS += $(ROMGS_OBJ) $(ROMFS_IMG)
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@ export RMDIR = rm -rf
|
||||||
export GENROMFS = genromfs
|
export GENROMFS = genromfs
|
||||||
export TOUCH = touch
|
export TOUCH = touch
|
||||||
export MKDIR = mkdir
|
export MKDIR = mkdir
|
||||||
|
export FIND = find
|
||||||
export ECHO = echo
|
export ECHO = echo
|
||||||
export UNZIP_CMD = unzip
|
export UNZIP_CMD = unzip
|
||||||
export PYTHON = python
|
export PYTHON = python
|
||||||
|
|
Loading…
Reference in New Issue