88bf8d7b4064d0e5bd636a5b28b630f71b0355fd
[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 Build/append-ls-rootfs-ext4
49 $(STAGING_DIR_HOST)/bin/make_ext4fs -l $(word 2,$(1)) -b 4096 -i 6000 -m 0 -J $(KDIR)/$(word 1,$(1))-$(word 2,$(1)).root.ext4 $(TARGET_DIR)
50 dd if=$(KDIR)/$(word 1,$(1))-$(word 2,$(1)).root.ext4 >> $@
51 endef
52
53 define Device/Default
54 PROFILES = Default
55 FILESYSTEMS := squashfs
56 DEVICE_DTS :=
57 IMAGES = firmware.bin
58
59 ifeq ($(SUBTARGET),armv8_64b)
60 KERNEL := kernel-bin | gzip | uImage gzip
61 KERNEL_LOADADDR = 0x80080000
62 KERNEL_ENTRY_POINT = 0x80080000
63 endif
64 ifeq ($(SUBTARGET),armv8_32b)
65 KERNEL := kernel-bin | uImage none
66 KERNEL_NAME := zImage
67 KERNEL_LOADADDR = 0x80008000
68 KERNEL_ENTRY_POINT = 0x80008000
69 endif
70 endef
71
72 define Device/ls1043ardb
73 DEVICE_TITLE := ls1043ardb-$(SUBTARGET)
74 DEVICE_PACKAGES += rcw-layerscape-ls1043ardb uboot-layerscape-$(SUBTARGET)-ls1043ardb \
75 fman-layerscape-ls1043ardb layerscape-ppa-ls1043ardb
76 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1043a-rdb-sdk
77 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
78 append-ls-uboot $(1) | pad-to 4M | \
79 append-ls-ppa $(1) | pad-to 9M | \
80 append-ls-fman $(1) | pad-to 15M | \
81 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
82 append-kernel | pad-to 32M | \
83 append-rootfs | pad-rootfs | check-size 67108865
84 endef
85 TARGET_DEVICES += ls1043ardb
86
87 define Device/ls1046ardb
88 DEVICE_TITLE := ls1046ardb-$(SUBTARGET)
89 DEVICE_PACKAGES += rcw-layerscape-ls1046ardb uboot-layerscape-$(SUBTARGET)-ls1046ardb \
90 fman-layerscape-ls1046ardb layerscape-ppa-ls1046ardb
91 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1046a-rdb-sdk
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-ls-rootfs-ext4 $(1) 30M | 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 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
108 append-ls-uboot $(1) | pad-to 4M | \
109 append-ls-ppa $(1) | pad-to 10M | \
110 append-ls-ppfe | pad-to 15M | \
111 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
112 append-kernel | pad-to 32M | \
113 append-ls-rootfs-ext4 $(1) 30M | check-size 67108865
114 endef
115 TARGET_DEVICES += ls1012ardb
116
117 define Device/ls1012afrdm
118 DEVICE_TITLE := ls1012afrdm-$(SUBTARGET)
119 DEVICE_PACKAGES += rcw-layerscape-ls1012afrdm uboot-layerscape-$(SUBTARGET)-ls1012afrdm \
120 kmod-ppfe layerscape-ppfe layerscape-ppa-ls1012afrdm
121 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1012a-frdm
122 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
123 append-ls-uboot $(1) | pad-to 4M | \
124 append-ls-ppa $(1) | pad-to 10M | \
125 append-ls-ppfe | pad-to 15M | \
126 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
127 append-kernel | pad-to 32M | \
128 append-ls-rootfs-ext4 $(1) 30M | check-size 67108865
129 endef
130 TARGET_DEVICES += ls1012afrdm
131
132 ifeq ($(SUBTARGET),armv8_64b)
133 define Device/ls1088ardb
134 DEVICE_TITLE := ls1088ardb-$(SUBTARGET)
135 DEVICE_PACKAGES += rcw-layerscape-ls1088ardb uboot-layerscape-$(SUBTARGET)-ls1088ardb \
136 layerscape-mc-ls1088ardb layerscape-dpl-ls1088ardb restool \
137 layerscape-ppa-ls1088ardb
138 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1088a-rdb
139 IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
140 append-ls-uboot $(1) | pad-to 4M | \
141 append-ls-ppa $(1) | pad-to 10M | \
142 append-ls-mc $(1) | pad-to 13M | \
143 append-ls-dpl $(1) | pad-to 14M | \
144 append-ls-dpc $(1) | pad-to 15M | \
145 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
146 append-kernel | pad-to 32M | \
147 append-ls-rootfs-ext4 $(1) 30M | check-size 67108865
148 endef
149 TARGET_DEVICES += ls1088ardb
150
151 define Device/ls2088ardb
152 DEVICE_TITLE := ls2088ardb-$(SUBTARGET)
153 DEVICE_PACKAGES += rcw-layerscape-ls2088ardb uboot-layerscape-$(SUBTARGET)-ls2088ardb \
154 layerscape-mc-ls2088ardb layerscape-dpl-ls2088ardb restool \
155 layerscape-ppa-ls2088ardb
156 DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls2088a-rdb
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-mc $(1) | pad-to 13M | \
161 append-ls-dpl $(1) | pad-to 14M | \
162 append-ls-dpc $(1) | pad-to 15M | \
163 append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
164 append-kernel | pad-to 32M | \
165 append-rootfs | pad-rootfs | check-size 67108865
166 endef
167 TARGET_DEVICES += ls2088ardb
168 endif
169
170 $(eval $(call BuildImage))