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