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