blob: 90801f4cf87d32bf2e4cc65bb9323ea295cb1a4a [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 Dudani7e5a6302011-11-24 12:23:49 -08003# Set flags if we need to include security libs
Shashank Mittalcd98d472011-08-02 14:29:24 -07004ifeq ($(TARGET_BOOTIMG_SIGNED),true)
5 SIGNED_KERNEL := SIGNED_KERNEL=1
6else
7 SIGNED_KERNEL := SIGNED_KERNEL=0
8endif
David Ng90556062010-12-20 18:36:33 -08009
wangxl1ddbd092015-02-03 20:31:24 +080010ifneq ($(strip $(TARGET_BOOTLOADER_PLATFORM_OVERRIDE)),)
11 BOOTLOADER_PLATFORM := $(TARGET_BOOTLOADER_PLATFORM_OVERRIDE)
David Ng7fbe5c32012-07-18 12:07:02 -070012else
wangxl1ddbd092015-02-03 20:31:24 +080013 ifeq ($(call is-board-platform,msm8660),true)
14 BOOTLOADER_PLATFORM := msm8660_surf
15 else
16 BOOTLOADER_PLATFORM := $(TARGET_BOARD_PLATFORM)
17 endif
David Ng7fbe5c32012-07-18 12:07:02 -070018endif
Channagoud Kadabi49c66962013-01-28 13:39:27 -080019
Ajay Dudani7e5a6302011-11-24 12:23:49 -080020# NAND variant output
21TARGET_NAND_BOOTLOADER := $(PRODUCT_OUT)/appsboot.mbn
22NAND_BOOTLOADER_OUT := $(TARGET_OUT_INTERMEDIATES)/NAND_BOOTLOADER_OBJ
David Ng025c1d92009-12-09 23:46:00 -080023
Channagoud Kadabic52dc182011-12-14 00:08:48 +053024# Remove bootloader binary to trigger recompile when source changes
25appsbootldr_clean:
26 $(hide) rm -f $(TARGET_NAND_BOOTLOADER)
27
Ajay Dudani7e5a6302011-11-24 12:23:49 -080028$(NAND_BOOTLOADER_OUT):
29 mkdir -p $(NAND_BOOTLOADER_OUT)
David Ng025c1d92009-12-09 23:46:00 -080030
Ajay Dudani7e5a6302011-11-24 12:23:49 -080031# eMMC variant output
32TARGET_EMMC_BOOTLOADER := $(PRODUCT_OUT)/emmc_appsboot.mbn
33EMMC_BOOTLOADER_OUT := $(TARGET_OUT_INTERMEDIATES)/EMMC_BOOTLOADER_OBJ
David Ng025c1d92009-12-09 23:46:00 -080034
Channagoud Kadabic52dc182011-12-14 00:08:48 +053035emmc_appsbootldr_clean:
36 $(hide) rm -f $(TARGET_EMMC_BOOTLOADER)
37
Ajay Dudani7e5a6302011-11-24 12:23:49 -080038$(EMMC_BOOTLOADER_OUT):
39 mkdir -p $(EMMC_BOOTLOADER_OUT)
David Ng025c1d92009-12-09 23:46:00 -080040
Ajay Dudani7e5a6302011-11-24 12:23:49 -080041# Top level for NAND variant targets
Channagoud Kadabic52dc182011-12-14 00:08:48 +053042$(TARGET_NAND_BOOTLOADER): appsbootldr_clean | $(NAND_BOOTLOADER_OUT)
David Ng7fbe5c32012-07-18 12:07:02 -070043 $(MAKE) -C bootable/bootloader/lk BOOTLOADER_OUT=../../../$(NAND_BOOTLOADER_OUT) $(BOOTLOADER_PLATFORM) $(SIGNED_KERNEL)
David Ng025c1d92009-12-09 23:46:00 -080044
Ajay Dudani7e5a6302011-11-24 12:23:49 -080045# Top level for eMMC variant targets
Channagoud Kadabic52dc182011-12-14 00:08:48 +053046$(TARGET_EMMC_BOOTLOADER): emmc_appsbootldr_clean | $(EMMC_BOOTLOADER_OUT)
David Ng7fbe5c32012-07-18 12:07:02 -070047 $(MAKE) -C bootable/bootloader/lk BOOTLOADER_OUT=../../../$(EMMC_BOOTLOADER_OUT) $(BOOTLOADER_PLATFORM) EMMC_BOOT=1 $(SIGNED_KERNEL)
Chandan Uddarajua9b07bb2009-11-21 12:22:02 -080048
Ajay Dudani7e5a6302011-11-24 12:23:49 -080049# Keep build NAND & eMMC as default for targets still using TARGET_BOOTLOADER
50TARGET_BOOTLOADER := $(PRODUCT_OUT)/EMMCBOOT.MBN
51$(TARGET_BOOTLOADER): $(NAND_BOOTLOADER_OUT) $(EMMC_BOOTLOADER_OUT) | $(TARGET_NAND_BOOTLOADER) $(TARGET_EMMC_BOOTLOADER)
Ajay Dudani168f6cb2009-12-07 19:04:02 -080052
Ajay Dudani7e5a6302011-11-24 12:23:49 -080053#
54# Build nandwrite as a part of Android Build for NAND configurations
55#
David Ng7fbe5c32012-07-18 12:07:02 -070056TARGET_NANDWRITE := $(PRODUCT_OUT)/obj/nandwrite/build-$(BOOTLOADER_PLATFORM)_nandwrite/lk
Ajay Dudani7e5a6302011-11-24 12:23:49 -080057NANDWRITE_OUT := $(TARGET_OUT_INTERMEDIATES)/nandwrite
Ajay Dudani168f6cb2009-12-07 19:04:02 -080058
David Ng17fdc972009-12-10 11:01:43 -080059nandwrite_clean:
60 $(hide) rm -f $(TARGET_NANDWRITE)
61 $(hide) rm -rf $(NANDWRITE_OUT)
Ajay Dudani168f6cb2009-12-07 19:04:02 -080062
David Ng17fdc972009-12-10 11:01:43 -080063$(NANDWRITE_OUT):
64 mkdir -p $(NANDWRITE_OUT)
65
Anshul Gupta0fd98fd2011-10-20 20:48:55 +053066$(TARGET_NANDWRITE): nandwrite_clean | $(NANDWRITE_OUT)
David Ng7fbe5c32012-07-18 12:07:02 -070067 @echo $(BOOTLOADER_PLATFORM)_nandwrite
68 $(MAKE) -C bootable/bootloader/lk BOOTLOADER_OUT=../../../$(NANDWRITE_OUT) $(BOOTLOADER_PLATFORM)_nandwrite BUILD_NANDWRITE=1