92174db19a8e910bfa9613cef1219c92d1714413
[openwrt/openwrt.git] / target / linux / zynq / image / Makefile
1 #
2 # Copyright (C) 2015 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9
10 FAT32_BLOCK_SIZE=1024
11 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_TARGET_KERNEL_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
12
13 define Build/zynq-sdcard
14 rm -f $@.boot
15 mkfs.fat $@.boot -C $(FAT32_BLOCKS)
16 mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-boot.bin ::boot.bin
17 mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-u-boot.img ::u-boot.img
18 mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-uEnv.txt ::uEnv.txt
19 mcopy -i $@.boot $(IMAGE_KERNEL) ::fit.itb
20 ./gen_zynq_sdcard_img.sh $@ \
21 $@.boot \
22 $(IMAGE_ROOTFS) \
23 $(CONFIG_TARGET_KERNEL_PARTSIZE) \
24 $(CONFIG_TARGET_ROOTFS_PARTSIZE)
25 rm -f $@.boot
26 endef
27
28 #################################################
29 # Default and templates
30 #################################################
31
32 define Device/Default
33 PROFILES := Default
34 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
35 KERNEL_INITRAMFS_PREFIX := $$(IMG_PREFIX)-$(1)-initramfs
36 KERNEL_PREFIX := $$(IMAGE_PREFIX)
37 KERNEL_LOADADDR := 0x8000
38 IMAGES := sdcard.img.gz
39 IMAGE/sdcard.img.gz := zynq-sdcard | gzip
40 endef
41
42 define Device/FitImageGzip
43 KERNEL_SUFFIX := -fit-uImage.itb
44 KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
45 KERNEL_NAME := Image
46 endef
47
48 #################################################
49 # Devices
50 #################################################
51
52 define Device/digilent_zynq-zybo
53 $(call Device/FitImageGzip)
54 DEVICE_TITLE := ZYBO Development Board
55 DEVICE_DTS := zynq-zybo
56 endef
57 TARGET_DEVICES += digilent_zynq-zybo
58
59 define Device/digilent_zynq-zybo-z7
60 $(call Device/FitImageGzip)
61 DEVICE_TITLE := Digilent Zybo Z7 board
62 DEVICE_DTS := zynq-zybo-z7
63 endef
64 TARGET_DEVICES += digilent_zynq-zybo-z7
65
66 define Device/xlnx_zynq-zc702
67 $(call Device/FitImageGzip)
68 DEVICE_TITLE := ZC702 Development Board
69 DEVICE_DTS := zynq-zc702
70 endef
71 TARGET_DEVICES += xlnx_zynq-zc702
72
73 define Device/xlnx_zynq-zed
74 $(call Device/FitImageGzip)
75 DEVICE_TITLE := Zed Development Board
76 DEVICE_DTS := zynq-zed
77 endef
78 TARGET_DEVICES += xlnx_zynq-zed
79
80 $(eval $(call BuildImage))