hw: Add kernel/spec/muen/target.mk to build Muen SK

This adds the automated compilation of the Muen Separation Kernel and
the required components to the hw_x86_64_muen build process.
This commit is contained in:
Adrian-Ken Rueegsegger 2015-08-26 10:16:47 +02:00 committed by Christian Helmuth
parent 8d2f2b0101
commit cb68f9a320

View File

@ -0,0 +1,43 @@
TARGET = muen
REQUIRES = x86_64 muen
MUEN_SRC_DIR = $(call select_from_ports,muen)/src/kernel/muen
MUEN_BUILD_DIR = $(BUILD_BASE_DIR)/kernel
MUEN_CONF_FILE = $(MUEN_BUILD_DIR)/muen.conf
MUEN_DST_DIR = $(MUEN_BUILD_DIR)/muen
MUEN_LOG = $(MUEN_BUILD_DIR)/build.log
MUEN_SYSTEM := $(shell sed -n "/^SYSTEM/s/^.*=\\s*//p" ${MUEN_CONF_FILE})
MUEN_HARDWARE := $(shell sed -n "/^HARDWARE/s/^.*=\\s*//p" ${MUEN_CONF_FILE})
MUEN_COMPONENTS := $(shell sed -n "/^COMPONENTS/s/^.*=\\s*//p" ${MUEN_CONF_FILE})
GNAT_PATH := $(shell sed -n "/^GNAT_PATH/s/^.*=\\s*//p" ${MUEN_CONF_FILE})
SPARK_PATH := $(shell sed -n "/^SPARK_PATH/s/^.*=\\s*//p" ${MUEN_CONF_FILE})
BUILD_ENV = PATH=$(GNAT_PATH)/bin:$(SPARK_PATH)/bin:$$PATH
BUILD_OPTS = SYSTEM=$(MUEN_SYSTEM) HARDWARE=$(MUEN_HARDWARE) NO_PROOF=true
$(TARGET): $(MUEN_DST_DIR)
$(MSG_BUILD)Muen kernel
$(VERBOSE)$(BUILD_ENV) $(MAKE) -C $(MUEN_DST_DIR) $(BUILD_OPTS) kernel > $(MUEN_LOG) 2>&1
$(MSG_BUILD)Muen components
$(VERBOSE)$(BUILD_ENV) $(MAKE) -C $(MUEN_DST_DIR)/components \
COMPONENTS=$(MUEN_COMPONENTS) $(BUILD_OPTS) > $(MUEN_LOG) 2>&1
$(MUEN_DST_DIR): $(MUEN_SRC_DIR)
$(VERBOSE)mkdir -p $(MUEN_DST_DIR)
$(VERBOSE)tar c -C $(MUEN_SRC_DIR) . | tar x -C $(MUEN_DST_DIR)
clean cleanall: clean_muen
#
# Make sure to execute the 'clean_muen' rule prior the generic clean
# rule in 'prg.mk' because the generic rule will attempt to remove $(TARGET)
# file, which is a directory in our case.
#
clean_prg_objects: clean_muen
clean_muen:
$(VERBOSE)rm -rf $(MUEN_DST_DIR)
$(VERBOSE)rm -f $(MUEN_CONF_FILE)
$(VERBOSE)rm -f $(MUEN_LOG)
.PHONY: $(TARGET)