1# 2# Copyright (c) 2013-2014, ARM Limited. All rights reserved. 3# 4# This program and the accompanying materials 5# are licensed and made available under the terms and conditions of the BSD License 6# which accompanies this distribution. The full text of the license may be found at 7# http://opensource.org/licenses/bsd-license.php 8# 9# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11# 12 13# Define the following variable to specify an alternative toolchain to the one located in your PATH: 14# - RVCT_TOOLS_PATH: for RVCT and RVCTLINUX toolchains 15 16EDK2_TOOLCHAIN ?= GCC49 17GCC49_AARCH64_PREFIX ?= aarch64-none-elf- 18EDK2_ARCH ?= AARCH64 19EDK2_BUILD ?= DEBUG 20EDK2_DSC = ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc 21DEST_BIN_ROOT ?= 22 23ifeq ($(EDK2_DSC),"") 24 $(error The Makefile macro 'EDK2_DSC' must be defined with an EDK2 DSC file.) 25endif 26 27ifeq ("$(OS)","Windows_NT") 28export WORKSPACE?=$(PWD) 29export EDK_TOOLS_PATH ?= $(WORKSPACE)\BaseTools 30else 31export WORKSPACE?=$(PWD) 32endif 33 34# Define the destination of the Firmware Image Package (FIP) if not defined 35ifndef JUNO_FIP 36 ifdef DEST_BIN_ROOT 37 JUNO_FIP=$(DEST_BIN_ROOT)/fip.bin 38 else 39 JUNO_FIP=fip.bin 40 endif 41endif 42 43SHELL := /bin/bash 44SILENT ?= @ 45ECHO ?= echo 46MAKE ?= make -i -k 47RM ?= rm -f 48CP ?= cp 49 50.PHONY: all clean 51 52EDK2_CONF = Conf/BuildEnv.sh Conf/build_rule.txt Conf/target.txt Conf/tools_def.txt 53 54all: $(EDK2_CONF) 55ifeq ("$(OS)","Windows_NT") 56 build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS) 57else 58 . ./edksetup.sh; GCC49_AARCH64_PREFIX=$(GCC49_AARCH64_PREFIX) build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS) 59endif 60ifeq ("$(OS)","Windows_NT") 61 $(SILENT)$(ECHO) "Warning: The UEFI Firmware must be added to the Firmware Image Package (FIP)." 62else 63 $(SILENT)which fip_create ; \ 64 if [ $$? -ne 0 ]; then \ 65 $(ECHO) "Warning: 'fip_create' tool is not in the PATH. The UEFI binary will not be added in the Firmware Image Package (FIP)."; \ 66 else \ 67 fip_create --bl33 $(WORKSPACE)/Build/ArmJuno/$(EDK2_BUILD)_$(EDK2_TOOLCHAIN)/FV/BL33_AP_UEFI.fd --dump $(JUNO_FIP); \ 68 fi 69endif 70 71$(EDK2_CONF): 72ifeq ("$(OS)","Windows_NT") 73 copy $(EDK_TOOLS_PATH)\Conf\build_rule.template Conf\build_rule.txt 74 copy $(EDK_TOOLS_PATH)\Conf\FrameworkDatabase.template Conf\FrameworkDatabase.txt 75 copy $(EDK_TOOLS_PATH)\Conf\target.template Conf\target.txt 76 copy $(EDK_TOOLS_PATH)\Conf\tools_def.template Conf\tools_def.txt 77else 78 . ./edksetup.sh; $(MAKE) -C BaseTools 79endif 80 81clean: 82ifeq ("$(OS)","Windows_NT") 83 build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS) cleanall 84else 85 . ./edksetup.sh; build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS) cleanall; \ 86 rm -Rf $(EDK2_CONF) Conf/.cache 87endif 88