bcm53xx: start working on Netgear R8500
[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 $(CP) $(DTS_DIR)/*.dtb $(KDIR)/
12
13 rm -f $(KDIR)/fs_mark
14 echo -ne '\xde\xad\xc0\xde' > $(KDIR)/fs_mark
15 $(call prepare_generic_squashfs,$(KDIR)/fs_mark)
16
17 # For UBI we want only one extra block
18 rm -f $(KDIR)/ubi_mark
19 echo -ne '\xde\xad\xc0\xde' > $(KDIR)/ubi_mark
20
21 $(CP) ./ubinize.cfg $(KDIR)
22 endef
23
24 define Build/append-dtb
25 cat $(KDIR)/$(DT).dtb >> $@
26 endef
27
28 define Build/lzma-d16
29 $(STAGING_DIR_HOST)/bin/lzma e $@ -d16 $(1) $@.new
30 @mv $@.new $@
31 endef
32
33 define Build/mkfs/squashfs
34 ( cd $(KDIR); $(STAGING_DIR_HOST)/bin/ubinize -p 128KiB -m 2048 -o $(KDIR)/root-block-0x20000-min-0x800.ubi ubinize.cfg )
35 endef
36
37 define Build/trx-serial
38 $(STAGING_DIR_HOST)/bin/trx \
39 -o $@ \
40 -f $(word 1,$^) -a 1024 \
41 -f $(KDIR)/root.squashfs -a 0x10000 -A $(KDIR)/fs_mark
42 endef
43
44 define Build/trx-nand
45 # kernel: always use 4 MiB (-28 B or TRX header) to allow upgrades even
46 # if it grows up between releases
47 # root: UBI with one extra block containing UBI mark to trigger erasing
48 # rest of partition
49 $(STAGING_DIR_HOST)/bin/trx \
50 -o $@ \
51 -m 33554432 \
52 -f $(word 1,$^) -a 0x20000 -b 0x400000 \
53 -f $(KDIR)/root-block-0x20000-min-0x800.ubi \
54 -A $(KDIR)/ubi_mark -a 0x20000
55 endef
56
57 define Build/asus-trx
58 $(STAGING_DIR_HOST)/bin/asustrx \
59 -p $(PRODUCTID) -i $@ -o $@.new
60 mv $@.new $@
61 endef
62
63 define Build/seama-nand
64 # Seama entity
65 $(STAGING_DIR_HOST)/bin/oseama \
66 entity $@.entity \
67 -m "dev=/dev/mtdblock/7" \
68 -m "type=firmware" \
69 -f $(word 1,$^) \
70 -b 0x400000 \
71 -f $(KDIR)/root-block-0x20000-min-0x800.ubi \
72 -f $(KDIR)/ubi_mark
73 # Seama container
74 $(STAGING_DIR_HOST)/bin/seama \
75 -s $@ \
76 -m "signature=$(SIGNATURE)" \
77 -i $@.entity
78 endef
79
80 DEVICE_VARS += DT PRODUCTID SIGNATURE NETGEAR_BOARD_ID NETGEAR_REGION
81
82 define Device/Default
83 # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names
84 # extract the full dtb name based on the device info
85 DT := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(1).dtb)))
86 KERNEL := kernel-bin | append-dtb | lzma-d16
87 KERNEL_DEPENDS = $$(wildcard $(KDIR)/$$(DT).dts)
88 FILESYSTEMS := squashfs
89 KERNEL_NAME := zImage
90 IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
91 IMAGES := trx
92 IMAGE/trx := trx-nand
93 endef
94
95 define Device/asus
96 IMAGES := trx
97 IMAGE/trx := trx-nand | asus-trx
98 endef
99
100 define AsusDevice
101 define Device/asus-$(1)
102 $$(Device/asus)
103 PRODUCTID := $(2)
104 endef
105 TARGET_DEVICES += asus-$(1)
106 endef
107
108 define Device/linksys
109 IMAGES := trx
110 IMAGE/trx := trx-nand
111 endef
112
113 define LinksysDevice
114 define Device/linksys-$(1)
115 $$(Device/linksys)
116 endef
117 TARGET_DEVICES += linksys-$(1)
118 endef
119
120 define Device/dlink
121 IMAGES := bin
122 IMAGE/bin := seama-nand
123 endef
124
125 define DLinkDevice
126 define Device/dlink-$(1)
127 $$(Device/dlink)
128 SIGNATURE := $(2)
129 endef
130 TARGET_DEVICES += dlink-$(1)
131 endef
132
133 define Device/netgear
134 IMAGES := chk
135 IMAGE/chk := trx-nand | netgear-chk
136 NETGEAR_REGION := 1
137 endef
138
139 define NetgearDevice
140 define Device/netgear-$(1)
141 $$(Device/netgear)
142 NETGEAR_BOARD_ID := $(2)
143 endef
144 TARGET_DEVICES += netgear-$(1)
145 endef
146
147 define Device/netgear-r6250
148 $(Device/netgear)
149 NETGEAR_BOARD_ID := U12H245T00_NETGEAR
150 endef
151
152 define Device/netgear-r6300-v2
153 $(Device/netgear)
154 NETGEAR_BOARD_ID := U12H240T00_NETGEAR
155 endef
156
157 define Device/netgear-r8000
158 $(Device/netgear)
159 NETGEAR_BOARD_ID := U12H315T00_NETGEAR
160 endef
161
162 define Device/smartrg-sr400ac
163 IMAGES := trx
164 IMAGE/trx := trx-serial
165 endef
166
167 TARGET_DEVICES += \
168 buffalo-wzr-1750dhp buffalo-wzr-600dhp2 buffalo-wzr-900dhp \
169 buffalo-wxr-1900dhp \
170 netgear-r6250 netgear-r6300-v2 netgear-r8000 \
171 smartrg-sr400ac
172
173 $(eval $(call AsusDevice,rt-ac56u,RT-AC56U))
174 $(eval $(call AsusDevice,rt-ac68u,RT-AC68U))
175 $(eval $(call AsusDevice,rt-ac87u,RT-AC87U))
176 $(eval $(call AsusDevice,rt-n18u,RT-N18U))
177 $(eval $(call DLinkDevice,dir-885l,wrgac42_dlink.2015_dir885l))
178 $(eval $(call LinksysDevice,ea6300-v1))
179 $(eval $(call NetgearDevice,r7000,U12H270T00_NETGEAR))
180 # $(eval $(call NetgearDevice,r8500,U12H334T00_NETGEAR))
181
182 $(eval $(call BuildImage))