8e85f768480c41734f19098368182c87ccf86f0c
[openwrt/openwrt.git] / target / linux / layerscape / image / Makefile
1 #
2 # Copyright (C) 2016 Jiang Yutang <jiangyutang1978@gmail.com>
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 ITB_BOARDS = traverse-five64
11
12 define Build/append-ls-rcw
13 rm -f $@
14 dd if=$(STAGING_DIR_IMAGE)/$(1)-rcw.bin >> $@
15 endef
16
17 define Build/append-ls-uboot
18 dd if=$(STAGING_DIR_IMAGE)/$(1)-uboot.bin >> $@
19 endef
20
21 define Build/append-ls-ppa
22 dd if=$(STAGING_DIR_IMAGE)/$(1)-ppa.itb >> $@
23 endef
24
25 define Build/append-ls-fman
26 dd if=$(STAGING_DIR_IMAGE)/$(1)-fman.bin >> $@
27 endef
28
29 define Build/append-ls-mc
30 dd if=$(STAGING_DIR_IMAGE)/$(1)-mc.itb >> $@
31 endef
32
33 define Build/append-ls-ppfe
34 dd if=$(STAGING_DIR_IMAGE)/pfe.itb >> $@
35 endef
36
37 define Build/append-ls-dpl
38 dd if=$(STAGING_DIR_IMAGE)/$(1)-dpl.dtb >> $@
39 endef
40
41 define Build/append-ls-dpc
42 dd if=$(STAGING_DIR_IMAGE)/$(1)-dpc.dtb >> $@
43 endef
44
45 define Build/append-ls-dtb
46 $(call Image/BuildDTB,$(DTS_DIR)/$(1).dts,$(DTS_DIR)/$(1).dtb)
47 dd if=$(DTS_DIR)/$(1).dtb >> $@
48 endef
49
50 define Build/traverse-fit
51 ./mkits-multiple-config.sh -o $@.its -A $(LINUX_KARCH) -v $(LINUX_VERSION) \
52 -k $@ -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
53 -C gzip -c 1 -c 2 \
54 -d $(DEVICE_DTS_DIR)/freescale/traverse-ls1043s.dtb -D "Traverse_LS1043S" -n "ls1043s" -a $(FDT_LOADADDR) -c 1 \
55 -d $(DEVICE_DTS_DIR)/freescale/traverse-ls1043v.dtb -D "Traverse_LS1043V" -n "ls1043v" -a $(FDT_LOADADDR) -c 2
56 PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
57 @mv -f $@.new $@
58 endef
59
60 define Device/Default
61 PROFILES = Default
62 FILESYSTEMS := squashfs
63 DEVICE_DTS :=
64 IMAGES = firmware.bin
65
66 ifeq ($(SUBTARGET),armv8_64b)
67 KERNEL := kernel-bin | gzip | uImage gzip
68 KERNEL_LOADADDR = 0x80080000
69 KERNEL_ENTRY_POINT = 0x80080000
70 endif
71 ifeq ($(SUBTARGET),armv8_32b)
72 KERNEL := kernel-bin | uImage none
73 KERNEL_NAME := zImage
74 KERNEL_LOADADDR = 0x80008000
75 KERNEL_ENTRY_POINT = 0x80008000
76 endif
77 FDT_LOADADDR = 0x90000000
78 endef
79
80 define Device/ls1043ardb
81 DEVICE_TITLE := ls1043ardb-$(SUBTARGET)
82 DEVICE_PACKAGES += layerscape-rcw-ls1043ardb layerscape-fman-ls1043ardb \
83 layerscape-ppa-ls1043ardb
84 ifeq ($(SUBTARGET),armv8_32b)
85 DEVICE_PACKAGES += u-boot-ls1043ardb-image
86 endif
87 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1043a-rdb-sdk
88 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
89 append-ls-uboot $(1) | pad-to 4M | \
90 append-ls-ppa $(1) | pad-to 9M | \
91 append-ls-fman $(1) | pad-to 15M | \
92 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
93 append-kernel | pad-to 32M | \
94 append-rootfs | pad-rootfs | check-size 67108865
95 endef
96 TARGET_DEVICES += ls1043ardb
97
98 define Device/ls1046ardb
99 DEVICE_TITLE := ls1046ardb-$(SUBTARGET)
100 DEVICE_PACKAGES += layerscape-rcw-ls1046ardb layerscape-fman-ls1046ardb \
101 layerscape-ppa-ls1046ardb
102 ifeq ($(SUBTARGET),armv8_32b)
103 DEVICE_PACKAGES += u-boot-ls1046ardb-image
104 endif
105 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1046a-rdb-sdk
106 FILESYSTEMS := ubifs
107 UBIFS_OPTS := -m 1 -e 262016 -c 128
108 UBINIZE_OPTS := -E 5
109 BLOCKSIZE := 256KiB
110 PAGESIZE := 1
111 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
112 append-ls-uboot $(1) | pad-to 4M | \
113 append-ls-ppa $(1) | pad-to 9M | \
114 append-ls-fman $(1) | pad-to 15M | \
115 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
116 append-kernel | pad-to 32M | \
117 append-ubi | check-size 67108865
118 endef
119 TARGET_DEVICES += ls1046ardb
120
121 define Device/ls1012ardb
122 DEVICE_TITLE := ls1012ardb-$(SUBTARGET)
123 DEVICE_PACKAGES += layerscape-rcw-ls1012ardb layerscape-ppfe \
124 layerscape-ppa-ls1012ardb kmod-ppfe
125 ifeq ($(SUBTARGET),armv8_32b)
126 DEVICE_PACKAGES += u-boot-ls1012ardb-image
127 endif
128 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1012a-rdb
129 FILESYSTEMS := ubifs
130 UBIFS_OPTS := -m 1 -e 262016 -c 128
131 UBINIZE_OPTS := -E 5
132 BLOCKSIZE := 256KiB
133 PAGESIZE := 1
134 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
135 append-ls-uboot $(1) | pad-to 4M | \
136 append-ls-ppa $(1) | pad-to 10M | \
137 append-ls-ppfe | pad-to 15M | \
138 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
139 append-kernel | pad-to 32M | \
140 append-ubi | check-size 67108865
141 endef
142 TARGET_DEVICES += ls1012ardb
143
144 define Device/ls1012afrdm
145 DEVICE_TITLE := ls1012afrdm-$(SUBTARGET)
146 DEVICE_PACKAGES += layerscape-rcw-ls1012afrdm layerscape-ppfe \
147 layerscape-ppa-ls1012afrdm kmod-ppfe
148 ifeq ($(SUBTARGET),armv8_32b)
149 DEVICE_PACKAGES += u-boot-ls1012afrdm-image
150 endif
151 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1012a-frdm
152 FILESYSTEMS := ubifs
153 UBIFS_OPTS := -m 1 -e 262016 -c 128
154 UBINIZE_OPTS := -E 5
155 BLOCKSIZE := 256KiB
156 PAGESIZE := 1
157 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
158 append-ls-uboot $(1) | pad-to 4M | \
159 append-ls-ppa $(1) | pad-to 10M | \
160 append-ls-ppfe | pad-to 15M | \
161 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
162 append-kernel | pad-to 32M | \
163 append-ubi | check-size 67108865
164 endef
165 TARGET_DEVICES += ls1012afrdm
166
167 ifeq ($(SUBTARGET),armv8_64b)
168 define Device/ls1088ardb
169 DEVICE_TITLE := ls1088ardb-$(SUBTARGET)
170 DEVICE_PACKAGES += layerscape-rcw-ls1088ardb uboot-layerscape-$(SUBTARGET)-ls1088ardb \
171 layerscape-mc-ls1088ardb layerscape-dpl-ls1088ardb restool \
172 layerscape-ppa-ls1088ardb
173 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1088a-rdb
174 FILESYSTEMS := ubifs
175 UBIFS_OPTS := -m 1 -e 262016 -c 128
176 UBINIZE_OPTS := -E 5
177 BLOCKSIZE := 256KiB
178 PAGESIZE := 1
179 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
180 append-ls-uboot $(1) | pad-to 4M | \
181 append-ls-ppa $(1) | pad-to 10M | \
182 append-ls-mc $(1) | pad-to 13M | \
183 append-ls-dpl $(1) | pad-to 14M | \
184 append-ls-dpc $(1) | pad-to 15M | \
185 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
186 append-kernel | pad-to 32M | \
187 append-ubi | check-size 67108865
188 endef
189 TARGET_DEVICES += ls1088ardb
190
191 define Device/ls2088ardb
192 DEVICE_TITLE := ls2088ardb-$(SUBTARGET)
193 DEVICE_PACKAGES += layerscape-rcw-ls2088ardb uboot-layerscape-$(SUBTARGET)-ls2088ardb \
194 layerscape-mc-ls2088ardb layerscape-dpl-ls2088ardb restool \
195 layerscape-ppa-ls2088ardb
196 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls2088a-rdb
197 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
198 append-ls-uboot $(1) | pad-to 4M | \
199 append-ls-ppa $(1) | pad-to 10M | \
200 append-ls-mc $(1) | pad-to 13M | \
201 append-ls-dpl $(1) | pad-to 14M | \
202 append-ls-dpc $(1) | pad-to 15M | \
203 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
204 append-kernel | pad-to 32M | \
205 append-rootfs | pad-rootfs | check-size 67108865
206 endef
207 TARGET_DEVICES += ls2088ardb
208 endif
209
210 define Device/traverse-five64
211 KERNEL_NAME := Image
212 KERNEL_SUFFIX := -kernel.itb
213 KERNEL_INSTALL := 1
214 FILESYSTEMS := ubifs
215 DEVICE_TITLE := Traverse LS1043 Boards (Five64, LS1043S)
216 DEVICE_PACKAGES += layerscape-fman-ls1043ardb kmod-i2c-core kmod-rtc-isl1208 uboot-envtools \
217 uboot-traverse-ls1043v uboot-traverse-ls1043v-sdcard \
218 kmod-hwmon-core kmod-hwmon-ltc2990 kmod-gpio-pca953x kmod-input-gpio-keys-polled \
219 kmod-i2c-mux-pca954x kmod-hwmon-pac1934 kmod-hwmon-emc17xx
220 DEVICE_DESCRIPTION = Build images for Traverse LS1043 boards. This generates a single image \
221 capable of booting on any of the boards in this family.
222 DEVICE_DTS = freescale/traverse-ls1043s
223 DEVICE_DTS_DIR = $(LINUX_DIR)/arch/arm64/boot/dts
224 DEVICE_DTS_CONFIG = ls1043s
225 KERNEL := kernel-bin | gzip | traverse-fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb $$(FDT_LOADADDR)
226 KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb $$(FDT_LOADADDR)
227 IMAGES = root sysupgrade.tar
228 IMAGE/root = append-rootfs
229 IMAGE/sysupgrade.tar = sysupgrade-tar
230 UBIFS_OPTS := -m 2048 -e 124KiB -c 4096
231 endef
232 TARGET_DEVICES += traverse-five64
233
234 $(eval $(call BuildImage))