blob: 787f377ec9806069d18ca45e595322eb2f35c8d2 [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
11ifeq ($(ANDROID_BUILD_TOP),)
12export CLANG35_AARCH64_PREFIX := $(CLANG_PREFIX)
13else
padarshr85181032016-07-09 02:32:43 +053014export CLANG35_AARCH64_PREFIX := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)/bin/aarch64-linux-android-
Maria Yu34a47932017-06-23 17:18:58 +080015export CLANG35_AARCH64_GCC_TOOLCHAIN := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)
Jeevan Shriram4d4d5e62017-06-08 16:43:07 -070016endif
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080017export CLANG35_BIN := $(CLANG_BIN)
Jeevan Shriramc8ee40b2017-09-05 05:17:41 -070018export CLANG35_ARM_PREFIX := $(CLANG_BIN)../tools/bin/arm-
19export CLANG35_ARM_LINK_PREFIX := $(CLANG_LINK_PATH)/arm-linux-gnueabihf-
Jeevan Shriram4d4d5e62017-06-08 16:43:07 -070020
lijuang35adede2017-07-27 20:52:45 +080021export BUILD_REPORT_DIR := $(BOOTLOADER_OUT)/build_report
Channagoud Kadabi53362e02016-06-29 18:34:12 -070022ANDROID_PRODUCT_OUT := $(BOOTLOADER_OUT)/Build
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080023
Jeevan Shriram4d4d5e62017-06-08 16:43:07 -070024ifeq ($(TARGET_ARCHITECTURE),arm)
25export ARCHITECTURE := ARM
26else
27export ARCHITECTURE := AARCH64
Maria Yu34a47932017-06-23 17:18:58 +080028export CLANG35_GCC_TOOLCHAIN := $(CLANG35_AARCH64_GCC_TOOLCHAIN)
Jeevan Shriram4d4d5e62017-06-08 16:43:07 -070029endif
30
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080031WORKSPACE=$(BUILDDIR)
32TARGET_TOOLS := CLANG35
33TARGET := DEBUG
34BUILD_ROOT := $(ANDROID_PRODUCT_OUT)/$(TARGET)_$(TARGET_TOOLS)
Channagoud Kadabi67698992016-03-02 13:04:47 -080035LOAD_ADDRESS := 0X9FA00000
Channagoud Kadabi1ed4a152016-02-05 15:15:41 -080036EDK_TOOLS := $(BUILDDIR)/BaseTools
37EDK_TOOLS_BIN := $(EDK_TOOLS)/Source/C/bin
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080038ABL_FV_IMG := $(BUILD_ROOT)/FV/abl.fv
39ABL_FV_ELF := $(BOOTLOADER_OUT)/../../abl.elf
lijuang4d342f62016-09-13 15:51:26 +080040SHELL:=/bin/bash
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080041
Trilok Sonic1a2d142017-04-26 17:32:05 -070042# UEFI UBSAN Configuration
43# ENABLE_UEFI_UBSAN := true
44
45ifeq "$(ENABLE_UEFI_UBSAN)" "true"
46 UBSAN_GCC_FLAG_UNDEFINED := -fsanitize=undefined
47 UBSAN_GCC_FLAG_ALIGNMENT := -fno-sanitize=alignment
48else
49 UBSAN_GCC_FLAG_UNDEFINED :=
50 UBSAN_GCC_FLAG_ALIGNMENT :=
51endif
52
Jeevan Shriram995c2312017-10-10 14:25:00 -070053ifeq ($(ENABLE_LE_VARIANT), true)
54 ENABLE_LE_VARIANT := 1
55else
56 ENABLE_LE_VARIANT := 0
57endif
58
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080059.PHONY: all cleanall
60
61all: ABL_FV_ELF
62
63cleanall:
64 @. ./edksetup.sh BaseTools && \
Jeevan Shriram4d4d5e62017-06-08 16:43:07 -070065 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 -080066 rm -rf $(WORKSPACE)/QcomModulePkg/Bin64
67
Channagoud Kadabi1ed4a152016-02-05 15:15:41 -080068EDK_TOOLS_BIN:
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080069 @. ./edksetup.sh BaseTools && \
Channagoud Kadabi1ed4a152016-02-05 15:15:41 -080070 $(MAKE) -C $(EDK_TOOLS) -j1
71
72ABL_FV_IMG: EDK_TOOLS_BIN
73 @. ./edksetup.sh BaseTools && \
Jeevan Shriram995c2312017-10-10 14:25:00 -070074 build -p $(WORKSPACE)/QcomModulePkg/QcomModulePkg.dsc \
75 -a $(ARCHITECTURE) \
76 -t $(TARGET_TOOLS) \
77 -b $(TARGET) \
78 -D ABL_OUT_DIR=$(ANDROID_PRODUCT_OUT) \
79 -D VERIFIED_BOOT=$(VERIFIED_BOOT) \
80 -D VERIFIED_BOOT_2=$(VERIFIED_BOOT_2) \
81 -D USER_BUILD_VARIANT=$(USER_BUILD_VARIANT) \
82 -D ENABLE_LE_VARIANT=$(ENABLE_LE_VARIANT) \
83 -D UBSAN_UEFI_GCC_FLAG_UNDEFINED=$(UBSAN_GCC_FLAG_UNDEFINED) \
84 -D UBSAN_UEFI_GCC_FLAG_ALIGNMENT=$(UBSAN_GCC_FLAG_ALIGNMENT) \
85 -j build_modulepkg.log $*
86
Sridhar Parasuramfedf9ac2015-11-03 16:20:50 -080087 cp $(BUILD_ROOT)/FV/FVMAIN_COMPACT.Fv $(ABL_FV_IMG)
88
89ABL_FV_ELF: ABL_FV_IMG
Jeevan Shriram19a53812017-06-14 15:39:48 -070090 python $(WORKSPACE)/QcomModulePkg/Tools/image_header.py $(ABL_FV_IMG) $(ABL_FV_ELF) $(LOAD_ADDRESS) elf 32