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