Makefile 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. # Copyright (c) 2014 The Linux Foundation. All rights reserved.
  2. #
  3. include $(TOPDIR)/rules.mk
  4. include $(INCLUDE_DIR)/image.mk
  5. UBIFS_OPTS = -m 2048 -e 124KiB -c 4096 -U -F
  6. UBINIZE_OPTS = -m 2048 -p 128KiB
  7. KERNEL_LOADADDR := 0x42208000
  8. define Image/Prepare
  9. $(CP) $(LINUX_DIR)/vmlinux $(KDIR)/$(IMG_PREFIX)-vmlinux.elf
  10. mkimage -A arm -O linux -T filesystem -C none \
  11. -a $(KERNEL_LOADADDR) -e $(KERNEL_LOADADDR) \
  12. -n 'ARM OpenWrt fakeroot' \
  13. -s $(KDIR_TMP)/root.dummy-uImage.tmp
  14. echo -ne '\xff' > $(KDIR_TMP)/root.dummy
  15. cat $(KDIR_TMP)/root.dummy $(KDIR_TMP)/root.dummy-uImage.tmp > $(KDIR)/root.dummy
  16. endef
  17. define Image/BuildKernel
  18. $(CP) $(KDIR)/$(IMG_PREFIX)-vmlinux.elf $(BIN_DIR)
  19. endef
  20. define Image/Build/squashfs
  21. cp $(KDIR)/root.squashfs $(KDIR)/root.squashfs-raw
  22. $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
  23. endef
  24. define Image/Build
  25. $(call Image/Build/$(1),$(1))
  26. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-root.img bs=2k conv=sync
  27. endef
  28. define Build/append-dtb
  29. cat $(DTS_DIR)/$(DEVICE_DTS).dtb >> $@
  30. endef
  31. define Build/append-file
  32. cat $(1) >> $@
  33. endef
  34. define Device/Default
  35. PROFILES := Default
  36. KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
  37. KERNEL_INITRAMFS_PREFIX := $$(IMG_PREFIX)-$(1)-initramfs
  38. DEVICE_DTS :=
  39. KERNEL_PREFIX := $$(IMAGE_PREFIX)
  40. IMAGES :=
  41. KERNEL_IN_UBI :=
  42. BOARD_NAME :=
  43. endef
  44. DEVICE_VARS += DEVICE_DTS KERNEL_IN_UBI BOARD_NAME
  45. define Device/LegacyImage
  46. KERNEL_SUFFIX := -uImage
  47. KERNEL = kernel-bin | append-dtb | uImage none
  48. KERNEL_NAME := zImage
  49. endef
  50. define Device/FitImage
  51. KERNEL_SUFFIX := -fit-uImage.itb
  52. KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
  53. KERNEL_NAME := Image
  54. endef
  55. define Device/UbiFit
  56. KERNEL_IN_UBI := 1
  57. IMAGES := nand-factory.ubi nand-sysupgrade.tar
  58. IMAGE/nand-factory.ubi := append-ubi
  59. IMAGE/nand-sysupgrade.tar := sysupgrade-nand
  60. endef
  61. define Device/DniImage
  62. PROFILES += $$(DEVICE_NAME)
  63. FILESYSTEMS := squashfs
  64. KERNEL_SUFFIX := -uImage
  65. KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none
  66. KERNEL = kernel-bin | append-dtb | pad-to $$$$(($$(KERNEL_SIZE)-2*64-1)) | uImage none | append-file $(KDIR)/root.dummy
  67. KERNEL_NAME := zImage
  68. NETGEAR_BOARD_ID :=
  69. NETGEAR_HW_ID :=
  70. IMAGES := factory.img sysupgrade.tar
  71. IMAGE/factory.img := append-kernel | append-ubi | netgear-dni
  72. IMAGE/sysupgrade.tar = sysupgrade-nand
  73. endef
  74. DEVICE_VARS += KERNEL_SIZE NETGEAR_BOARD_ID NETGEAR_HW_ID DEVICE_BLOCK_SIZE DEVICE_PAGE_SIZE
  75. define Device/TpSafeImage
  76. PROFILES += $$(DEVICE_NAME)
  77. FILESYSTEMS := squashfs
  78. KERNEL_SUFFIX := -uImage
  79. KERNEL = kernel-bin | append-dtb | uImage none
  80. KERNEL_NAME := zImage
  81. TPLINK_BOARD_NAME :=
  82. IMAGES := factory.bin sysupgrade.bin
  83. IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
  84. IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
  85. endef
  86. DEVICE_VARS += TPLINK_BOARD_NAME
  87. define Device/AP148
  88. $(call Device/FitImage)
  89. $(call Device/UbiFit)
  90. DEVICE_DTS := qcom-ipq8064-ap148
  91. BLOCKSIZE := 128KiB
  92. PAGESIZE := 2048
  93. BOARD_NAME := ap148
  94. DEVICE_TITLE := Qualcomm AP148
  95. DEVICE_PACKAGES := ath10k-firmware-qca99x0
  96. endef
  97. define Device/AP148-legacy
  98. $(call Device/LegacyImage)
  99. $(call Device/UbiFit)
  100. DEVICE_DTS := qcom-ipq8064-ap148
  101. BLOCKSIZE := 128KiB
  102. PAGESIZE := 2048
  103. BOARD_NAME := ap148
  104. DEVICE_TITLE := Qualcomm AP148 (legacy)
  105. DEVICE_PACKAGES := ath10k-firmware-qca99x0
  106. endef
  107. define Device/C2600
  108. $(call Device/TpSafeImage)
  109. DEVICE_DTS := qcom-ipq8064-c2600
  110. BLOCKSIZE := 128KiB
  111. PAGESIZE := 2048
  112. BOARD_NAME := c2600
  113. TPLINK_BOARD_NAME := C2600
  114. DEVICE_TITLE := TP-Link Archer C2600
  115. DEVICE_PACKAGES := ath10k-firmware-qca99x0
  116. endef
  117. define Device/D7800
  118. $(call Device/DniImage)
  119. DEVICE_DTS := qcom-ipq8064-d7800
  120. KERNEL_SIZE := 2097152
  121. NETGEAR_BOARD_ID := D7800
  122. NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4
  123. BLOCKSIZE := 128KiB
  124. PAGESIZE := 2048
  125. BOARD_NAME := d7800
  126. DEVICE_TITLE := Netgear Nighthawk X4 D7800
  127. DEVICE_PACKAGES := ath10k-firmware-qca99x0
  128. endef
  129. define Device/DB149
  130. $(call Device/FitImage)
  131. DEVICE_DTS := qcom-ipq8064-db149
  132. KERNEL_INSTALL := 1
  133. BOARD_NAME := db149
  134. DEVICE_TITLE := Qualcomm DB149
  135. DEVICE_PACKAGES := ath10k-firmware-qca99x0
  136. endef
  137. define Device/EA8500
  138. $(call Device/LegacyImage)
  139. DEVICE_DTS := qcom-ipq8064-ea8500
  140. PAGESIZE := 2048
  141. BLOCKSIZE := 128KiB
  142. KERNEL_SIZE := 3145728
  143. FILESYSTEMS := squashfs
  144. KERNEL = kernel-bin | append-dtb | uImage none | append-file $(KDIR)/root.dummy
  145. PROFILES += $$(DEVICE_NAME)
  146. BOARD_NAME := ea8500
  147. IMAGES := factory.bin sysupgrade.tar
  148. IMAGE/factory.bin := append-kernel 3145728 | append-ubi
  149. IMAGE/sysupgrade.tar := sysupgrade-nand
  150. DEVICE_VARS += DEVICE_DTS KERNEL_SIZE PAGESIZE BLOCKSIZE SUBPAGESIZE
  151. DEVICE_TITLE := Linksys EA8500
  152. DEVICE_PACKAGES := ath10k-firmware-qca99x0
  153. endef
  154. define Device/R7500
  155. $(call Device/DniImage)
  156. DEVICE_DTS := qcom-ipq8064-r7500
  157. KERNEL_SIZE := 2097152
  158. NETGEAR_BOARD_ID := R7500
  159. NETGEAR_HW_ID := 29764841+0+128+256+3x3+4x4
  160. BLOCKSIZE := 128KiB
  161. PAGESIZE := 2048
  162. BOARD_NAME := r7500
  163. DEVICE_TITLE := Netgear Nighthawk X4 R7500
  164. DEVICE_PACKAGES := ath10k-firmware-qca99x0
  165. endef
  166. define Device/R7500v2
  167. $(call Device/DniImage)
  168. DEVICE_DTS := qcom-ipq8064-r7500v2
  169. KERNEL_SIZE := 2097152
  170. NETGEAR_BOARD_ID := R7500v2
  171. NETGEAR_HW_ID := 29764958+0+128+512+3x3+4x4
  172. BLOCKSIZE := 128KiB
  173. PAGESIZE := 2048
  174. BOARD_NAME := r7500v2
  175. DEVICE_PACKAGES := ath10k-firmware-qca99x0
  176. endef
  177. define Device/R7800
  178. $(call Device/DniImage)
  179. DEVICE_DTS := qcom-ipq8065-r7800
  180. KERNEL_SIZE := 2097152
  181. NETGEAR_BOARD_ID := R7800
  182. NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4+cascade
  183. BLOCKSIZE := 128KiB
  184. PAGESIZE := 2048
  185. BOARD_NAME := r7800
  186. DEVICE_TITLE := Netgear Nighthawk X4S R7800
  187. DEVICE_PACKAGES := ath10k-firmware-qca9984
  188. endef
  189. TARGET_DEVICES += AP148 AP148-legacy C2600 D7800 DB149 EA8500 R7500 R7500v2 R7800
  190. $(eval $(call BuildImage))