blob: 1a09f4c7c308bc2831e2a0c1ada76ece30d3629d [file] [log] [blame]
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -08001UEFI_TOP_DIR := .
2
3ifndef $(BOOTLOADER_OUT)
4 BOOTLOADER_OUT := .
5endif
6export $(BOOTLOADER_OUT)
7
8BUILDDIR=$(shell pwd)
Prathyush Katukojwalaeec0cc62017-08-23 12:00:14 -07009export WRAPPER := $(BUILDDIR)/clang-wrapper.py
Jeevan Shriram4d4d5e62017-06-08 16:43:07 -070010
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080011export CLANG35_BIN := $(CLANG_BIN)
Jeevan Shriramd29e4402017-11-06 14:04:11 -080012export CLANG35_GCC_TOOLCHAIN := $(CLANG35_GCC_TOOLCHAIN)
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080013
Jeevan Shriram4d4d5e62017-06-08 16:43:07 -070014ifeq ($(TARGET_ARCHITECTURE),arm)
15export ARCHITECTURE := ARM
Jeevan Shriramd29e4402017-11-06 14:04:11 -080016export CLANG35_ARM_PREFIX := $(CLANG_PREFIX)
Jeevan Shriram4d4d5e62017-06-08 16:43:07 -070017else
18export ARCHITECTURE := AARCH64
Jeevan Shriramd29e4402017-11-06 14:04:11 -080019export CLANG35_AARCH64_PREFIX := $(CLANG_PREFIX)
Jeevan Shriram4d4d5e62017-06-08 16:43:07 -070020endif
21
Jeevan Shriramd29e4402017-11-06 14:04:11 -080022export BUILD_REPORT_DIR := $(BOOTLOADER_OUT)/build_report
23ANDROID_PRODUCT_OUT := $(BOOTLOADER_OUT)/Build
24
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080025WORKSPACE=$(BUILDDIR)
26TARGET_TOOLS := CLANG35
27TARGET := DEBUG
28BUILD_ROOT := $(ANDROID_PRODUCT_OUT)/$(TARGET)_$(TARGET_TOOLS)
Channagoud Kadabi1ed4a152016-02-05 15:15:41 -080029EDK_TOOLS := $(BUILDDIR)/BaseTools
30EDK_TOOLS_BIN := $(EDK_TOOLS)/Source/C/bin
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080031ABL_FV_IMG := $(BUILD_ROOT)/FV/abl.fv
32ABL_FV_ELF := $(BOOTLOADER_OUT)/../../abl.elf
lijuang4d342f62016-09-13 15:51:26 +080033SHELL:=/bin/bash
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080034
Trilok Sonic1a2d142017-04-26 17:32:05 -070035# UEFI UBSAN Configuration
36# ENABLE_UEFI_UBSAN := true
37
38ifeq "$(ENABLE_UEFI_UBSAN)" "true"
39 UBSAN_GCC_FLAG_UNDEFINED := -fsanitize=undefined
40 UBSAN_GCC_FLAG_ALIGNMENT := -fno-sanitize=alignment
41else
42 UBSAN_GCC_FLAG_UNDEFINED :=
43 UBSAN_GCC_FLAG_ALIGNMENT :=
44endif
45
Jeevan Shriram995c2312017-10-10 14:25:00 -070046ifeq ($(ENABLE_LE_VARIANT), true)
47 ENABLE_LE_VARIANT := 1
Jeevan Shriram32541172017-12-02 10:19:23 -080048 LOAD_ADDRESS := 0X8FB00000
Jeevan Shriram995c2312017-10-10 14:25:00 -070049else
50 ENABLE_LE_VARIANT := 0
Jeevan Shriram32541172017-12-02 10:19:23 -080051 LOAD_ADDRESS := 0X9FA00000
Jeevan Shriram995c2312017-10-10 14:25:00 -070052endif
53
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080054.PHONY: all cleanall
55
56all: ABL_FV_ELF
57
58cleanall:
59 @. ./edksetup.sh BaseTools && \
Jeevan Shriram4d4d5e62017-06-08 16:43:07 -070060 build -p $(WORKSPACE)/QcomModulePkg/QcomModulePkg.dsc -a $(ARCHITECTURE) -t $(TARGET_TOOLS) -b $(TARGET) -j build_modulepkg.log cleanall
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080061 rm -rf $(WORKSPACE)/QcomModulePkg/Bin64
62
Channagoud Kadabi1ed4a152016-02-05 15:15:41 -080063EDK_TOOLS_BIN:
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080064 @. ./edksetup.sh BaseTools && \
Channagoud Kadabi1ed4a152016-02-05 15:15:41 -080065 $(MAKE) -C $(EDK_TOOLS) -j1
66
67ABL_FV_IMG: EDK_TOOLS_BIN
68 @. ./edksetup.sh BaseTools && \
Jeevan Shriram995c2312017-10-10 14:25:00 -070069 build -p $(WORKSPACE)/QcomModulePkg/QcomModulePkg.dsc \
70 -a $(ARCHITECTURE) \
71 -t $(TARGET_TOOLS) \
72 -b $(TARGET) \
73 -D ABL_OUT_DIR=$(ANDROID_PRODUCT_OUT) \
74 -D VERIFIED_BOOT=$(VERIFIED_BOOT) \
75 -D VERIFIED_BOOT_2=$(VERIFIED_BOOT_2) \
76 -D USER_BUILD_VARIANT=$(USER_BUILD_VARIANT) \
77 -D ENABLE_LE_VARIANT=$(ENABLE_LE_VARIANT) \
78 -D UBSAN_UEFI_GCC_FLAG_UNDEFINED=$(UBSAN_GCC_FLAG_UNDEFINED) \
79 -D UBSAN_UEFI_GCC_FLAG_ALIGNMENT=$(UBSAN_GCC_FLAG_ALIGNMENT) \
80 -j build_modulepkg.log $*
81
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080082 cp $(BUILD_ROOT)/FV/FVMAIN_COMPACT.Fv $(ABL_FV_IMG)
83
84ABL_FV_ELF: ABL_FV_IMG
Jeevan Shriram19a53812017-06-14 15:39:48 -070085 python $(WORKSPACE)/QcomModulePkg/Tools/image_header.py $(ABL_FV_IMG) $(ABL_FV_ELF) $(LOAD_ADDRESS) elf 32