-include Rules.make

MAKE_JOBS ?= 1

all: linux matrix-gui arm-benchmarks am-sysinfo oprofile-example matrix-gui-browser refresh-screen u-boot-spl ti-crypto-examples linux-dtbs cryptodev ti-sgx-ddk-km pru-icss barcode-roi uio-module-drv evse-hmi protection-relays-hmi 
clean: linux_clean matrix-gui_clean arm-benchmarks_clean am-sysinfo_clean oprofile-example_clean matrix-gui-browser_clean refresh-screen_clean u-boot-spl_clean ti-crypto-examples_clean linux-dtbs_clean cryptodev_clean ti-sgx-ddk-km_clean pru-icss_clean barcode-roi_clean uio-module-drv_clean evse-hmi_clean protection-relays-hmi_clean 
install: linux_install matrix-gui_install arm-benchmarks_install am-sysinfo_install oprofile-example_install matrix-gui-browser_install refresh-screen_install u-boot-spl_install ti-crypto-examples_install linux-dtbs_install cryptodev_install ti-sgx-ddk-km_install pru-icss_install barcode-roi_install uio-module-drv_install evse-hmi_install protection-relays-hmi_install 

# +++ Vern, basic setup,20181030	+++
Taurus-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/Taurus/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/Taurus/Images/

Taurus-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================	
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

Taurus-uboot: 
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[Taurus]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/Taurus/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/Taurus/Images/

Taurus-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/Taurus/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/Taurus/Images/

Taurus-linux: 
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb 
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[Taurus]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage 
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/Taurus/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/Taurus/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/
	

