bcm53xx: add profile with brcmfmac for Netgear R7900
[openwrt/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 define Device/Default
74 # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names
75 # extract the full dtb name based on the device info
76 DEVICE_DTS := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(1).dtb)))
77 KERNEL := kernel-bin | append-dtb | lzma-d16
78 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
79 FILESYSTEMS := squashfs
80 KERNEL_NAME := zImage
81 IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
82 IMAGES := trx
83 BLOCKSIZE := 128KiB
84 PAGESIZE := 2048
85 UBINIZE_OPTS :=
86 IMAGE/trx := append-ubi | trx-nand
87 endef
88
89 define Device/asus
90 IMAGES := trx
91 IMAGE/trx := append-ubi | trx-nand | asus-trx
92 endef
93
94 define AsusDevice
95 define Device/asus-$(1)
96 $$(Device/asus)
97 PRODUCTID := $(2)
98 endef
99 TARGET_DEVICES += asus-$(1)
100 endef
101
102 define LinksysDevice
103 TARGET_DEVICES += linksys-$(1)
104 endef
105
106 define Device/dlink
107 IMAGES := bin
108 IMAGE/bin := append-ubi | seama-nand
109 endef
110
111 define DLinkDevice
112 define Device/dlink-$(1)
113 $$(Device/dlink)
114 SIGNATURE := $(2)
115 endef
116 TARGET_DEVICES += dlink-$(1)
117 endef
118
119 define Device/dlink-dir-885l
120 DEVICE_TITLE := D-Link DIR-885L
121 DEVICE_PACKAGES := kmod-brcmfmac
122 $(Device/dlink)
123 SIGNATURE := wrgac42_dlink.2015_dir885l
124 endef
125 TARGET_DEVICES += dlink-dir-885l
126
127 define Device/netgear
128 IMAGES := chk
129 IMAGE/chk := append-ubi | trx-nand | netgear-chk
130 NETGEAR_REGION := 1
131 endef
132
133 define NetgearDevice
134 define Device/netgear-$(1)
135 $$(Device/netgear)
136 NETGEAR_BOARD_ID := $(2)
137 endef
138 TARGET_DEVICES += netgear-$(1)
139 endef
140
141 define Device/netgear-r6250
142 $(Device/netgear)
143 NETGEAR_BOARD_ID := U12H245T00_NETGEAR
144 endef
145
146 define Device/netgear-r6300-v2
147 $(Device/netgear)
148 NETGEAR_BOARD_ID := U12H240T00_NETGEAR
149 endef
150
151 define Device/netgear-r7900
152 DEVICE_TITLE := Netgear R7900
153 DEVICE_PACKAGES := kmod-brcmfmac
154 $(Device/netgear)
155 NETGEAR_BOARD_ID := U12H315T30_NETGEAR
156 endef
157 TARGET_DEVICES += netgear-r7900
158
159 define Device/netgear-r8000
160 DEVICE_TITLE := Netgear R8000
161 DEVICE_PACKAGES := kmod-brcmfmac
162 $(Device/netgear)
163 NETGEAR_BOARD_ID := U12H315T00_NETGEAR
164 endef
165
166 define Device/smartrg-sr400ac
167 DEVICE_TITLE := SmartRG SR400ac
168 DEVICE_PACKAGES := kmod-brcmfmac
169 IMAGES := trx
170 IMAGE/trx := append-rootfs | trx-serial
171 endef
172
173 TARGET_DEVICES += \
174 buffalo-wzr-1750dhp buffalo-wzr-600dhp2 buffalo-wzr-900dhp \
175 buffalo-wxr-1900dhp \
176 netgear-r6250 netgear-r6300-v2 netgear-r8000 \
177 smartrg-sr400ac
178
179 $(eval $(call AsusDevice,rt-ac56u,RT-AC56U))
180 $(eval $(call AsusDevice,rt-ac68u,RT-AC68U))
181 $(eval $(call AsusDevice,rt-ac87u,RT-AC87U))
182 $(eval $(call AsusDevice,rt-n18u,RT-N18U))
183 $(eval $(call LinksysDevice,ea6300-v1))
184 $(eval $(call NetgearDevice,r7000,U12H270T00_NETGEAR))
185 # $(eval $(call NetgearDevice,r8500,U12H334T00_NETGEAR))
186
187 $(eval $(call BuildImage))