1
0

ubnt.mk 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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. IMAGES := sysupgrade.bin factory.bin
  46. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
  47. IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  48. endef
  49. define Device/ubnt-xw
  50. DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
  51. DEVICE_PROFILE := UBNT
  52. IMAGE_SIZE := 7552k
  53. MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
  54. UBNT_TYPE := XW
  55. UBNT_BOARD := XM
  56. UBNT_CHIP := ar934x
  57. IMAGES := sysupgrade.bin factory.bin
  58. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
  59. IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  60. endef
  61. define Device/ubnt-bz
  62. DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
  63. DEVICE_PROFILE := UBNT
  64. IMAGE_SIZE := 7552k
  65. MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
  66. UBNT_TYPE := BZ
  67. UBNT_BOARD := XM
  68. UBNT_CHIP := ar934x
  69. IMAGES := sysupgrade.bin factory.bin
  70. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
  71. IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  72. endef
  73. define Device/ubnt-unifiac
  74. DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
  75. DEVICE_PROFILE := UBNT
  76. IMAGE_SIZE := 7744k
  77. MTDPARTS = spi0.0:384k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),7744k(ubnt-airos)ro,128k(bs)ro,256k(cfg)ro,64k(EEPROM)ro
  78. IMAGES := sysupgrade.bin
  79. IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  80. endef
  81. define Device/rw2458n
  82. $(Device/ubnt-xm)
  83. DEVICE_TITLE := Ubiquiti RW2458N
  84. BOARDNAME := RW2458N
  85. endef
  86. define Device/ubnt-airrouter
  87. $(Device/ubnt-xm)
  88. DEVICE_TITLE := Ubiquiti AirRouter
  89. BOARDNAME := UBNT-AR
  90. endef
  91. define Device/ubnt-bullet-m
  92. $(Device/ubnt-xm)
  93. DEVICE_TITLE := Ubiquiti Bullet-M
  94. BOARDNAME := UBNT-BM
  95. endef
  96. define Device/ubnt-rocket-m
  97. $(Device/ubnt-xm)
  98. DEVICE_TITLE := Ubiquiti Rocket-M
  99. BOARDNAME := UBNT-RM
  100. endef
  101. define Device/ubnt-nano-m
  102. $(Device/ubnt-xm)
  103. DEVICE_TITLE := Ubiquiti Nano-M
  104. BOARDNAME := UBNT-NM
  105. endef
  106. TARGET_DEVICES += rw2458n ubnt-airrouter ubnt-bullet-m ubnt-rocket-m ubnt-nano-m
  107. define Device/ubnt-unifi
  108. $(Device/ubnt-bz)
  109. DEVICE_TITLE := Ubiquiti UniFi
  110. BOARDNAME := UBNT-UF
  111. DEVICE_PROFILE := UBNT UBNTUNIFI
  112. endef
  113. define Device/ubnt-unifi-outdoor
  114. $(Device/ubnt-bz)
  115. DEVICE_TITLE := Ubiquiti UniFi Outdoor
  116. BOARDNAME := UBNT-U20
  117. DEVICE_PROFILE := UBNT UBNTUNIFIOUTDOOR
  118. endef
  119. TARGET_DEVICES += ubnt-unifi ubnt-unifiac-lite ubnt-unifiac-pro ubnt-unifi-outdoor
  120. define Device/ubnt-nano-m-xw
  121. $(Device/ubnt-xw)
  122. DEVICE_TITLE := Ubiquiti Nano M XW
  123. BOARDNAME := UBNT-NM-XW
  124. endef
  125. define Device/ubnt-loco-m-xw
  126. $(Device/ubnt-xw)
  127. DEVICE_TITLE := Ubiquiti Loco XW
  128. BOARDNAME := UBNT-LOCO-XW
  129. endef
  130. define Device/ubnt-rocket-m-xw
  131. $(Device/ubnt-xw)
  132. DEVICE_TITLE := Ubiquiti Rocket M XW
  133. BOARDNAME := UBNT-RM-XW
  134. endef
  135. define Device/ubnt-rocket-m-ti
  136. $(Device/ubnt-xw)
  137. DEVICE_TITLE := Ubiquiti Rocket M TI
  138. BOARDNAME := UBNT-RM-TI
  139. UBNT_TYPE := TI
  140. UBNT_BOARD := XM
  141. endef
  142. TARGET_DEVICES += ubnt-nano-m-xw ubnt-loco-m-xw ubnt-rocket-m-xw ubnt-rocket-m-ti
  143. define Device/ubnt-air-gateway
  144. $(Device/ubnt-xm)
  145. DEVICE_TITLE := Ubiquiti Air Gateway
  146. BOARDNAME := UBNT-AGW
  147. UBNT_BOARD := XM
  148. UBNT_TYPE := AirGW
  149. UBNT_CHIP := ar933x
  150. CONSOLE = ttyATH0,115200
  151. endef
  152. TARGET_DEVICES += ubnt-air-gateway
  153. define Device/ubnt-air-gateway-pro
  154. $(Device/ubnt-xm)
  155. DEVICE_TITLE := Ubiquiti Air Gateway Pro
  156. BOARDNAME := UBNT-AGWP
  157. UBNT_TYPE := AirGWP
  158. UBNT_CHIP := ar934x
  159. CONSOLE = ttyS0,115200
  160. endef
  161. TARGET_DEVICES += ubnt-air-gateway-pro
  162. define Device/ubdev01
  163. $(Device/ubnt-xm)
  164. DEVICE_TITLE := Ubiquiti ubDEV01
  165. MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
  166. BOARDNAME := UBNT-UF
  167. UBNT_BOARD := UBDEV01
  168. UBNT_TYPE := XM
  169. UBNT_CHIP := ar7240
  170. endef
  171. TARGET_DEVICES += ubdev01
  172. define Device/ubnt-routerstation
  173. DEVICE_TITLE := Ubiquiti RouterStation
  174. DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2
  175. IMAGE_SIZE := 16128k
  176. IMAGES := sysupgrade.bin factory.bin
  177. IMAGE/factory.bin = append-rootfs | pad-rootfs | mkubntimage
  178. IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE)
  179. KERNEL := kernel-bin | patch-cmdline | lzma | pad-to $$(BLOCKSIZE)
  180. endef
  181. define Device/ubnt-rs
  182. $(Device/ubnt-routerstation)
  183. DEVICE_TITLE := Ubiquiti RouterStation
  184. BOARDNAME := UBNT-RS
  185. DEVICE_PROFILE := UBNT UBNTRS
  186. UBNT_BOARD := RS
  187. UBNT_TYPE := RSx
  188. UBNT_CHIP := ar7100
  189. endef
  190. define Device/ubnt-rspro
  191. $(Device/ubnt-routerstation)
  192. DEVICE_TITLE := Ubiquiti RouterStation Pro
  193. BOARDNAME := UBNT-RSPRO
  194. DEVICE_PROFILE := UBNT UBNTRSPRO
  195. UBNT_BOARD := RSPRO
  196. UBNT_TYPE := RSPRO
  197. UBNT_CHIP := ar7100pro
  198. endef
  199. define Device/ubnt-ls-sr71
  200. $(Device/ubnt-routerstation)
  201. DEVICE_TITLE := Ubiquiti LS-SR71
  202. BOARDNAME := UBNT-LS-SR71
  203. DEVICE_PROFILE := UBNT
  204. UBNT_BOARD := LS-SR71
  205. UBNT_TYPE := LS-SR71
  206. UBNT_CHIP := ar7100
  207. endef
  208. TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71
  209. define Device/ubnt-uap-pro
  210. DEVICE_TITLE := Ubiquiti UAP Pro
  211. KERNEL_SIZE := 1536k
  212. IMAGE_SIZE := 15744k
  213. 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)
  214. UBNT_TYPE := BZ
  215. UBNT_CHIP := ar934x
  216. BOARDNAME := UAP-PRO
  217. DEVICE_PROFILE := UBNT UAPPRO
  218. KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0
  219. IMAGES := sysupgrade.bin factory.bin
  220. IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  221. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage2
  222. endef
  223. define Device/ubnt-unifi-outdoor-plus
  224. $(Device/ubnt-uap-pro)
  225. DEVICE_TITLE := Ubiquiti UniFi Outdoor Plus
  226. UBNT_CHIP := ar7240
  227. BOARDNAME := UBNT-UOP
  228. DEVICE_PROFILE := UBNT
  229. endef
  230. TARGET_DEVICES += ubnt-uap-pro ubnt-unifi-outdoor-plus