c8e4777a363411dd5efa9945c397c63ca9fa8d1a
[oweals/openwrt.git] / target / linux / bcm53xx / image / Makefile
1 #
2 # Copyright (C) 2013 OpenWrt.org
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 Image/Prepare
11         rm -f $(KDIR)/fs_mark
12         echo -ne '\xde\xad\xc0\xde' > $(KDIR)/fs_mark
13         $(call prepare_generic_squashfs,$(KDIR)/fs_mark)
14
15         # For UBI we want only one extra block
16         rm -f $(KDIR)/ubi_mark
17         echo -ne '\xde\xad\xc0\xde' > $(KDIR)/ubi_mark
18 endef
19
20 define Build/lzma-d16
21         $(STAGING_DIR_HOST)/bin/lzma e $@ -d16 $(1) $@.new
22         mv $@.new $@
23 endef
24
25 define Build/trx-serial
26         $(STAGING_DIR_HOST)/bin/trx \
27                 -o $@.new \
28                 -m 33554432 \
29                 -f $(IMAGE_KERNEL) -a 1024 \
30                 -f $@ -a 0x10000 -A $(KDIR)/fs_mark
31         mv $@.new $@
32 endef
33
34 define Build/trx-nand
35         # kernel: always use 4 MiB (-28 B or TRX header) to allow upgrades even
36         #         if it grows up between releases
37         # root: UBI with one extra block containing UBI mark to trigger erasing
38         #       rest of partition
39         $(STAGING_DIR_HOST)/bin/trx \
40                 -o $@.new \
41                 -m 33554432 \
42                 -f $(IMAGE_KERNEL) -a 0x20000 -b 0x400000 \
43                 -f $@ \
44                 -A $(KDIR)/ubi_mark -a 0x20000
45         mv $@.new $@
46 endef
47
48 define Build/asus-trx
49         $(STAGING_DIR_HOST)/bin/asustrx \
50                 -p $(PRODUCTID) -i $@ -o $@.new
51         mv $@.new $@
52 endef
53
54 define Build/seama-nand
55         # Seama entity
56         $(STAGING_DIR_HOST)/bin/oseama \
57                 entity $@.entity \
58                 -m "dev=/dev/mtdblock/7" \
59                 -m "type=firmware" \
60                 -f $(IMAGE_KERNEL) \
61                 -b 0x400000 \
62                 -f $@ \
63                 -f $(KDIR)/ubi_mark
64         # Seama container
65         $(STAGING_DIR_HOST)/bin/seama \
66                 -s $@ \
67                 -m "signature=$(SIGNATURE)" \
68                 -i $@.entity
69 endef
70
71 DEVICE_VARS += PRODUCTID SIGNATURE NETGEAR_BOARD_ID NETGEAR_REGION
72
73 BRCMFMAC_43602A1 := kmod-brcmfmac brcmfmac-firmware-43602a1-pcie
74 BRCMFMAC_4366B1 := kmod-brcmfmac brcmfmac-firmware-4366b1-pcie
75 USB2_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-phy-bcm-ns-usb2
76 USB2_PACKAGES += kmod-usb-ledtrig-usbport
77 USB3_PACKAGES := $(USB2_PACKAGES) kmod-usb3 kmod-phy-bcm-ns-usb3
78
79 define Device/Default
80   # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names
81   # extract the full dtb name based on the device info
82   DEVICE_DTS := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(1).dtb)))
83   KERNEL := kernel-bin | append-dtb | lzma-d16
84   KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
85   FILESYSTEMS := squashfs
86   KERNEL_NAME := zImage
87   IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
88   IMAGES := trx
89   BLOCKSIZE := 128k
90   PAGESIZE := 2048
91   IMAGE/trx := append-ubi | trx-nand
92 endef
93
94 define Device/asus
95   IMAGES := trx
96   IMAGE/trx := append-ubi | trx-nand | asus-trx
97 endef
98
99 define Device/asus-rt-ac56u
100   DEVICE_TITLE := Asus RT-AC56U
101   DEVICE_PACKAGES := kmod-b43 $(USB3_PACKAGES)
102 endef
103 TARGET_DEVICES += asus-rt-ac56u
104
105 define Device/asus-rt-ac68u
106   DEVICE_TITLE := Asus RT-AC68U
107   DEVICE_PACKAGES := $(USB3_PACKAGES)
108 endef
109 TARGET_DEVICES += asus-rt-ac68u
110
111 define Device/asus-rt-ac87u
112   DEVICE_TITLE := Asus RT-AC87U
113   DEVICE_PACKAGES := $(USB3_PACKAGES)
114 endef
115 TARGET_DEVICES += asus-rt-ac87u
116
117 define Device/asus-rt-n18u
118   DEVICE_TITLE := Asus RT-N18U
119   DEVICE_PACKAGES := $(USB3_PACKAGES)
120 endef
121 TARGET_DEVICES += asus-rt-n18u
122
123 define Device/buffalo-wxr-1900dhp
124   DEVICE_TITLE := Buffalo WXR-1900DHP
125   DEVICE_PACKAGES := $(USB3_PACKAGES)
126 endef
127 TARGET_DEVICES += buffalo-wxr-1900dhp
128
129 define Device/buffalo-wzr-600dhp2
130   DEVICE_TITLE := Buffalo WZR-600DHP2
131   DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES)
132 endef
133 TARGET_DEVICES += buffalo-wzr-600dhp2
134
135 define Device/buffalo-wzr-900dhp
136   DEVICE_TITLE := Buffalo WZR-900DHP
137   DEVICE_PACKAGES := kmod-b43 $(USB3_PACKAGES)
138 endef
139 TARGET_DEVICES += buffalo-wzr-900dhp
140
141 define Device/buffalo-wzr-1750dhp
142   DEVICE_TITLE := Buffalo WZR-1750DHP
143   DEVICE_PACKAGES := kmod-b43 $(USB3_PACKAGES)
144 endef
145 TARGET_DEVICES += buffalo-wzr-1750dhp
146
147 define Device/dlink
148   IMAGES := bin
149   IMAGE/bin := append-ubi | seama-nand
150 endef
151
152 define Device/dlink-dir-885l
153   DEVICE_TITLE := D-Link DIR-885L
154   DEVICE_PACKAGES := $(BRCMFMAC_4366B1) $(USB3_PACKAGES)
155   $(Device/dlink)
156   SIGNATURE := wrgac42_dlink.2015_dir885l
157 endef
158 TARGET_DEVICES += dlink-dir-885l
159
160 define Device/linksys-ea6300-v1
161   DEVICE_TITLE := Linksys EA6300 V1
162   DEVICE_PACKAGES := kmod-b43 $(USB3_PACKAGES)
163 endef
164 TARGET_DEVICES += linksys-ea6300-v1
165
166 define Device/netgear
167   IMAGES := chk
168   IMAGE/chk := append-ubi | trx-nand | netgear-chk
169   NETGEAR_REGION := 1
170 endef
171
172 define Device/netgear-r6250
173   DEVICE_TITLE := Netgear R6250
174   DEVICE_PACKAGES := kmod-b43 $(USB3_PACKAGES)
175   $(Device/netgear)
176   NETGEAR_BOARD_ID := U12H245T00_NETGEAR
177 endef
178
179 define Device/netgear-r6300-v2
180   DEVICE_TITLE := Netgear R6300 V2
181   DEVICE_PACKAGES := kmod-b43 $(USB3_PACKAGES)
182   $(Device/netgear)
183   NETGEAR_BOARD_ID := U12H240T00_NETGEAR
184 endef
185
186 define Device/netgear-r7000
187   DEVICE_TITLE := Netgear R7000
188   DEVICE_PACKAGES := $(USB3_PACKAGES)
189   $(Device/netgear)
190   NETGEAR_BOARD_ID := U12H270T00_NETGEAR
191 endef
192 TARGET_DEVICES += netgear-r7000
193
194 define Device/netgear-r7900
195   DEVICE_TITLE := Netgear R7900
196   DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
197   $(Device/netgear)
198   NETGEAR_BOARD_ID := U12H315T30_NETGEAR
199 endef
200 TARGET_DEVICES += netgear-r7900
201
202 define Device/netgear-r8000
203   DEVICE_TITLE := Netgear R8000
204   DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
205   $(Device/netgear)
206   NETGEAR_BOARD_ID := U12H315T00_NETGEAR
207 endef
208
209 define Device/netgear-r8500
210   DEVICE_TITLE := Netgear R8500
211   DEVICE_PACKAGES := $(BRCMFMAC_4366B1) $(USB3_PACKAGES)
212   $(Device/netgear)
213   NETGEAR_BOARD_ID := U12H334T00_NETGEAR
214 endef
215 # TARGET_DEVICES += netgear-r8500
216
217 define Device/smartrg-sr400ac
218   DEVICE_TITLE := SmartRG SR400ac
219   DEVICE_PACKAGES := $(BRCMFMAC_43602A1) $(USB3_PACKAGES)
220   IMAGES := trx
221   IMAGE/trx := append-rootfs | trx-serial
222 endef
223
224 define Device/tenda-ac9
225   DEVICE_TITLE := Tenda AC9
226   DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES)
227   IMAGES := trx
228   IMAGE/trx := append-rootfs | trx-serial
229 endef
230 TARGET_DEVICES += tenda-ac9
231
232 TARGET_DEVICES += \
233         netgear-r6250 netgear-r6300-v2 netgear-r8000 \
234         smartrg-sr400ac
235
236 $(eval $(call BuildImage))