Chandan Uddaraju | a9b07bb | 2009-11-21 12:22:02 -0800 | [diff] [blame] | 1 | #Android makefile to build lk bootloader as a part of Android Build |
| 2 | |
Ajay Dudani | 0269560 | 2015-04-12 08:29:41 -0700 | [diff] [blame] | 3 | ifeq ($(BOOTLOADER_GCC_VERSION),) |
| 4 | ifndef $(2ND_TARGET_GCC_VERSION) |
Channagoud Kadabi | 8dc5c3b | 2014-05-27 14:39:04 -0700 | [diff] [blame] | 5 | CROSS_COMPILE := ../../../prebuilts/gcc/linux-x86/arm/arm-eabi-$(TARGET_GCC_VERSION)/bin/arm-eabi- |
Shruthi Krishna | c91e1b8 | 2014-06-11 14:53:25 -0700 | [diff] [blame] | 6 | else |
Sridhar Parasuram | 3d6011f | 2014-08-19 16:00:51 -0700 | [diff] [blame] | 7 | CROSS_COMPILE := ../../../prebuilts/gcc/linux-x86/arm/arm-eabi-$(2ND_TARGET_GCC_VERSION)/bin/arm-eabi- |
Shruthi Krishna | c91e1b8 | 2014-06-11 14:53:25 -0700 | [diff] [blame] | 8 | endif |
Ajay Dudani | 0269560 | 2015-04-12 08:29:41 -0700 | [diff] [blame] | 9 | else # BOOTLOADER_GCC_VERSION defined |
| 10 | CROSS_COMPILE := ../../../prebuilts/gcc/linux-x86/arm/$(BOOTLOADER_GCC_VERSION)/bin/arm-eabi- |
| 11 | endif |
Channagoud Kadabi | 8dc5c3b | 2014-05-27 14:39:04 -0700 | [diff] [blame] | 12 | |
Ajay Dudani | 7e5a630 | 2011-11-24 12:23:49 -0800 | [diff] [blame] | 13 | # Set flags if we need to include security libs |
Shashank Mittal | cd98d47 | 2011-08-02 14:29:24 -0700 | [diff] [blame] | 14 | ifeq ($(TARGET_BOOTIMG_SIGNED),true) |
| 15 | SIGNED_KERNEL := SIGNED_KERNEL=1 |
| 16 | else |
| 17 | SIGNED_KERNEL := SIGNED_KERNEL=0 |
| 18 | endif |
David Ng | 9055606 | 2010-12-20 18:36:33 -0800 | [diff] [blame] | 19 | |
Sridhar Parasuram | 5b0a024 | 2014-11-12 20:56:05 -0800 | [diff] [blame] | 20 | ifeq ($(BOOTLOADER_PLATFORM),) |
| 21 | BOOTLOADER_PLATFORM := $(TARGET_BOARD_PLATFORM) |
| 22 | endif |
| 23 | |
Shashank Mittal | e99a8d3 | 2014-09-11 19:51:06 -0700 | [diff] [blame] | 24 | ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true) |
| 25 | VERIFIED_BOOT := VERIFIED_BOOT=1 |
| 26 | else |
Unnati Gandhi | 87ce999 | 2015-03-30 16:34:48 +0530 | [diff] [blame] | 27 | VERIFIED_BOOT := VERIFIED_BOOT=0 |
Shashank Mittal | e99a8d3 | 2014-09-11 19:51:06 -0700 | [diff] [blame] | 28 | endif |
| 29 | |
| 30 | ifneq ($(TARGET_BUILD_VARIANT),user) |
| 31 | DEVICE_STATUS := DEFAULT_UNLOCK=true |
Channagoud Kadabi | 9071af3 | 2015-03-12 12:39:56 -0700 | [diff] [blame] | 32 | endif |
| 33 | |
| 34 | ifeq ($(TARGET_BUILD_VARIANT),user) |
| 35 | BUILD_VARIANT := USER_BUILD_VARIANT=true |
Shashank Mittal | e99a8d3 | 2014-09-11 19:51:06 -0700 | [diff] [blame] | 36 | endif |
| 37 | |
AUDITYA BHATTARAM | 68c18eb | 2013-11-26 02:19:21 +0530 | [diff] [blame] | 38 | ifeq ($(TARGET_BOARD_PLATFORM),msm8660) |
Channagoud Kadabi | 49c6696 | 2013-01-28 13:39:27 -0800 | [diff] [blame] | 39 | BOOTLOADER_PLATFORM := msm8660_surf |
David Ng | 7fbe5c3 | 2012-07-18 12:07:02 -0700 | [diff] [blame] | 40 | endif |
Channagoud Kadabi | 49c6696 | 2013-01-28 13:39:27 -0800 | [diff] [blame] | 41 | |
lijuang | 42d0ec4 | 2015-12-04 17:36:51 +0800 | [diff] [blame] | 42 | ifeq ($(TARGET_BOOTLOADER_BOARD_NAME),) |
| 43 | BOARD_NAME := BOARD_NAME=$(PRODUCT_NAME) |
| 44 | else |
| 45 | BOARD_NAME := BOARD_NAME=$(TARGET_BOOTLOADER_BOARD_NAME) |
| 46 | endif |
| 47 | |
Channagoud Kadabi | aeabd16 | 2014-02-28 19:13:14 -0800 | [diff] [blame] | 48 | ABOOT_OUT := $(TARGET_OUT_INTERMEDIATES)/ABOOT_OBJ |
| 49 | $(ABOOT_OUT): |
| 50 | $(hide) mkdir -p $(ABOOT_OUT) |
| 51 | |
| 52 | ABOOT_CLEAN: |
| 53 | $(hide) rm -f $(TARGET_ABOOT_ELF) |
| 54 | |
| 55 | # ELF binary for ABOOT |
| 56 | TARGET_ABOOT_ELF := $(PRODUCT_OUT)/aboot.elf |
| 57 | $(TARGET_ABOOT_ELF): ABOOT_CLEAN | $(ABOOT_OUT) |
lijuang | 42d0ec4 | 2015-12-04 17:36:51 +0800 | [diff] [blame] | 58 | $(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 Kadabi | aeabd16 | 2014-02-28 19:13:14 -0800 | [diff] [blame] | 59 | |
Ajay Dudani | 7e5a630 | 2011-11-24 12:23:49 -0800 | [diff] [blame] | 60 | # NAND variant output |
| 61 | TARGET_NAND_BOOTLOADER := $(PRODUCT_OUT)/appsboot.mbn |
| 62 | NAND_BOOTLOADER_OUT := $(TARGET_OUT_INTERMEDIATES)/NAND_BOOTLOADER_OBJ |
David Ng | 025c1d9 | 2009-12-09 23:46:00 -0800 | [diff] [blame] | 63 | |
Channagoud Kadabi | c52dc18 | 2011-12-14 00:08:48 +0530 | [diff] [blame] | 64 | # Remove bootloader binary to trigger recompile when source changes |
| 65 | appsbootldr_clean: |
| 66 | $(hide) rm -f $(TARGET_NAND_BOOTLOADER) |
| 67 | |
Ajay Dudani | 7e5a630 | 2011-11-24 12:23:49 -0800 | [diff] [blame] | 68 | $(NAND_BOOTLOADER_OUT): |
| 69 | mkdir -p $(NAND_BOOTLOADER_OUT) |
David Ng | 025c1d9 | 2009-12-09 23:46:00 -0800 | [diff] [blame] | 70 | |
Ajay Dudani | 7e5a630 | 2011-11-24 12:23:49 -0800 | [diff] [blame] | 71 | # eMMC variant output |
| 72 | TARGET_EMMC_BOOTLOADER := $(PRODUCT_OUT)/emmc_appsboot.mbn |
| 73 | EMMC_BOOTLOADER_OUT := $(TARGET_OUT_INTERMEDIATES)/EMMC_BOOTLOADER_OBJ |
David Ng | 025c1d9 | 2009-12-09 23:46:00 -0800 | [diff] [blame] | 74 | |
Channagoud Kadabi | c52dc18 | 2011-12-14 00:08:48 +0530 | [diff] [blame] | 75 | emmc_appsbootldr_clean: |
| 76 | $(hide) rm -f $(TARGET_EMMC_BOOTLOADER) |
| 77 | |
Ajay Dudani | 7e5a630 | 2011-11-24 12:23:49 -0800 | [diff] [blame] | 78 | $(EMMC_BOOTLOADER_OUT): |
| 79 | mkdir -p $(EMMC_BOOTLOADER_OUT) |
David Ng | 025c1d9 | 2009-12-09 23:46:00 -0800 | [diff] [blame] | 80 | |
Ajay Dudani | 7e5a630 | 2011-11-24 12:23:49 -0800 | [diff] [blame] | 81 | # Top level for NAND variant targets |
Channagoud Kadabi | c52dc18 | 2011-12-14 00:08:48 +0530 | [diff] [blame] | 82 | $(TARGET_NAND_BOOTLOADER): appsbootldr_clean | $(NAND_BOOTLOADER_OUT) |
lijuang | 42d0ec4 | 2015-12-04 17:36:51 +0800 | [diff] [blame] | 83 | $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(NAND_BOOTLOADER_OUT) $(BOOTLOADER_PLATFORM) $(SIGNED_KERNEL) $(BOARD_NAME) |
David Ng | 025c1d9 | 2009-12-09 23:46:00 -0800 | [diff] [blame] | 84 | |
Ajay Dudani | 7e5a630 | 2011-11-24 12:23:49 -0800 | [diff] [blame] | 85 | # Top level for eMMC variant targets |
Shashank Mittal | e99a8d3 | 2014-09-11 19:51:06 -0700 | [diff] [blame] | 86 | $(TARGET_EMMC_BOOTLOADER): emmc_appsbootldr_clean | $(EMMC_BOOTLOADER_OUT) $(INSTALLED_KEYSTOREIMAGE_TARGET) |
lijuang | 42d0ec4 | 2015-12-04 17:36:51 +0800 | [diff] [blame] | 87 | $(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 Uddaraju | a9b07bb | 2009-11-21 12:22:02 -0800 | [diff] [blame] | 88 | |
Ajay Dudani | 7e5a630 | 2011-11-24 12:23:49 -0800 | [diff] [blame] | 89 | # Keep build NAND & eMMC as default for targets still using TARGET_BOOTLOADER |
| 90 | TARGET_BOOTLOADER := $(PRODUCT_OUT)/EMMCBOOT.MBN |
| 91 | $(TARGET_BOOTLOADER): $(NAND_BOOTLOADER_OUT) $(EMMC_BOOTLOADER_OUT) | $(TARGET_NAND_BOOTLOADER) $(TARGET_EMMC_BOOTLOADER) |
Ajay Dudani | 168f6cb | 2009-12-07 19:04:02 -0800 | [diff] [blame] | 92 | |
Ajay Dudani | 7e5a630 | 2011-11-24 12:23:49 -0800 | [diff] [blame] | 93 | # |
| 94 | # Build nandwrite as a part of Android Build for NAND configurations |
| 95 | # |
David Ng | 7fbe5c3 | 2012-07-18 12:07:02 -0700 | [diff] [blame] | 96 | TARGET_NANDWRITE := $(PRODUCT_OUT)/obj/nandwrite/build-$(BOOTLOADER_PLATFORM)_nandwrite/lk |
Ajay Dudani | 7e5a630 | 2011-11-24 12:23:49 -0800 | [diff] [blame] | 97 | NANDWRITE_OUT := $(TARGET_OUT_INTERMEDIATES)/nandwrite |
Ajay Dudani | 168f6cb | 2009-12-07 19:04:02 -0800 | [diff] [blame] | 98 | |
David Ng | 17fdc97 | 2009-12-10 11:01:43 -0800 | [diff] [blame] | 99 | nandwrite_clean: |
| 100 | $(hide) rm -f $(TARGET_NANDWRITE) |
| 101 | $(hide) rm -rf $(NANDWRITE_OUT) |
Ajay Dudani | 168f6cb | 2009-12-07 19:04:02 -0800 | [diff] [blame] | 102 | |
David Ng | 17fdc97 | 2009-12-10 11:01:43 -0800 | [diff] [blame] | 103 | $(NANDWRITE_OUT): |
| 104 | mkdir -p $(NANDWRITE_OUT) |
| 105 | |
Anshul Gupta | 0fd98fd | 2011-10-20 20:48:55 +0530 | [diff] [blame] | 106 | $(TARGET_NANDWRITE): nandwrite_clean | $(NANDWRITE_OUT) |
David Ng | 7fbe5c3 | 2012-07-18 12:07:02 -0700 | [diff] [blame] | 107 | @echo $(BOOTLOADER_PLATFORM)_nandwrite |
Channagoud Kadabi | 8dc5c3b | 2014-05-27 14:39:04 -0700 | [diff] [blame] | 108 | $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(NANDWRITE_OUT) $(BOOTLOADER_PLATFORM)_nandwrite BUILD_NANDWRITE=1 |