layerscape: add multiple-configuration generator for FIT images
[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 define Build/append-ls-rcw
11 rm -f $@
12 dd if=$(STAGING_DIR_IMAGE)/$(1)-rcw.bin >> $@
13 endef
14
15 define Build/append-ls-uboot
16 dd if=$(STAGING_DIR_IMAGE)/$(1)-$(SUBTARGET)-uboot.bin >> $@
17 endef
18
19 define Build/append-ls-ppa
20 dd if=$(STAGING_DIR_IMAGE)/$(1)-ppa.itb >> $@
21 endef
22
23 define Build/append-ls-fman
24 dd if=$(STAGING_DIR_IMAGE)/$(1)-fman.bin >> $@
25 endef
26
27 define Build/append-ls-mc
28 dd if=$(STAGING_DIR_IMAGE)/$(1)-mc.itb >> $@
29 endef
30
31 define Build/append-ls-ppfe
32 dd if=$(STAGING_DIR_IMAGE)/pfe.itb >> $@
33 endef
34
35 define Build/append-ls-dpl
36 dd if=$(STAGING_DIR_IMAGE)/$(1)-dpl.dtb >> $@
37 endef
38
39 define Build/append-ls-dpc
40 dd if=$(STAGING_DIR_IMAGE)/$(1)-dpc.dtb >> $@
41 endef
42
43 define Build/append-ls-dtb
44 $(call Image/BuildDTB,$(DTS_DIR)/$(1).dts,$(DTS_DIR)/$(1).dtb)
45 dd if=$(DTS_DIR)/$(1).dtb >> $@
46 endef
47
48 define Device/Default
49 PROFILES = Default
50 FILESYSTEMS := squashfs
51 DEVICE_DTS :=
52 IMAGES = firmware.bin
53
54 ifeq ($(SUBTARGET),armv8_64b)
55 KERNEL := kernel-bin | gzip | uImage gzip
56 KERNEL_LOADADDR = 0x80080000
57 KERNEL_ENTRY_POINT = 0x80080000
58 endif
59 ifeq ($(SUBTARGET),armv8_32b)
60 KERNEL := kernel-bin | uImage none
61 KERNEL_NAME := zImage
62 KERNEL_LOADADDR = 0x80008000
63 KERNEL_ENTRY_POINT = 0x80008000
64 endif
65 endef
66
67 define Device/ls1043ardb
68 DEVICE_TITLE := ls1043ardb-$(SUBTARGET)
69 DEVICE_PACKAGES += rcw-layerscape-ls1043ardb uboot-layerscape-$(SUBTARGET)-ls1043ardb \
70 fman-layerscape-ls1043ardb layerscape-ppa-ls1043ardb
71 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1043a-rdb-sdk
72 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
73 append-ls-uboot $(1) | pad-to 4M | \
74 append-ls-ppa $(1) | pad-to 9M | \
75 append-ls-fman $(1) | pad-to 15M | \
76 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
77 append-kernel | pad-to 32M | \
78 append-rootfs | pad-rootfs | check-size 67108865
79 endef
80 TARGET_DEVICES += ls1043ardb
81
82 define Device/ls1046ardb
83 DEVICE_TITLE := ls1046ardb-$(SUBTARGET)
84 DEVICE_PACKAGES += rcw-layerscape-ls1046ardb uboot-layerscape-$(SUBTARGET)-ls1046ardb \
85 fman-layerscape-ls1046ardb layerscape-ppa-ls1046ardb
86 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1046a-rdb-sdk
87 FILESYSTEMS := ubifs
88 UBIFS_OPTS := -m 1 -e 262016 -c 128
89 UBINIZE_OPTS := -E 5
90 BLOCKSIZE := 256KiB
91 PAGESIZE := 1
92 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
93 append-ls-uboot $(1) | pad-to 4M | \
94 append-ls-ppa $(1) | pad-to 9M | \
95 append-ls-fman $(1) | pad-to 15M | \
96 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
97 append-kernel | pad-to 32M | \
98 append-ubi | check-size 67108865
99 endef
100 TARGET_DEVICES += ls1046ardb
101
102 define Device/ls1012ardb
103 DEVICE_TITLE := ls1012ardb-$(SUBTARGET)
104 DEVICE_PACKAGES += rcw-layerscape-ls1012ardb uboot-layerscape-$(SUBTARGET)-ls1012ardb \
105 kmod-ppfe layerscape-ppfe layerscape-ppa-ls1012ardb
106 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1012a-rdb
107 FILESYSTEMS := ubifs
108 UBIFS_OPTS := -m 1 -e 262016 -c 128
109 UBINIZE_OPTS := -E 5
110 BLOCKSIZE := 256KiB
111 PAGESIZE := 1
112 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
113 append-ls-uboot $(1) | pad-to 4M | \
114 append-ls-ppa $(1) | pad-to 10M | \
115 append-ls-ppfe | pad-to 15M | \
116 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
117 append-kernel | pad-to 32M | \
118 append-ubi | check-size 67108865
119 endef
120 TARGET_DEVICES += ls1012ardb
121
122 define Device/ls1012afrdm
123 DEVICE_TITLE := ls1012afrdm-$(SUBTARGET)
124 DEVICE_PACKAGES += rcw-layerscape-ls1012afrdm uboot-layerscape-$(SUBTARGET)-ls1012afrdm \
125 kmod-ppfe layerscape-ppfe layerscape-ppa-ls1012afrdm
126 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1012a-frdm
127 FILESYSTEMS := ubifs
128 UBIFS_OPTS := -m 1 -e 262016 -c 128
129 UBINIZE_OPTS := -E 5
130 BLOCKSIZE := 256KiB
131 PAGESIZE := 1
132 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
133 append-ls-uboot $(1) | pad-to 4M | \
134 append-ls-ppa $(1) | pad-to 10M | \
135 append-ls-ppfe | pad-to 15M | \
136 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
137 append-kernel | pad-to 32M | \
138 append-ubi | check-size 67108865
139 endef
140 TARGET_DEVICES += ls1012afrdm
141
142 ifeq ($(SUBTARGET),armv8_64b)
143 define Device/ls1088ardb
144 DEVICE_TITLE := ls1088ardb-$(SUBTARGET)
145 DEVICE_PACKAGES += rcw-layerscape-ls1088ardb uboot-layerscape-$(SUBTARGET)-ls1088ardb \
146 layerscape-mc-ls1088ardb layerscape-dpl-ls1088ardb restool \
147 layerscape-ppa-ls1088ardb
148 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1088a-rdb
149 FILESYSTEMS := ubifs
150 UBIFS_OPTS := -m 1 -e 262016 -c 128
151 UBINIZE_OPTS := -E 5
152 BLOCKSIZE := 256KiB
153 PAGESIZE := 1
154 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
155 append-ls-uboot $(1) | pad-to 4M | \
156 append-ls-ppa $(1) | pad-to 10M | \
157 append-ls-mc $(1) | pad-to 13M | \
158 append-ls-dpl $(1) | pad-to 14M | \
159 append-ls-dpc $(1) | pad-to 15M | \
160 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
161 append-kernel | pad-to 32M | \
162 append-ubi | check-size 67108865
163 endef
164 TARGET_DEVICES += ls1088ardb
165
166 define Device/ls2088ardb
167 DEVICE_TITLE := ls2088ardb-$(SUBTARGET)
168 DEVICE_PACKAGES += rcw-layerscape-ls2088ardb uboot-layerscape-$(SUBTARGET)-ls2088ardb \
169 layerscape-mc-ls2088ardb layerscape-dpl-ls2088ardb restool \
170 layerscape-ppa-ls2088ardb
171 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls2088a-rdb
172 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
173 append-ls-uboot $(1) | pad-to 4M | \
174 append-ls-ppa $(1) | pad-to 10M | \
175 append-ls-mc $(1) | pad-to 13M | \
176 append-ls-dpl $(1) | pad-to 14M | \
177 append-ls-dpc $(1) | pad-to 15M | \
178 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
179 append-kernel | pad-to 32M | \
180 append-rootfs | pad-rootfs | check-size 67108865
181 endef
182 TARGET_DEVICES += ls2088ardb
183 endif
184
185 $(eval $(call BuildImage))