ubnt.mk 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
  2. # UBNT_TYPE e.g. one of (BZ, XM, XW)
  3. # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
  4. # mkubntimage is using the kernel image direct
  5. # routerboard creates partitions out of the ubnt header
  6. define Build/mkubntimage
  7. -$(STAGING_DIR_HOST)/bin/mkfwimage \
  8. -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \
  9. -k $(IMAGE_KERNEL) \
  10. -r $@ \
  11. -o $@
  12. endef
  13. # all UBNT XM device expect the kernel image to have 1024k while flash, when
  14. # booting the image, the size doesn't matter.
  15. define Build/mkubntimage-split
  16. -[ -f $@ ] && ( \
  17. dd if=$@ of=$@.old1 bs=1024k count=1; \
  18. dd if=$@ of=$@.old2 bs=1024k skip=1; \
  19. $(STAGING_DIR_HOST)/bin/mkfwimage \
  20. -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \
  21. -k $@.old1 \
  22. -r $@.old2 \
  23. -o $@; \
  24. rm $@.old1 $@.old2 )
  25. endef
  26. define Build/mkubntimage2
  27. -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
  28. -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \
  29. -p jffs2:0x50000:0xf60000:0:0:$@ \
  30. -o $@.new
  31. @mv $@.new $@
  32. endef
  33. DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE
  34. # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
  35. # UBNT_TYPE e.g. one of (BZ, XM, XW)
  36. # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
  37. define Device/ubnt-xm
  38. DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
  39. DEVICE_PROFILE := UBNT
  40. IMAGE_SIZE := 7552k
  41. MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
  42. UBNT_TYPE := XM
  43. UBNT_BOARD := XM
  44. UBNT_CHIP := ar7240
  45. KERNEL := kernel-bin | patch-cmdline | relocate-kernel | lzma | uImage lzma
  46. IMAGES := sysupgrade.bin factory.bin
  47. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
  48. IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  49. endef
  50. define Device/ubnt-xw
  51. DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
  52. DEVICE_PROFILE := UBNT
  53. IMAGE_SIZE := 7552k
  54. MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
  55. UBNT_TYPE := XW
  56. UBNT_BOARD := XM
  57. UBNT_CHIP := ar934x
  58. IMAGES := sysupgrade.bin factory.bin
  59. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
  60. IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  61. endef
  62. define Device/ubnt-bz
  63. DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
  64. DEVICE_PROFILE := UBNT
  65. IMAGE_SIZE := 7552k
  66. MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
  67. UBNT_TYPE := BZ
  68. UBNT_BOARD := XM
  69. UBNT_CHIP := ar934x
  70. IMAGES := sysupgrade.bin factory.bin
  71. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
  72. IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  73. endef
  74. define Device/ubnt-unifiac
  75. DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
  76. DEVICE_PROFILE := UBNT
  77. IMAGE_SIZE := 7744k
  78. MTDPARTS = spi0.0:384k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),7744k(ubnt-airos)ro,128k(bs),256k(cfg)ro,64k(EEPROM)ro
  79. IMAGES := sysupgrade.bin
  80. IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  81. endef
  82. define Device/rw2458n
  83. $(Device/ubnt-xm)
  84. DEVICE_TITLE := Ubiquiti RW2458N
  85. BOARDNAME := RW2458N
  86. endef
  87. define Device/ubnt-airrouter
  88. $(Device/ubnt-xm)
  89. DEVICE_TITLE := Ubiquiti AirRouter
  90. BOARDNAME := UBNT-AR
  91. endef
  92. define Device/ubnt-bullet-m
  93. $(Device/ubnt-xm)
  94. DEVICE_TITLE := Ubiquiti Bullet-M
  95. BOARDNAME := UBNT-BM
  96. endef
  97. define Device/ubnt-rocket-m
  98. $(Device/ubnt-xm)
  99. DEVICE_TITLE := Ubiquiti Rocket-M
  100. BOARDNAME := UBNT-RM
  101. endef
  102. define Device/ubnt-nano-m
  103. $(Device/ubnt-xm)
  104. DEVICE_TITLE := Ubiquiti Nano-M
  105. BOARDNAME := UBNT-NM
  106. endef
  107. TARGET_DEVICES += rw2458n ubnt-airrouter ubnt-bullet-m ubnt-rocket-m ubnt-nano-m
  108. define Device/ubnt-unifi
  109. $(Device/ubnt-bz)
  110. DEVICE_TITLE := Ubiquiti UniFi
  111. BOARDNAME := UBNT-UF
  112. DEVICE_PROFILE := UBNT UBNTUNIFI
  113. endef
  114. define Device/ubnt-unifiac-lite
  115. $(Device/ubnt-unifiac)
  116. DEVICE_TITLE := Ubiquiti UniFi AC-Lite
  117. DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x
  118. DEVICE_PROFILE := UBNT UBNTUNIFIACLITE
  119. BOARDNAME := UBNT-UF-AC-LITE
  120. endef
  121. define Device/ubnt-unifiac-pro
  122. $(Device/ubnt-unifiac)
  123. DEVICE_TITLE := Ubiquiti UniFi AC-Pro
  124. DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x kmod-usb-core kmod-usb-ohci kmod-usb2
  125. DEVICE_PROFILE := UBNT UBNTUNIFIACPRO
  126. BOARDNAME := UBNT-UF-AC-PRO
  127. endef
  128. define Device/ubnt-unifi-outdoor
  129. $(Device/ubnt-bz)
  130. DEVICE_TITLE := Ubiquiti UniFi Outdoor
  131. BOARDNAME := UBNT-U20
  132. DEVICE_PROFILE := UBNT UBNTUNIFIOUTDOOR
  133. endef
  134. TARGET_DEVICES += ubnt-unifi ubnt-unifiac-lite ubnt-unifiac-pro ubnt-unifi-outdoor
  135. define Device/ubnt-nano-m-xw
  136. $(Device/ubnt-xw)
  137. DEVICE_TITLE := Ubiquiti Nano M XW
  138. BOARDNAME := UBNT-NM-XW
  139. endef
  140. define Device/ubnt-loco-m-xw
  141. $(Device/ubnt-xw)
  142. DEVICE_TITLE := Ubiquiti Loco XW
  143. BOARDNAME := UBNT-LOCO-XW
  144. endef
  145. define Device/ubnt-rocket-m-xw
  146. $(Device/ubnt-xw)
  147. DEVICE_TITLE := Ubiquiti Rocket M XW
  148. BOARDNAME := UBNT-RM-XW
  149. endef
  150. define Device/ubnt-rocket-m-ti
  151. $(Device/ubnt-xw)
  152. DEVICE_TITLE := Ubiquiti Rocket M TI
  153. BOARDNAME := UBNT-RM-TI
  154. UBNT_TYPE := TI
  155. UBNT_BOARD := XM
  156. endef
  157. TARGET_DEVICES += ubnt-nano-m-xw ubnt-loco-m-xw ubnt-rocket-m-xw ubnt-rocket-m-ti
  158. define Device/ubnt-air-gateway
  159. $(Device/ubnt-xm)
  160. DEVICE_TITLE := Ubiquiti Air Gateway
  161. BOARDNAME := UBNT-AGW
  162. UBNT_BOARD := XM
  163. UBNT_TYPE := AirGW
  164. UBNT_CHIP := ar933x
  165. CONSOLE = ttyATH0,115200
  166. endef
  167. TARGET_DEVICES += ubnt-air-gateway
  168. define Device/ubnt-air-gateway-pro
  169. $(Device/ubnt-xm)
  170. DEVICE_TITLE := Ubiquiti Air Gateway Pro
  171. BOARDNAME := UBNT-AGWP
  172. UBNT_TYPE := AirGWP
  173. UBNT_CHIP := ar934x
  174. CONSOLE = ttyS0,115200
  175. endef
  176. TARGET_DEVICES += ubnt-air-gateway-pro
  177. define Device/ubdev01
  178. $(Device/ubnt-xm)
  179. DEVICE_TITLE := Ubiquiti ubDEV01
  180. MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
  181. BOARDNAME := UBNT-UF
  182. UBNT_BOARD := UBDEV01
  183. UBNT_TYPE := XM
  184. UBNT_CHIP := ar7240
  185. endef
  186. TARGET_DEVICES += ubdev01
  187. define Device/ubnt-routerstation
  188. DEVICE_TITLE := Ubiquiti RouterStation
  189. DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
  190. IMAGE_SIZE := 16128k
  191. IMAGES := sysupgrade.bin factory.bin
  192. IMAGE/factory.bin = append-rootfs | pad-rootfs | mkubntimage
  193. IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE)
  194. KERNEL := kernel-bin | patch-cmdline | lzma | pad-to $$(BLOCKSIZE)
  195. endef
  196. define Device/ubnt-rs
  197. $(Device/ubnt-routerstation)
  198. DEVICE_TITLE := Ubiquiti RouterStation
  199. BOARDNAME := UBNT-RS
  200. DEVICE_PROFILE := UBNT UBNTRS
  201. UBNT_BOARD := RS
  202. UBNT_TYPE := RSx
  203. UBNT_CHIP := ar7100
  204. endef
  205. define Device/ubnt-rspro
  206. $(Device/ubnt-routerstation)
  207. DEVICE_TITLE := Ubiquiti RouterStation Pro
  208. BOARDNAME := UBNT-RSPRO
  209. DEVICE_PROFILE := UBNT UBNTRSPRO
  210. UBNT_BOARD := RSPRO
  211. UBNT_TYPE := RSPRO
  212. UBNT_CHIP := ar7100pro
  213. endef
  214. define Device/ubnt-ls-sr71
  215. $(Device/ubnt-routerstation)
  216. DEVICE_TITLE := Ubiquiti LS-SR71
  217. BOARDNAME := UBNT-LS-SR71
  218. DEVICE_PROFILE := UBNT
  219. UBNT_BOARD := LS-SR71
  220. UBNT_TYPE := LS-SR71
  221. UBNT_CHIP := ar7100
  222. endef
  223. TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71
  224. define Device/ubnt-uap-pro
  225. DEVICE_TITLE := Ubiquiti UAP Pro
  226. KERNEL_SIZE := 1536k
  227. IMAGE_SIZE := 15744k
  228. MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x50000(firmware)
  229. UBNT_TYPE := BZ
  230. UBNT_CHIP := ar934x
  231. BOARDNAME := UAP-PRO
  232. DEVICE_PROFILE := UBNT UAPPRO
  233. KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0
  234. IMAGES := sysupgrade.bin factory.bin
  235. IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  236. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage2
  237. endef
  238. define Device/ubnt-unifi-outdoor-plus
  239. $(Device/ubnt-uap-pro)
  240. DEVICE_TITLE := Ubiquiti UniFi Outdoor Plus
  241. UBNT_CHIP := ar7240
  242. BOARDNAME := UBNT-UOP
  243. DEVICE_PROFILE := UBNT
  244. endef
  245. TARGET_DEVICES += ubnt-uap-pro ubnt-unifi-outdoor-plus