From 8a365179eafdf3aea98e60ab9f5882b200d4c759 Mon Sep 17 00:00:00 2001 From: px4dev Date: Sat, 4 Aug 2012 15:12:36 -0700 Subject: Fresh import of the PX4 firmware sources. --- ROMFS/Makefile | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 ROMFS/Makefile (limited to 'ROMFS/Makefile') diff --git a/ROMFS/Makefile b/ROMFS/Makefile new file mode 100644 index 000000000..cc5a3ccd3 --- /dev/null +++ b/ROMFS/Makefile @@ -0,0 +1,102 @@ +# +# 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 ~ +# +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 \ + $(SRCROOT)/scripts/rc.PX4IOAR~init.d/rc.PX4IOAR + +# +# 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 + -- cgit v1.2.3