6f4a909eff6661ad28b0d19f3084f8c1c387c50c
[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 #################################################
11 # Images
12 #################################################
13
14 define Image/boot-imgs
15 # Copy zImage to BIN_DIR
16 $(CP) $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
17
18 $(call Image/BuildKernel/MkuImage, none, $(KERNEL_LOADADDR), \
19 $(KERNEL_ENTRY_POINT), $(KDIR)/zImage, \
20 $(BIN_DIR)/$(IMG_PREFIX)-uImage)
21
22 $(call Image/BuildDTB,$(DTS_DIR)/$(DEVICE_DTS).dts,\
23 $(BIN_DIR)/$(IMG_PREFIX)-system.dtb)
24
25 $(call Image/mkfs/cpiogz)
26 $(call Image/mkfs/targz)
27
28 # Create uboot cpio.gz
29 mkimage -A arm -T ramdisk -C gzip -n "$(PROFILE) OpenWRT rootfs" \
30 -d $(BIN_DIR)/$(IMG_PREFIX)-rootfs.cpio.gz \
31 $(BIN_DIR)/$(IMG_PREFIX)-uramdisk.image.gz
32
33 # create FIT image with rootfs
34 ./mkits.sh \
35 -D $(DEVICE_LC) -o $(KDIR)/fit-$(DEVICE_LC).its -k $(KDIR)/zImage \
36 -d $(BIN_DIR)/$(IMG_PREFIX)-system.dtb \
37 -C none -a $(KERNEL_LOADADDR) -e $(KERNEL_ENTRY_POINT) \
38 -A $(ARCH) -v $(LINUX_VERSION) \
39 -r $(BIN_DIR)/$(IMG_PREFIX)-rootfs.cpio.gz -z gzip
40 PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/fit-$(DEVICE_LC).its $(KDIR)/fit-$(DEVICE_LC).itb
41 $(CP) $(KDIR)/fit-$(DEVICE_LC).itb $(BIN_DIR)/$(IMG_PREFIX)-fit.itb
42 ln -fs $(IMG_PREFIX)-fit.itb $(BIN_DIR)/fit.itb
43
44 endef
45
46 #################################################
47 # Devices
48 #################################################
49
50 # default kernel load address
51 KERNEL_LOADADDR=0x8000
52 KERNEL_ENTRY_POINT=0x8000
53
54 ### Device macros ###
55 define Device/Default
56 IMG_PREFIX := zynq
57 PROFILE_SANITIZED :=
58 endef
59
60 define Device/DefaultConfig
61 DEVICE_LC = $(1)
62 IMG_PREFIX = zynq-$(1)
63 DEVICE_DTS = zynq-$(1)
64 endef
65
66 ### ZC702 ###
67 define Device/ZC702
68 $(call Device/DefaultConfig,zc702)
69 endef
70
71 define Device/ZED
72 $(call Device/DefaultConfig,zed)
73 endef
74
75 define Device/ZYBO
76 $(call Device/DefaultConfig,zybo)
77 endef
78
79 define Image/BuildKernel
80 $(eval $(call Device/$(PROFILE)))
81 $(call Image/boot-imgs)
82 endef
83
84 $(eval $(call BuildImage))