blob: e93b7b487b6c2692da9136d9c4dbf5e6488f63ee [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
AUDITYA BHATTARAM68c18eb2013-11-26 02:19:21 +053020ifeq ($(TARGET_BOARD_PLATFORM),msm8660)
Channagoud Kadabi49c66962013-01-28 13:39:27 -080021 BOOTLOADER_PLATFORM := msm8660_surf
David Ng7fbe5c32012-07-18 12:07:02 -070022endif
Channagoud Kadabi49c66962013-01-28 13:39:27 -080023
Channagoud Kadabiaeabd162014-02-28 19:13:14 -080024ABOOT_OUT := $(TARGET_OUT_INTERMEDIATES)/ABOOT_OBJ
25$(ABOOT_OUT):
26 $(hide) mkdir -p $(ABOOT_OUT)
27
28ABOOT_CLEAN:
29 $(hide) rm -f $(TARGET_ABOOT_ELF)
30
31# ELF binary for ABOOT
32TARGET_ABOOT_ELF := $(PRODUCT_OUT)/aboot.elf
33$(TARGET_ABOOT_ELF): ABOOT_CLEAN | $(ABOOT_OUT)
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -070034 $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(ABOOT_OUT) $(BOOTLOADER_PLATFORM) $(EMMC_BOOT) $(SIGNED_KERNEL)
Channagoud Kadabiaeabd162014-02-28 19:13:14 -080035
Ajay Dudani7e5a6302011-11-24 12:23:49 -080036# NAND variant output
37TARGET_NAND_BOOTLOADER := $(PRODUCT_OUT)/appsboot.mbn
38NAND_BOOTLOADER_OUT := $(TARGET_OUT_INTERMEDIATES)/NAND_BOOTLOADER_OBJ
David Ng025c1d92009-12-09 23:46:00 -080039
Channagoud Kadabic52dc182011-12-14 00:08:48 +053040# Remove bootloader binary to trigger recompile when source changes
41appsbootldr_clean:
42 $(hide) rm -f $(TARGET_NAND_BOOTLOADER)
43
Ajay Dudani7e5a6302011-11-24 12:23:49 -080044$(NAND_BOOTLOADER_OUT):
45 mkdir -p $(NAND_BOOTLOADER_OUT)
David Ng025c1d92009-12-09 23:46:00 -080046
Ajay Dudani7e5a6302011-11-24 12:23:49 -080047# eMMC variant output
48TARGET_EMMC_BOOTLOADER := $(PRODUCT_OUT)/emmc_appsboot.mbn
49EMMC_BOOTLOADER_OUT := $(TARGET_OUT_INTERMEDIATES)/EMMC_BOOTLOADER_OBJ
David Ng025c1d92009-12-09 23:46:00 -080050
Channagoud Kadabic52dc182011-12-14 00:08:48 +053051emmc_appsbootldr_clean:
52 $(hide) rm -f $(TARGET_EMMC_BOOTLOADER)
53
Ajay Dudani7e5a6302011-11-24 12:23:49 -080054$(EMMC_BOOTLOADER_OUT):
55 mkdir -p $(EMMC_BOOTLOADER_OUT)
David Ng025c1d92009-12-09 23:46:00 -080056
Ajay Dudani7e5a6302011-11-24 12:23:49 -080057# Top level for NAND variant targets
Channagoud Kadabic52dc182011-12-14 00:08:48 +053058$(TARGET_NAND_BOOTLOADER): appsbootldr_clean | $(NAND_BOOTLOADER_OUT)
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -070059 $(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 -080060
Ajay Dudani7e5a6302011-11-24 12:23:49 -080061# Top level for eMMC variant targets
Channagoud Kadabic52dc182011-12-14 00:08:48 +053062$(TARGET_EMMC_BOOTLOADER): emmc_appsbootldr_clean | $(EMMC_BOOTLOADER_OUT)
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -070063 $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(EMMC_BOOTLOADER_OUT) $(BOOTLOADER_PLATFORM) EMMC_BOOT=1 $(SIGNED_KERNEL)
Chandan Uddarajua9b07bb2009-11-21 12:22:02 -080064
Ajay Dudani7e5a6302011-11-24 12:23:49 -080065# Keep build NAND & eMMC as default for targets still using TARGET_BOOTLOADER
66TARGET_BOOTLOADER := $(PRODUCT_OUT)/EMMCBOOT.MBN
67$(TARGET_BOOTLOADER): $(NAND_BOOTLOADER_OUT) $(EMMC_BOOTLOADER_OUT) | $(TARGET_NAND_BOOTLOADER) $(TARGET_EMMC_BOOTLOADER)
Ajay Dudani168f6cb2009-12-07 19:04:02 -080068
Ajay Dudani7e5a6302011-11-24 12:23:49 -080069#
70# Build nandwrite as a part of Android Build for NAND configurations
71#
David Ng7fbe5c32012-07-18 12:07:02 -070072TARGET_NANDWRITE := $(PRODUCT_OUT)/obj/nandwrite/build-$(BOOTLOADER_PLATFORM)_nandwrite/lk
Ajay Dudani7e5a6302011-11-24 12:23:49 -080073NANDWRITE_OUT := $(TARGET_OUT_INTERMEDIATES)/nandwrite
Ajay Dudani168f6cb2009-12-07 19:04:02 -080074
David Ng17fdc972009-12-10 11:01:43 -080075nandwrite_clean:
76 $(hide) rm -f $(TARGET_NANDWRITE)
77 $(hide) rm -rf $(NANDWRITE_OUT)
Ajay Dudani168f6cb2009-12-07 19:04:02 -080078
David Ng17fdc972009-12-10 11:01:43 -080079$(NANDWRITE_OUT):
80 mkdir -p $(NANDWRITE_OUT)
81
Anshul Gupta0fd98fd2011-10-20 20:48:55 +053082$(TARGET_NANDWRITE): nandwrite_clean | $(NANDWRITE_OUT)
David Ng7fbe5c32012-07-18 12:07:02 -070083 @echo $(BOOTLOADER_PLATFORM)_nandwrite
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -070084 $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(NANDWRITE_OUT) $(BOOTLOADER_PLATFORM)_nandwrite BUILD_NANDWRITE=1