[Feature]add MT2731_MP2_MR2_SVN388 baseline version
Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/src/bsp/lk/android_env.mk b/src/bsp/lk/android_env.mk
new file mode 100644
index 0000000..a098a02
--- /dev/null
+++ b/src/bsp/lk/android_env.mk
@@ -0,0 +1,70 @@
+LK_ENV_PATH := $(call my-dir)
+LK_ROOT_DIR := $(PWD)
+HOST_OS ?= $(shell uname | tr '[A-Z]' '[a-z]')
+
+# BL2 and BL33 LK common tool and directories setting
+LK_DIR := $(LK_ENV_PATH)
+DRAMK_DIR := $(LK_ENV_PATH)/../dramk_2712
+LK_EXT_DIR := $(LK_ENV_PATH)/../lk_ext_mod
+LK_DTS_DIR := $(LK_ROOT_DIR)/device/mediatek/common/tools/bootloader/security/lk_dts
+DUMMY_IMG_DIR := $(LK_ROOT_DIR)/device/mediatek/common/tools/bootloader/security/dummy_img
+DEV_INFO_DIR := $(LK_ROOT_DIR)/device/mediatek/common/tools/bootloader/security/dev_info
+UBOOT_MKIMG_TOOL := $(LK_ROOT_DIR)/prebuilts/u-boot/host/x86_64-linux/usr/bin/uboot-mkimage
+BL2_BUILDROOT := $(LK_ROOT_DIR)/$(PRODUCT_OUT)/bl2_out
+BL33_BUILDROOT := $(LK_ROOT_DIR)/$(PRODUCT_OUT)/bl33_out
+LK_BLOB_INC := $(BL2_BUILDROOT)
+BL33_BLOB_INC := $(BL33_BUILDROOT)
+
+#userdebug/eng setting DEBUG=1, user load setting it to 0
+ifeq ($(TARGET_BUILD_VARIANT), user)
+ DEBUG = 0
+else
+ DEBUG = 1
+endif
+
+COMMON_PROJ_OPTION = \
+ SECURE_BOOT_ENABLE \
+ AB_OTA_UPDATER
+
+BL2_PROJ_OPTION = \
+ MTK_CLK32K_EXT_REMOVAL_SUPPORT
+
+define convertOpt
+ $(eval result := $(empty)) \
+ $(foreach opt, $(strip $(1)), $(eval result += $(opt)=$($(opt)))) \
+ $(patsubst %=false,%=no,$(patsubst %=true,%=yes,$(result)))
+endef
+
+CONVERTED_COMMON_PROJ_OPTION := $(strip $(call convertOpt,$(COMMON_PROJ_OPTION)))
+CONVERTED_BL2_PROJ_OPTION := $(strip $(call convertOpt,$(BL2_PROJ_OPTION)))
+
+# LK/BL33 make option
+LOCAL_COMMON_MAKE_OPTION := $(if $(SHOW_COMMANDS),NOECHO=) $(if $(LK_CROSS_COMPILE),ARCH_arm64_TOOLCHAIN_PREFIX=$(LK_CROSS_COMPILE)) \
+ CFLAGS= DEBUG=$(DEBUG) CLANGBUILD=$(LK_CLANGBUILD) CLANG_BINDIR=$(LK_CLANG_BINDIR) \
+ $(CONVERTED_COMMON_PROJ_OPTION) \
+ SECURE_BOOT_TYPE=$(SECURE_BOOT_TYPE) \
+ ANDROID_2712=yes
+
+# BL2 LK specific
+ifeq ($(wildcard $(TARGET_PREBUILT_LK)),)
+TARGET_LK_OUT ?= $(TARGET_OUT_INTERMEDIATES)/BOOTLOADER_OBJ
+BUILT_LK_TARGET := $(TARGET_LK_OUT)/build-$(LK_PROJECT)/lk.bin
+LK_FIT_PACK_SCRIPT := $(LK_ROOT_DIR)/device/mediatek/common/tools/bootloader/mk_lk_img.sh
+LK_MAKE_OPTION := PROJECT=$(LK_PROJECT) \
+ $(CONVERTED_BL2_PROJ_OPTION)
+BL2_OFF_DT_STRINGS=`fdtdump ${BL2_BUILDROOT}/lk.dtb | grep off_dt_strings | sed "s,^\/\/.*:\s*0x,,"`
+BL2_SIZE_DT_STRINGS=`fdtdump ${BL2_BUILDROOT}/lk.dtb | grep size_dt_strings | sed "s,^\/\/.*:\s*0x,,"`
+endif
+
+# BL33 LK specific
+ifeq ($(wildcard $(TARGET_PREBUILT_BL33)),)
+TARGET_BL33_OUT ?= $(TARGET_OUT_INTERMEDIATES)/BL33_OBJ
+BUILT_BL33_TARGET := $(TARGET_BL33_OUT)/build-$(BL33_PROJECT)/bl33.bin
+BL33_FIT_PACK_SCRIPT := $(LK_ROOT_DIR)/device/mediatek/common/tools/bootloader/mk_bl33_img.sh
+BL33_MAKE_OPTION := MTK_MRDUMP_SUPPORT=$(MTK_MRDUMP_SUPPORT) \
+ MTK_KEDUMP_MINI_SUPPORT=$(MTK_KEDUMP_MINI_SUPPORT) \
+ PROJECT=$(BL33_PROJECT) \
+ MTK_BOOT_REASON_SUPPORT=$(MTK_BOOT_REASON_SUPPORT)
+BL33_OFF_DT_STRINGS=`fdtdump ${BL33_BUILDROOT}/lk.dtb | grep off_dt_strings | sed "s,^\/\/.*:\s*0x,,"`
+BL33_SIZE_DT_STRINGS=`fdtdump ${BL33_BUILDROOT}/lk.dtb | grep size_dt_strings | sed "s,^\/\/.*:\s*0x,,"`
+endif