ubnt.mk 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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 $(word 1,$^) \
  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. dd if=$@ of=$@.old1 bs=1024k count=1
  17. dd if=$@ of=$@.old2 bs=1024k skip=1
  18. $(STAGING_DIR_HOST)/bin/mkfwimage \
  19. -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \
  20. -k $@.old1 \
  21. -r $@.old2 \
  22. -o $@
  23. rm $@.old1 $@.old2
  24. endef
  25. define Build/mkubntimage2
  26. $(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
  27. -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-OpenWrt-$(REVISION) \
  28. -p jffs2:0x50000:0xf60000:0:0:$@ \
  29. -o $@.new
  30. @mv $@.new $@
  31. endef
  32. DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE
  33. # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
  34. # UBNT_TYPE e.g. one of (BZ, XM, XW)
  35. # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
  36. define Device/ubnt-xm
  37. DEVICE_PROFILE := UBNT
  38. IMAGE_SIZE := 7552k
  39. MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
  40. UBNT_TYPE := XM
  41. UBNT_BOARD := XM
  42. UBNT_CHIP := ar7240
  43. IMAGES := sysupgrade.bin factory.bin
  44. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
  45. IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  46. endef
  47. define Device/ubnt-xw
  48. DEVICE_PROFILE := UBNT
  49. IMAGE_SIZE := 7552k
  50. MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
  51. UBNT_TYPE := XW
  52. UBNT_BOARD := XM
  53. UBNT_CHIP := ar934x
  54. IMAGES := sysupgrade.bin factory.bin
  55. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
  56. IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  57. endef
  58. define Device/ubnt-bz
  59. DEVICE_PROFILE := UBNT
  60. IMAGE_SIZE := 7552k
  61. MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
  62. UBNT_TYPE := BZ
  63. UBNT_BOARD := XM
  64. UBNT_CHIP := ar934x
  65. IMAGES := sysupgrade.bin factory.bin
  66. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
  67. IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  68. endef
  69. define Device/ubnt-unifiac
  70. DEVICE_PROFILE := UBNT
  71. IMAGE_SIZE := 7744k
  72. 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
  73. IMAGES := sysupgrade.bin
  74. IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  75. endef
  76. define Device/rw2458n
  77. $(Device/ubnt-xm)
  78. BOARDNAME := RW2458N
  79. endef
  80. define Device/ubnt-airrouter
  81. $(Device/ubnt-xm)
  82. BOARDNAME := UBNT-AR
  83. endef
  84. define Device/ubnt-bullet-m
  85. $(Device/ubnt-xm)
  86. BOARDNAME := UBNT-BM
  87. endef
  88. define Device/ubnt-rocket-m
  89. $(Device/ubnt-xm)
  90. BOARDNAME := UBNT-RM
  91. endef
  92. define Device/ubnt-nano-m
  93. $(Device/ubnt-xm)
  94. BOARDNAME := UBNT-NM
  95. endef
  96. TARGET_DEVICES += rw2458n ubnt-airrouter ubnt-bullet-m ubnt-rocket-m ubnt-nano-m
  97. define Device/ubnt-unifi
  98. $(Device/ubnt-bz)
  99. BOARDNAME := UBNT-UF
  100. DEVICE_PROFILE := UBNT UBNTUNIFI
  101. endef
  102. define Device/ubnt-unifiac-lite
  103. $(Device/ubnt-unifiac)
  104. DEVICE_PROFILE := UBNT UBNTUNIFIACLITE
  105. BOARDNAME := UBNT-UF-AC-LITE
  106. endef
  107. define Device/ubnt-unifiac-pro
  108. $(Device/ubnt-unifiac)
  109. DEVICE_PROFILE := UBNT UBNTUNIFIACPRO
  110. BOARDNAME := UBNT-UF-AC-PRO
  111. endef
  112. define Device/ubnt-unifi-outdoor
  113. $(Device/ubnt-bz)
  114. BOARDNAME := UBNT-U20
  115. DEVICE_PROFILE := UBNT UBNTUNIFIOUTDOOR
  116. endef
  117. TARGET_DEVICES += ubnt-unifi ubnt-unifiac-lite ubnt-unifiac-pro ubnt-unifi-outdoor
  118. define Device/ubnt-nano-m-xw
  119. $(Device/ubnt-xw)
  120. BOARDNAME := UBNT-NM-XW
  121. endef
  122. define Device/ubnt-loco-m-xw
  123. $(Device/ubnt-xw)
  124. BOARDNAME := UBNT-LOCO-XW
  125. endef
  126. define Device/ubnt-rocket-m-xw
  127. $(Device/ubnt-xw)
  128. BOARDNAME := UBNT-RM-XW
  129. endef
  130. define Device/ubnt-rocket-m-ti
  131. $(Device/ubnt-xw)
  132. BOARDNAME := UBNT-RM-TI
  133. UBNT_TYPE := TI
  134. UBNT_BOARD := XM
  135. endef
  136. TARGET_DEVICES += ubnt-nano-m-xw ubnt-loco-m-xw ubnt-rocket-m-xw ubnt-rocket-m-ti
  137. define Device/ubnt-air-gateway
  138. $(Device/ubnt-xm)
  139. BOARDNAME := UBNT-AGW
  140. UBNT_BOARD := XM
  141. UBNT_TYPE := AirGW
  142. UBNT_CHIP := ar933x
  143. CONSOLE = ttyATH0,115200
  144. endef
  145. TARGET_DEVICES += ubnt-air-gateway
  146. define Device/ubnt-air-gateway-pro
  147. $(Device/ubnt-xm)
  148. BOARDNAME := UBNT-AGWP
  149. UBNT_TYPE := AirGWP
  150. UBNT_CHIP := ar934x
  151. CONSOLE = ttyS0,115200
  152. endef
  153. TARGET_DEVICES += ubnt-air-gateway-pro
  154. define Device/ubdev01
  155. $(Device/ubnt-xm)
  156. MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
  157. BOARDNAME := UBNT-UF
  158. UBNT_BOARD := UBDEV01
  159. UBNT_TYPE := XM
  160. UBNT_CHIP := ar7240
  161. endef
  162. TARGET_DEVICES += ubdev01
  163. define Device/ubnt-routerstation
  164. IMAGE_SIZE := 16128k
  165. IMAGES := sysupgrade.bin factory.bin
  166. IMAGE/factory.bin = append-rootfs | pad-rootfs | mkubntimage
  167. IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE)
  168. KERNEL := kernel-bin | patch-cmdline | lzma | pad-to $$(BLOCKSIZE)
  169. endef
  170. define Device/ubnt-rs
  171. $(Device/ubnt-routerstation)
  172. BOARDNAME := UBNT-RS
  173. DEVICE_PROFILE := Madwifi UBNT UBNTRS
  174. UBNT_BOARD := RS
  175. UBNT_TYPE := RSx
  176. UBNT_CHIP := ar7100
  177. endef
  178. define Device/ubnt-rspro
  179. $(Device/ubnt-routerstation)
  180. BOARDNAME := UBNT-RSPRO
  181. DEVICE_PROFILE := Madwifi UBNT UBNTRSPRO
  182. UBNT_BOARD := RSPRO
  183. UBNT_TYPE := RSPRO
  184. UBNT_CHIP := ar7100pro
  185. endef
  186. define Device/ubnt-ls-sr71
  187. $(Device/ubnt-routerstation)
  188. BOARDNAME := UBNT-LS-SR71
  189. DEVICE_PROFILE := Madwifi UBNT
  190. UBNT_BOARD := LS-SR71
  191. UBNT_TYPE := LS-SR71
  192. UBNT_CHIP := ar7100
  193. endef
  194. TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71
  195. define Device/ubnt-uap-pro
  196. KERNEL_SIZE := 1536k
  197. IMAGE_SIZE := 15744k
  198. 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)
  199. UBNT_TYPE := BZ
  200. UBNT_CHIP := ar934x
  201. BOARDNAME := UAP-PRO
  202. DEVICE_PROFILE := UBNT UAPPRO
  203. KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0
  204. IMAGES := sysupgrade.bin factory.bin
  205. IMAGE/sysupgrade.bin = append-kernel $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  206. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage2
  207. endef
  208. define Device/ubnt-unifi-outdoor-plus
  209. $(Device/ubnt-uap-pro)
  210. UBNT_CHIP := ar7240
  211. BOARDNAME := UBNT-UOP
  212. DEVICE_PROFILE := UBNT
  213. endef
  214. TARGET_DEVICES += ubnt-uap-pro ubnt-unifi-outdoor-plus