2012-08-04 19:12:36 -03:00
|
|
|
#
|
|
|
|
# Makefile to generate a PX4FMU ROMFS image.
|
|
|
|
#
|
|
|
|
# In normal use, 'make install' will generate a new ROMFS header and place it
|
|
|
|
# into the px4fmu configuration in the appropriate location.
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Directories of interest
|
|
|
|
#
|
|
|
|
SRCROOT ?= $(dir $(lastword $(MAKEFILE_LIST)))
|
|
|
|
BUILDROOT ?= $(SRCROOT)/img
|
|
|
|
ROMFS_HEADER ?= $(SRCROOT)/../nuttx/configs/px4fmu/include/nsh_romfsimg.h
|
|
|
|
|
|
|
|
#
|
|
|
|
# List of files to install in the ROMFS, specified as <source>~<destination>
|
|
|
|
#
|
|
|
|
ROMFS_FSSPEC := $(SRCROOT)/scripts/rcS~init.d/rcS \
|
|
|
|
$(SRCROOT)/scripts/rc.sensors~init.d/rc.sensors \
|
|
|
|
$(SRCROOT)/scripts/rc.logging~init.d/rc.logging \
|
|
|
|
$(SRCROOT)/scripts/rc.standalone~init.d/rc.standalone \
|
|
|
|
$(SRCROOT)/scripts/rc.PX4IO~init.d/rc.PX4IO \
|
2012-08-05 20:30:28 -03:00
|
|
|
$(SRCROOT)/scripts/rc.PX4IOAR~init.d/rc.PX4IOAR \
|
2012-09-10 06:26:14 -03:00
|
|
|
$(SRCROOT)/scripts/rc.FMU_quad_x~init.d/rc.FMU_quad_x \
|
2012-08-05 23:47:29 -03:00
|
|
|
$(SRCROOT)/mixers/FMU_pass.mix~mixers/FMU_pass.mix \
|
2012-08-05 20:54:50 -03:00
|
|
|
$(SRCROOT)/mixers/FMU_delta.mix~mixers/FMU_delta.mix \
|
|
|
|
$(SRCROOT)/mixers/FMU_AERT.mix~mixers/FMU_AERT.mix \
|
|
|
|
$(SRCROOT)/mixers/FMU_AET.mix~mixers/FMU_AET.mix \
|
2012-08-20 18:52:13 -03:00
|
|
|
$(SRCROOT)/mixers/FMU_RET.mix~mixers/FMU_ERT.mix \
|
|
|
|
$(SRCROOT)/mixers/FMU_quad_x.mix~mixers/FMU_quad_x.mix \
|
2012-09-14 12:51:49 -03:00
|
|
|
$(SRCROOT)/mixers/FMU_quad_+.mix~mixers/FMU_quad_+.mix \
|
2012-11-03 23:44:06 -03:00
|
|
|
$(SRCROOT)/mixers/FMU_hex_x.mix~mixers/FMU_hex_x.mix \
|
|
|
|
$(SRCROOT)/mixers/FMU_hex_+.mix~mixers/FMU_hex_+.mix \
|
|
|
|
$(SRCROOT)/mixers/FMU_octo_x.mix~mixers/FMU_octo_x.mix \
|
|
|
|
$(SRCROOT)/mixers/FMU_octo_+.mix~mixers/FMU_octo_+.mix \
|
2012-09-14 13:59:45 -03:00
|
|
|
$(SRCROOT)/logging/logconv.m~logging/logconv.m
|
2012-08-04 19:12:36 -03:00
|
|
|
|
2013-01-20 17:16:03 -04:00
|
|
|
# the EXTERNAL_SCRIPTS variable is used to add out of tree scripts
|
|
|
|
# to ROMFS.
|
|
|
|
ROMFS_FSSPEC += $(EXTERNAL_SCRIPTS)
|
|
|
|
|
2012-08-04 19:12:36 -03:00
|
|
|
#
|
|
|
|
# Add the PX4IO firmware to the spec if someone has dropped it into the
|
|
|
|
# source directory, or otherwise specified its location.
|
|
|
|
#
|
|
|
|
# Normally this is only something you'd do when working on PX4IO; most
|
|
|
|
# users will upgrade with firmware off the microSD card.
|
|
|
|
#
|
|
|
|
PX4IO_FIRMWARE ?= $(SRCROOT)/px4io.bin
|
|
|
|
ifneq ($(wildcard $(PX4IO_FIRMWARE)),)
|
|
|
|
ROMFS_FSSPEC += $(PX4IO_FIRMWARE)~px4io.bin
|
|
|
|
endif
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# No user-serviceable parts below
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
#
|
|
|
|
# Just the source files from the ROMFS spec, so that we can fail cleanly if they don't
|
|
|
|
# exist
|
|
|
|
#
|
|
|
|
ROMFS_SRCFILES = $(foreach spec,$(ROMFS_FSSPEC),$(firstword $(subst ~, ,$(spec))))
|
|
|
|
|
|
|
|
#
|
|
|
|
# Just the destination directories from the ROMFS spec
|
|
|
|
#
|
|
|
|
ROMFS_DIRS = $(sort $(dir $(foreach spec,$(ROMFS_FSSPEC),$(lastword $(subst ~, ,$(spec))))))
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Intermediate products
|
|
|
|
#
|
|
|
|
ROMFS_IMG = $(BUILDROOT)/romfs.img
|
|
|
|
ROMFS_WORKDIR = $(BUILDROOT)/romfs
|
|
|
|
|
|
|
|
#
|
|
|
|
# Convenience target for rebuilding the ROMFS header
|
|
|
|
#
|
|
|
|
all: $(ROMFS_HEADER)
|
|
|
|
|
|
|
|
$(ROMFS_HEADER): $(ROMFS_IMG) $(dir $(ROMFS_HEADER))
|
|
|
|
@echo Generating the ROMFS header...
|
|
|
|
@(cd $(dir $(ROMFS_IMG)) && xxd -i $(notdir $(ROMFS_IMG))) > $@
|
|
|
|
|
|
|
|
$(ROMFS_IMG): $(ROMFS_WORKDIR)
|
|
|
|
@echo Generating the ROMFS image...
|
|
|
|
@genromfs -f $@ -d $(ROMFS_WORKDIR) -V "NSHInitVol"
|
|
|
|
|
|
|
|
$(ROMFS_WORKDIR): $(ROMFS_SRCFILES)
|
|
|
|
@echo Rebuilding the ROMFS work area...
|
|
|
|
@rm -rf $(ROMFS_WORKDIR)
|
|
|
|
@mkdir -p $(ROMFS_WORKDIR)
|
|
|
|
@for dir in $(ROMFS_DIRS) ; do mkdir -p $(ROMFS_WORKDIR)/$$dir; done
|
|
|
|
@for spec in $(ROMFS_FSSPEC) ; do \
|
|
|
|
echo $$spec | sed -e 's%^.*~% %' ;\
|
|
|
|
`echo "cp $$spec" | sed -e 's%~% $(ROMFS_WORKDIR)/%'` ;\
|
|
|
|
done
|
|
|
|
|
|
|
|
$(BUILDROOT):
|
|
|
|
@mkdir -p $(BUILDROOT)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@rm -rf $(BUILDROOT)
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
@rm -f $(PX4IO_FIRMWARE) $(ROMFS_HEADER)
|
|
|
|
|
|
|
|
.PHONY: all install clean distclean
|
|
|
|
|
|
|
|
#
|
|
|
|
# Hacks and fixups
|
|
|
|
#
|
|
|
|
SYSTYPE = $(shell uname)
|
|
|
|
|
|
|
|
ifeq ($(SYSTYPE),Darwin)
|
|
|
|
# PATH inherited by Eclipse may not include toolchain install location
|
|
|
|
export PATH := $(PATH):/usr/local/bin
|
|
|
|
endif
|
|
|
|
|