Makefile 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. #
  2. # Copyright (C) 2012-2016 OpenWrt.org
  3. # Copyright (C) 2016 LEDE-project.org
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. JFFS2_BLOCKSIZE = 128k
  9. include $(TOPDIR)/rules.mk
  10. include $(INCLUDE_DIR)/image.mk
  11. KERNEL_LOADADDR := 0x00008000
  12. define Build/dtb
  13. $(call Image/BuildDTB,$(DTS_DIR)/$(DEVICE_DTS).dts,$@.dtb)
  14. endef
  15. # SD-Card Images:
  16. # these values are optimized for a 4GB labeled sdcard that actually holds 7744512 sectors of 512 byte
  17. # MBR: 2048 sectors
  18. # Partition 1: 32768 sectors
  19. # Partition 2: 98304 sectors (configurable)
  20. define Build/boot-scr
  21. rm -f $@.bootscript
  22. mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d boot.script $@.bootscript
  23. endef
  24. define Build/boot-img
  25. rm -f $@.boot
  26. mkfs.fat -C $@.boot 16384
  27. $(foreach dts,$(DEVICE_DTS), mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::$(dts).dtb)
  28. mcopy -i $@.boot $(IMAGE_KERNEL) ::zImage
  29. mcopy -i $@.boot $@.bootscript ::boot.scr
  30. endef
  31. define Build/sdcard-img
  32. ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \
  33. ./gen_mvebu_sdcard_img.sh $@ \
  34. "$(KDIR)/openwrt-mvebu-clearfog-u-boot-spl.kwb" \
  35. c 32768 $@.boot \
  36. 83 $$ROOTFS_SIZE $(IMAGE_ROOTFS)
  37. endef
  38. define Device/Default
  39. PROFILES := Default
  40. DEVICE_DTS := $(1)
  41. BOARD_NAME = $$(DEVICE_DTS)
  42. KERNEL_NAME := zImage
  43. KERNEL := kernel-bin | append-dtb | uImage none
  44. SUPPORTED_DEVICES = $$(DEVICE_DTS)
  45. endef
  46. define Device/UBI
  47. IMAGES := sysupgrade.bin
  48. IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
  49. endef
  50. define Device/UBI-factory
  51. $(Device/UBI)
  52. UBINIZE_OPTS := -E 5
  53. IMAGES += factory.img
  54. IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | pad-to $$$$(PAGESIZE)
  55. endef
  56. define Device/NAND-128K
  57. $(Device/UBI)
  58. BLOCKSIZE := 128k
  59. PAGESIZE := 2048
  60. SUBPAGESIZE := 512
  61. VID_HDR_OFFSET := 2048
  62. endef
  63. define Device/NAND-256K
  64. $(Device/UBI)
  65. BLOCKSIZE := 256k
  66. PAGESIZE := 4096
  67. endef
  68. define Device/NAND-512K
  69. $(Device/UBI)
  70. BLOCKSIZE := 512k
  71. PAGESIZE := 4096
  72. endef
  73. define Device/linksys
  74. DEVICE_TITLE := Linksys $(1)
  75. DEVICE_PACKAGES := kmod-mwlwifi wpad-mini swconfig
  76. endef
  77. define Device/armada-385-linksys
  78. $(Device/NAND-128K)
  79. $(Device/UBI-factory)
  80. KERNEL_SIZE := 6144k
  81. endef
  82. define Device/linksys-wrt1200ac
  83. $(call Device/linksys,WRT1200AC (Caiman))
  84. $(Device/armada-385-linksys)
  85. DEVICE_DTS := armada-385-linksys-caiman
  86. endef
  87. TARGET_DEVICES += linksys-wrt1200ac
  88. define Device/linksys-wrt1900acv2
  89. $(call Device/linksys,WRT1900ACv2 (Cobra))
  90. $(Device/armada-385-linksys)
  91. DEVICE_DTS := armada-385-linksys-cobra
  92. endef
  93. TARGET_DEVICES += linksys-wrt1900acv2
  94. define Device/linksys-wrt3200acm
  95. $(call Device/linksys,WRT3200ACM (Rango))
  96. $(Device/armada-385-linksys)
  97. DEVICE_DTS := armada-385-linksys-rango
  98. DEVICE_PACKAGES += kmod-mwifiex-sdio
  99. endef
  100. TARGET_DEVICES += linksys-wrt3200acm
  101. define Device/linksys-wrt1900acs
  102. $(call Device/linksys,WRT1900ACS (Shelby))
  103. $(Device/armada-385-linksys)
  104. DEVICE_DTS := armada-385-linksys-shelby
  105. endef
  106. TARGET_DEVICES += linksys-wrt1900acs
  107. define Device/linksys-wrt1900ac
  108. $(call Device/linksys,WRT1900AC (Mamba))
  109. DEVICE_DTS := armada-xp-linksys-mamba
  110. $(Device/NAND-128K)
  111. $(Device/UBI-factory)
  112. KERNEL_SIZE := 3072k
  113. endef
  114. TARGET_DEVICES += linksys-wrt1900ac
  115. define Device/openblocks-ax3-4
  116. $(Device/UBI-factory)
  117. DEVICE_DTS := armada-xp-openblocks-ax3-4
  118. SUPPORTED_DEVICES := $(1)
  119. BLOCKSIZE := 128k
  120. PAGESIZE := 1
  121. IMAGE/factory.img := append-kernel | pad-to $$(BLOCKSIZE) | append-ubi
  122. DEVICE_TITLE := Plat'Home OpenBlocks AX3
  123. endef
  124. TARGET_DEVICES += openblocks-ax3-4
  125. define Device/armada-385-db-ap
  126. $(Device/NAND-256K)
  127. $(Device/UBI-factory)
  128. KERNEL_SIZE := 8192k
  129. DEVICE_TITLE := Marvell Armada 385 DB AP (DB-88F6820-AP)
  130. endef
  131. TARGET_DEVICES += armada-385-db-ap
  132. define Device/marvell-nand
  133. $(Device/NAND-512K)
  134. DEVICE_TITLE := Marvell Armada $(1)
  135. endef
  136. Device/armada-370-db = $(call Device/marvell-nand,370 DB (DB-88F6710-BP-DDR3))
  137. Device/armada-370-rd = $(call Device/marvell-nand,370 RD (RD-88F6710-A1))
  138. Device/armada-xp-db = $(call Device/marvell-nand,XP DB (DB-78460-BP))
  139. Device/armada-xp-gp = $(call Device/marvell-nand,XP GP (DB-MV784MP-GP))
  140. TARGET_DEVICES += armada-370-db armada-370-rd armada-xp-db armada-xp-gp
  141. define Device/armada-388-rd
  142. DEVICE_TITLE := Marvell Armada 388 RD (RD-88F6820-AP)
  143. IMAGES := firmware.bin
  144. IMAGE/firmware.bin := append-kernel | pad-to 256k | append-rootfs | pad-rootfs
  145. endef
  146. TARGET_DEVICES += armada-388-rd
  147. define Device/armada-388-clearfog
  148. KERNEL_INSTALL := 1
  149. KERNEL := dtb | kernel-bin
  150. DEVICE_TITLE := SolidRun ClearFog
  151. DEVICE_PACKAGES := mkf2fs e2fsprogs swconfig kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1
  152. IMAGES := sdcard.img.gz
  153. IMAGE/sdcard.img.gz := boot-scr | boot-img | sdcard-img | gzip | append-metadata
  154. IMAGE_NAME = $$(IMAGE_PREFIX)-$$(2)
  155. endef
  156. TARGET_DEVICES += armada-388-clearfog
  157. define Device/globalscale-mirabox
  158. $(Device/NAND-512K)
  159. DEVICE_DTS := armada-370-mirabox
  160. SUPPORTED_DEVICES := mirabox
  161. DEVICE_TITLE := Globalscale Mirabox
  162. endef
  163. TARGET_DEVICES += globalscale-mirabox
  164. $(eval $(call BuildImage))