blob: 06647a9f3988a8af8af088c326edce347eddf6cb [file] [log] [blame]
Chandan Uddarajua9b07bb2009-11-21 12:22:02 -08001#Android makefile to build lk bootloader as a part of Android Build
2
Shruthi Krishnac91e1b82014-06-11 14:53:25 -07003ifndef 2ND_TARGET_GCC_VERSION
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -07004CROSS_COMPILE := ../../../prebuilts/gcc/linux-x86/arm/arm-eabi-$(TARGET_GCC_VERSION)/bin/arm-eabi-
Shruthi Krishnac91e1b82014-06-11 14:53:25 -07005else
Sridhar Parasuram3d6011f2014-08-19 16:00:51 -07006CROSS_COMPILE := ../../../prebuilts/gcc/linux-x86/arm/arm-eabi-$(2ND_TARGET_GCC_VERSION)/bin/arm-eabi-
Shruthi Krishnac91e1b82014-06-11 14:53:25 -07007endif
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -07008
Ajay Dudani7e5a6302011-11-24 12:23:49 -08009# Set flags if we need to include security libs
Shashank Mittalcd98d472011-08-02 14:29:24 -070010ifeq ($(TARGET_BOOTIMG_SIGNED),true)
11 SIGNED_KERNEL := SIGNED_KERNEL=1
12else
13 SIGNED_KERNEL := SIGNED_KERNEL=0
14endif
David Ng90556062010-12-20 18:36:33 -080015
Sridhar Parasuram5b0a0242014-11-12 20:56:05 -080016ifeq ($(BOOTLOADER_PLATFORM),)
17 BOOTLOADER_PLATFORM := $(TARGET_BOARD_PLATFORM)
18endif
19
Shashank Mittale99a8d32014-09-11 19:51:06 -070020ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
21 VERIFIED_BOOT := VERIFIED_BOOT=1
22else
23 VERIFIED_BOOT := VERIFEID_BOOT=0
24endif
25
26ifneq ($(TARGET_BUILD_VARIANT),user)
27 DEVICE_STATUS := DEFAULT_UNLOCK=true
Channagoud Kadabi2021cef2015-02-25 12:08:32 -080028 USER_BUILD_VARIANT=true
Shashank Mittale99a8d32014-09-11 19:51:06 -070029endif
30
AUDITYA BHATTARAM68c18eb2013-11-26 02:19:21 +053031ifeq ($(TARGET_BOARD_PLATFORM),msm8660)
Channagoud Kadabi49c66962013-01-28 13:39:27 -080032 BOOTLOADER_PLATFORM := msm8660_surf
David Ng7fbe5c32012-07-18 12:07:02 -070033endif
Channagoud Kadabi49c66962013-01-28 13:39:27 -080034
Channagoud Kadabiaeabd162014-02-28 19:13:14 -080035ABOOT_OUT := $(TARGET_OUT_INTERMEDIATES)/ABOOT_OBJ
36$(ABOOT_OUT):
37 $(hide) mkdir -p $(ABOOT_OUT)
38
39ABOOT_CLEAN:
40 $(hide) rm -f $(TARGET_ABOOT_ELF)
41
42# ELF binary for ABOOT
43TARGET_ABOOT_ELF := $(PRODUCT_OUT)/aboot.elf
44$(TARGET_ABOOT_ELF): ABOOT_CLEAN | $(ABOOT_OUT)
Shashank Mittale99a8d32014-09-11 19:51:06 -070045 $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(ABOOT_OUT) $(BOOTLOADER_PLATFORM) $(EMMC_BOOT) $(SIGNED_KERNEL) $(VERIFIED_BOOT) $(DEVICE_STATUS)
Channagoud Kadabiaeabd162014-02-28 19:13:14 -080046
Ajay Dudani7e5a6302011-11-24 12:23:49 -080047# NAND variant output
48TARGET_NAND_BOOTLOADER := $(PRODUCT_OUT)/appsboot.mbn
49NAND_BOOTLOADER_OUT := $(TARGET_OUT_INTERMEDIATES)/NAND_BOOTLOADER_OBJ
David Ng025c1d92009-12-09 23:46:00 -080050
Channagoud Kadabic52dc182011-12-14 00:08:48 +053051# Remove bootloader binary to trigger recompile when source changes
52appsbootldr_clean:
53 $(hide) rm -f $(TARGET_NAND_BOOTLOADER)
54
Ajay Dudani7e5a6302011-11-24 12:23:49 -080055$(NAND_BOOTLOADER_OUT):
56 mkdir -p $(NAND_BOOTLOADER_OUT)
David Ng025c1d92009-12-09 23:46:00 -080057
Ajay Dudani7e5a6302011-11-24 12:23:49 -080058# eMMC variant output
59TARGET_EMMC_BOOTLOADER := $(PRODUCT_OUT)/emmc_appsboot.mbn
60EMMC_BOOTLOADER_OUT := $(TARGET_OUT_INTERMEDIATES)/EMMC_BOOTLOADER_OBJ
David Ng025c1d92009-12-09 23:46:00 -080061
Channagoud Kadabic52dc182011-12-14 00:08:48 +053062emmc_appsbootldr_clean:
63 $(hide) rm -f $(TARGET_EMMC_BOOTLOADER)
64
Ajay Dudani7e5a6302011-11-24 12:23:49 -080065$(EMMC_BOOTLOADER_OUT):
66 mkdir -p $(EMMC_BOOTLOADER_OUT)
David Ng025c1d92009-12-09 23:46:00 -080067
Ajay Dudani7e5a6302011-11-24 12:23:49 -080068# Top level for NAND variant targets
Channagoud Kadabic52dc182011-12-14 00:08:48 +053069$(TARGET_NAND_BOOTLOADER): appsbootldr_clean | $(NAND_BOOTLOADER_OUT)
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -070070 $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(NAND_BOOTLOADER_OUT) $(BOOTLOADER_PLATFORM) $(SIGNED_KERNEL)
David Ng025c1d92009-12-09 23:46:00 -080071
Ajay Dudani7e5a6302011-11-24 12:23:49 -080072# Top level for eMMC variant targets
Shashank Mittale99a8d32014-09-11 19:51:06 -070073$(TARGET_EMMC_BOOTLOADER): emmc_appsbootldr_clean | $(EMMC_BOOTLOADER_OUT) $(INSTALLED_KEYSTOREIMAGE_TARGET)
74 $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(EMMC_BOOTLOADER_OUT) $(BOOTLOADER_PLATFORM) EMMC_BOOT=1 $(SIGNED_KERNEL) $(VERIFIED_BOOT) $(DEVICE_STATUS)
Chandan Uddarajua9b07bb2009-11-21 12:22:02 -080075
Ajay Dudani7e5a6302011-11-24 12:23:49 -080076# Keep build NAND & eMMC as default for targets still using TARGET_BOOTLOADER
77TARGET_BOOTLOADER := $(PRODUCT_OUT)/EMMCBOOT.MBN
78$(TARGET_BOOTLOADER): $(NAND_BOOTLOADER_OUT) $(EMMC_BOOTLOADER_OUT) | $(TARGET_NAND_BOOTLOADER) $(TARGET_EMMC_BOOTLOADER)
Ajay Dudani168f6cb2009-12-07 19:04:02 -080079
Ajay Dudani7e5a6302011-11-24 12:23:49 -080080#
81# Build nandwrite as a part of Android Build for NAND configurations
82#
David Ng7fbe5c32012-07-18 12:07:02 -070083TARGET_NANDWRITE := $(PRODUCT_OUT)/obj/nandwrite/build-$(BOOTLOADER_PLATFORM)_nandwrite/lk
Ajay Dudani7e5a6302011-11-24 12:23:49 -080084NANDWRITE_OUT := $(TARGET_OUT_INTERMEDIATES)/nandwrite
Ajay Dudani168f6cb2009-12-07 19:04:02 -080085
David Ng17fdc972009-12-10 11:01:43 -080086nandwrite_clean:
87 $(hide) rm -f $(TARGET_NANDWRITE)
88 $(hide) rm -rf $(NANDWRITE_OUT)
Ajay Dudani168f6cb2009-12-07 19:04:02 -080089
David Ng17fdc972009-12-10 11:01:43 -080090$(NANDWRITE_OUT):
91 mkdir -p $(NANDWRITE_OUT)
92
Anshul Gupta0fd98fd2011-10-20 20:48:55 +053093$(TARGET_NANDWRITE): nandwrite_clean | $(NANDWRITE_OUT)
David Ng7fbe5c32012-07-18 12:07:02 -070094 @echo $(BOOTLOADER_PLATFORM)_nandwrite
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -070095 $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(NANDWRITE_OUT) $(BOOTLOADER_PLATFORM)_nandwrite BUILD_NANDWRITE=1