Taurus-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make all
	@cd EVSE/Modularization;make all
	@cd EVSE/Projects/Taurus/Apps;make all
	@rm -f EVSE/Projects/Taurus/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/Taurus/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/Taurus/Images/mnt
	@gunzip EVSE/Projects/Taurus/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/Taurus/Images/ramdisk EVSE/Projects/Taurus/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/Taurus/Images/mnt/
	@cp -rfv EVSE/Projects/Taurus/Images/root/* EVSE/Projects/Taurus/Images/mnt/root
	@chown www-data:www-data EVSE/Projects/Taurus/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/Taurus/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/Taurus/Images/mnt/var/run -R
	@sync
	@sleep 3
	@umount EVSE/Projects/Taurus/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/Taurus/Images/ramdisk
	@rm -rfv EVSE/Projects/Taurus/Images/root
	@rm -rfv EVSE/Projects/Taurus/Images/mnt
		
Taurus-all: Taurus-uboot Taurus-linux Taurus-rootfs

# --- Vern, basic setup,20181030	---

# +++ Vern,  add for DD360 ,20200908	+++
DD360-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DD360/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DD360/Images/

DD360-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================	
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

DD360-uboot:
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DD360]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DD360/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DD360/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/DD360/Images/

DD360-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/DD360/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/DD360/Images/

DD360-linux: 
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb 
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[DD360]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage 
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/DD360/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/DD360/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

DD360-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make Project=DD360 all
	@cd EVSE/Modularization;make Project=DD360 all
	@cd EVSE/Projects/DD360/Apps;make Project=DD360 all
	@rm -f EVSE/Projects/DD360/Images/ramdisk.gz
	@dd if=/dev/zero of=EVSE/Projects/DD360/Images/ramdisk bs=1k count=131072
	@losetup /dev/loop0 EVSE/Projects/DD360/Images/ramdisk
	@mke2fs -vm 0 /dev/loop0 131072
	@tune2fs -c 0 /dev/loop0
	@mkdir -p EVSE/Projects/DD360/Images/mnt
	@sync
	@mount -t ext2 /dev/loop0 EVSE/Projects/DD360/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/DD360/Images/mnt/
	@cp -rfv EVSE/Projects/DD360/Images/root/* EVSE/Projects/DD360/Images/mnt/root
	@chown www-data:www-data EVSE/Projects/DD360/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/DD360/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/DD360/Images/mnt/var/run -R
	@sync
	@sleep 3
	@umount EVSE/Projects/DD360/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/DD360/Images/ramdisk
	@sync
	@sleep 1
	@rm -rfv EVSE/Projects/DD360/Images/root
	@rm -rfv EVSE/Projects/DD360/Images/mnt
	@losetup /dev/loop0 -d
	@umount /dev/loop0	
		
DD360-all: DD360-uboot DD360-linux DD360-rootfs
# --- Vern,  add for DD360 ,20200908	---

# +++ Vern,  for all board ,20190430	+++
CCS-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/CCS/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/CCS/Images/

CCS-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================	
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

CCS-uboot: 
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[CCS]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/CCS/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/CCS/Images/

CCS-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/CCS/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/CCS/Images/

CCS-linux: 
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb 
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[CCS]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage 
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/CCS/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/CCS/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

CCS-rootfs-old:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make all
#	@cd EVSE/Modularization;make all
	@cd EVSE/Projects/CCS/Apps;make all
	@rm -f EVSE/Projects/CCS/Images/ramdisk.gz
	@dd if=/dev/zero of=EVSE/Projects/CCS/Images/ramdisk bs=1k count=131072
	@losetup /dev/loop0 EVSE/Projects/CCS/Images/ramdisk
	@mke2fs -vm 0 /dev/loop0 131072
	@tune2fs -c 0 /dev/loop0
	@mkdir -p EVSE/Projects/CCS/Images/mnt
	@sync
	@mount -t ext2 /dev/loop0 EVSE/Projects/CCS/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/CCS/Images/mnt/
	@cp -rfv EVSE/Projects/CCS/Images/root/* EVSE/Projects/CCS/Images/mnt/root
	@chown www-data:www-data EVSE/Projects/CCS/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/CCS/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/CCS/Images/mnt/var/run -R
	@sync
	@sleep 3
	@umount EVSE/Projects/CCS/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/CCS/Images/ramdisk
	@sync
	@sleep 1
	@rm -rfv EVSE/Projects/CCS/Images/root
	@rm -rfv EVSE/Projects/CCS/Images/mnt
	@losetup /dev/loop0 -d
	@umount /dev/loop0

CCS-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make all
#	@cd EVSE/Modularization;make all
	@cd EVSE/Projects/CCS/Apps;make all
	@rm -f EVSE/Projects/CCS/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/CCS/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/CCS/Images/mnt
	@gunzip EVSE/Projects/CCS/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/CCS/Images/ramdisk EVSE/Projects/CCS/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/CCS/Images/mnt/
	@cp -rfv EVSE/Projects/CCS/Images/root/* EVSE/Projects/CCS/Images/mnt/root
	@chown www-data:www-data EVSE/Projects/CCS/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/CCS/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/CCS/Images/mnt/var/run -R
	@sync
	@sleep 3
	@umount EVSE/Projects/CCS/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/CCS/Images/ramdisk
	@rm -rfv EVSE/Projects/CCS/Images/root
	@rm -rfv EVSE/Projects/CCS/Images/mnt
		
CCS-all: CCS-uboot CCS-linux CCS-rootfs

DM30-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DM30/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DM30/Images/

DM30-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================	
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

DM30-uboot: 
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DM30]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DM30/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DM30/Images/

DM30-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/DM30/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/DM30/Images/

DM30-linux: 
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb 
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[DM30]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage 
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/DM30/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/DM30/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

DM30-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make all
	@cd EVSE/Modularization;make Project=DM30 all
	@cd EVSE/Projects/DM30/Apps;make Project=DM30 Project_Debug_Option=0 all
	@rm -f EVSE/Projects/DM30/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/DM30/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/DM30/Images/mnt
	@gunzip EVSE/Projects/DM30/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/DM30/Images/ramdisk EVSE/Projects/DM30/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/DM30/Images/mnt/
	@cp -rfv EVSE/Projects/DM30/Images/root/* EVSE/Projects/DM30/Images/mnt/root
	@chown www-data:www-data EVSE/Projects/DM30/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/DM30/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/DM30/Images/mnt/var/run -R
	@sync
	@sleep 3
	@umount EVSE/Projects/DM30/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/DM30/Images/ramdisk
	@rm -rfv EVSE/Projects/DM30/Images/root
	@rm -rfv EVSE/Projects/DM30/Images/mnt
	
DM30-DEBUG-rootfs:
	@echo =================================
	@echo     Building DM30 debug rootfs
	@echo =================================
	@cd EVSE/Modularization;make Project=DM30 all
	@cd EVSE/Projects/DM30/Apps;make Project=DM30 Project_Debug_Option=1 all
	@rm -f EVSE/Projects/DM30/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/DM30/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/DM30/Images/mnt
	@gunzip EVSE/Projects/DM30/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/DM30/Images/ramdisk EVSE/Projects/DM30/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/DM30/Images/mnt/
	@cp -rfv EVSE/Projects/DM30/Images/root/* EVSE/Projects/DM30/Images/mnt/root
	@chown www-data:www-data EVSE/Projects/DM30/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/DM30/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/DM30/Images/mnt/var/run -R
	@sync
	@sleep 3
	@umount EVSE/Projects/DM30/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/DM30/Images/ramdisk
	@rm -rfv EVSE/Projects/DM30/Images/root
	@rm -rfv EVSE/Projects/DM30/Images/mnt
		
DM30-all: DM30-uboot DM30-linux DM30-rootfs

DW30-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================	
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

DW30-uboot: 
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DW30]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DW30/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DW30/Images/

DW30-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/DW30/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/DW30/Images/

DW30-linux: 
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb 
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[DW30]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage 
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/DW30/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/DW30/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

DW30-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make all
	@cd EVSE/Modularization;make Project=DW30 all
	@cd EVSE/Projects/DW30/Apps;make Project=DW30 Project_Debug_Option=0 all
	@rm -f EVSE/Projects/DW30/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/DW30/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/DW30/Images/mnt
	@gunzip EVSE/Projects/DW30/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/DW30/Images/ramdisk EVSE/Projects/DW30/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/DW30/Images/mnt/
	@cp -rfv EVSE/Projects/DW30/Images/root/* EVSE/Projects/DW30/Images/mnt/root
	@chown www-data:www-data EVSE/Projects/DW30/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/DW30/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/DW30/Images/mnt/var/run -R
	@sync
	@sleep 3
	@umount EVSE/Projects/DW30/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/DW30/Images/ramdisk
	@rm -rfv EVSE/Projects/DW30/Images/root
	@rm -rfv EVSE/Projects/DW30/Images/mnt

DW30-DEBUG-rootfs:
	@echo =================================
	@echo     Building DW30 debug rootfs
	@echo =================================
	@cd EVSE/Modularization;make Project=DW30 all
	@cd EVSE/Projects/DW30/Apps;make Project=DW30 Project_Debug_Option=1 all
	@rm -f EVSE/Projects/DW30/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/DW30/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/DW30/Images/mnt
	@gunzip EVSE/Projects/DW30/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/DW30/Images/ramdisk EVSE/Projects/DW30/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/DW30/Images/mnt/
	@cp -rfv EVSE/Projects/DW30/Images/root/* EVSE/Projects/DW30/Images/mnt/root
	@chown www-data:www-data EVSE/Projects/DW30/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/DW30/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/DW30/Images/mnt/var/run -R
	@sync
	@sleep 3
	@umount EVSE/Projects/DW30/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/DW30/Images/ramdisk
	@rm -rfv EVSE/Projects/DW30/Images/root
	@rm -rfv EVSE/Projects/DW30/Images/mnt

DW30-all: DW30-uboot DW30-linux DW30-rootfs

DS60-120-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DS60-120/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DS60-120/Images/

DS60-120-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================	
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

DS60-120-uboot: 
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DS60-120]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DS60-120/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DS60-120/Images/

DS60-120-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/DS60-120/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/DS60-120/Images/

DS60-120-linux: 
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb 
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[DS60-120]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage 
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/DS60-120/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/DS60-120/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

DS60-120-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make all
	@cd EVSE/Modularization;make Project=DS60120 all
	@cd EVSE/Projects/DS60-120/Apps;make Project=DS60120 all
	@rm -f EVSE/Projects/DS60-120/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/DS60-120/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/DS60-120/Images/mnt
	@gunzip EVSE/Projects/DS60-120/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/DS60-120/Images/ramdisk EVSE/Projects/DS60-120/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/DS60-120/Images/mnt/
	@cp -rfv EVSE/Projects/DS60-120/Images/root/* EVSE/Projects/DS60-120/Images/mnt/root
	@chown www-data:www-data EVSE/Projects/DS60-120/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/DS60-120/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/DS60-120/Images/mnt/var/run -R
	@sync
	@sleep 3
	@umount EVSE/Projects/DS60-120/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/DS60-120/Images/ramdisk
	@rm -rfv EVSE/Projects/DS60-120/Images/root
	@rm -rfv EVSE/Projects/DS60-120/Images/mnt
		
DS60-120-all: DS60-120-uboot DS60-120-linux DS60-120-rootfs

AW-Regular-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/AW-Regular/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/AW-Regular/Images/

AW-Regular-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================	
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

AW-Regular-uboot: 
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[AW-Regular]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/AW-Regular/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/AW-Regular/Images/

AW-Regular-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/AW-Regular/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/AW-Regular/Images/

AW-Regular-linux: 
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb 
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[AW-Regular]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage 
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/AW-Regular/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/AW-Regular/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

AW-Regular-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make all
	@cd EVSE/Modularization;make Project=AWRegular all
	@cd EVSE/Projects/AW-Regular/Apps;make Project=AWRegular all
	@rm -f EVSE/Projects/AW-Regular/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/AW-Regular/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/AW-Regular/Images/mnt
	@gunzip EVSE/Projects/AW-Regular/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/AW-Regular/Images/ramdisk EVSE/Projects/AW-Regular/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/AW-Regular/Images/mnt/
	@chown www-data:www-data EVSE/Projects/AW-Regular/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/AW-Regular/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/AW-Regular/Images/mnt/var/run -R
	@cp -rfv EVSE/Projects/AW-Regular/Images/root/* EVSE/Projects/AW-Regular/Images/mnt/root
	@sync
	@sleep 3
	@umount EVSE/Projects/AW-Regular/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/AW-Regular/Images/ramdisk
	@rm -rfv EVSE/Projects/AW-Regular/Images/root
	@rm -rfv EVSE/Projects/AW-Regular/Images/mnt
		
AW-Regular-all: AW-Regular-uboot AW-Regular-linux AW-Regular-rootfs

BYTON-GB-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/BYTON-GB/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/BYTON-GB/Images/

BYTON-GB-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================	
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

BYTON-GB-uboot: 
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[BYTON-GB]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/BYTON-GB/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/BYTON-GB/Images/

BYTON-GB-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/BYTON-GB/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/BYTON-GB/Images/

BYTON-GB-linux: 
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb 
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[BYTON-GB]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage 
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/BYTON-GB/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/BYTON-GB/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

BYTON-GB-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make all
	@cd EVSE/Modularization;make Project=BYTONGB all
	@cd EVSE/Projects/BYTON-GB/Apps;make Project=BYTONGB all
	@rm -f EVSE/Projects/BYTON-GB/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/BYTON-GB/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/BYTON-GB/Images/mnt
	@gunzip EVSE/Projects/BYTON-GB/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/BYTON-GB/Images/ramdisk EVSE/Projects/BYTON-GB/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/BYTON-GB/Images/mnt/
	@cp -rfv EVSE/Projects/BYTON-GB/Images/root/* EVSE/Projects/BYTON-GB/Images/mnt/root
	@chown www-data:www-data EVSE/Projects/BYTON-GB/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/BYTON-GB/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/BYTON-GB/Images/mnt/var/run -R	
	@sync
	@sleep 3
	@umount EVSE/Projects/BYTON-GB/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/BYTON-GB/Images/ramdisk
	@rm -rfv EVSE/Projects/BYTON-GB/Images/root
	@rm -rfv EVSE/Projects/BYTON-GB/Images/mnt
		
BYTON-GB-all: BYTON-GB-uboot BYTON-GB-linux BYTON-GB-rootfs

# --- Vern, for all board ,20190430 	---

# +++ vern,Add menuconfig,20161128	+++
linux_config: 
	@echo =================================
	@echo     Configuring the Linux Kernel
	@echo =================================
#	$(MAKE) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) $(DEFCONFIG)
	$(MAKE) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) menuconfig
# --- vern,Add menuconfig,20161128	---

# Kernel build targets
linux: linux-dtbs
	@echo =================================
	@echo     Building the Linux Kernel
	@echo =================================

	$(MAKE) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) $(DEFCONFIG)
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules

linux_install: linux-dtbs_install
	@echo ===================================
	@echo     Installing the Linux Kernel
	@echo ===================================
	@if [ ! -d $(DESTDIR) ] ; then \
		echo "The extracted target filesystem directory doesn't exist."; \
		echo "Please run setup.sh in the SDK's root directory and then try again."; \
		exit 1; \
	fi
	install -d $(DESTDIR)/boot
	install $(LINUXKERNEL_INSTALL_DIR)/arch/arm/boot/zImage $(DESTDIR)/boot
	install $(LINUXKERNEL_INSTALL_DIR)/vmlinux $(DESTDIR)/boot
	install $(LINUXKERNEL_INSTALL_DIR)/System.map $(DESTDIR)/boot
	$(MAKE) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) INSTALL_MOD_PATH=$(DESTDIR) modules_install

linux_clean:
	@echo =================================
	@echo     Cleaning the Linux Kernel
	@echo =================================
	$(MAKE) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) mrproper
# Make Rules for matrix-gui project
matrix-gui:
	@echo =============================
	@echo      Building Matrix GUI
	@echo =============================
	@echo    NOTHING TO DO.  COMPILATION NOT REQUIRED

matrix-gui_clean:
	@echo =============================
	@echo      Cleaning Matrix GUI
	@echo =============================
	@echo    NOTHING TO DO.

matrix-gui_install:
	@echo =============================
	@echo     Installing Matrix GUI
	@echo =============================
	@cd example-applications; cd `find . -name "*matrix-gui-2.0*"`; make install
# arm-benchmarks build targets
arm-benchmarks:
	@echo =============================
	@echo    Building ARM Benchmarks
	@echo =============================
	@cd example-applications; cd `find . -name "*arm-benchmarks*"`; make

arm-benchmarks_clean:
	@echo =============================
	@echo    Cleaning ARM Benchmarks
	@echo =============================
	@cd example-applications; cd `find . -name "*arm-benchmarks*"`; make clean

arm-benchmarks_install:
	@echo ==============================================
	@echo   Installing ARM Benchmarks - Release version
	@echo ==============================================
	@cd example-applications; cd `find . -name "*arm-benchmarks*"`; make install

arm-benchmarks_install_debug:
	@echo ============================================
	@echo   Installing ARM Benchmarks - Debug Version
	@echo ============================================
	@cd example-applications; cd `find . -name "*arm-benchmarks*"`; make install_debug
# am-sysinfo build targets
am-sysinfo:
	@echo =============================
	@echo    Building AM Sysinfo
	@echo =============================
	@cd example-applications; cd `find . -name "*am-sysinfo*"`; make

am-sysinfo_clean:
	@echo =============================
	@echo    Cleaning AM Sysinfo
	@echo =============================
	@cd example-applications; cd `find . -name "*am-sysinfo*"`; make clean

am-sysinfo_install:
	@echo ===============================================
	@echo     Installing AM Sysinfo - Release version
	@echo ===============================================
	@cd example-applications; cd `find . -name "*am-sysinfo*"`; make install

am-sysinfo_install_debug:
	@echo =============================================
	@echo     Installing AM Sysinfo - Debug version
	@echo =============================================
	@cd example-applications; cd `find . -name "*am-sysinfo*"`; make install_debug
# matrix-gui-browser build targets
matrix-gui-browser:
	@echo =================================
	@echo    Building Matrix GUI Browser
	@echo =================================
	@cd example-applications; cd `find . -name "*matrix-gui-browser*"`; make -f Makefile.build release

matrix-gui-browser_clean:
	@echo =================================
	@echo    Cleaning Matrix GUI Browser
	@echo =================================
	@cd example-applications; cd `find . -name "*matrix-gui-browser*"`; make -f Makefile.build clean

matrix-gui-browser_install:
	@echo ===================================================
	@echo   Installing Matrix GUI Browser - Release version
	@echo ===================================================
	@cd example-applications; cd `find . -name "*matrix-gui-browser*"`; make -f Makefile.build install

matrix-gui-browser_install_debug:
	@echo =================================================
	@echo   Installing Matrix GUI Browser - Debug Version
	@echo =================================================
	@cd example-applications; cd `find . -name "*matrix-gui-browser*"`; make -f Makefile.build install_debug
# refresh-screen build targets
refresh-screen:
	@echo =============================
	@echo    Building Refresh Screen
	@echo =============================
	@cd example-applications; cd `find . -name "*refresh-screen*"`; make -f Makefile.build release

refresh-screen_clean:
	@echo =============================
	@echo    Cleaning Refresh Screen
	@echo =============================
	@cd example-applications; cd `find . -name "*refresh-screen*"`; make -f Makefile.build clean

refresh-screen_install:
	@echo ================================================
	@echo   Installing Refresh Screen - Release version
	@echo ================================================
	@cd example-applications; cd `find . -name "*refresh-screen*"`; make -f Makefile.build install

refresh-screen_install_debug:
	@echo ==============================================
	@echo   Installing Refresh Screen - Debug Version
	@echo ==============================================
	@cd example-applications; cd `find . -name "*refresh-screen*"`; make -f Makefile.build install_debug
# QT Thermostat build targets
qt-tstat:
	@echo ================================
	@echo    Building QT Thermostat App
	@echo ================================
	@cd example-applications; cd `find . -name "*qt-tstat*"`; make -f Makefile.build release

qt-tstat_clean:
	@echo ================================
	@echo    Cleaning QT Thermostat App
	@echo ================================
	@cd example-applications; cd `find . -name "*qt-tstat*"`; make -f Makefile.build clean

qt-tstat_install:
	@echo ===================================================
	@echo   Installing QT Thermostat App - Release version
	@echo ===================================================
	@cd example-applications; cd `find . -name "*qt-tstat*"`; make -f Makefile.build install

qt-tstat_install_debug:
	@echo =================================================
	@echo   Installing QT Thermostat App - Debug version
	@echo =================================================
	@cd example-applications; cd `find . -name "*qt-tstat*"`; make -f Makefile.build install_debug
# oprofile-example build targets
oprofile-example:
	@echo =============================
	@echo    Building OProfile Example
	@echo =============================
	@cd example-applications; cd `find . -name "*oprofile-example*"`; make

oprofile-example_clean:
	@echo =============================
	@echo    Cleaning OProfile Example
	@echo =============================
	@cd example-applications; cd `find . -name "*oprofile-example*"`; make clean

oprofile-example_install:
	@echo =============================================
	@echo     Installing OProfile Example - Debug version
	@echo =============================================
	@cd example-applications; cd `find . -name "*oprofile-example*"`; make install
# u-boot build targets
u-boot-spl: u-boot
u-boot-spl_clean: u-boot_clean
u-boot-spl_install: u-boot_install

u-boot:
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) $(UBOOT_MACHINE)
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)

u-boot_clean:
	@echo ===================================
	@echo    Cleaining U-boot
	@echo ===================================
	$(MAKE) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) distclean

u-boot_install:
	@echo ===================================
	@echo    Installing U-boot
	@echo ===================================
	@echo "Nothing to do"
# Quick Playground build targets
quick-playground:
	@echo =================================
	@echo    Building Quick Playground App
	@echo =================================
	@cd example-applications; cd `find . -name "*quick-playground*"`; make -f Makefile.build

quick-playground_clean:
	@echo =================================
	@echo    Cleaning Quick Playground App
	@echo =================================
	@cd example-applications; cd `find . -name "*quick-playground*"`; make -f Makefile.build clean

quick-playground_install:
	@echo ====================================================
	@echo   Installing Quick Playground App - Release version
	@echo ====================================================
	@cd example-applications; cd `find . -name "*quick-playground*"`; make -f Makefile.build install

quick-playground_install_debug:
	@echo ==================================================
	@echo   Installing Quick Playground App - Debug version
	@echo ==================================================
	@cd example-applications; cd `find . -name "*quick-playground*"`; make -f Makefile.build install_debug
# ti-crypto-examples build targets
ti-crypto-examples:
	@echo =================================
	@echo    Building TI Crypto Examples
	@echo =================================
	@cd example-applications; cd `find . -name "*ti-crypto-examples*"`; make release

ti-crypto-examples_clean:
	@echo =================================
	@echo    Cleaning TI Crypto Examples
	@echo =================================
	@cd example-applications; cd `find . -name "*ti-crypto-examples*"`; make clean

ti-crypto-examples_install:
	@echo ===================================================
	@echo   Installing TI Crypto Examples - Release version
	@echo ===================================================
	@cd example-applications; cd `find . -name "*ti-crypto-examples*"`; make install

ti-crypto-examples_install_debug:
	@echo =================================================
	@echo   Installing TI Crypto Examples - Debug Version
	@echo =================================================
	@cd example-applications; cd `find . -name "*ti-crypto-examples*"`; make install_debug
# Kernel DTB build targets
linux-dtbs:
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	$(MAKE) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) $(DEFCONFIG)
# +++ vern,only one dtb is enough,20161128	+++
#	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb am335x-evmsk.dtb am335x-bone.dtb am335x-boneblack.dtb
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
# --- vern,only one dtb is enough,20161128	---

linux-dtbs_install:
	@echo =======================================
	@echo     Installing the Linux Kernel DTBs
	@echo =======================================
	@if [ ! -d $(DESTDIR) ] ; then \
		echo "The extracted target filesystem directory doesn't exist."; \
		echo "Please run setup.sh in the SDK's root directory and then try again."; \
		exit 1; \
	fi
	install -d $(DESTDIR)/boot
# +++ vern,only one dtb is enough,20161128	+++	
#	@cp -f $(LINUXKERNEL_INSTALL_DIR)/arch/arm/boot/dts/*.dtb $(DESTDIR)/boot/
	@cp -f $(LINUXKERNEL_INSTALL_DIR)/arch/arm/boot/dts/am335x-evm.dtb $(DESTDIR)/boot/
# --- vern,only one dtb is enough,20161128	---
linux-dtbs_clean:
	@echo =======================================
	@echo     Cleaning the Linux Kernel DTBs
	@echo =======================================
	@echo "Nothing to do"

# Wireless build targets
wireless: wifi-firmware
wireless_install: wifi-firmware_install
wireless_clean: wifi-firmware_clean

wifi-firmware:
	@echo ================================
	@echo      Building wifi firmware
	@echo ================================
	@echo "Nothing to do"

wifi-firmware_install:
	@echo ==================================
	@echo      Installing wifi firmware
	@echo ==================================
	@cd board-support/extra-drivers; \
	cd `find . -maxdepth 1 -name "wl18xx-firmware*"`; \
	make DEST_DIR=${DESTDIR} install

wifi-firmware_clean:
	@echo ================================
	@echo      Cleaning wifi firmware
	@echo ================================
	@echo "Nothing to do" 
cryptodev: linux
	@echo ================================
	@echo      Building cryptodev-linux
	@echo ================================
	@cd board-support/extra-drivers; \
	cd `find . -maxdepth 1 -name "cryptodev*"`; \
	make ARCH=arm KERNEL_DIR=$(LINUXKERNEL_INSTALL_DIR)

cryptodev_clean:
	@echo ================================
	@echo      Cleaning cryptodev-linux
	@echo ================================
	@cd board-support/extra-drivers; \
	cd `find . -maxdepth 1 -name "cryptodev*"`; \
	make ARCH=arm KERNEL_DIR=$(LINUXKERNEL_INSTALL_DIR) clean

cryptodev_install:
	@echo ================================
	@echo      Installing cryptodev-linux
	@echo ================================
	@if [ ! -d $(DESTDIR) ] ; then \
		echo "The extracted target filesystem directory doesn't exist."; \
		echo "Please run setup.sh in the SDK's root directory and then try again."; \
		exit 1; \
	fi
	@cd board-support/extra-drivers; \
	cd `find . -maxdepth 1 -name "cryptodev*"`; \
	make ARCH=arm  KERNEL_DIR=$(LINUXKERNEL_INSTALL_DIR)  INSTALL_MOD_PATH=$(DESTDIR) PREFIX=$(SDK_PATH_TARGET)  install

Noodoe-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/Noodoe/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/Noodoe/Images/

Noodoe-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

Noodoe-uboot:
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[Noodoe]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/Noodoe/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/Noodoe/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/Noodoe/Images/

Noodoe-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/Noodoe/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/Noodoe/Images/

Noodoe-linux:
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[Noodoe]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/Noodoe/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/Noodoe/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

Noodoe-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make Project=Noodoe all
	@cd EVSE/Modularization;make Project=Noodoe all
	@cd EVSE/Projects/Noodoe/Apps;make Project=Noodoe all
	@rm -f EVSE/Projects/Noodoe/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/Noodoe/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/Noodoe/Images/mnt
	@gunzip EVSE/Projects/Noodoe/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/Noodoe/Images/ramdisk EVSE/Projects/Noodoe/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/Noodoe/Images/mnt/
	@chown www-data:www-data EVSE/Projects/Noodoe/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/Noodoe/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/Noodoe/Images/mnt/var/run -R
	@cp -rfv EVSE/Projects/Noodoe/Images/root/* EVSE/Projects/Noodoe/Images/mnt/root
	@sync
	@sleep 3
	@umount EVSE/Projects/Noodoe/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/Noodoe/Images/ramdisk
	@rm -rfv EVSE/Projects/Noodoe/Images/root
	@rm -rfv EVSE/Projects/Noodoe/Images/mnt

Noodoe-all: Noodoe-uboot Noodoe-linux Noodoe-rootfs


PlugIt360-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/PlugIt360/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/PlugIt360/Images/

PlugIt360-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

PlugIt360-uboot:
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[PlugIt360]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/PlugIt360/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/PlugIt360/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/PlugIt360/Images/

PlugIt360-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/PlugIt360/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/PlugIt360/Images/

PlugIt360-linux:
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[PlugIt360]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/PlugIt360/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/PlugIt360/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

PlugIt360-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make Project=PlugIt360 all
	@cd EVSE/Modularization;make Project=PlugIt360 all
	@cd EVSE/Projects/PlugIt360/Apps;make Project=PlugIt360 all
	@rm -f EVSE/Projects/PlugIt360/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/PlugIt360/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/PlugIt360/Images/mnt
	@gunzip EVSE/Projects/PlugIt360/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/PlugIt360/Images/ramdisk EVSE/Projects/PlugIt360/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/PlugIt360/Images/mnt/
	@chown www-data:www-data EVSE/Projects/PlugIt360/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/PlugIt360/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/PlugIt360/Images/mnt/var/run -R
	@cp -rfv EVSE/Projects/PlugIt360/Images/root/* EVSE/Projects/PlugIt360/Images/mnt/root
	@sync
	@sleep 3
	@umount EVSE/Projects/PlugIt360/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/PlugIt360/Images/ramdisk
	@rm -rfv EVSE/Projects/PlugIt360/Images/root
	@rm -rfv EVSE/Projects/PlugIt360/Images/mnt

PlugIt360-all: PlugIt360-uboot PlugIt360-linux PlugIt360-rootfs


AW-CCS-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/AW-CCS/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/AW-CCS/Images/

AW-CCS-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

AW-CCS-uboot:
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[AW-CCS]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/AW-CCS/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/AW-CCS/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/AW-CCS/Images/

AW-CCS-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/AW-CCS/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/AW-CCS/Images/

AW-CCS-linux:
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[AW-CCS]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/AW-CCS/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/AW-CCS/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

AW-CCS-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make Project=AWCCS all
	@cd EVSE/Modularization;make Project=AWCCS all
	@cd EVSE/Projects/AW-CCS/Apps;make Project=AWCCS all
	@rm -f EVSE/Projects/AW-CCS/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/AW-CCS/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/AW-CCS/Images/mnt
	@gunzip EVSE/Projects/AW-CCS/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/AW-CCS/Images/ramdisk EVSE/Projects/AW-CCS/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/AW-CCS/Images/mnt/
	@chown www-data:www-data EVSE/Projects/AW-CCS/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/AW-CCS/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/AW-CCS/Images/mnt/var/run -R
	@cp -rfv EVSE/Projects/AW-CCS/Images/root/* EVSE/Projects/AW-CCS/Images/mnt/root
	@sync
	@sleep 3
	@umount EVSE/Projects/AW-CCS/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/AW-CCS/Images/ramdisk
	@rm -rfv EVSE/Projects/AW-CCS/Images/root
	@rm -rfv EVSE/Projects/AW-CCS/Images/mnt

AW-CCS-all: AW-CCS-uboot AW-CCS-linux AW-CCS-rootfs

DO360-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DO360/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DO360/Images/

DO360-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

DO360-uboot:
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DO360]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DO360/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DO360/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/DO360/Images/

DO360-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/DO360/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/DO360/Images/

DO360-linux:
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[DO360]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/DO360/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/DO360/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

DO360-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make Project=DO360 all
	@cd EVSE/Modularization;make Project=DO360 all
	@cd EVSE/Projects/DO360/Apps;make Project=DO360 all
	@rm -f EVSE/Projects/DO360/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/DO360/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/DO360/Images/mnt
	@gunzip EVSE/Projects/DO360/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/DO360/Images/ramdisk EVSE/Projects/DO360/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/DO360/Images/mnt/
	@chown www-data:www-data EVSE/Projects/DO360/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/DO360/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/DO360/Images/mnt/var/run -R
	@cp -rfv EVSE/Projects/DO360/Images/root/* EVSE/Projects/DO360/Images/mnt/root
	@sync
	@sleep 3
	@umount EVSE/Projects/DO360/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/DO360/Images/ramdisk
	@rm -rfv EVSE/Projects/DO360/Images/root
	@rm -rfv EVSE/Projects/DO360/Images/mnt

DO360-all: DO360-uboot DO360-linux DO360-rootfs


ATE-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/ATE/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/ATE/Images/

ATE-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

ATE-uboot:
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[ATE]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/ATE/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/ATE/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/ATE/Images/

ATE-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/ATE/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/ATE/Images/

ATE-linux:
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[ATE]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/ATE/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/ATE/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

ATE-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make Project=ATE all
	@cd EVSE/Modularization;make Project=ATE all
	@cd EVSE/Projects/ATE/Apps;make Project=ATE all
	@rm -f EVSE/Projects/ATE/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/ATE/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/ATE/Images/mnt
	@gunzip EVSE/Projects/ATE/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/ATE/Images/ramdisk EVSE/Projects/ATE/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/ATE/Images/mnt/
	@chown www-data:www-data EVSE/Projects/ATE/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/ATE/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/ATE/Images/mnt/var/run -R
	@cp -rfv EVSE/Projects/ATE/Images/root/* EVSE/Projects/ATE/Images/mnt/root
	@sync
	@sleep 3
	@umount EVSE/Projects/ATE/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/ATE/Images/ramdisk
	@rm -rfv EVSE/Projects/ATE/Images/root
	@rm -rfv EVSE/Projects/ATE/Images/mnt

ATE-all: ATE-uboot ATE-linux ATE-rootfs


Zanobe-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/Zanobe/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/Zanobe/Images/

Zanobe-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

Zanobe-uboot:
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[Zanobe]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/Zanobe/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/Zanobe/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/Zanobe/Images/

Zanobe-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/Zanobe/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/Zanobe/Images/

Zanobe-linux:
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[Zanobe]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/Zanobe/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/Zanobe/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

Zanobe-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make Project=Zanobe all
	@cd EVSE/Modularization;make Project=Zanobe all
	@cd EVSE/Projects/Zanobe/Apps;make Project=Zanobe all
	@rm -f EVSE/Projects/Zanobe/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/Zanobe/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/Zanobe/Images/mnt
	@gunzip EVSE/Projects/Zanobe/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/Zanobe/Images/ramdisk EVSE/Projects/Zanobe/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/Zanobe/Images/mnt/
	@chown www-data:www-data EVSE/Projects/Zanobe/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/Zanobe/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/Zanobe/Images/mnt/var/run -R
	@cp -rfv EVSE/Projects/Zanobe/Images/root/* EVSE/Projects/Zanobe/Images/mnt/root
	@sync
	@sleep 3
	@umount EVSE/Projects/Zanobe/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/Zanobe/Images/ramdisk
	@rm -rfv EVSE/Projects/Zanobe/Images/root
	@rm -rfv EVSE/Projects/Zanobe/Images/mnt

Zanobe-all: Zanobe-uboot Zanobe-linux Zanobe-rootfs


e4you-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/e4you/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/e4you/Images/

e4you-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

e4you-uboot:
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[e4you]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/e4you/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/e4you/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/e4you/Images/

e4you-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/e4you/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/e4you/Images/

e4you-linux:
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[e4you]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/e4you/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/e4you/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

e4you-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make Project=e4you all
	@cd EVSE/Modularization;make Project=e4you all
	@cd EVSE/Projects/e4you/Apps;make Project=e4you all
	@rm -f EVSE/Projects/e4you/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/e4you/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/e4you/Images/mnt
	@gunzip EVSE/Projects/e4you/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/e4you/Images/ramdisk EVSE/Projects/e4you/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/e4you/Images/mnt/
	@chown www-data:www-data EVSE/Projects/e4you/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/e4you/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/e4you/Images/mnt/var/run -R
	@cp -rfv EVSE/Projects/e4you/Images/root/* EVSE/Projects/e4you/Images/mnt/root
	@sync
	@sleep 3
	@umount EVSE/Projects/e4you/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/e4you/Images/ramdisk
	@rm -rfv EVSE/Projects/e4you/Images/root
	@rm -rfv EVSE/Projects/e4you/Images/mnt

e4you-all: e4you-uboot e4you-linux e4you-rootfs


DD360Audi-uboot-default: u-boot_clean u-boot
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DD360Audi/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DD360Audi/Images/

DD360Audi-uboot-menuconfig:
	@echo ===================================
	@echo    Building U-boot menuconfig
	@echo ===================================
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig

DD360Audi-uboot:
	@echo ===================================
	@echo    Building U-boot
	@echo ===================================
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DD360Audi]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE)
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DD360Audi/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DD360Audi/Images/
	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/DD360Audi/Images/

DD360Audi-linux-default: linux_clean linux
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/DD360Audi/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/DD360Audi/Images/

DD360Audi-linux:
	@echo =====================================
	@echo     Building the Linux Kernel DTBs
	@echo =====================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[DD360Audi]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
	@echo =================================
	@echo     Building User Linux Kernel
	@echo =================================
	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/DD360Audi/Images/
	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/DD360Audi/Images/
#	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/

DD360Audi-rootfs:
	@echo =================================
	@echo     Building User rootfs
	@echo =================================
#	@cd EVSE/GPL;make Project=DD360Audi all
	@cd EVSE/Modularization;make Project=DD360Audi all
	@cd EVSE/Projects/DD360Audi/Apps;make Project=DD360Audi all
	@rm -f EVSE/Projects/DD360Audi/Images/ramdisk.gz
	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
	@mke2fs -vm0 /dev/ram0 131072
	@tune2fs -c 0 /dev/ram0
	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/DD360Audi/Images/ramdisk.gz
	@mkdir -p EVSE/Projects/DD360Audi/Images/mnt
	@gunzip EVSE/Projects/DD360Audi/Images/ramdisk.gz
	@sync
	@mount -o loop EVSE/Projects/DD360Audi/Images/ramdisk EVSE/Projects/DD360Audi/Images/mnt
	@cp -rfv EVSE/rootfs/* EVSE/Projects/DD360Audi/Images/mnt/
	@chown www-data:www-data EVSE/Projects/DD360Audi/Images/mnt/var/www -R
	@chmod 777 EVSE/Projects/DD360Audi/Images/mnt/var/log -R
	@chmod 777 EVSE/Projects/DD360Audi/Images/mnt/var/run -R
	@cp -rfv EVSE/Projects/DD360Audi/Images/root/* EVSE/Projects/DD360Audi/Images/mnt/root
	@sync
	@sleep 3
	@umount EVSE/Projects/DD360Audi/Images/mnt
	@sync
	@gzip -v9 EVSE/Projects/DD360Audi/Images/ramdisk
	@rm -rfv EVSE/Projects/DD360Audi/Images/root
	@rm -rfv EVSE/Projects/DD360Audi/Images/mnt

DD360Audi-all: DD360Audi-uboot DD360Audi-linux DD360Audi-rootfs