12fe4e5f8Sopenharmony_ci##########################################################################################
22fe4e5f8Sopenharmony_ci#	prepare param
32fe4e5f8Sopenharmony_ci##########################################################################################
42fe4e5f8Sopenharmony_ciexport OSDRV_DIR=$(shell pwd)
52fe4e5f8Sopenharmony_ciexport OSDRV_CROSS
62fe4e5f8Sopenharmony_ciexport CHIP?=hi3516dv300
72fe4e5f8Sopenharmony_ciexport ARCH=arm
82fe4e5f8Sopenharmony_ciexport CROSS_COMPILE=$(OSDRV_CROSS)-
92fe4e5f8Sopenharmony_ciBOOT_MEDIA?=emmc
102fe4e5f8Sopenharmony_ci
112fe4e5f8Sopenharmony_ciifneq ($(BOOT_MEDIA),spi)
122fe4e5f8Sopenharmony_ciifneq ($(BOOT_MEDIA),emmc)
132fe4e5f8Sopenharmony_ci$(error you must set valid BOOT_MEDIA:spi or emmc!)
142fe4e5f8Sopenharmony_ciendif
152fe4e5f8Sopenharmony_ciendif
162fe4e5f8Sopenharmony_ci
172fe4e5f8Sopenharmony_ciifeq ($(OSDRV_CROSS), )
182fe4e5f8Sopenharmony_ciOSDRV_CROSS=$(OSDRV_DIR)/../../../../../prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/bin/arm-linux-gnueabi
192fe4e5f8Sopenharmony_ciendif
202fe4e5f8Sopenharmony_ci
212fe4e5f8Sopenharmony_ciUBOOT_VER:=u-boot-2020.01
222fe4e5f8Sopenharmony_ciUBOOT_TAR:=$(UBOOT_VER).tgz
232fe4e5f8Sopenharmony_ciUBOOT:=u-boot-$(CHIP).bin
242fe4e5f8Sopenharmony_ciUBOOT_REG_BIN:=reg_info_$(CHIP).bin
252fe4e5f8Sopenharmony_ciifeq ($(BOOT_MEDIA),emmc)
262fe4e5f8Sopenharmony_ciexport UBOOT_CONFIG:=$(CHIP)_$(BOOT_MEDIA)_smp_config
272fe4e5f8Sopenharmony_cielse
282fe4e5f8Sopenharmony_ciexport UBOOT_CONFIG:=$(CHIP)_smp_config
292fe4e5f8Sopenharmony_ciendif
302fe4e5f8Sopenharmony_ci
312fe4e5f8Sopenharmony_ciNORMAL_UBOOT_DIR:=$(OSDRV_DIR)/../../../../../third_party/u-boot
322fe4e5f8Sopenharmony_ci
332fe4e5f8Sopenharmony_ci##########################################################################################
342fe4e5f8Sopenharmony_ci#	set task
352fe4e5f8Sopenharmony_ci##########################################################################################
362fe4e5f8Sopenharmony_ciall: prepare hiboot hipctools build_done
372fe4e5f8Sopenharmony_ci
382fe4e5f8Sopenharmony_ciclean: hiboot_clean hipctools_clean
392fe4e5f8Sopenharmony_ci
402fe4e5f8Sopenharmony_cidistclean: clean pub_clean clean_done
412fe4e5f8Sopenharmony_ci
422fe4e5f8Sopenharmony_ci##########################################################################################
432fe4e5f8Sopenharmony_ci##task [0] prepare out directory
442fe4e5f8Sopenharmony_ci##########################################################################################
452fe4e5f8Sopenharmony_ciprepare:
462fe4e5f8Sopenharmony_ci	@echo "------- task [0] prepare out dir -------"
472fe4e5f8Sopenharmony_ci	mkdir $(OSDRV_DIR)/out/boot -p
482fe4e5f8Sopenharmony_ci
492fe4e5f8Sopenharmony_ci##########################################################################################
502fe4e5f8Sopenharmony_ci#task [1]	build uboot
512fe4e5f8Sopenharmony_ci##########################################################################################
522fe4e5f8Sopenharmony_cihiboot:
532fe4e5f8Sopenharmony_ci	@echo "---------task [1]	build boot"
542fe4e5f8Sopenharmony_ci	find $(NORMAL_UBOOT_DIR)/$(UBOOT_VER) | xargs touch
552fe4e5f8Sopenharmony_ci	make -C $(NORMAL_UBOOT_DIR)/$(UBOOT_VER) ARCH=arm CROSS_COMPILE=$(OSDRV_CROSS)- $(UBOOT_CONFIG)
562fe4e5f8Sopenharmony_ci	pushd $(NORMAL_UBOOT_DIR)/$(UBOOT_VER);make ARCH=arm CROSS_COMPILE=$(OSDRV_CROSS)- -j 20 >/dev/null;popd
572fe4e5f8Sopenharmony_ci	chmod +x $(NORMAL_UBOOT_DIR)/$(UBOOT_VER)/arch/arm/cpu/armv7/$(CHIP)/hw_compressed/gzip
582fe4e5f8Sopenharmony_ci	cp $(OSDRV_DIR)/reg/$(UBOOT_REG_BIN) $(NORMAL_UBOOT_DIR)/$(UBOOT_VER)/.reg
592fe4e5f8Sopenharmony_ci	pushd $(NORMAL_UBOOT_DIR)/$(UBOOT_VER);make ARCH=arm CROSS_COMPILE=$(OSDRV_CROSS)- u-boot-z.bin >/dev/null;popd
602fe4e5f8Sopenharmony_ci	cp $(NORMAL_UBOOT_DIR)/$(UBOOT_VER)/u-boot-$(CHIP).bin $(OSDRV_DIR)/out/boot
612fe4e5f8Sopenharmony_ci	cp $(NORMAL_UBOOT_DIR)/$(UBOOT_VER)/u-boot-$(CHIP).bin  $(OSDRV_DIR)/secureboot_release
622fe4e5f8Sopenharmony_ci
632fe4e5f8Sopenharmony_cihiboot_clean:
642fe4e5f8Sopenharmony_ci	@cd $(NORMAL_UBOOT_DIR)/$(UBOOT_VER)/;make distclean
652fe4e5f8Sopenharmony_ci	@echo "---------boot clean"
662fe4e5f8Sopenharmony_ci
672fe4e5f8Sopenharmony_ci##########################################################################################
682fe4e5f8Sopenharmony_ci##task [2] make hipctools
692fe4e5f8Sopenharmony_ci##########################################################################################
702fe4e5f8Sopenharmony_cihipctools:prepare
712fe4e5f8Sopenharmony_ci	@echo "---------task [2] build tools run on pc"
722fe4e5f8Sopenharmony_ci
732fe4e5f8Sopenharmony_cihipctools_clean:
742fe4e5f8Sopenharmony_ci
752fe4e5f8Sopenharmony_ci##########################################################################################
762fe4e5f8Sopenharmony_ci#task [4]	clean out
772fe4e5f8Sopenharmony_ci##########################################################################################
782fe4e5f8Sopenharmony_cipub_clean:
792fe4e5f8Sopenharmony_ci	rm $(OSDRV_DIR)/out/* -rf
802fe4e5f8Sopenharmony_ci
812fe4e5f8Sopenharmony_cibuild_done:
822fe4e5f8Sopenharmony_ci	@echo "------- osdrv build done -------"
832fe4e5f8Sopenharmony_ci
842fe4e5f8Sopenharmony_ciclean_done:
852fe4e5f8Sopenharmony_ci	@echo "------- clean done -------"
862fe4e5f8Sopenharmony_ci
87