#=============================================================================== # export #=============================================================================== # The location of the Mafefile BUILD_DIR := $(CURDIR) # The top of the bootloader src tree app_srctree := $(CURDIR)/.. # The top of the whole src tree top_srctree := $(CURDIR)/../../../../ export top_srctree app_srctree BUILD_DIR include bootloader.cfg # This is the default target. It must be the first declared target. .DEFAULT_GOAL := help HL_IMAGE_SUBDIR := ifeq ($(CFG_SOCT_NAND_FLASH_SUPPORT),y) HL_IMAGE_SUBDIR += $(SOCT_NAND_IMAGE_DIR) endif ifeq ($(CFG_SOCT_EMMC_SUPPORT),y) HL_IMAGE_SUBDIR += $(SOCT_EMMC_IMAGE_DIR) endif ifeq ($(CFG_SOCT_SPI_SUPPORT)_$(CFG_SOCT_EMMC_SUPPORT),y_y) HL_IMAGE_SUBDIR += $(SOCT_SPI_EMMC_IMAGE_DIR) endif ifeq ($(CFG_SOCT_SPI_SUPPORT),y) HL_IMAGE_SUBDIR += $(SOCT_SPI_IMAGE_DIR) endif export HL_IMAGE_SUBDIR ifneq ($(SOCT_OUT_DIR), ) BUILD_DIR_OBJ := $(SOCT_OUT_DIR)/obj else BUILD_DIR_OBJ := $(O) endif # # $(call copy_image,src-image,new-image,new-image-dir) # # this function can't use in this file, please use _copy_image instead # export copy_image = set -e; test -z "$$3" || for ix in $$3; do ( \ (test -d $$$${ix} || mkdir -p $$$${ix}); cp -rvf $$1 $$$${ix}/$$2; ) done unexport $(eval _copy_image=$(copy_image)) export remove_image = set -e; for ix in $$1; do (rm -rf $$$${ix} ) done # # $(call IF,$(CONFIG_XXX) = y,\ # echo true1; echo ture2; ,\ # echo false1; echo false2 ) # # $(call IF,condition,THEN-PART,ELSE-PART) export IF = if [ $$1 ]; then ( true; $$2 ) else ( true; $$3 ) fi #==================================================================================== # bootloader #==================================================================================== .PHONY: first_prepare firstboot second_prepare .PHONY: second_prepare secondboot secondboot_clean programmer programmer_clean programmer_prepare .PHONY: slave_prepare slaveboot slaveboot_clean #++++++++++++++++++++++++++++++++++++++++++++++++++++ ifeq ($(CFG_SOCT_TWOSTAGEBOOT_SUPPORT),y) MASTER_BOOTAPP_TARGET=master_fbl_boot_app else MASTER_BOOTAPP_TARGET=master_boot_app endif ##########################first boot######################### first_prepare: ifneq ($(CFG_SOCT_LOADER_APPLOADER),y) $(AT)$(MAKE) -f Makefile_masterboot fastboot-prepare $(if $(SOCT_OUT_DIR),O=$(SOCT_OUT_DIR)/obj/source/boot,) \ $(if $(CFG_SOCT_TWOSTAGEBOOT_SUPPORT),CFG_SOCT_BOOT_FBL=y,CFG_SOCT_BOOT_ONESTAGE=y) endif ifneq ($(CFG_SOCT_LOADER_APPLOADER),y) ifeq ($(CFG_SOCT_FBL_SUPPORT),y) firstboot: $(if $(O),mkdir -p $(O),) $(AT)$(MAKE) -f Makefile_masterboot fbl else firstboot: first_prepare $(AT)$(MAKE) -f Makefile_masterboot all $(if $(SOCT_OUT_DIR),O=$(SOCT_OUT_DIR)/obj/source/boot,) \ $(if $(CFG_SOCT_TWOSTAGEBOOT_SUPPORT),CFG_SOCT_BOOT_FBL=y,CFG_SOCT_BOOT_ONESTAGE=y) endif else firstboot: endif firstboot_clean: $(AT)$(MAKE) -f Makefile_masterboot clean $(if $(SOCT_OUT_DIR),O=$(SOCT_OUT_DIR)/obj/source/boot,) #########################second boot########################### second_prepare: ifneq ($(CFG_SOCT_LOADER_APPLOADER),y) $(AT)$(MAKE) -f Makefile_masterboot fastboot-prepare $(if $(SOCT_OUT_DIR),O=$(SOCT_OUT_DIR)/obj/source/boot,) CFG_SOCT_BOOT_SBL=y endif programmer_prepare: ifneq ($(CFG_SOCT_LOADER_APPLOADER),y) $(AT)$(MAKE) -f Makefile_masterboot fastboot-prepare $(if $(SOCT_OUT_DIR),O=$(SOCT_OUT_DIR)/obj/source/boot,) CFG_SOCT_BOOT_SBL=y CFG_SOCT_BOOT_PROGRAMMER=y endif ifeq ($(CFG_SOCT_LOADER_APPLOADER),y) secondboot: else secondboot: second_prepare $(AT)$(MAKE) -f Makefile_masterboot all $(if $(SOCT_OUT_DIR),O=$(SOCT_OUT_DIR)/obj/source/boot,) CFG_SOCT_BOOT_SBL=y endif programmer: programmer_prepare $(AT)$(MAKE) -f Makefile_masterboot all $(if $(SOCT_OUT_DIR),O=$(SOCT_OUT_DIR)/obj/source/boot,) CFG_SOCT_BOOT_SBL=y CFG_SOCT_BOOT_PROGRAMMER=y programmer_clean: $(AT)$(MAKE) -f Makefile_masterboot clean $(if $(SOCT_OUT_DIR),O=$(SOCT_OUT_DIR)/obj/source/boot,) secondboot_clean: $(AT)$(MAKE) -f Makefile_masterboot clean $(if $(SOCT_OUT_DIR),O=$(SOCT_OUT_DIR)/obj/source/boot,) #########################slave boot############################ slave_prepare: ifneq ($(CFG_SOCT_LOADER_APPLOADER),y) $(AT)$(MAKE) -f Makefile_slaveboot slaveboot-prepare $(if $(SOCT_OUT_DIR),O=$(SOCT_OUT_DIR)/obj/source/boot,) CFG_SOCT_BOOT_SLAVE=y endif slaveboot: slave_prepare ifneq ($(CFG_SOCT_LOADER_APPLOADER),y) $(AT)$(MAKE) -f Makefile_slaveboot all $(if $(SOCT_OUT_DIR),O=$(SOCT_OUT_DIR)/obj/source/boot,) CFG_SOCT_BOOT_SLAVE=y endif slaveboot_clean: $(AT)$(MAKE) -f Makefile_slaveboot clean $(if $(SOCT_OUT_DIR),O=$(SOCT_OUT_DIR)/obj/source/boot,)