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