blob: 089c4d8eb716c6dc35eeb7138b80c7aeff478875 [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
AUDITYA BHATTARAM68c18eb2013-11-26 02:19:21 +053016ifeq ($(TARGET_BOARD_PLATFORM),msm8660)
Channagoud Kadabi49c66962013-01-28 13:39:27 -080017 BOOTLOADER_PLATFORM := msm8660_surf
David Ng7fbe5c32012-07-18 12:07:02 -070018else
Channagoud Kadabi49c66962013-01-28 13:39:27 -080019 BOOTLOADER_PLATFORM := $(TARGET_BOARD_PLATFORM)
David Ng7fbe5c32012-07-18 12:07:02 -070020endif
Channagoud Kadabi49c66962013-01-28 13:39:27 -080021
Channagoud Kadabiaeabd162014-02-28 19:13:14 -080022ABOOT_OUT := $(TARGET_OUT_INTERMEDIATES)/ABOOT_OBJ
23$(ABOOT_OUT):
24 $(hide) mkdir -p $(ABOOT_OUT)
25
26ABOOT_CLEAN:
27 $(hide) rm -f $(TARGET_ABOOT_ELF)
28
29# ELF binary for ABOOT
30TARGET_ABOOT_ELF := $(PRODUCT_OUT)/aboot.elf
31$(TARGET_ABOOT_ELF): ABOOT_CLEAN | $(ABOOT_OUT)
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -070032 $(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 -080033
Ajay Dudani7e5a6302011-11-24 12:23:49 -080034# NAND variant output
35TARGET_NAND_BOOTLOADER := $(PRODUCT_OUT)/appsboot.mbn
36NAND_BOOTLOADER_OUT := $(TARGET_OUT_INTERMEDIATES)/NAND_BOOTLOADER_OBJ
David Ng025c1d92009-12-09 23:46:00 -080037
Channagoud Kadabic52dc182011-12-14 00:08:48 +053038# Remove bootloader binary to trigger recompile when source changes
39appsbootldr_clean:
40 $(hide) rm -f $(TARGET_NAND_BOOTLOADER)
41
Ajay Dudani7e5a6302011-11-24 12:23:49 -080042$(NAND_BOOTLOADER_OUT):
43 mkdir -p $(NAND_BOOTLOADER_OUT)
David Ng025c1d92009-12-09 23:46:00 -080044
Ajay Dudani7e5a6302011-11-24 12:23:49 -080045# eMMC variant output
46TARGET_EMMC_BOOTLOADER := $(PRODUCT_OUT)/emmc_appsboot.mbn
47EMMC_BOOTLOADER_OUT := $(TARGET_OUT_INTERMEDIATES)/EMMC_BOOTLOADER_OBJ
David Ng025c1d92009-12-09 23:46:00 -080048
Channagoud Kadabic52dc182011-12-14 00:08:48 +053049emmc_appsbootldr_clean:
50 $(hide) rm -f $(TARGET_EMMC_BOOTLOADER)
51
Ajay Dudani7e5a6302011-11-24 12:23:49 -080052$(EMMC_BOOTLOADER_OUT):
53 mkdir -p $(EMMC_BOOTLOADER_OUT)
David Ng025c1d92009-12-09 23:46:00 -080054
Ajay Dudani7e5a6302011-11-24 12:23:49 -080055# Top level for NAND variant targets
Channagoud Kadabic52dc182011-12-14 00:08:48 +053056$(TARGET_NAND_BOOTLOADER): appsbootldr_clean | $(NAND_BOOTLOADER_OUT)
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -070057 $(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 -080058
Ajay Dudani7e5a6302011-11-24 12:23:49 -080059# Top level for eMMC variant targets
Channagoud Kadabic52dc182011-12-14 00:08:48 +053060$(TARGET_EMMC_BOOTLOADER): emmc_appsbootldr_clean | $(EMMC_BOOTLOADER_OUT)
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -070061 $(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 -080062
Ajay Dudani7e5a6302011-11-24 12:23:49 -080063# Keep build NAND & eMMC as default for targets still using TARGET_BOOTLOADER
64TARGET_BOOTLOADER := $(PRODUCT_OUT)/EMMCBOOT.MBN
65$(TARGET_BOOTLOADER): $(NAND_BOOTLOADER_OUT) $(EMMC_BOOTLOADER_OUT) | $(TARGET_NAND_BOOTLOADER) $(TARGET_EMMC_BOOTLOADER)
Ajay Dudani168f6cb2009-12-07 19:04:02 -080066
Ajay Dudani7e5a6302011-11-24 12:23:49 -080067#
68# Build nandwrite as a part of Android Build for NAND configurations
69#
David Ng7fbe5c32012-07-18 12:07:02 -070070TARGET_NANDWRITE := $(PRODUCT_OUT)/obj/nandwrite/build-$(BOOTLOADER_PLATFORM)_nandwrite/lk
Ajay Dudani7e5a6302011-11-24 12:23:49 -080071NANDWRITE_OUT := $(TARGET_OUT_INTERMEDIATES)/nandwrite
Ajay Dudani168f6cb2009-12-07 19:04:02 -080072
David Ng17fdc972009-12-10 11:01:43 -080073nandwrite_clean:
74 $(hide) rm -f $(TARGET_NANDWRITE)
75 $(hide) rm -rf $(NANDWRITE_OUT)
Ajay Dudani168f6cb2009-12-07 19:04:02 -080076
David Ng17fdc972009-12-10 11:01:43 -080077$(NANDWRITE_OUT):
78 mkdir -p $(NANDWRITE_OUT)
79
Anshul Gupta0fd98fd2011-10-20 20:48:55 +053080$(TARGET_NANDWRITE): nandwrite_clean | $(NANDWRITE_OUT)
David Ng7fbe5c32012-07-18 12:07:02 -070081 @echo $(BOOTLOADER_PLATFORM)_nandwrite
Channagoud Kadabi8dc5c3b2014-05-27 14:39:04 -070082 $(MAKE) -C bootable/bootloader/lk TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=../../../$(NANDWRITE_OUT) $(BOOTLOADER_PLATFORM)_nandwrite BUILD_NANDWRITE=1