common-ubnt.mk 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE UBNT_VERSION UBNT_REVISION
  2. # On M (XW) devices the U-Boot as of version 1.1.4-s1039 doesn't like
  3. # VERSION_DIST being on the place of major(?) version number, so we need to
  4. # use some number.
  5. UBNT_REVISION := $(VERSION_DIST)-$(REVISION)
  6. # mkubntimage is using the kernel image direct
  7. # routerboard creates partitions out of the ubnt header
  8. define Build/mkubntimage
  9. -$(STAGING_DIR_HOST)/bin/mkfwimage -B $(UBNT_BOARD) \
  10. -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-$(REVISION) \
  11. -k $(if $(1),$(1),$(IMAGE_KERNEL)) -r $@ -o $@
  12. endef
  13. define Build/mkubntimage2
  14. -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
  15. -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-$(REVISION) \
  16. -p jffs2:0x50000:0xf60000:0:0:$@ \
  17. -o [email protected]
  18. @mv [email protected] $@
  19. endef
  20. # all UBNT XM/WA devices expect the kernel image to have 1024k while flash, when
  21. # booting the image, the size doesn't matter.
  22. define Build/mkubntimage-split
  23. -[ -f $@ ] && ( \
  24. dd if=$@ [email protected] bs=1024k count=1; \
  25. dd if=$@ [email protected] bs=1024k skip=1; \
  26. $(STAGING_DIR_HOST)/bin/mkfwimage -B $(UBNT_BOARD) \
  27. -v $(UBNT_TYPE).$(UBNT_CHIP).v$(UBNT_VERSION)-$(UBNT_REVISION) \
  28. -k [email protected] -r [email protected] -o $@; \
  29. rm [email protected] [email protected] )
  30. endef
  31. # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
  32. # UBNT_TYPE e.g. one of (BZ, XM, XW)
  33. # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
  34. # UBNT_VERSION e.g. one of (6.0.0, 8.5.3)
  35. define Device/ubnt
  36. DEVICE_VENDOR := Ubiquiti
  37. DEVICE_PACKAGES := kmod-usb2
  38. IMAGES += factory.bin
  39. IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
  40. append-rootfs | pad-rootfs | check-size | mkubntimage-split
  41. endef
  42. define Device/ubnt-bz
  43. $(Device/ubnt)
  44. SOC := ar7241
  45. IMAGE_SIZE := 7448k
  46. UBNT_BOARD := XM
  47. UBNT_CHIP := ar7240
  48. UBNT_TYPE := BZ
  49. UBNT_VERSION := 6.0.0
  50. endef
  51. define Device/ubnt-sw
  52. $(Device/ubnt)
  53. SOC := ar7242
  54. DEVICE_PACKAGES += kmod-usb-ohci
  55. IMAGE_SIZE := 7552k
  56. UBNT_BOARD := SW
  57. UBNT_CHIP := ar7240
  58. UBNT_TYPE := SW
  59. UBNT_VERSION := 1.4.1
  60. KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage lzma
  61. endef
  62. define Device/ubnt-2wa
  63. $(Device/ubnt)
  64. SOC := ar9342
  65. IMAGE_SIZE := 15744k
  66. UBNT_BOARD := WA
  67. UBNT_CHIP := ar934x
  68. UBNT_TYPE := 2WA
  69. UBNT_VERSION := 8.7.4
  70. endef
  71. define Device/ubnt-wa
  72. $(Device/ubnt)
  73. SOC := ar9342
  74. IMAGE_SIZE := 15744k
  75. UBNT_BOARD := WA
  76. UBNT_CHIP := ar934x
  77. UBNT_TYPE := WA
  78. UBNT_VERSION := 8.7.4
  79. endef
  80. define Device/ubnt-xc
  81. $(Device/ubnt)
  82. IMAGE_SIZE := 15744k
  83. UBNT_BOARD := XC
  84. UBNT_CHIP := qca955x
  85. UBNT_TYPE := XC
  86. UBNT_VERSION := 8.7.4
  87. endef
  88. define Device/ubnt-xm
  89. $(Device/ubnt)
  90. DEVICE_VARIANT := XM
  91. DEVICE_PACKAGES += kmod-usb-ohci
  92. IMAGE_SIZE := 7448k
  93. UBNT_BOARD := XM
  94. UBNT_CHIP := ar7240
  95. UBNT_REVISION := 42.$(UBNT_REVISION)
  96. UBNT_TYPE := XM
  97. UBNT_VERSION := 6.0.0
  98. KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage lzma
  99. endef
  100. define Device/ubnt-xw
  101. $(Device/ubnt)
  102. SOC := ar9342
  103. DEVICE_VARIANT := XW
  104. IMAGE_SIZE := 7552k
  105. UBNT_BOARD := XM
  106. UBNT_CHIP := ar934x
  107. UBNT_REVISION := 42.$(UBNT_REVISION)
  108. UBNT_TYPE := XW
  109. UBNT_VERSION := 6.0.4
  110. endef
  111. define Device/ubnt_unifiac
  112. DEVICE_VENDOR := Ubiquiti
  113. SOC := qca9563
  114. IMAGE_SIZE := 15488k
  115. DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
  116. endef
  117. define Device/ubnt-unifi-jffs2
  118. $(Device/ubnt)
  119. KERNEL_SIZE := 3072k
  120. IMAGE_SIZE := 15744k
  121. UBNT_TYPE := BZ
  122. KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | jffs2 kernel0
  123. IMAGES := sysupgrade.bin factory.bin
  124. IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs |\
  125. pad-rootfs | check-size | append-metadata
  126. IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage2
  127. endef
  128. define Device/ubnt-acb
  129. $(Device/ubnt)
  130. IMAGE_SIZE := 15744k
  131. UBNT_BOARD := ACB
  132. UBNT_TYPE := ACB
  133. UBNT_VERSION := 2.5.0
  134. endef