Makefile 7.4 KB

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