Makefile 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075
  1. #
  2. # Copyright (C) 2008-2011 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. include $(INCLUDE_DIR)/image.mk
  9. define imgname
  10. $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)
  11. endef
  12. define sysupname
  13. $(call imgname,$(1),$(2))-sysupgrade.bin
  14. endef
  15. VMLINUX:=$(IMG_PREFIX)-vmlinux
  16. UIMAGE:=$(IMG_PREFIX)-uImage
  17. define Image/Build/Initramfs
  18. $(call Image/Build/Profile/$(PROFILE),initramfs)
  19. endef
  20. DEVICE_VARS += DTS
  21. loadaddr-y := 0x80000000
  22. loadaddr-$(CONFIG_TARGET_ramips_rt288x) := 0x88000000
  23. loadaddr-$(CONFIG_TARGET_ramips_mt7621) := 0x80001000
  24. KERNEL_LOADADDR := $(loadaddr-y)
  25. KERNEL_DTB = kernel-bin | patch-dtb | lzma
  26. define Device/Default
  27. KERNEL := $(KERNEL_DTB) | uImage lzma
  28. IMAGES := sysupgrade.bin
  29. IMAGE_SIZE := $(ralink_default_fw_size_8M)
  30. IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  31. endef
  32. define Build/patch-dtb
  33. $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $@.dtb ../dts/$(DTS).dts
  34. $(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb
  35. endef
  36. define Build/trx
  37. $(STAGING_DIR_HOST)/bin/trx \
  38. -o $@ \
  39. -m $(IMAGE_SIZE) \
  40. -f $(word 1,$^) \
  41. -a 4 -f $(word 2,$^)
  42. endef
  43. define Build/seama
  44. $(STAGING_DIR_HOST)/bin/seama -i $@ $(1)
  45. mv $@.seama $@
  46. endef
  47. define Build/seama-seal
  48. $(call Build/seama,-s $@.seama $(1))
  49. endef
  50. define Build/relocate-kernel
  51. ( \
  52. dd if=$(KDIR)/loader.bin bs=32 conv=sync && \
  53. perl -e '@s = stat("$@"); print pack("V", @s[7])' && \
  54. cat $@ \
  55. ) > $@.new
  56. mv $@.new $@
  57. endef
  58. define MkCombineduImage
  59. $(call PatchKernelLzma,$(2),$(3))
  60. if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt `expr $(4) - 64` ]; then \
  61. echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big" >&2; \
  62. else if [ `stat -c%s "$(KDIR)/root.$(1)"` -gt $(5) ]; then \
  63. echo "Warning: $(KDIR)/root.$(1) is too big" >&2; \
  64. else \
  65. ( dd if=$(KDIR)/vmlinux-$(2).bin.lzma bs=`expr $(4) - 64` conv=sync ; dd if=$(KDIR)/root.$(1) ) > $(KDIR)/vmlinux-$(2).bin.lzma.combined ; \
  66. fi ; fi
  67. $(call MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.combined,$(call sysupname,$(1),$(2)),$(6))
  68. endef
  69. #
  70. # The real magic happens inside these templates
  71. #
  72. # $(1), compression method
  73. # $(2), filename of image data
  74. # $(3), output filename
  75. define MkImage
  76. $(eval imagename=$(if $(4),$(4),MIPS OpenWrt Linux-$(LINUX_VERSION)))
  77. -mkimage -A mips -O linux -T kernel -C $(1) -a $(loadaddr-y) -e $(loadaddr-y) \
  78. -n "$(imagename)" \
  79. -d $(2) $(3)
  80. endef
  81. define CompressLzma
  82. $(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(2)
  83. endef
  84. define MkImageSysupgrade/squashfs
  85. $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-$(if $(4),$(4),sysupgrade).bin)
  86. cat $(KDIR)/vmlinux-$(2).uImage $(KDIR)/root.$(1) > $(KDIR)/$(output_name)
  87. $(call prepare_generic_squashfs,$(KDIR)/$(output_name))
  88. if [ `stat -c%s "$(KDIR)/$(output_name)"` -gt $(3) ]; then \
  89. echo "Warning: $(KDIR)/$(output_name) is too big" >&2; \
  90. else \
  91. $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name); \
  92. fi
  93. endef
  94. define MkImageTpl/squashfs
  95. $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-$(if $(4),$(4),sysupgrade).bin)
  96. $(STAGING_DIR_HOST)/bin/mktplinkfw2 -V "ver. 2.0" -B "$(2)" -j \
  97. -o $(KDIR)/$(output_name) \
  98. -k $(KDIR)/vmlinux-$(1)$(4).bin.lzma \
  99. -r $(KDIR)/root.$(1)
  100. $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name)
  101. endef
  102. define MkImageTpl/initramfs
  103. $(eval output_name=$(IMG_PREFIX)-$(2)-$(1).bin)
  104. $(STAGING_DIR_HOST)/bin/mktplinkfw2 -V "ver. 2.0" -B "$(2)" -c \
  105. -o $(KDIR)/$(output_name) \
  106. -k $(KDIR)/vmlinux-$(1).bin.lzma
  107. $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name)
  108. endef
  109. # $(1), lowercase board name like "mt7620a_v22sg"
  110. # $(2), DTS filename without .dts extension
  111. # $(3), optional filename suffix, e.g. "-initramfs"
  112. define PatchKernelLzmaDtb
  113. cp $(KDIR)/vmlinux$(3) $(KDIR)/vmlinux-$(1)$(3)
  114. $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(2).dtb ../dts/$(2).dts
  115. $(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux-$(1)$(3) $(KDIR)/$(2).dtb
  116. $(call CompressLzma,$(KDIR)/vmlinux-$(1)$(3),$(KDIR)/vmlinux-$(1)$(3).bin.lzma)
  117. endef
  118. # $(1), lowercase board name
  119. # $(2), DTS filename without .dts extension
  120. # $(3), ih_name field of uImage header
  121. # $(4), optional filename suffix, e.g. "-initramfs"
  122. define MkImageLzmaDtb
  123. $(call PatchKernelLzmaDtb,$(1),$(2),$(4))
  124. $(call MkImage,lzma,$(KDIR)/vmlinux-$(1)$(4).bin.lzma,$(KDIR)/vmlinux-$(1)$(4).uImage,$(3))
  125. endef
  126. # $(1), Rootfs type, e.g. squashfs
  127. # $(2), lowercase board name
  128. # $(3), DTS filename without .dts extension
  129. # $(4), maximum size of sysupgrade image
  130. # $(5), uImage header's ih_name field
  131. define BuildFirmware/OF
  132. $(call MkImageLzmaDtb,$(2),$(3),$(5))
  133. $(call MkImageSysupgrade/$(1),$(1),$(2),$(4),$(6))
  134. endef
  135. define BuildFirmware/OF/tplink
  136. $(call PatchKernelLzmaDtb,$(1),$(2),$(4))
  137. $(call MkImageTpl/$(1),$(1),$(2),$(4),$(5))
  138. endef
  139. define BuildFirmware/OF/tplink/initramfs
  140. $(call PatchKernelLzmaDtb,$(2),$(3),-initramfs)
  141. $(call MkImageTpl/$(1),$(1),$(2),$(4),$(5))
  142. endef
  143. # $(1), squashfs/initramfs
  144. # $(2), lowercase board name
  145. # $(3), DTS filename without .dts extension
  146. # $(4), ih_name field of uImage header
  147. define BuildFirmware/OF/initramfs
  148. $(call MkImageLzmaDtb,$(2),$(3),$(4),-initramfs)
  149. $(CP) $(KDIR)/vmlinux-$(2)-initramfs.uImage $(call imgname,$(1),$(2))-uImage.bin
  150. endef
  151. # Build images for default ralink layout for 4MB flash
  152. # kernel + roots = 0x3b0000
  153. # $(1) = squashfs/initramfs
  154. # $(2) = lowercase board name
  155. # $(3) = dts file
  156. ralink_default_fw_size_4M=3866624
  157. BuildFirmware/Default4M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_4M),$(4))
  158. BuildFirmware/Default4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
  159. # Build images for default ralink layout for 8MB flash
  160. # kernel + roots = 0x7b0000
  161. # $(1) = squashfs/initramfs
  162. # $(2) = lowercase board name
  163. # $(3) = dts file
  164. # $(4) = uImage header name field
  165. ralink_default_fw_size_8M=8060928
  166. BuildFirmware/Default8M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_8M),$(4))
  167. BuildFirmware/Default8M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
  168. BuildFirmware/Tplink/squashfs=$(call BuildFirmware/OF/tplink,$(1),$(2),$(3),$(4))
  169. BuildFirmware/Tplink/initramfs=$(call BuildFirmware/OF/tplink/initramfs,$(1),$(2),$(3),$(4))
  170. ralink_default_fw_size_16M=16121856
  171. BuildFirmware/Default16M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_16M),$(4))
  172. BuildFirmware/Default16M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
  173. ralink_default_fw_size_32M=33226752
  174. BuildFirmware/Default32M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_32M),$(4))
  175. BuildFirmware/Default32M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
  176. # Build images for a custom sized flash layout
  177. # $(1) = squashfs/initramfs
  178. # $(2) = lowercase board name
  179. # $(3) = dts file
  180. # $(4) = kernel + rootfs size
  181. BuildFirmware/CustomFlash/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(4),$(5),$(6))
  182. BuildFirmware/CustomFlash/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
  183. # wrappers for boards that have 4MB and 8MB versions
  184. define BuildFirmware/DefaultDualSize/squashfs
  185. $(call BuildFirmware/Default4M/$(1),$(1),$(2)-4M,$(3)-4M)
  186. $(call BuildFirmware/Default8M/$(1),$(1),$(2)-8M,$(3)-8M)
  187. endef
  188. define BuildFirmware/DefaultDualSize/initramfs
  189. $(call BuildFirmware/OF/initramfs,$(1),$(2)-4M,$(3)-4M)
  190. $(call BuildFirmware/OF/initramfs,$(1),$(2)-8M,$(3)-8M)
  191. endef
  192. # Some boards need a special header inside the uImage to make them bootable
  193. define BuildFirmware/CustomFlashFactory/squashfs
  194. $(call BuildFirmware/CustomFlash/$(1),$(1),$(2),$(3),$(4))
  195. $(call BuildFirmware/CustomFlash/$(1),$(1),$(2),$(3),$(4),$(5),$(6))
  196. endef
  197. BuildFirmware/CustomFlashFactory/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
  198. # sign an image to make it work with edimax tftp recovery
  199. define BuildFirmware/Edimax/squashfs
  200. $(call BuildFirmware/OF,$(1),$(2),$(3),$(4))
  201. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  202. mkedimaximg -i $(call sysupname,$(1),$(2)) \
  203. -o $(call imgname,$(1),$(2))-factory.bin \
  204. -s $(5) -m $(6) -f $(7) -S $(8); \
  205. fi
  206. endef
  207. BuildFirmware/Edimax/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
  208. # build Seama header images
  209. define BuildFirmware/Seama/squashfs
  210. $(call MkImageLzmaDtb,$(2),$(3),$(5))
  211. $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-sysupgrade.bin)
  212. cat $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/root.$(1) > $(KDIR)/img_$(2).$(1).tmp
  213. if [ `stat -c%s "$(KDIR)/img_$(2).$(1).tmp"` -gt $$$$(($(5) - 64)) ]; then \
  214. echo "Warning: $(KDIR)/img_$(2).$(1).tmp is too big" >&2; \
  215. else \
  216. dd if=$(KDIR)/vmlinux-$(2).bin.lzma of=$(KDIR)/vmlinux-$(2).bin.lzma.padded bs=64k conv=sync; \
  217. ( \
  218. dd if=$(KDIR)/vmlinux-$(2).bin.lzma.padded bs=1 count=`expr \`stat -c%s $(KDIR)/vmlinux-$(2).bin.lzma.padded\` - 64`; \
  219. dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
  220. ) > $(KDIR)/vmlinux-$(2).tmp; \
  221. $(STAGING_DIR_HOST)/bin/seama \
  222. -i $(KDIR)/vmlinux-$(2).tmp \
  223. -m "dev=/dev/mtdblock/2" -m "type=firmware"; \
  224. $(STAGING_DIR_HOST)/bin/seama \
  225. -s $(call imgname,$(1),$(2))-factory.bin \
  226. -m "signature=$(4)" \
  227. -i $(KDIR)/vmlinux-$(2).tmp.seama; \
  228. dd if=$(KDIR)/vmlinux-$(2).bin.lzma.padded bs=1 count=`expr \`stat -c%s $(KDIR)/vmlinux-$(2).bin.lzma.padded\` - 64` of=$(KDIR)/vmlinux-$(2)-sysupgrade.tmp; \
  229. $(STAGING_DIR_HOST)/bin/seama \
  230. -i $(KDIR)/vmlinux-$(2)-sysupgrade.tmp \
  231. -m "dev=/dev/mtdblock/2" -m "type=firmware"; \
  232. ( \
  233. dd if=$(KDIR)/vmlinux-$(2)-sysupgrade.tmp.seama; \
  234. dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
  235. ) > $(BIN_DIR)/$(output_name); \
  236. fi
  237. endef
  238. BuildFirmware/Seama/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
  239. # sign Buffalo images
  240. define BuildFirmware/Buffalo
  241. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  242. buffalo-enc -p $(3) -v 1.76 \
  243. -i $(KDIR)/vmlinux-$(2).uImage \
  244. -o $(KDIR)/vmlinux-$(2).uImage.enc; \
  245. buffalo-enc -p $(3) -v 1.76 \
  246. -i $(KDIR)/root.$(1) \
  247. -o $(KDIR)/root.$(2).enc; \
  248. buffalo-tag -b $(3) -p $(3) -a ram -v 1.76 -m 1.01 \
  249. -l mlang8 -f 1 -r EU \
  250. -i $(KDIR)/vmlinux-$(2).uImage.enc \
  251. -i $(KDIR)/root.$(2).enc \
  252. -o $(call imgname,$(1),$(2))-factory-EU.bin; \
  253. fi
  254. endef
  255. # sign trednet / UMedia images
  256. define BuildFirmware/UMedia/squashfs
  257. $(call BuildFirmware/Default8M/$(1),$(1),$(2),$(3))
  258. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  259. fix-u-media-header -T 0x46 -B $(4) \
  260. -i $(call sysupname,$(1),$(2)) \
  261. -o $(call imgname,$(1),$(2))-factory.bin; \
  262. fi
  263. endef
  264. BuildFirmware/UMedia/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
  265. # sign dap 1350 based images
  266. dap1350_mtd_size=7667712
  267. define BuildFirmware/dap1350/squashfs
  268. $(call BuildFirmware/CustomFlash/$(1),$(1),$(2),$(3),$(dap1350_mtd_size))
  269. -mkdapimg -s $(4) \
  270. -i $(call sysupname,$(1),$(2)) \
  271. -o $(call imgname,$(1),$(2))-factory.bin
  272. endef
  273. BuildFirmware/dap1350/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
  274. # Sign Poray images
  275. define BuildFirmware/Poray4M/squashfs
  276. $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
  277. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  278. mkporayfw -B $(3) -F 4M \
  279. -f $(call sysupname,$(1),$(2)) \
  280. -o $(call imgname,$(1),$(2))-factory.bin; \
  281. fi
  282. endef
  283. BuildFirmware/Poray4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
  284. define BuildFirmware/Poray8M/squashfs
  285. $(call BuildFirmware/Default8M/$(1),$(1),$(2),$(3))
  286. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  287. mkporayfw -B $(3) -F 8M \
  288. -f $(call sysupname,$(1),$(2)) \
  289. -o $(call imgname,$(1),$(2))-factory.bin; \
  290. fi
  291. endef
  292. BuildFirmware/Poray8M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
  293. define BuildFirmware/PorayDualSize/squashfs
  294. $(call BuildFirmware/DefaultDualSize/$(1),$(1),$(2),$(3))
  295. if [ -e "$(call sysupname,$(1),$(2)-4M)" ]; then \
  296. mkporayfw -B $(3) -F 4M \
  297. -f $(call sysupname,$(1),$(2)-4M) \
  298. -o $(call imgname,$(1),$(2)-4M)-factory.bin; \
  299. fi
  300. if [ -e "$(call sysupname,$(1),$(2)-8M)" ]; then \
  301. mkporayfw -B $(3) -F 8M \
  302. -f $(call sysupname,$(1),$(2)-8M) \
  303. -o $(call imgname,$(1),$(2)-8M)-factory.bin; \
  304. fi
  305. endef
  306. BuildFirmware/PorayDualSize/initramfs=$(call BuildFirmware/DefaultDualSize/initramfs,$(1),$(2),$(3))
  307. define BuildFirmware/Gemtek/squashfs
  308. $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
  309. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  310. mkheader_gemtek "$(call sysupname,$(1),$(2))" \
  311. "$(call imgname,$(1),$(2))-factory.bin" $(2) || \
  312. rm -f "$(call imgname,$(1),$(2))-factory.bin"; \
  313. fi
  314. endef
  315. BuildFirmware/Gemtek/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
  316. # Airlink101 AR670W -- LZMA without uImage header
  317. define BuildFirmware/AR670W/squashfs
  318. $(call PatchKernelLzmaDtb,$(2),$(3),$(5))
  319. $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-$(if $(4),$(4),sysupgrade).bin)
  320. $(eval factory_name=$(IMG_PREFIX)-$(2)-$(1)-factory.bin)
  321. ( dd if=$(KDIR)/vmlinux-$(2).bin.lzma bs=65536 \
  322. conv=sync; dd if=$(KDIR)/root.$(1) ) > $(KDIR)/$(output_name)
  323. $(call prepare_generic_squashfs,$(KDIR)/$(output_name))
  324. if [ `stat -c%s "$(KDIR)/$(output_name)"` \
  325. -gt $(ralink_default_fw_size_4M) ]; then \
  326. echo "Warning: $(KDIR)/$(output_name) is too big" >&2; \
  327. else \
  328. mkwrgimg -i $(KDIR)/$(output_name) \
  329. -d "/dev/mtdblock/2" \
  330. -s "wrgn16a_airlink_ar670w" \
  331. -o $(BIN_DIR)/$(factory_name); \
  332. $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name); \
  333. fi
  334. endef
  335. #
  336. # RT288X Profiles
  337. #
  338. Image/Build/Profile/AR670W=$(call BuildFirmware/AR670W/$(1),$(1),ar670w,AR670W)
  339. Image/Build/Profile/AR725W=$(call BuildFirmware/Gemtek/$(1),$(1),ar725w,AR725W)
  340. # 0x790000
  341. belkin_f5d8235v1_mtd_size=7929856
  342. Image/Build/Profile/F5D8235V1=$(call BuildFirmware/CustomFlash/$(1),$(1),f5d8235v1,F5D8235_V1,$(belkin_f5d8235v1_mtd_size))
  343. Image/Build/Profile/RTN15=$(call BuildFirmware/Default4M/$(1),$(1),rt-n15,RT-N15)
  344. Image/Build/Profile/V11STFE=$(call BuildFirmware/Default4M/$(1),$(1),v11st-fe,V11STFE)
  345. Image/Build/Profile/WLITX4AG300N=$(call BuildFirmware/Default4M/$(1),$(1),wli-tx4-ag300n,WLI-TX4-AG300N)
  346. Image/Build/Profile/WZRAGL300NH=$(call BuildFirmware/Default4M/$(1),$(1),wzr-agl300nh,WZR-AGL300NH)
  347. ifeq ($(SUBTARGET),rt288x)
  348. define Image/Build/Profile/Default
  349. $(call Image/Build/Profile/AR670W,$(1))
  350. $(call Image/Build/Profile/AR725W,$(1))
  351. $(call Image/Build/Profile/F5D8235V1,$(1))
  352. $(call Image/Build/Profile/RTN15,$(1))
  353. $(call Image/Build/Profile/V11STFE,$(1))
  354. $(call Image/Build/Profile/WLITX4AG300N,$(1))
  355. $(call Image/Build/Profile/WZRAGL300NH,$(1))
  356. endef
  357. endif
  358. #
  359. # RT305X Profiles
  360. #
  361. Image/Build/Profile/DIR610A1=$(call BuildFirmware/Seama/$(1),$(1),dir-610-a1,DIR-610-A1,wrgn59_dlob.hans_dir610,$(ralink_default_fw_size_4M))
  362. edimax_3g6200n_mtd_size=3735552
  363. Image/Build/Profile/3G6200N=$(call BuildFirmware/Edimax/$(1),$(1),3g-6200n,3G-6200N,$(edimax_3g6200n_mtd_size),CSYS,3G62,0x50000,0xc0000)
  364. Image/Build/Profile/3G6200NL=$(call BuildFirmware/Edimax/$(1),$(1),3g-6200nl,3G-6200NL,$(edimax_3g6200n_mtd_size),CSYS,3G62,0x50000,0xc0000)
  365. Image/Build/Profile/3G300M=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),3g300m,3G300M,$(ralink_default_fw_size_4M),3G150M_SPI Kernel Image,factory)
  366. Image/Build/Profile/A5-V11=$(call BuildFirmware/Poray4M/$(1),$(1),a5-v11,A5-V11)
  367. Image/Build/Profile/AIR3GII=$(call BuildFirmware/Default4M/$(1),$(1),air3gii,AIR3GII)
  368. define BuildFirmware/UIMAGE_8M
  369. $(call MkCombineduImage,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) $(call mkmtd/$(6),$(mtdlayout_8M)),$(kernel_size_8M),$(rootfs_size_8M),$(7))
  370. endef
  371. define Image/Build/Profile/ALL02393G
  372. $(call Image/Build/Template/$(image_type)/$(1),UIMAGE_8M,all0239-3g,ALL0239-3G,ttyS1,57600,phys)
  373. endef
  374. Image/Build/Profile/ALL0256N=$(call BuildFirmware/DefaultDualSize/$(1),$(1),all0256n,ALL0256N)
  375. allnet_all5002_mtd_size=33226752
  376. Image/Build/Profile/ALL5002=$(call BuildFirmware/CustomFlash/$(1),$(1),all5002,ALL5002,$(allnet_all5002_mtd_size))
  377. Image/Build/Profile/ALL5003=$(call BuildFirmware/CustomFlash/$(1),$(1),all5003,ALL5003,$(allnet_all5002_mtd_size))
  378. argus_atp52b_mtd_size=7995392
  379. Image/Build/Profile/ARGUS_ATP52B=$(call BuildFirmware/CustomFlash/$(1),$(1),argus_atp52b,ARGUS_ATP52B,$(argus_atp52b_mtd_size))
  380. asl26555_8mb_mtd_size=7929856
  381. asl26555_16mb_mtd_size=16252928
  382. define BuildFirmware/ASL26555/squashfs
  383. $(call BuildFirmware/CustomFlash/$(1),$(1),$(2)-8M,$(3)-8M,$(asl26555_8mb_mtd_size))
  384. $(call BuildFirmware/CustomFlash/$(1),$(1),$(2)-16M,$(3)-16M,$(asl26555_16mb_mtd_size))
  385. endef
  386. define BuildFirmware/ASL26555/initramfs
  387. $(call BuildFirmware/OF/initramfs,$(1),$(2)-8M,$(3)-8M)
  388. $(call BuildFirmware/OF/initramfs,$(1),$(2)-16M,$(3)-16M)
  389. endef
  390. Image/Build/Profile/ASL26555=$(call BuildFirmware/ASL26555/$(1),$(1),asl26555,ASL26555)
  391. Image/Build/Profile/AWM002EVB=$(call BuildFirmware/DefaultDualSize/$(1),$(1),awm002-evb,AWM002-EVB)
  392. Image/Build/Profile/AWM003EVB=$(call BuildFirmware/Default8M/$(1),$(1),awm003-evb,AWM003-EVB)
  393. Image/Build/Profile/AWAPN2403=$(call BuildFirmware/Default4M/$(1),$(1),awmapn2403,AWAPN2403)
  394. Image/Build/Profile/BC2=$(call BuildFirmware/Default8M/$(1),$(1),bc2,BC2)
  395. broadway_mtd_size=7929856
  396. Image/Build/Profile/BROADWAY=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),broadway,BROADWAY,$(broadway_mtd_size),Broadway Kernel Image,factory)
  397. Image/Build/Profile/CARAMBOLA=$(call BuildFirmware/Default8M/$(1),$(1),carambola,CARAMBOLA)
  398. Image/Build/Profile/D105=$(call BuildFirmware/Default4M/$(1),$(1),d105,D105)
  399. define BuildFirmware/DIR300B1/squashfs
  400. $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
  401. -mkwrgimg -s $(4) -d /dev/mtdblock/2 \
  402. -i $(call sysupname,$(1),$(2)) \
  403. -o $(call imgname,$(1),$(2))-factory.bin
  404. endef
  405. BuildFirmware/DIR300B1/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
  406. Image/Build/Profile/DIR-300-B1=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-300-b1,DIR-300-B1,wrgn23_dlwbr_dir300b)
  407. Image/Build/Profile/DIR-600-B1=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-600-b1,DIR-600-B1,wrgn23_dlwbr_dir600b)
  408. Image/Build/Profile/DIR-600-B2=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-600-b2,DIR-600-B2,wrgn23_dlwbr_dir600b)
  409. Image/Build/Profile/DIR-615-D=$(call BuildFirmware/DIR300B1/$(1),$(1),dir-615-d,DIR-615-D,wrgn23_dlwbr_dir615d)
  410. Image/Build/Profile/DIR-620-A1=$(call BuildFirmware/Default8M/$(1),$(1),dir-620-a1,DIR-620-A1)
  411. Image/Build/Profile/DIR-620-D1=$(call BuildFirmware/Default8M/$(1),$(1),dir-620-d1,DIR-620-D1)
  412. define BuildFirmware/DIR615H1/squashfs
  413. $(call BuildFirmware/Default4M/$(1),$(1),dir-615-h1,DIR-615-H1)
  414. -mksenaofw -e $(call sysupname,$(1),dir-615-h1) \
  415. -o $(call imgname,$(1),dir-615-h1)-factory.bin \
  416. -r 0x218 -p 0x30 -t 3
  417. endef
  418. BuildFirmware/DIR615H1/initramfs=$(call BuildFirmware/OF/initramfs,$(1),dir-615-h1,DIR-615-H1)
  419. Image/Build/Profile/DIR615H1=$(call BuildFirmware/DIR615H1/$(1),$(1))
  420. Image/Build/Profile/DAP1350=$(call BuildFirmware/dap1350/$(1),$(1),dap-1350,DAP-1350,RT3052-AP-DAP1350-3)
  421. Image/Build/Profile/DAP1350WW=$(call BuildFirmware/dap1350/$(1),$(1),dap-1350WW,DAP-1350,RT3052-AP-DAP1350WW-3)
  422. define BuildFirmware/DCS930/squashfs
  423. $(call BuildFirmware/Default4M/squashfs,squashfs,$(2),$(3))
  424. dd if=$(KDIR)/vmlinux-$(2).bin.lzma of=$(KDIR)/image.$(2).combined bs=1048512 count=1 conv=sync
  425. cat $(KDIR)/root.squashfs >> $(KDIR)/image.$(2).combined
  426. $(call MkImage,lzma,$(KDIR)/image.$(2).combined,$(KDIR)/image.$(2))
  427. $(call prepare_generic_squashfs,$(KDIR)/image.$(2))
  428. if [ `stat -c%s "$(KDIR)/image.$(2)"` -gt $(ralink_default_fw_size_4M) ]; then \
  429. echo "Warning: $(KDIR)/image.$(2) is too big" >&2; \
  430. else \
  431. dd if=$(KDIR)/image.$(2) of=$(KDIR)/dcs.tmp bs=64K count=5 conv=sync ;\
  432. cat $(KDIR)/image.$(2) >> $(KDIR)/dcs.tmp ; \
  433. dd if=$(KDIR)/dcs.tmp of=$(call imgname,$(1),$(2))-factory.bin bs=4096k count=1 conv=sync ;\
  434. $(STAGING_DIR_HOST)/bin/mkdcs932 $(call imgname,$(1),$(2))-factory.bin ; \
  435. fi
  436. endef
  437. BuildFirmware/DCS930/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
  438. Image/Build/Profile/DCS930=$(call BuildFirmware/DCS930/$(1),$(1),dcs-930,DCS-930)
  439. Image/Build/Profile/DCS930LB1=$(call BuildFirmware/DCS930/$(1),$(1),dcs-930l-b1,DCS-930L-B1)
  440. Image/Build/Profile/ESR-9753=$(call BuildFirmware/Default4M/$(1),$(1),esr-9753,ESR-9753)
  441. Image/Build/Profile/HW550-3G=$(call BuildFirmware/Default8M/$(1),$(1),hw550-3g,HW550-3G)
  442. belkin_f5d8235v2_mtd_size=7929856
  443. Image/Build/Profile/F5D8235V2=$(call BuildFirmware/CustomFlash/$(1),$(1),f5d8235v2,F5D8235_V2,$(belkin_f5d8235v2_mtd_size))
  444. # 0x770000
  445. belkin_f7c027_mtd_size=7798784
  446. Image/Build/Profile/F7C027=$(call BuildFirmware/CustomFlash/$(1),$(1),belkinf7c027,F7C027,$(belkin_f7c027_mtd_size))
  447. Image/Build/Profile/FONERA20N=$(call BuildFirmware/Edimax/$(1),$(1),fonera20n,FONERA20N,$(ralink_default_fw_size_8M),RSDK,NL1T,0x50000,0xc0000)
  448. Image/Build/Profile/RT-N13U=$(call BuildFirmware/Default8M/$(1),$(1),rt-n13u,RT-N13U)
  449. #Image/Build/Profile/HG255D=$(call BuildFirmware/Default16M/$(1),$(1),hg255d,HG255D)
  450. Image/Build/Profile/FREESTATION5=$(call BuildFirmware/Default8M/$(1),$(1),freestation5,FREESTATION5)
  451. Image/Build/Profile/IP2202=$(call BuildFirmware/Default8M/$(1),$(1),ip2202,IP2202)
  452. BuildFirmware/HLKRM04/squashfs=$(call BuildFirmware/Default4M/squashfs,$(1),$(2),$(3),$(4))
  453. define BuildFirmware/HLKRM04/initramfs
  454. $(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
  455. mkhilinkfw -e -i$(call imgname,$(1),$(2))-uImage.bin -o $(call imgname,$(1),$(2))-factory.bin;
  456. endef
  457. Image/Build/Profile/HLKRM04=$(call BuildFirmware/HLKRM04/$(1),$(1),hlk-rm04,HLKRM04,HLK-RM04)
  458. Image/Build/Profile/HT-TM02=$(call BuildFirmware/Default8M/$(1),$(1),ht-tm02,HT-TM02)
  459. Image/Build/Profile/M3=$(call BuildFirmware/Poray4M/$(1),$(1),m3,M3)
  460. Image/Build/Profile/M4=$(call BuildFirmware/PorayDualSize/$(1),$(1),m4,M4)
  461. Image/Build/Profile/MOFI3500-3GN=$(call BuildFirmware/Default8M/$(1),$(1),mofi3500-3gn,MOFI3500-3GN)
  462. # Kernel name should be "Linux Kernel Image" to make the OpenWrt image installable from factory Web UI
  463. Image/Build/Profile/3G150B=$(call BuildFirmware/Default4M/$(1),$(1),3g150b,3G150B,Linux Kernel Image)
  464. Image/Build/Profile/MR102N=$(call BuildFirmware/Default8M/$(1),$(1),mr-102n,MR-102N)
  465. Image/Build/Profile/MPRA1=$(call BuildFirmware/Default4M/$(1),$(1),mpr-a1,MPRA1,Linux Kernel Image)
  466. Image/Build/Profile/MPRA2=$(call BuildFirmware/Default8M/$(1),$(1),mpr-a2,MPRA2,Linux Kernel Image)
  467. Image/Build/Profile/DIR-300-B7=$(call BuildFirmware/Default4M/$(1),$(1),dir-300-b7,DIR-300-B7)
  468. Image/Build/Profile/DIR-320-B1=$(call BuildFirmware/Default8M/$(1),$(1),dir-320-b1,DIR-320-B1)
  469. Image/Build/Profile/NBG-419N=$(call BuildFirmware/Default4M/$(1),$(1),nbg-419n,NBG-419N)
  470. Image/Build/Profile/MZKW300NH2=$(call BuildFirmware/Edimax/$(1),$(1),mzk-w300nh2,MZK-W300NH2,$(mzkw300nh2_mtd_size),CSYS,RN52,0x50000,0xc0000)
  471. Image/Build/Profile/NCS601W=$(call BuildFirmware/Default8M/$(1),$(1),ncs601W,NCS601W)
  472. nw718_mtd_size=3801088
  473. Image/Build/Profile/NW718=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),nw718m,NW718,$(nw718_mtd_size),ARA1B4NCRNW718;1,factory)
  474. Image/Build/Profile/M2M=$(call BuildFirmware/Default8M/$(1),$(1),m2m,M2M,Linux Kernel Image)
  475. Image/Build/Profile/OMNI-EMB=$(call BuildFirmware/Default8M/$(1),$(1),omni-emb,OMNI-EMB)
  476. Image/Build/Profile/OMNI-PLUG=$(call BuildFirmware/Default8M/$(1),$(1),omni-plug,OMNI-PLUG)
  477. Image/Build/Profile/OLINUXINO-RT5350F=$(call BuildFirmware/Default8M/$(1),$(1),olinuxino-rt5350f,OLINUXINO-RT5350F)
  478. Image/Build/Profile/OLINUXINO-RT5350F-EVB=$(call BuildFirmware/Default8M/$(1),$(1),olinuxino-rt5350f-evb,OLINUXINO-RT5350F-EVB)
  479. Image/Build/Profile/PSR-680W=$(call BuildFirmware/Default4M/$(1),$(1),psr-680w,PSR-680W)
  480. Image/Build/Profile/PWH2004=$(call BuildFirmware/Default8M/$(1),$(1),pwh2004,PWH2004)
  481. Image/Build/Profile/PX4885=$(call BuildFirmware/DefaultDualSize/$(1),$(1),px4885,PX4885)
  482. Image/Build/Profile/RTG32B1=$(call BuildFirmware/Default4M/$(1),$(1),rt-g32-b1,RT-G32-B1)
  483. Image/Build/Profile/RTN10PLUS=$(call BuildFirmware/Default4M/$(1),$(1),rt-n10-plus,RT-N10-PLUS)
  484. Image/Build/Profile/RUT5XX=$(call BuildFirmware/Default8M/$(1),$(1),rut5xx,RUT5XX)
  485. Image/Build/Profile/SL-R7205=$(call BuildFirmware/Default4M/$(1),$(1),sl-r7205,SL-R7205)
  486. Image/Build/Profile/V22RW-2X2=$(call BuildFirmware/Default4M/$(1),$(1),v22rw-2x2,V22RW-2X2)
  487. Image/Build/Profile/VOCORE=$(call BuildFirmware/Default8M/$(1),$(1),vocore,VOCORE)
  488. Image/Build/Profile/W150M=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),w150m,W150M,$(ralink_default_fw_size_4M),W150M Kernel Image,factory)
  489. Image/Build/Profile/W306R_V20=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),w306r-v20,W306R_V20,$(ralink_default_fw_size_4M),linkn Kernel Image,factory)
  490. Image/Build/Profile/W502U=$(call BuildFirmware/Default8M/$(1),$(1),w502u,W502U)
  491. Image/Build/Profile/WCR150GN=$(call BuildFirmware/Default4M/$(1),$(1),wcr150gn,WCR150GN)
  492. buffalo_whrg300n_mtd_size=3801088
  493. define BuildFirmware/WHRG300N/squashfs
  494. $(call BuildFirmware/Default4M/$(1),$(1),whr-g300n,WHR-G300N)
  495. # the following line has a bad argument 3 ... the old Makefile was already broken
  496. $(call BuildFirmware/Buffalo,$(1),whr-g300n,whr-g300n)
  497. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  498. ( \
  499. echo -n -e "# Airstation FirmWare\nrun u_fw\nreset\n\n" | \
  500. dd bs=512 count=1 conv=sync; \
  501. dd if=$(call sysupname,$(1),whr-g300n); \
  502. ) > $(KDIR)/whr-g300n-tftp.tmp && \
  503. buffalo-tftp -i $(KDIR)/whr-g300n-tftp.tmp \
  504. -o $(call imgname,$(1),whr-g300n)-tftp.bin; \
  505. fi
  506. endef
  507. BuildFirmware/WHRG300N/initramfs=$(call BuildFirmware/OF/initramfs,$(1),whr-g300n,WHR-G300N)
  508. Image/Build/Profile/WHRG300N=$(call BuildFirmware/WHRG300N/$(1),$(1))
  509. Image/Build/Profile/WIZFI630A=$(call BuildFirmware/Default16M/$(1),$(1),wizfi630a,WIZFI630A)
  510. Image/Build/Profile/WIZARD8800=$(call BuildFirmware/Default8M/$(1),$(1),wizard-8800,WIZARD8800,Linux Kernel Image)
  511. Image/Build/Profile/WL_330N=$(call BuildFirmware/Default4M/$(1),$(1),wl-330n,WL_330N)
  512. Image/Build/Profile/WL_330N3G=$(call BuildFirmware/Default4M/$(1),$(1),wl-330n3g,WL_330N3G)
  513. kernel_size_wl341v3=917504
  514. rootfs_size_wl341v3=2949120
  515. define BuildFirmware/WL341V3/squashfs
  516. $(call BuildFirmware/Default4M/$(1),$(1),wl341v3,WL341V3)
  517. # This code looks broken and really needs to be converted to C
  518. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  519. ( \
  520. dd if=/dev/zero bs=195936 count=1; \
  521. echo "1.01"; \
  522. dd if=/dev/zero bs=581 count=1; \
  523. echo -n -e "\x73\x45\x72\x43\x6F\x4D\x6D\x00\x01\x00\x00\x59\x4E\x37\x95\x58\x10\x00\x20\x00\x28\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x03\x00\x00\x80\x00\x00\x00\x00\x03\x00\x00\x10\x12\x00\x00\x00\x10\x73\x45\x72\x43\x6F\x4D\x6D"; \
  524. dd if=/dev/zero bs=65552 count=1; \
  525. dd if=$(KDIR)/vmlinux-$(2).uImage bs=$(kernel_size_wl341v3) conv=sync; \
  526. dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
  527. dd if=/dev/zero bs=`expr 4194304 - 262144 - 16 - $(kernel_size_wl341v3) - \( \( \( \`stat -c%s $(KDIR)/root.$(1)\` / 65536 \) + 1 \) \* 65536 \)` count=1; \
  528. echo -n -e "\x11\x03\x80\x00\x10\x12\x90\xF7\x65\x52\x63\x4F\x6D\x4D\x00\x00"; \
  529. ) > $(call imgname,$(1),$(2))-factory.bin; \
  530. fi
  531. endef
  532. BuildFirmware/WL341V3/initramfs=$(call BuildFirmware/OF/initramfs,$(1),wl341v3,WL341V3)
  533. Image/Build/Profile/WL341V3=$(call BuildFirmware/WL341V3/$(1),$(1))
  534. Image/Build/Profile/WL-351=$(call BuildFirmware/Default4M/$(1),$(1),wl-351,WL-351)
  535. define BuildFirmware/WNCE2001/squashfs
  536. $(call BuildFirmware/Default4M/$(1),$(1),$(2),$(3))
  537. -mkdapimg -s RT3052-AP-WNCE2001-3 -r WW -v 1.0.0.99 \
  538. -i $(call sysupname,$(1),$(2)) \
  539. -o $(call imgname,$(1),$(2))-factory-worldwide.bin
  540. -mkdapimg -s RT3052-AP-WNCE2001-3 -r NA -v 1.0.0.99 \
  541. -i $(call sysupname,$(1),$(2)) \
  542. -o $(call imgname,$(1),$(2))-factory-northamerica.bin
  543. endef
  544. BuildFirmware/WNCE2001/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3))
  545. Image/Build/Profile/WNCE2001=$(call BuildFirmware/WNCE2001/$(1),$(1),wnce2001,WNCE2001)
  546. Image/Build/Profile/WR512-3GN=$(call BuildFirmware/DefaultDualSize/$(1),$(1),wr512-3ng,WR512-3GN)
  547. Image/Build/Profile/WT1520=$(call BuildFirmware/PorayDualSize/$(1),$(1),wt1520,WT1520)
  548. Image/Build/Profile/UR-326N4G=$(call BuildFirmware/Default4M/$(1),$(1),ur-326n4g,UR-326N4G)
  549. Image/Build/Profile/UR-336UN=$(call BuildFirmware/Default8M/$(1),$(1),ur-336un,UR-336UN)
  550. Image/Build/Profile/WR6202=$(call BuildFirmware/Default8M/$(1),$(1),wr6202,WR6202)
  551. Image/Build/Profile/X5=$(call BuildFirmware/Poray8M/$(1),$(1),x5,X5)
  552. Image/Build/Profile/X8=$(call BuildFirmware/Poray8M/$(1),$(1),x8,X8)
  553. Image/Build/Profile/XDXRN502J=$(call BuildFirmware/Default4M/$(1),$(1),xdxrn502j,XDXRN502J)
  554. ifeq ($(SUBTARGET),rt305x)
  555. define Image/Build/Profile/Default
  556. $(call Image/Build/Profile/3G6200N,$(1))
  557. $(call Image/Build/Profile/3G6200NL,$(1))
  558. $(call Image/Build/Profile/3G150B,$(1))
  559. $(call Image/Build/Profile/3G300M,$(1))
  560. $(call Image/Build/Profile/A5-11,$(1))
  561. $(call Image/Build/Profile/AIR3GII,$(1))
  562. $(call Image/Build/Profile/ALL02393G,$(1))
  563. $(call Image/Build/Profile/ALL0256N,$(1))
  564. $(call Image/Build/Profile/ALL5002,$(1))
  565. $(call Image/Build/Profile/ALL5003,$(1))
  566. $(call Image/Build/Profile/ARGUS_ATP52B,$(1))
  567. $(call Image/Build/Profile/ASL26555,$(1))
  568. $(call Image/Build/Profile/AWM002EVB,$(1))
  569. $(call Image/Build/Profile/AWAPN2403,$(1))
  570. $(call Image/Build/Profile/BC2,$(1))
  571. $(call Image/Build/Profile/BROADWAY,$(1))
  572. $(call Image/Build/Profile/CARAMBOLA,$(1))
  573. $(call Image/Build/Profile/D105,$(1))
  574. $(call Image/Build/Profile/DIR-300-B1,$(1))
  575. $(call Image/Build/Profile/DIR-600-B1,$(1))
  576. $(call Image/Build/Profile/DIR-300-B7,$(1))
  577. $(call Image/Build/Profile/DIR-320-B1,$(1))
  578. $(call Image/Build/Profile/DIR-600-B2,$(1))
  579. $(call Image/Build/Profile/DIR610A1,$(1))
  580. $(call Image/Build/Profile/DIR-615-D,$(1))
  581. $(call Image/Build/Profile/DIR-620-A1,$(1))
  582. $(call Image/Build/Profile/DIR-620-D1,$(1))
  583. $(call Image/Build/Profile/DIR615H1,$(1))
  584. $(call Image/Build/Profile/DAP1350,$(1))
  585. $(call Image/Build/Profile/DAP1350WW,$(1))
  586. $(call Image/Build/Profile/DCS930,$(1))
  587. $(call Image/Build/Profile/DCS930LB1,$(1))
  588. $(call Image/Build/Profile/ESR-9753,$(1))
  589. $(call Image/Build/Profile/F7C027,$(1))
  590. $(call Image/Build/Profile/F5D8235V2,$(1))
  591. $(call Image/Build/Profile/FONERA20N,$(1))
  592. $(call Image/Build/Profile/FREESTATION5,$(1))
  593. # $(call Image/Build/Profile/HG255D,$(1))
  594. $(call Image/Build/Profile/HLKRM04,$(1))
  595. $(call Image/Build/Profile/HT-TM02,$(1))
  596. $(call Image/Build/Profile/HW550-3G,$(1))
  597. $(call Image/Build/Profile/IP2202,$(1))
  598. $(call Image/Build/Profile/M2M,$(1))
  599. $(call Image/Build/Profile/M3,$(1))
  600. $(call Image/Build/Profile/M4,$(1))
  601. $(call Image/Build/Profile/MOFI3500-3GN,$(1))
  602. $(call Image/Build/Profile/MR102N,$(1))
  603. $(call Image/Build/Profile/MPRA1,$(1))
  604. $(call Image/Build/Profile/MPRA2,$(1))
  605. $(call Image/Build/Profile/MZKW300NH2,$(1))
  606. $(call Image/Build/Profile/NBG-419N,$(1))
  607. $(call Image/Build/Profile/NCS601W,$(1))
  608. $(call Image/Build/Profile/NW718,$(1))
  609. $(call Image/Build/Profile/OMNI-EMB,$(1))
  610. $(call Image/Build/Profile/OMNI-PLUG,$(1))
  611. $(call Image/Build/Profile/OLINUXINO-RT5350F,$(1))
  612. $(call Image/Build/Profile/OLINUXINO-RT5350F-EVB,$(1))
  613. $(call Image/Build/Profile/PSR-680W,$(1))
  614. $(call Image/Build/Profile/PWH2004,$(1))
  615. $(call Image/Build/Profile/PX4885,$(1))
  616. $(call Image/Build/Profile/RTG32B1,$(1))
  617. $(call Image/Build/Profile/RTN10PLUS,$(1))
  618. $(call Image/Build/Profile/RT-N13U,$(1))
  619. $(call Image/Build/Profile/RUT5XX,$(1))
  620. $(call Image/Build/Profile/SL-R7205,$(1))
  621. $(call Image/Build/Profile/UR-326N4G,$(1))
  622. $(call Image/Build/Profile/V22RW-2X2,$(1))
  623. $(call Image/Build/Profile/VOCORE,$(1))
  624. $(call Image/Build/Profile/W150M,$(1))
  625. $(call Image/Build/Profile/W306R_V20,$(1))
  626. $(call Image/Build/Profile/W502U,$(1))
  627. $(call Image/Build/Profile/WCR150GN,$(1))
  628. $(call Image/Build/Profile/WHRG300N,$(1))
  629. $(call Image/Build/Profile/WIZARD8800,$(1))
  630. $(call Image/Build/Profile/WIZFI630A,$(1))
  631. $(call Image/Build/Profile/WL_330N,$(1))
  632. $(call Image/Build/Profile/WL_330N3G,$(1))
  633. $(call Image/Build/Profile/WL341V3,$(1))
  634. $(call Image/Build/Profile/WL-351,$(1))
  635. $(call Image/Build/Profile/WNCE2001,$(1))
  636. $(call Image/Build/Profile/WR512-3GN,$(1))
  637. $(call Image/Build/Profile/WR6202,$(1))
  638. $(call Image/Build/Profile/WT1520,$(1))
  639. $(call Image/Build/Profile/X5,$(1))
  640. $(call Image/Build/Profile/X8,$(1))
  641. $(call Image/Build/Profile/XDXRN502J,$(1))
  642. endef
  643. endif
  644. #
  645. # RT3662/RT3883 Profiles
  646. #
  647. # $(1) = squashfs/initramfs
  648. # $(2) = lowercase board name
  649. # $(3) = dts file
  650. # $(4) = kernel size
  651. # $(5) = rootfs size
  652. # $(6) = signature
  653. # $(7) = model
  654. # $(8) = flash address
  655. # $(9) = start address
  656. define BuildFirmware/EdimaxCombined/squashfs
  657. $(call PatchKernelLzmaDtb,$(2),$(3))
  658. $(call MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).bin.uImage)
  659. if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.uImage"` -gt `expr $(4) - 20` ]; then \
  660. echo "Warning: $(KDIR)/vmlinux-$(2).bin.uImage is too big" >&2; \
  661. exit 1; \
  662. else if [ `stat -c%s "$(KDIR)/root.$(1)"` -gt $(5) ]; then \
  663. echo "Warning: $(KDIR)/root.$(1) is too big" >&2; \
  664. exit 1; \
  665. else \
  666. ( dd if=$(KDIR)/vmlinux-$(2).bin.uImage bs=`expr $(4) - 20` conv=sync ; dd if=$(KDIR)/root.$(1) ) > $(KDIR)/vmlinux-$(2).bin.uImage.combined ; \
  667. fi ; fi
  668. mkedimaximg -i "$(KDIR)/vmlinux-$(2).bin.uImage.combined" \
  669. -o $(call imgname,$(1),$(2)).bin \
  670. -s $(6) -m $(7) -f $(8) -S $(9)
  671. endef
  672. Image/Build/Profile/CYSWR1100=$(call BuildFirmware/Seama/$(1),$(1),cy-swr1100,CY-SWR1100,wrgnd10_samsung_ss815,$(ralink_default_fw_size_8M))
  673. Image/Build/Profile/DIR645=$(call BuildFirmware/Seama/$(1),$(1),dir-645,DIR-645,wrgn39_dlob.hans_dir645,$(ralink_default_fw_size_8M))
  674. omniembhpm_mtd_size=16449536
  675. Image/Build/Profile/OMNIEMBHPM=$(call BuildFirmware/CustomFlash/$(1),$(1),omni-emb-hpm,OMNI-EMB-HPM,$(omniembhpm_mtd_size))
  676. define BuildFirmware/RTN56U/squashfs
  677. $(call BuildFirmware/Default8M/$(1),$(1),rt-n56u,RTN56U)
  678. -mkrtn56uimg -s $(call sysupname,$(1),rt-n56u)
  679. -cp $(call sysupname,$(1),rt-n56u) $(call imgname,$(1),rt-n56u)-factory.bin
  680. -mkrtn56uimg -f $(call imgname,$(1),rt-n56u)-factory.bin
  681. endef
  682. Image/Build/Profile/RTN56U=$(call BuildFirmware/RTN56U/$(1),$(1),rt-n56u,RTN56U)
  683. Image/Build/Profile/TEW691GR=$(call BuildFirmware/UMedia/$(1),$(1),tew-691gr,TEW-691GR,0x026910)
  684. Image/Build/Profile/TEW692GR=$(call BuildFirmware/UMedia/$(1),$(1),tew-692gr,TEW-692GR,0x026920)
  685. kernel_size_BR6475ND:=2097152
  686. rootfs_size_BR6475ND:=5832704
  687. Image/Build/Profile/BR6475ND=$(call BuildFirmware/EdimaxCombined/$(1),$(1),br-6475nd,BR-6475ND,$(kernel_size_BR6475ND),$(rootfs_size_BR6475ND),CSYS,RN54,0x70000,0x01100000)
  688. ifeq ($(SUBTARGET),rt3883)
  689. define Image/Build/Profile/Default
  690. $(call Image/Build/Profile/CYSWR1100,$(1))
  691. $(call Image/Build/Profile/DIR645,$(1))
  692. $(call Image/Build/Profile/OMNIEMBHPM,$(1))
  693. $(call Image/Build/Profile/RTN56U,$(1))
  694. $(call Image/Build/Profile/BR6475ND,$(1))
  695. $(call Image/Build/Profile/TEW691GR,$(1))
  696. $(call Image/Build/Profile/TEW692GR,$(1))
  697. endef
  698. endif
  699. #
  700. # MT7620A Profiles
  701. #
  702. # $(1): (ignored)
  703. # $(2): lowercase board name
  704. # $(3): uppercase board name (must match DTS filename w/o extension)
  705. # $(4): erase block size
  706. # $(5): hardware id for mkdniimg
  707. # $(6): maximum image size
  708. define BuildFirmware/Netgear/squashfs
  709. $(call PatchKernelLzmaDtb,$(2),$(3))
  710. # Pad kernel to eraseblock boundary, minus 2 uImage headers (=128 bytes):
  711. # bs = (eraseblock * (1 + (128 + kernelsize)/eraseblock)) - 128
  712. dd if=$(KDIR)/vmlinux-$(2).bin.lzma \
  713. of=$(KDIR)/vmlinux-$(2).bin.lzma.tmp \
  714. bs=`expr \( $(4) \* \( 1 + \( 128 + \`wc -c < $(KDIR)/vmlinux-$(2).bin.lzma\` \) / $(4) \) \) - 128` \
  715. count=1 conv=sync
  716. $(call MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.tmp,$(KDIR)/vmlinux-$(2).uImage)
  717. cat ex2700-fakeroot.uImage >> $(KDIR)/vmlinux-$(2).uImage
  718. $(call MkImageSysupgrade/squashfs,squashfs,$(2),$(6))
  719. $(STAGING_DIR_HOST)/bin/mkdniimg \
  720. -B $(3) -H $(5) -v OpenWrt \
  721. -i $(call imgname,squashfs,$(2))-sysupgrade.bin \
  722. -o $(call imgname,squashfs,$(2))-factory.bin
  723. endef
  724. Image/Build/Profile/E1700=$(call BuildFirmware/UMedia/$(1),$(1),e1700,E1700,0x013326)
  725. ex2700_mtd_size=3866624
  726. Image/Build/Profile/EX2700=$(call BuildFirmware/Netgear/$(1),$(1),ex2700,EX2700,65536,29764623+4+0+32+2x2+0,$(ex2700_mtd_size))
  727. Image/Build/Profile/MT7620a=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
  728. Image/Build/Profile/MT7620a_MT7610e=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
  729. Image/Build/Profile/MT7620a_MT7530=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7530,MT7620a_MT7530)
  730. Image/Build/Profile/MT7620a_V22SG=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_v22sg,MT7620a_V22SG)
  731. br100_mtd_size=8126464
  732. Image/Build/Profile/AIBR100=$(call BuildFirmware/CustomFlash/$(1),$(1),ai-br100,AIBR100,$(br100_mtd_size),Ai-BR)
  733. Image/Build/Profile/RP-N53=$(call BuildFirmware/Default8M/$(1),$(1),rp_n53,RP-N53)
  734. whr_300hp2_mtd_size=7012352
  735. Image/Build/Profile/WHR300HP2=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-300hp2,WHR-300HP2,$(whr_300hp2_mtd_size))
  736. Image/Build/Profile/WHR600D=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-600d,WHR-600D,$(whr_300hp2_mtd_size))
  737. whr_1166d_mtd_size=15400960
  738. Image/Build/Profile/WHR1166D=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-1166d,WHR-1166D,$(whr_1166hd_mtd_size))
  739. dlink810l_mtd_size=6881280
  740. Image/Build/Profile/CF-WR800N=$(call BuildFirmware/Default8M/$(1),$(1),cf-wr800n,CF-WR800N)
  741. Image/Build/Profile/DIR-810L=$(call BuildFirmware/CustomFlash/$(1),$(1),dir-810l,DIR-810L,$(dlink810l_mtd_size))
  742. na930_mtd_size=20971520
  743. Image/Build/Profile/NA930=$(call BuildFirmware/CustomFlash/$(1),$(1),na930,NA930,$(na930_mtd_size))
  744. Image/Build/Profile/MZK-750DHP=$(call BuildFirmware/Default8M/$(1),$(1),mzk-750dhp,MZK-750DHP)
  745. Image/Build/Profile/Y1=$(call BuildFirmware/Default16M/$(1),$(1),Lenovo-y1,Y1)
  746. Image/Build/Profile/Y1S=$(call BuildFirmware/Default16M/$(1),$(1),Lenovo-y1s,Y1S)
  747. Image/Build/Profile/MLW221=$(call BuildFirmware/Default16M/$(1),$(1),mlw221,MLW221)
  748. Image/Build/Profile/MLWG2=$(call BuildFirmware/Default16M/$(1),$(1),mlwg2,MLWG2)
  749. Image/Build/Profile/WMR300=$(call BuildFirmware/Default8M/$(1),$(1),wmr-300,WMR300)
  750. Image/Build/Profile/RT-N14U=$(call BuildFirmware/Default8M/$(1),$(1),rt-n14u,RT-N14U)
  751. Image/Build/Profile/WR8305RT=$(call BuildFirmware/Default8M/$(1),$(1),wr8305rt,WR8305RT)
  752. Image/Build/Profile/WRTNODE=$(call BuildFirmware/Default16M/$(1),$(1),wrtnode,WRTNODE)
  753. Image/Build/Profile/WT3020=$(call BuildFirmware/PorayDualSize/$(1),$(1),wt3020,WT3020)
  754. Image/Build/Profile/XIAOMI-MIWIFI-MINI=$(call BuildFirmware/Default16M/$(1),$(1),xiaomi-miwifi-mini,XIAOMI-MIWIFI-MINI)
  755. Image/Build/Profile/ZTE-Q7=$(call BuildFirmware/Default8M/$(1),$(1),zte-q7,ZTE-Q7)
  756. Image/Build/Profile/ZBT-WA05=$(call BuildFirmware/Default8M/$(1),$(1),zbt-wa05,ZBT-WA05)
  757. Image/Build/Profile/ArcherC20i=$(call BuildFirmware/Tplink/$(1),$(1),ArcherC20i,ArcherC20i)
  758. microwrt_mtd_size=16515072
  759. Image/Build/Profile/MicroWRT=$(call BuildFirmware/CustomFlash/$(1),$(1),microwrt,MicroWRT,$(microwrt_mtd_size))
  760. ifeq ($(SUBTARGET),mt7620)
  761. define Image/Build/Profile/Default
  762. $(call Image/Build/Profile/E1700,$(1))
  763. $(call Image/Build/Profile/EX2700,$(1))
  764. $(call Image/Build/Profile/MT7620a,$(1))
  765. $(call Image/Build/Profile/MT7620a_MT7610e,$(1))
  766. $(call Image/Build/Profile/MT7620a_MT7530,$(1))
  767. $(call Image/Build/Profile/MT7620a_V22SG,$(1))
  768. $(call Image/Build/Profile/AIBR100,$(1))
  769. $(call Image/Build/Profile/CF-WR800N,$(1))
  770. $(call Image/Build/Profile/RP-N53,$(1))
  771. $(call Image/Build/Profile/DIR-810L,$(1))
  772. $(call Image/Build/Profile/WHR300HP2,$(1))
  773. $(call Image/Build/Profile/WHR600D,$(1))
  774. $(call Image/Build/Profile/WHR1166D,$(1))
  775. $(call Image/Build/Profile/MZK-750DHP,$(1))
  776. $(call Image/Build/Profile/NA930,$(1))
  777. $(call Image/Build/Profile/Y1,$(1))
  778. $(call Image/Build/Profile/Y1S,$(1))
  779. $(call Image/Build/Profile/MLW221,$(1))
  780. $(call Image/Build/Profile/MLWG2,$(1))
  781. $(call Image/Build/Profile/WMR300,$(1))
  782. $(call Image/Build/Profile/RT-N14U,$(1))
  783. $(call Image/Build/Profile/WR8305RT,$(1))
  784. $(call Image/Build/Profile/WRTNODE,$(1))
  785. $(call Image/Build/Profile/WT3020,$(1))
  786. $(call Image/Build/Profile/XIAOMI-MIWIFI-MINI,$(1))
  787. $(call Image/Build/Profile/ZTE-Q7,$(1))
  788. $(call Image/Build/Profile/ZBT-WA05,$(1))
  789. $(call Image/Build/Profile/ArcherC20i,$(1))
  790. $(call Image/Build/Profile/MicroWRT,$(1))
  791. endef
  792. endif
  793. #
  794. # MT7621 Profiles
  795. #
  796. ifeq ($(SUBTARGET),mt7621)
  797. TARGET_DEVICES += mt7621 wsr-600 wsr-1166 dir-860l-b1 firewrt pbr-m1 re6500 zbt-wg2626
  798. endif
  799. define Device/mt7621
  800. DTS := MT7621
  801. IMAGE_SIZE := $(ralink_default_fw_size_4M)
  802. endef
  803. define Device/wsr-600
  804. DTS := WSR-600
  805. endef
  806. define Device/re6500
  807. DTS := RE6500
  808. endef
  809. define Device/wsr-1166
  810. DTS := WSR-1166
  811. IMAGE/sysupgrade.bin := trx | pad-rootfs
  812. endef
  813. define Device/dir-860l-b1
  814. DTS := DIR-860L-B1
  815. IMAGES += factory.bin
  816. KERNEL := kernel-bin | patch-dtb | relocate-kernel | lzma | uImage lzma
  817. IMAGE/sysupgrade.bin := \
  818. append-kernel | pad-offset 65536 64 | append-rootfs | \
  819. seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
  820. pad-rootfs | check-size $$$$(IMAGE_SIZE)
  821. IMAGE/factory.bin := \
  822. append-kernel | pad-offset 65536 64 | append-rootfs | pad-rootfs -x 64 | \
  823. seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
  824. check-size $$$$(IMAGE_SIZE) | \
  825. seama-seal -m "signature=wrgac13_dlink.2013gui_dir860lb"
  826. endef
  827. define Device/firewrt
  828. DTS := FIREWRT
  829. IMAGE_SIZE := $(ralink_default_fw_size_16M)
  830. endef
  831. define Device/pbr-m1
  832. DTS := PBR-M1
  833. IMAGE_SIZE := $(ralink_default_fw_size_16M)
  834. endef
  835. define Device/zbt-wg2626
  836. DTS := ZBT-WG2626
  837. IMAGE_SIZE := $(ralink_default_fw_size_16M)
  838. endef
  839. #
  840. # MT7628 Profiles
  841. #
  842. Image/Build/Profile/MT7628=$(call BuildFirmware/Default4M/$(1),$(1),mt7628,MT7628)
  843. ifeq ($(SUBTARGET),mt7628)
  844. define Image/Build/Profile/Default
  845. $(call Image/Build/Profile/MT7628,$(1))
  846. endef
  847. endif
  848. #
  849. # MT7688 Profiles
  850. #
  851. Image/Build/Profile/MT7688=$(call BuildFirmware/Default4M/$(1),$(1),mt7628,MT7628)
  852. Image/Build/Profile/LinkIt7688=$(call BuildFirmware/Default32M/$(1),$(1),LinkIt7688,LINKIT7688)
  853. ifeq ($(SUBTARGET),mt7628)
  854. define Image/Build/Profile/Default
  855. $(call Image/Build/Profile/MT7688,$(1))
  856. $(call Image/Build/Profile/LinkIt7688,$(1))
  857. endef
  858. endif
  859. ifndef TARGET_DEVICES
  860. #
  861. # Generic Targets - only needed for legacy image building code
  862. #
  863. define Image/BuildKernel
  864. cp $(KDIR)/vmlinux.elf $(BIN_DIR)/$(VMLINUX).elf
  865. cp $(KDIR)/vmlinux $(BIN_DIR)/$(VMLINUX).bin
  866. $(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma)
  867. $(call MkImage,lzma,$(KDIR)/vmlinux.bin.lzma,$(KDIR)/uImage.lzma)
  868. cp $(KDIR)/uImage.lzma $(BIN_DIR)/$(UIMAGE).bin
  869. endef
  870. define Image/BuildKernel/Initramfs
  871. cp $(KDIR)/vmlinux-initramfs.elf $(BIN_DIR)/$(VMLINUX)-initramfs.elf
  872. cp $(KDIR)/vmlinux-initramfs $(BIN_DIR)/$(VMLINUX)-initramfs.bin
  873. $(call CompressLzma,$(KDIR)/vmlinux-initramfs,$(KDIR)/vmlinux-initramfs.bin.lzma)
  874. $(call MkImage,lzma,$(KDIR)/vmlinux-initramfs.bin.lzma,$(KDIR)/uImage-initramfs.lzma)
  875. cp $(KDIR)/uImage-initramfs.lzma $(BIN_DIR)/$(UIMAGE)-initramfs.bin
  876. $(call Image/Build/Initramfs)
  877. endef
  878. define Image/Build
  879. $(call Image/Build/$(1))
  880. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
  881. $(call Image/Build/Profile/$(PROFILE),$(1))
  882. endef
  883. endif
  884. ifeq ($(SUBTARGET),mt7621)
  885. define Image/Prepare
  886. #define Build/Compile
  887. rm -rf $(KDIR)/relocate
  888. $(CP) ../../generic/image/relocate $(KDIR)
  889. $(MAKE) -C $(KDIR)/relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
  890. $(CP) $(KDIR)/relocate/loader.bin $(KDIR)/loader.bin
  891. endef
  892. endif
  893. $(eval $(call BuildImage))