blob: 33f6e9104ffccc06eb5f2db2d799f59bfefd5a9d [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
10CROSS_COMPILE := ../../../prebuilts/gcc/linux-x86/arm/$(BOOTLOADER_GCC_VERSION)/bin/arm-eabi-
11endif
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -070012
Ajay Dudani7e5a6302011-11-24 12:23:49 -080013# Set flags if we need to include security libs
Shashank Mittalcd98d472011-08-02 14:29:24 -070014ifeq ($(TARGET_BOOTIMG_SIGNED),true)
15 SIGNED_KERNEL := SIGNED_KERNEL=1
16else
17 SIGNED_KERNEL := SIGNED_KERNEL=0
18endif
David Ng90556062010-12-20 18:36:33 -080019
Sridhar Parasuram5b0a0242014-11-12 20:56:05 -080020ifeq ($(BOOTLOADER_PLATFORM),)
21 BOOTLOADER_PLATFORM := $(TARGET_BOARD_PLATFORM)
22endif
23
Shashank Mittale99a8d32014-09-11 19:51:06 -070024ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
25 VERIFIED_BOOT := VERIFIED_BOOT=1
26else
Unnati Gandhi87ce9992015-03-30 16:34:48 +053027 VERIFIED_BOOT := VERIFIED_BOOT=0
Shashank Mittale99a8d32014-09-11 19:51:06 -070028endif
29
30ifneq ($(TARGET_BUILD_VARIANT),user)
31 DEVICE_STATUS := DEFAULT_UNLOCK=true
Channagoud Kadabi9071af32015-03-12 12:39:56 -070032endif
33
34ifeq ($(TARGET_BUILD_VARIANT),user)
35 BUILD_VARIANT := USER_BUILD_VARIANT=true
Shashank Mittale99a8d32014-09-11 19:51:06 -070036endif
37
AUDITYA BHATTARAM68c18eb2013-11-26 02:19:21 +053038ifeq ($(TARGET_BOARD_PLATFORM),msm8660)
Channagoud Kadabi49c66962013-01-28 13:39:27 -080039 BOOTLOADER_PLATFORM := msm8660_surf
David Ng7fbe5c32012-07-18 12:07:02 -070040endif
Channagoud Kadabi49c66962013-01-28 13:39:27 -080041
lijuang42d0ec42015-12-04 17:36:51 +080042ifeq ($(TARGET_BOOTLOADER_BOARD_NAME),)
43 BOARD_NAME := BOARD_NAME=$(PRODUCT_NAME)
44else
45 BOARD_NAME := BOARD_NAME=$(TARGET_BOOTLOADER_BOARD_NAME)
46endif
47
Channagoud Kadabiaeabd162014-02-28 19:13:14 -080048ABOOT_OUT := $(TARGET_OUT_INTERMEDIATES)/ABOOT_OBJ
49$(ABOOT_OUT):
50 $(hide) mkdir -p $(ABOOT_OUT)
51
52ABOOT_CLEAN:
53 $(hide) rm -f $(TARGET_ABOOT_ELF)
54
55# ELF binary for ABOOT
56TARGET_ABOOT_ELF := $(PRODUCT_OUT)/aboot.elf
57$(TARGET_ABOOT_ELF): ABOOT_CLEAN | $(ABOOT_OUT)
lijuang42d0ec42015-12-04 17:36:51 +080058 $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(ABOOT_OUT) $(BOOTLOADER_PLATFORM) $(EMMC_BOOT) $(SIGNED_KERNEL) $(VERIFIED_BOOT) $(DEVICE_STATUS) $(BUILD_VARIANT) $(BOARD_NAME)
Channagoud Kadabiaeabd162014-02-28 19:13:14 -080059
Ajay Dudani7e5a6302011-11-24 12:23:49 -080060# NAND variant output
61TARGET_NAND_BOOTLOADER := $(PRODUCT_OUT)/appsboot.mbn
62NAND_BOOTLOADER_OUT := $(TARGET_OUT_INTERMEDIATES)/NAND_BOOTLOADER_OBJ
David Ng025c1d92009-12-09 23:46:00 -080063
Channagoud Kadabic52dc182011-12-14 00:08:48 +053064# Remove bootloader binary to trigger recompile when source changes
65appsbootldr_clean:
66 $(hide) rm -f $(TARGET_NAND_BOOTLOADER)
67
Ajay Dudani7e5a6302011-11-24 12:23:49 -080068$(NAND_BOOTLOADER_OUT):
69 mkdir -p $(NAND_BOOTLOADER_OUT)
David Ng025c1d92009-12-09 23:46:00 -080070
Ajay Dudani7e5a6302011-11-24 12:23:49 -080071# eMMC variant output
72TARGET_EMMC_BOOTLOADER := $(PRODUCT_OUT)/emmc_appsboot.mbn
73EMMC_BOOTLOADER_OUT := $(TARGET_OUT_INTERMEDIATES)/EMMC_BOOTLOADER_OBJ
David Ng025c1d92009-12-09 23:46:00 -080074
Channagoud Kadabic52dc182011-12-14 00:08:48 +053075emmc_appsbootldr_clean:
76 $(hide) rm -f $(TARGET_EMMC_BOOTLOADER)
77
Ajay Dudani7e5a6302011-11-24 12:23:49 -080078$(EMMC_BOOTLOADER_OUT):
79 mkdir -p $(EMMC_BOOTLOADER_OUT)
David Ng025c1d92009-12-09 23:46:00 -080080
Ajay Dudani7e5a6302011-11-24 12:23:49 -080081# Top level for NAND variant targets
Channagoud Kadabic52dc182011-12-14 00:08:48 +053082$(TARGET_NAND_BOOTLOADER): appsbootldr_clean | $(NAND_BOOTLOADER_OUT)
lijuang42d0ec42015-12-04 17:36:51 +080083 $(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 -080084
Ajay Dudani7e5a6302011-11-24 12:23:49 -080085# Top level for eMMC variant targets
Shashank Mittale99a8d32014-09-11 19:51:06 -070086$(TARGET_EMMC_BOOTLOADER): emmc_appsbootldr_clean | $(EMMC_BOOTLOADER_OUT) $(INSTALLED_KEYSTOREIMAGE_TARGET)
lijuang42d0ec42015-12-04 17:36:51 +080087 $(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) $(BUILD_VARIANT) $(BOARD_NAME)
Chandan Uddarajua9b07bb2009-11-21 12:22:02 -080088
Ajay Dudani7e5a6302011-11-24 12:23:49 -080089# Keep build NAND & eMMC as default for targets still using TARGET_BOOTLOADER
90TARGET_BOOTLOADER := $(PRODUCT_OUT)/EMMCBOOT.MBN
91$(TARGET_BOOTLOADER): $(NAND_BOOTLOADER_OUT) $(EMMC_BOOTLOADER_OUT) | $(TARGET_NAND_BOOTLOADER) $(TARGET_EMMC_BOOTLOADER)
Ajay Dudani168f6cb2009-12-07 19:04:02 -080092
Ajay Dudani7e5a6302011-11-24 12:23:49 -080093#
94# Build nandwrite as a part of Android Build for NAND configurations
95#
David Ng7fbe5c32012-07-18 12:07:02 -070096TARGET_NANDWRITE := $(PRODUCT_OUT)/obj/nandwrite/build-$(BOOTLOADER_PLATFORM)_nandwrite/lk
Ajay Dudani7e5a6302011-11-24 12:23:49 -080097NANDWRITE_OUT := $(TARGET_OUT_INTERMEDIATES)/nandwrite
Ajay Dudani168f6cb2009-12-07 19:04:02 -080098
David Ng17fdc972009-12-10 11:01:43 -080099nandwrite_clean:
100 $(hide) rm -f $(TARGET_NANDWRITE)
101 $(hide) rm -rf $(NANDWRITE_OUT)
Ajay Dudani168f6cb2009-12-07 19:04:02 -0800102
David Ng17fdc972009-12-10 11:01:43 -0800103$(NANDWRITE_OUT):
104 mkdir -p $(NANDWRITE_OUT)
105
Anshul Gupta0fd98fd2011-10-20 20:48:55 +0530106$(TARGET_NANDWRITE): nandwrite_clean | $(NANDWRITE_OUT)
David Ng7fbe5c32012-07-18 12:07:02 -0700107 @echo $(BOOTLOADER_PLATFORM)_nandwrite
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -0700108 $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(NANDWRITE_OUT) $(BOOTLOADER_PLATFORM)_nandwrite BUILD_NANDWRITE=1