blob: 104f4de54f35d6296b3d42fc5eef1cafe33c19c3 [file] [log] [blame]
Chandan Uddarajua9b07bb2009-11-21 12:22:02 -08001#Android makefile to build lk bootloader as a part of Android Build
2
Ajay Dudani02695602015-04-12 08:29:41 -07003ifeq ($(BOOTLOADER_GCC_VERSION),)
4ifndef $(2ND_TARGET_GCC_VERSION)
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -07005CROSS_COMPILE := ../../../prebuilts/gcc/linux-x86/arm/arm-eabi-$(TARGET_GCC_VERSION)/bin/arm-eabi-
Shruthi Krishnac91e1b82014-06-11 14:53:25 -07006else
Sridhar Parasuram3d6011f2014-08-19 16:00:51 -07007CROSS_COMPILE := ../../../prebuilts/gcc/linux-x86/arm/arm-eabi-$(2ND_TARGET_GCC_VERSION)/bin/arm-eabi-
Shruthi Krishnac91e1b82014-06-11 14:53:25 -07008endif
Ajay Dudani02695602015-04-12 08:29:41 -07009else # BOOTLOADER_GCC_VERSION defined
Swetha Vuchab2428212017-05-12 16:38:27 +053010ifeq ($(BOOTLOADER_GCC_VERSION),arm-linux-androideabi-4.9)
11CROSS_COMPILE := ../../../prebuilts/gcc/linux-x86/arm/$(BOOTLOADER_GCC_VERSION)/bin/arm-linux-androideabi-
12else
Ajay Dudani02695602015-04-12 08:29:41 -070013CROSS_COMPILE := ../../../prebuilts/gcc/linux-x86/arm/$(BOOTLOADER_GCC_VERSION)/bin/arm-eabi-
14endif
Swetha Vuchab2428212017-05-12 16:38:27 +053015endif
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -070016
Ajay Dudani7e5a6302011-11-24 12:23:49 -080017# Set flags if we need to include security libs
Shashank Mittalcd98d472011-08-02 14:29:24 -070018ifeq ($(TARGET_BOOTIMG_SIGNED),true)
19 SIGNED_KERNEL := SIGNED_KERNEL=1
20else
21 SIGNED_KERNEL := SIGNED_KERNEL=0
22endif
David Ng90556062010-12-20 18:36:33 -080023
Sridhar Parasuram5b0a0242014-11-12 20:56:05 -080024ifeq ($(BOOTLOADER_PLATFORM),)
25 BOOTLOADER_PLATFORM := $(TARGET_BOARD_PLATFORM)
26endif
27
Shashank Mittale99a8d32014-09-11 19:51:06 -070028ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
29 VERIFIED_BOOT := VERIFIED_BOOT=1
30else
Unnati Gandhi87ce9992015-03-30 16:34:48 +053031 VERIFIED_BOOT := VERIFIED_BOOT=0
Shashank Mittale99a8d32014-09-11 19:51:06 -070032endif
33
Vladislav Levenetz14528442017-03-16 16:40:42 +020034ifeq ($(BOOTLOADER_DISABLE_DISPLAY),true)
35 ENABLE_DISPLAY := ENABLE_DISPLAY=0
36else
37 ENABLE_DISPLAY := ENABLE_DISPLAY=1
38endif
39
Vijay Kumar Pendoti2f869052016-07-15 12:04:19 +053040ifeq (1,$(filter 1,$(shell echo "$$(( $(PLATFORM_SDK_VERSION) >= 24 ))" )))
41 OSVERSION_IN_BOOTIMAGE := OSVERSION_IN_BOOTIMAGE=1
42 ENABLE_VB_ATTEST := ENABLE_VB_ATTEST=1
43else
44 OSVERSION_IN_BOOTIMAGE := OSVERSION_IN_BOOTIMAGE=0
45 ENABLE_VB_ATTEST := ENABLE_VB_ATTEST=0
46endif
47
Shashank Mittale99a8d32014-09-11 19:51:06 -070048ifneq ($(TARGET_BUILD_VARIANT),user)
49 DEVICE_STATUS := DEFAULT_UNLOCK=true
Channagoud Kadabi9071af32015-03-12 12:39:56 -070050endif
51
52ifeq ($(TARGET_BUILD_VARIANT),user)
53 BUILD_VARIANT := USER_BUILD_VARIANT=true
Shashank Mittale99a8d32014-09-11 19:51:06 -070054endif
55
AUDITYA BHATTARAM68c18eb2013-11-26 02:19:21 +053056ifeq ($(TARGET_BOARD_PLATFORM),msm8660)
Channagoud Kadabi49c66962013-01-28 13:39:27 -080057 BOOTLOADER_PLATFORM := msm8660_surf
David Ng7fbe5c32012-07-18 12:07:02 -070058endif
Channagoud Kadabi49c66962013-01-28 13:39:27 -080059
lijuang42d0ec42015-12-04 17:36:51 +080060ifeq ($(TARGET_BOOTLOADER_BOARD_NAME),)
61 BOARD_NAME := BOARD_NAME=$(PRODUCT_NAME)
62else
63 BOARD_NAME := BOARD_NAME=$(TARGET_BOOTLOADER_BOARD_NAME)
64endif
65
Channagoud Kadabiaeabd162014-02-28 19:13:14 -080066ABOOT_OUT := $(TARGET_OUT_INTERMEDIATES)/ABOOT_OBJ
67$(ABOOT_OUT):
68 $(hide) mkdir -p $(ABOOT_OUT)
69
70ABOOT_CLEAN:
71 $(hide) rm -f $(TARGET_ABOOT_ELF)
72
73# ELF binary for ABOOT
74TARGET_ABOOT_ELF := $(PRODUCT_OUT)/aboot.elf
75$(TARGET_ABOOT_ELF): ABOOT_CLEAN | $(ABOOT_OUT)
Vladislav Levenetz14528442017-03-16 16:40:42 +020076 $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(ABOOT_OUT) $(BOOTLOADER_PLATFORM) $(EMMC_BOOT) $(SIGNED_KERNEL) $(VERIFIED_BOOT) $(ENABLE_DISPLAY) $(DEVICE_STATUS) $(BUILD_VARIANT) $(BOARD_NAME) $(ENABLE_VB_ATTEST) $(OSVERSION_IN_BOOTIMAGE)
Channagoud Kadabiaeabd162014-02-28 19:13:14 -080077
Ajay Dudani7e5a6302011-11-24 12:23:49 -080078# NAND variant output
79TARGET_NAND_BOOTLOADER := $(PRODUCT_OUT)/appsboot.mbn
80NAND_BOOTLOADER_OUT := $(TARGET_OUT_INTERMEDIATES)/NAND_BOOTLOADER_OBJ
David Ng025c1d92009-12-09 23:46:00 -080081
Channagoud Kadabic52dc182011-12-14 00:08:48 +053082# Remove bootloader binary to trigger recompile when source changes
83appsbootldr_clean:
84 $(hide) rm -f $(TARGET_NAND_BOOTLOADER)
85
Ajay Dudani7e5a6302011-11-24 12:23:49 -080086$(NAND_BOOTLOADER_OUT):
87 mkdir -p $(NAND_BOOTLOADER_OUT)
David Ng025c1d92009-12-09 23:46:00 -080088
Ajay Dudani7e5a6302011-11-24 12:23:49 -080089# eMMC variant output
90TARGET_EMMC_BOOTLOADER := $(PRODUCT_OUT)/emmc_appsboot.mbn
91EMMC_BOOTLOADER_OUT := $(TARGET_OUT_INTERMEDIATES)/EMMC_BOOTLOADER_OBJ
David Ng025c1d92009-12-09 23:46:00 -080092
Channagoud Kadabic52dc182011-12-14 00:08:48 +053093emmc_appsbootldr_clean:
94 $(hide) rm -f $(TARGET_EMMC_BOOTLOADER)
95
Ajay Dudani7e5a6302011-11-24 12:23:49 -080096$(EMMC_BOOTLOADER_OUT):
97 mkdir -p $(EMMC_BOOTLOADER_OUT)
David Ng025c1d92009-12-09 23:46:00 -080098
Ajay Dudani7e5a6302011-11-24 12:23:49 -080099# Top level for NAND variant targets
Channagoud Kadabic52dc182011-12-14 00:08:48 +0530100$(TARGET_NAND_BOOTLOADER): appsbootldr_clean | $(NAND_BOOTLOADER_OUT)
lijuang42d0ec42015-12-04 17:36:51 +0800101 $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(NAND_BOOTLOADER_OUT) $(BOOTLOADER_PLATFORM) $(SIGNED_KERNEL) $(BOARD_NAME)
David Ng025c1d92009-12-09 23:46:00 -0800102
Ajay Dudani7e5a6302011-11-24 12:23:49 -0800103# Top level for eMMC variant targets
Shashank Mittale99a8d32014-09-11 19:51:06 -0700104$(TARGET_EMMC_BOOTLOADER): emmc_appsbootldr_clean | $(EMMC_BOOTLOADER_OUT) $(INSTALLED_KEYSTOREIMAGE_TARGET)
Vladislav Levenetz14528442017-03-16 16:40:42 +0200105 $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(EMMC_BOOTLOADER_OUT) $(BOOTLOADER_PLATFORM) EMMC_BOOT=1 $(SIGNED_KERNEL) $(VERIFIED_BOOT) $(ENABLE_DISPLAY) $(DEVICE_STATUS) $(BUILD_VARIANT) $(BOARD_NAME) $(ENABLE_VB_ATTEST) $(OSVERSION_IN_BOOTIMAGE)
Chandan Uddarajua9b07bb2009-11-21 12:22:02 -0800106
Ajay Dudani7e5a6302011-11-24 12:23:49 -0800107# Keep build NAND & eMMC as default for targets still using TARGET_BOOTLOADER
108TARGET_BOOTLOADER := $(PRODUCT_OUT)/EMMCBOOT.MBN
109$(TARGET_BOOTLOADER): $(NAND_BOOTLOADER_OUT) $(EMMC_BOOTLOADER_OUT) | $(TARGET_NAND_BOOTLOADER) $(TARGET_EMMC_BOOTLOADER)
Ajay Dudani168f6cb2009-12-07 19:04:02 -0800110
Ajay Dudani7e5a6302011-11-24 12:23:49 -0800111#
112# Build nandwrite as a part of Android Build for NAND configurations
113#
David Ng7fbe5c32012-07-18 12:07:02 -0700114TARGET_NANDWRITE := $(PRODUCT_OUT)/obj/nandwrite/build-$(BOOTLOADER_PLATFORM)_nandwrite/lk
Ajay Dudani7e5a6302011-11-24 12:23:49 -0800115NANDWRITE_OUT := $(TARGET_OUT_INTERMEDIATES)/nandwrite
Ajay Dudani168f6cb2009-12-07 19:04:02 -0800116
David Ng17fdc972009-12-10 11:01:43 -0800117nandwrite_clean:
118 $(hide) rm -f $(TARGET_NANDWRITE)
119 $(hide) rm -rf $(NANDWRITE_OUT)
Ajay Dudani168f6cb2009-12-07 19:04:02 -0800120
David Ng17fdc972009-12-10 11:01:43 -0800121$(NANDWRITE_OUT):
122 mkdir -p $(NANDWRITE_OUT)
123
Anshul Gupta0fd98fd2011-10-20 20:48:55 +0530124$(TARGET_NANDWRITE): nandwrite_clean | $(NANDWRITE_OUT)
David Ng7fbe5c32012-07-18 12:07:02 -0700125 @echo $(BOOTLOADER_PLATFORM)_nandwrite
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -0700126 $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(NANDWRITE_OUT) $(BOOTLOADER_PLATFORM)_nandwrite BUILD_NANDWRITE=1