Makefile 89 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274
  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. IMAGE_PROFILE:=$(if $(PROFILE),$(PROFILE),Default)
  10. JFFS2_BLOCKSIZE = 64k 128k 256k
  11. KERNEL_LOADADDR = 0x80060000
  12. DEVICE_VARS += NETGEAR_KERNEL_MAGIC NETGEAR_BOARD NETGEAR_ID CMDLINE CONSOLE IMAGE_SIZE BOARDNAME LOADER_FLASH_OFFS
  13. define Build/netgear-squashfs
  14. rm -rf $@.fs $@.squashfs
  15. mkdir -p $@.fs/image
  16. cp $@ $@.fs/image/uImage
  17. $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
  18. $@.fs $@.squashfs \
  19. -noappend -root-owned -be -b 65536
  20. dd if=/dev/zero bs=1k count=1 >> $@.squashfs
  21. mkimage \
  22. -A mips -O linux -T filesystem -C none \
  23. -M $(NETGEAR_KERNEL_MAGIC) \
  24. -a 0xbf070000 -e 0xbf070000 \
  25. -n 'MIPS libreCMC Linux-$(LINUX_VERSION)' \
  26. -d $@.squashfs $@
  27. rm -rf $@.squashfs $@.fs
  28. endef
  29. define Build/netgear-uImage
  30. $(call Build/uImage,$(1) -M $(NETGEAR_KERNEL_MAGIC))
  31. endef
  32. define Build/netgear-image
  33. $(STAGING_DIR_HOST)/bin/mkdniimg \
  34. -B $(NETGEAR_BOARD) -v libreCMC.$(REVISION) \
  35. $(if $(NETGEAR_ID),-H $(NETGEAR_ID)) \
  36. -r "$(1)" \
  37. -i $@ -o $@.new
  38. mv $@.new $@
  39. endef
  40. # combine kernel and rootfs into one image
  41. # -a align the rootfs start on an <align> bytes boundary
  42. # -j add jffs2 end-of-filesystem markers
  43. # -s strip padding from end of the image
  44. # -X reserve <size> bytes in the firmware image (hexval prefixed with 0x)
  45. define Build/mktplinkfw
  46. -$(STAGING_DIR_HOST)/bin/mktplinkfw \
  47. -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N libreCMC -V $(REVISION) \
  48. -k $(word 1,$^) \
  49. -r $@ \
  50. -o $@.new \
  51. -j -X 0x40000 \
  52. -a $(call rootfs_align,$(FILESYSTEM)) \
  53. $(if $(findstring sysupgrade,$1),-s) && mv $@.new $@ || rm -f $@
  54. endef
  55. # -c combined image
  56. define Build/mktplinkfw-initramfs
  57. $(STAGING_DIR_HOST)/bin/mktplinkfw \
  58. -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N libreCMC -V $(REVISION) \
  59. -k $@ \
  60. -o $@.new \
  61. -s -S \
  62. -c
  63. @mv $@.new $@
  64. endef
  65. define Build/loader-common
  66. rm -rf $@.src
  67. $(MAKE) -C lzma-loader \
  68. PKG_BUILD_DIR="$@.src" \
  69. TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \
  70. KERNEL_CMDLINE="$(CMDLINE)" BOARD="$(BOARDNAME)" \
  71. LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
  72. $(1) compile loader.gz
  73. mv "$@.gz" "$@"
  74. rm -rf $@.src
  75. endef
  76. define Build/loader-okli-compile
  77. $(call Build/loader-common,FLASH_OFFS=$(LOADER_FLASH_OFFS) FLASH_MAX=0)
  78. endef
  79. define Build/loader-kernel
  80. $(call Build/loader-common,LOADER_DATA="$@")
  81. endef
  82. define Build/loader-okli
  83. dd if=$(KDIR)/loader-$(1).gz bs=7680 conv=sync of="$@.new"
  84. cat "$@" >> "$@.new"
  85. mv "$@.new" "$@"
  86. endef
  87. define Build/copy-file
  88. cat "$(1)" > "$@"
  89. endef
  90. DEVICE_VARS += TPLINK_HWID TPLINK_HWREV TPLINK_FLASHLAYOUT
  91. # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
  92. # UBNT_TYPE e.g. one of (BZ, XM, XW)
  93. # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
  94. # mkubntimage is using the kernel image direct
  95. # routerboard creates partitions out of the ubnt header
  96. define Build/mkubntimage
  97. $(STAGING_DIR_HOST)/bin/mkfwimage \
  98. -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-libreCMC-$(REVISION) \
  99. -k $(word 1,$^) \
  100. -r $@ \
  101. -o $@
  102. endef
  103. # all UBNT XM device expect the kernel image to have 1024k while flash, when
  104. # booting the image, the size doesn't matter.
  105. define Build/mkubntimage-split
  106. dd if=$@ of=$@.old1 bs=1024k count=1
  107. dd if=$@ of=$@.old2 bs=1024k skip=1
  108. $(STAGING_DIR_HOST)/bin/mkfwimage \
  109. -B $(UBNT_BOARD) -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-libreCMC-$(REVISION) \
  110. -k $@.old1 \
  111. -r $@.old2 \
  112. -o $@
  113. rm $@.old1 $@.old2
  114. endef
  115. define Build/mkubntimage2
  116. $(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
  117. -v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-libreCMC-$(REVISION) \
  118. -p jffs2:0x50000:0xf60000:0:0:$@ \
  119. -o $@.new
  120. @mv $@.new $@
  121. endef
  122. DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE
  123. define Build/mkubntkernelimage
  124. rm -rf $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image && \
  125. mkdir -p $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image && \
  126. cp $@ $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image/kernel0 && \
  127. $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
  128. --pad --big-endian --squash-uids -v -e 64KiB \
  129. -o $@.new \
  130. -d $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image \
  131. 2>&1 && \
  132. $(STAGING_DIR_HOST)/bin/padjffs2 $@.new -J 64
  133. -rm -rf $(KDIR_TMP)/ubnt-$(KERNEL_IMAGE)/image
  134. @mv $@.new $@
  135. endef
  136. define Device/Default
  137. BOARDNAME :=
  138. DEVICE_PROFILE = $$(BOARDNAME)
  139. PROFILES = Default Minimal $$(DEVICE_PROFILE)
  140. MTDPARTS :=
  141. IMAGES := sysupgrade.bin
  142. BLOCKSIZE := 64k
  143. FILESYSTEMS = $(filter-out jffs2-%,$(TARGET_FILESYSTEMS)) jffs2-$$(BLOCKSIZE)
  144. CONSOLE = ttyS0,115200
  145. CMDLINE = $$(if $$(BOARDNAME),board=$$(BOARDNAME)) $$(if $$(MTDPARTS),mtdparts=$$(MTDPARTS)) $$(if $$(CONSOLE),console=$$(CONSOLE))
  146. KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma
  147. COMPILE :=
  148. IMAGES := sysupgrade.bin
  149. IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  150. endef
  151. define Device/carambola2
  152. BOARDNAME = CARAMBOLA2
  153. IMAGE_SIZE = 16000k
  154. CONSOLE = ttyATH0,115200
  155. MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
  156. endef
  157. TARGET_DEVICES += carambola2
  158. define Device/wndr3700
  159. BOARDNAME = WNDR3700
  160. NETGEAR_KERNEL_MAGIC = 0x33373030
  161. NETGEAR_BOARD = WNDR3700
  162. IMAGE_SIZE = 7680k
  163. MTDPARTS = spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,7680k(firmware),64k(art)ro
  164. IMAGES := sysupgrade.bin factory.img factory-NA.img
  165. KERNEL := kernel-bin | patch-cmdline | lzma -d20 | netgear-uImage lzma
  166. IMAGE/default = append-kernel $$$$(BLOCKSIZE) | netgear-squashfs | append-rootfs | pad-rootfs
  167. IMAGE/sysupgrade.bin = $$(IMAGE/default) | check-size $$$$(IMAGE_SIZE)
  168. IMAGE/factory.img = $$(IMAGE/default) | netgear-image | check-size $$$$(IMAGE_SIZE)
  169. IMAGE/factory-NA.img = $$(IMAGE/default) | netgear-image NA | check-size $$$$(IMAGE_SIZE)
  170. endef
  171. define Device/wndr3700v2
  172. $(Device/wndr3700)
  173. NETGEAR_BOARD = WNDR3700v2
  174. NETGEAR_KERNEL_MAGIC = 0x33373031
  175. NETGEAR_ID = 29763654+16+64
  176. IMAGE_SIZE = 15872k
  177. MTDPARTS = spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,15872k(firmware),64k(art)ro
  178. IMAGES := sysupgrade.bin factory.img
  179. endef
  180. define Device/wndr3800
  181. $(Device/wndr3700v2)
  182. NETGEAR_BOARD = WNDR3800
  183. NETGEAR_ID = 29763654+16+128
  184. endef
  185. define Device/wndr3800ch
  186. $(Device/wndr3800)
  187. NETGEAR_BOARD = WNDR3800CH
  188. endef
  189. define Device/wndrmac
  190. $(Device/wndr3700v2)
  191. NETGEAR_BOARD = WNDRMAC
  192. endef
  193. define Device/wndrmacv2
  194. $(Device/wndr3800)
  195. NETGEAR_BOARD = WNDRMACv2
  196. endef
  197. TARGET_DEVICES += wndr3700 wndr3700v2 wndr3800 wndr3800ch wndrmac wndrmacv2
  198. define Device/tplink
  199. TPLINK_HWREV := 0x1
  200. KERNEL := kernel-bin | patch-cmdline | lzma
  201. KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | mktplinkfw-initramfs
  202. IMAGES := sysupgrade.bin factory.bin
  203. IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade
  204. IMAGE/factory.bin := append-rootfs | mktplinkfw factory
  205. endef
  206. define Device/tplink-nolzma
  207. $(Device/tplink)
  208. LOADER_FLASH_OFFS := 0x22000
  209. COMPILE := loader-$(1).gz
  210. COMPILE/loader-$(1).gz := loader-okli-compile
  211. KERNEL := copy-file $(KDIR)/vmlinux.bin.lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1)
  212. KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux-initramfs.bin.lzma | loader-kernel | mktplinkfw-initramfs
  213. endef
  214. define Device/tplink-4m
  215. $(Device/tplink-nolzma)
  216. TPLINK_FLASHLAYOUT := 4M
  217. IMAGE_SIZE := 3904k
  218. endef
  219. define Device/tplink-8m
  220. $(Device/tplink-nolzma)
  221. TPLINK_FLASHLAYOUT := 8M
  222. IMAGE_SIZE := 7936k
  223. endef
  224. define Device/tplink-4mlzma
  225. $(Device/tplink)
  226. TPLINK_FLASHLAYOUT := 4Mlzma
  227. IMAGE_SIZE := 3904k
  228. endef
  229. define Device/tplink-8mlzma
  230. $(Device/tplink)
  231. TPLINK_FLASHLAYOUT := 8Mlzma
  232. IMAGE_SIZE := 7936k
  233. endef
  234. define Device/tplink-16mlzma
  235. $(Device/tplink)
  236. TPLINK_FLASHLAYOUT := 16Mlzma
  237. IMAGE_SIZE := 15872k
  238. endef
  239. define Device/tl-wdr4300-v1
  240. $(Device/tplink-8mlzma)
  241. BOARDNAME = TL-WDR4300
  242. DEVICE_PROFILE = TLWDR4300
  243. TPLINK_HWID := 0x43000001
  244. endef
  245. define Device/tl-wdr3500-v1
  246. $(Device/tl-wdr4300-v1)
  247. BOARDNAME = TL-WDR3500
  248. TPLINK_HWID := 0x35000001
  249. endef
  250. define Device/tl-wdr3600-v1
  251. $(Device/tl-wdr4300-v1)
  252. TPLINK_HWID := 0x36000001
  253. endef
  254. define Device/tl-wdr4300-v1-il
  255. $(Device/tl-wdr4300-v1)
  256. TPLINK_HWID := 0x43008001
  257. endef
  258. define Device/tl-wdr4310-v1
  259. $(Device/tl-wdr4300-v1)
  260. TPLINK_HWID := 0x43100001
  261. endef
  262. define Device/mw4530r-v1
  263. $(Device/tl-wdr4300-v1)
  264. TPLINK_HWID := 0x45300001
  265. endef
  266. TARGET_DEVICES += tl-wdr3500-v1 tl-wdr3600-v1 tl-wdr4300-v1 tl-wdr4300-v1-il tl-wdr4310-v1 mw4530r-v1
  267. define Device/archer-c5
  268. $(Device/tplink-16mlzma)
  269. BOARDNAME := ARCHER-C5
  270. DEVICE_PROFILE := ARCHERC7
  271. TPLINK_HWID := 0xc5000001
  272. endef
  273. define Device/archer-c7-v1
  274. $(Device/tplink-8mlzma)
  275. BOARDNAME := ARCHER-C7
  276. DEVICE_PROFILE := ARCHERC7
  277. TPLINK_HWID := 0x75000001
  278. endef
  279. define Device/archer-c7-v2
  280. $(Device/tplink-16mlzma)
  281. BOARDNAME := ARCHER-C7
  282. DEVICE_PROFILE := ARCHERC7
  283. TPLINK_HWID := 0xc7000002
  284. endef
  285. TARGET_DEVICES += archer-c5 archer-c7-v1 archer-c7-v2
  286. define Device/antminer-s1
  287. $(Device/tplink-8mlzma)
  288. BOARDNAME := ANTMINER-S1
  289. DEVICE_PROFILE := ANTMINER_S1
  290. TPLINK_HWID := 0x04440001
  291. CONSOLE := ttyATH0,115200
  292. endef
  293. define Device/antminer-s3
  294. $(Device/tplink-8mlzma)
  295. BOARDNAME := ANTMINER-S3
  296. DEVICE_PROFILE := ANTMINER_S3
  297. TPLINK_HWID := 0x04440003
  298. CONSOLE := ttyATH0,115200
  299. endef
  300. define Device/el-m150
  301. $(Device/tplink-8mlzma)
  302. BOARDNAME := EL-M150
  303. DEVICE_PROFILE := ELM150
  304. TPLINK_HWID := 0x01500101
  305. CONSOLE := ttyATH0,115200
  306. endef
  307. define Device/el-mini
  308. $(Device/tplink-8mlzma)
  309. BOARDNAME := EL-MINI
  310. DEVICE_PROFILE := ELMINI
  311. TPLINK_HWID := 0x01530001
  312. CONSOLE := ttyATH0,115200
  313. endef
  314. TARGET_DEVICES += antminer-s1 antminer-s3 el-m150 el-mini
  315. define Device/gl-inet-6408A-v1
  316. $(Device/tplink-8mlzma)
  317. BOARDNAME := GL-INET
  318. DEVICE_PROFILE := GLINET
  319. TPLINK_HWID := 0x08000001
  320. CONSOLE := ttyATH0,115200
  321. endef
  322. define Device/gl-inet-6416A-v1
  323. $(Device/tplink-16mlzma)
  324. BOARDNAME := GL-INET
  325. DEVICE_PROFILE := GLINET
  326. TPLINK_HWID := 0x08000001
  327. CONSOLE := ttyATH0,115200
  328. endef
  329. TARGET_DEVICES += gl-inet-6408A-v1 gl-inet-6416A-v1
  330. define Device/mc-mac1200r
  331. $(Device/tplink-8mlzma)
  332. BOARDNAME := MC-MAC1200R
  333. DEVICE_PROFILE := MAC1200R
  334. TPLINK_HWID := 0x12000001
  335. endef
  336. TARGET_DEVICES += mc-mac1200r
  337. define Device/onion-omega
  338. $(Device/tplink-16mlzma)
  339. BOARDNAME := ONION-OMEGA
  340. DEVICE_PROFILE := OMEGA
  341. TPLINK_HWID := 0x04700001
  342. CONSOLE := ttyATH0,115200
  343. endef
  344. TARGET_DEVICES += onion-omega
  345. define Device/tl-mr10u-v1
  346. $(Device/tplink-4mlzma)
  347. BOARDNAME := TL-MR10U
  348. DEVICE_PROFILE := TLMR10U
  349. TPLINK_HWID := 0x00100101
  350. CONSOLE := ttyATH0,115200
  351. endef
  352. define Device/tl-mr11u-v1
  353. $(Device/tplink-4mlzma)
  354. BOARDNAME := TL-MR11U
  355. DEVICE_PROFILE := TLMR11U
  356. TPLINK_HWID := 0x00110101
  357. CONSOLE := ttyATH0,115200
  358. endef
  359. define Device/tl-mr11u-v2
  360. $(Device/tplink-4mlzma)
  361. BOARDNAME := TL-MR11U
  362. DEVICE_PROFILE := TLMR11U
  363. TPLINK_HWID := 0x00110102
  364. CONSOLE := ttyATH0,115200
  365. endef
  366. define Device/tl-mr12u-v1
  367. $(Device/tplink-4mlzma)
  368. BOARDNAME := TL-MR13U
  369. DEVICE_PROFILE := TLMR12U
  370. TPLINK_HWID := 0x00120101
  371. CONSOLE := ttyATH0,115200
  372. endef
  373. define Device/tl-mr13u-v1
  374. $(Device/tplink-4mlzma)
  375. BOARDNAME := TL-MR13U
  376. DEVICE_PROFILE := TLMR13U
  377. TPLINK_HWID := 0x00130101
  378. CONSOLE := ttyATH0,115200
  379. endef
  380. TARGET_DEVICES += tl-mr10u-v1 tl-mr11u-v1 tl-mr11u-v2 tl-mr12u-v1 tl-mr13u-v1
  381. define Device/tl-mr3020-v1
  382. $(Device/tplink-4mlzma)
  383. BOARDNAME := TL-MR3020
  384. DEVICE_PROFILE := TLMR3020
  385. TPLINK_HWID := 0x30200001
  386. CONSOLE := ttyATH0,115200
  387. endef
  388. define Device/tl-mr3040-v1
  389. $(Device/tplink-4mlzma)
  390. BOARDNAME := TL-MR3040
  391. DEVICE_PROFILE := TLMR3040
  392. TPLINK_HWID := 0x30400001
  393. CONSOLE := ttyATH0,115200
  394. endef
  395. define Device/tl-mr3040-v2
  396. $(Device/tplink-4mlzma)
  397. BOARDNAME := TL-MR3040-v2
  398. DEVICE_PROFILE := TLMR3040
  399. TPLINK_HWID := 0x30400002
  400. CONSOLE := ttyATH0,115200
  401. endef
  402. define Device/tl-mr3220-v2
  403. $(Device/tplink-4mlzma)
  404. BOARDNAME := TL-MR3220-v2
  405. DEVICE_PROFILE := TLMR3220V2
  406. TPLINK_HWID := 0x32200002
  407. CONSOLE := ttyATH0,115200
  408. endef
  409. define Device/tl-mr3420-v2
  410. $(Device/tplink-4mlzma)
  411. BOARDNAME := TL-MR3420-v2
  412. DEVICE_PROFILE := TLMR3420
  413. TPLINK_HWID := 0x34200002
  414. endef
  415. TARGET_DEVICES += tl-mr3020-v1 tl-mr3040-v1 tl-mr3040-v2 tl-mr3220-v2 tl-mr3420-v2
  416. define Device/tl-wr703n-v1
  417. $(Device/tplink-4mlzma)
  418. BOARDNAME := TL-WR703N
  419. DEVICE_PROFILE := TLWR703
  420. TPLINK_HWID := 0x07030101
  421. CONSOLE := ttyATH0,115200
  422. endef
  423. define Device/tl-wr710n-v1
  424. $(Device/tplink-8mlzma)
  425. BOARDNAME := TL-WR710N
  426. DEVICE_PROFILE := TLWR710
  427. TPLINK_HWID := 0x07100001
  428. CONSOLE := ttyATH0,115200
  429. endef
  430. define Device/tl-wr710n-v2
  431. $(Device/tplink-4mlzma)
  432. BOARDNAME := TL-WR710N
  433. DEVICE_PROFILE := TLWR710
  434. TPLINK_HWID := 0x07100002
  435. CONSOLE := ttyATH0,115200
  436. endef
  437. define Device/tl-wr720n-v3
  438. $(Device/tplink-4mlzma)
  439. BOARDNAME := TL-WR720N-v3
  440. DEVICE_PROFILE := TLWR720
  441. TPLINK_HWID := 0x07200103
  442. CONSOLE := ttyATH0,115200
  443. endef
  444. define Device/tl-wr720n-v4
  445. $(Device/tplink-4mlzma)
  446. BOARDNAME := TL-WR720N-v3
  447. DEVICE_PROFILE := TLWR720
  448. TPLINK_HWID := 0x07200104
  449. CONSOLE := ttyATH0,115200
  450. endef
  451. TARGET_DEVICES += tl-wr703n-v1 tl-wr710n-v1 tl-wr710n-v2 tl-wr720n-v3 tl-wr720n-v4
  452. define Device/tl-wr740n-v4
  453. $(Device/tplink-4mlzma)
  454. BOARDNAME := TL-WR741ND-v4
  455. DEVICE_PROFILE := TLWR740
  456. TPLINK_HWID := 0x07400004
  457. CONSOLE := ttyATH0,115200
  458. endef
  459. define Device/tl-wr740n-v5
  460. $(Device/tplink-4mlzma)
  461. BOARDNAME := TL-WR741ND-v4
  462. DEVICE_PROFILE := TLWR740
  463. TPLINK_HWID := 0x07400005
  464. CONSOLE := ttyATH0,115200
  465. endef
  466. define Device/tl-wr741nd-v1
  467. $(Device/tplink-4m)
  468. BOARDNAME := TL-WR741ND
  469. DEVICE_PROFILE := TLWR741
  470. TPLINK_HWID := 0x07410001
  471. endef
  472. define Device/tl-wr741nd-v2
  473. $(Device/tplink-4m)
  474. BOARDNAME := TL-WR741ND
  475. DEVICE_PROFILE := TLWR741
  476. TPLINK_HWID := 0x07410001
  477. endef
  478. define Device/tl-wr741nd-v4
  479. $(Device/tplink-4mlzma)
  480. BOARDNAME := TL-WR741ND-v4
  481. DEVICE_PROFILE := TLWR741
  482. TPLINK_HWID := 0x07410004
  483. CONSOLE := ttyATH0,115200
  484. endef
  485. define Device/tl-wr741nd-v5
  486. $(Device/tplink-4mlzma)
  487. BOARDNAME := TL-WR741ND-v4
  488. DEVICE_PROFILE := TLWR741
  489. TPLINK_HWID := 0x07400005
  490. CONSOLE := ttyATH0,115200
  491. endef
  492. define Device/tl-wr743nd-v2
  493. $(Device/tplink-4mlzma)
  494. BOARDNAME := TL-WR741ND-v4
  495. DEVICE_PROFILE := TLWR743
  496. TPLINK_HWID := 0x07430002
  497. CONSOLE := ttyATH0,115200
  498. endef
  499. TARGET_DEVICES += tl-wr740n-v4 tl-wr740n-v5 tl-wr741nd-v1 tl-wr741nd-v2 tl-wr741nd-v4 tl-wr741nd-v5 tl-wr743nd-v2
  500. define Device/tl-wr841n-v8
  501. $(Device/tplink-4mlzma)
  502. BOARDNAME := TL-WR841N-v8
  503. DEVICE_PROFILE := TLWR841
  504. TPLINK_HWID := 0x08410008
  505. endef
  506. define Device/tl-wr841n-v9
  507. $(Device/tplink-4mlzma)
  508. BOARDNAME := TL-WR841N-v9
  509. DEVICE_PROFILE := TLWR841
  510. TPLINK_HWID := 0x08410009
  511. endef
  512. define Device/tl-wr842n-v2
  513. $(Device/tplink-8mlzma)
  514. BOARDNAME := TL-WR842N-v2
  515. DEVICE_PROFILE := TLWR842
  516. TPLINK_HWID := 0x8420002
  517. endef
  518. define Device/tl-wr843nd-v1
  519. $(Device/tplink-4mlzma)
  520. BOARDNAME := TL-WR841N-v8
  521. DEVICE_PROFILE := TLWR843
  522. TPLINK_HWID := 0x08430001
  523. endef
  524. define Device/tl-wr847n-v8
  525. $(Device/tplink-4mlzma)
  526. BOARDNAME := TL-WR841N-v8
  527. DEVICE_PROFILE := TLWR841
  528. TPLINK_HWID := 0x08470008
  529. endef
  530. TARGET_DEVICES += tl-wr841n-v8 tl-wr841n-v9 tl-wr842n-v2 tl-wr843nd-v1 tl-wr847n-v8
  531. define Device/tl-wr941nd-v5
  532. $(Device/tplink-4mlzma)
  533. BOARDNAME := TL-WR941ND-v5
  534. DEVICE_PROFILE := TLWR941
  535. TPLINK_HWID := 0x09410005
  536. endef
  537. define Device/tl-wr941nd-v6
  538. $(Device/tplink-4mlzma)
  539. BOARDNAME := TL-WDR3500
  540. DEVICE_PROFILE := TLWR941
  541. TPLINK_HWID := 0x09410006
  542. endef
  543. TARGET_DEVICES += tl-wr941nd-v5 tl-wr941nd-v6
  544. define Device/tl-wr1041n-v2
  545. $(Device/tplink-4mlzma)
  546. BOARDNAME := TL-WR1041N-v2
  547. DEVICE_PROFILE := TLWR1041
  548. TPLINK_HWID := 0x10410002
  549. endef
  550. TARGET_DEVICES += tl-wr1041n-v2
  551. define Device/tl-wdr4900-v2
  552. $(Device/tplink-8mlzma)
  553. BOARDNAME := TL-WDR4900-v2
  554. DEVICE_PROFILE := TLWDR4900V2
  555. TPLINK_HWID := 0x49000002
  556. endef
  557. TARGET_DEVICES += tl-wdr4900-v2
  558. define Device/tl-wa701nd-v2
  559. $(Device/tplink-4mlzma)
  560. BOARDNAME := TL-WA701ND-v2
  561. DEVICE_PROFILE := TLWA701
  562. TPLINK_HWID := 0x07010002
  563. CONSOLE := ttyATH0,115200
  564. endef
  565. define Device/tl-wa750re-v1
  566. $(Device/tplink-4mlzma)
  567. BOARDNAME := TL-WA750RE
  568. DEVICE_PROFILE := TLWA750
  569. TPLINK_HWID := 0x07500001
  570. endef
  571. TARGET_DEVICES += tl-wa701nd-v2 tl-wa750re-v1
  572. define Device/tl-wa801nd-v2
  573. $(Device/tplink-4mlzma)
  574. BOARDNAME := TL-WA801ND-v2
  575. DEVICE_PROFILE := TLWA801
  576. TPLINK_HWID := 0x08010002
  577. endef
  578. define Device/tl-wa830re-v2
  579. $(Device/tplink-4mlzma)
  580. BOARDNAME := TL-WA830RE-v2
  581. DEVICE_PROFILE := TLWA830
  582. TPLINK_HWID := 0x08300002
  583. endef
  584. define Device/tl-wa850re-v1
  585. $(Device/tplink-4mlzma)
  586. BOARDNAME := TL-WA850RE
  587. DEVICE_PROFILE := TLWA850
  588. TPLINK_HWID := 0x08500001
  589. endef
  590. define Device/tl-wa860re-v1
  591. $(Device/tplink-4mlzma)
  592. BOARDNAME := TL-WA860RE
  593. DEVICE_PROFILE := TLWA860
  594. TPLINK_HWID := 0x08600001
  595. endef
  596. TARGET_DEVICES += tl-wa801nd-v2 tl-wa830re-v2 tl-wa850re-v1 tl-wa860re-v1
  597. define Device/tl-wa901nd-v3
  598. $(Device/tplink-4mlzma)
  599. BOARDNAME := TL-WA901ND-v3
  600. DEVICE_PROFILE := TLWA901
  601. TPLINK_HWID := 0x09010003
  602. endef
  603. TARGET_DEVICES += tl-wa901nd-v3
  604. define Device/tl-wa7210n-v2
  605. $(Device/tplink-4mlzma)
  606. BOARDNAME := TL-WA7210N-v2
  607. DEVICE_PROFILE := TLWA7210
  608. TPLINK_HWID := 0x72100002
  609. CONSOLE := ttyATH0,115200
  610. endef
  611. TARGET_DEVICES += tl-wa7210n-v2
  612. define Device/smart-300
  613. $(Device/tplink-8mlzma)
  614. BOARDNAME := SMART-300
  615. DEVICE_PROFILE := SMART-300
  616. TPLINK_HWID := 0x93410001
  617. endef
  618. TARGET_DEVICES += smart-300
  619. define Device/oolite
  620. $(Device/tplink-16mlzma)
  621. BOARDNAME := GS-OOLITE
  622. DEVICE_PROFILE := OOLITE
  623. TPLINK_HWID := 0x3C000101
  624. CONSOLE := ttyATH0,115200
  625. endef
  626. TARGET_DEVICES += oolite
  627. # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
  628. # UBNT_TYPE e.g. one of (BZ, XM, XW)
  629. # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
  630. define Device/ubnt-xm
  631. DEVICE_PROFILE := UBNT
  632. IMAGE_SIZE := 7552k
  633. MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
  634. UBNT_TYPE := XM
  635. UBNT_BOARD := XM
  636. UBNT_CHIP := ar7240
  637. IMAGES := sysupgrade.bin factory.bin
  638. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
  639. IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  640. endef
  641. define Device/ubnt-xw
  642. DEVICE_PROFILE := UBNT
  643. IMAGE_SIZE := 7552k
  644. MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
  645. UBNT_TYPE := XW
  646. UBNT_BOARD := XM
  647. UBNT_CHIP := ar934x
  648. IMAGES := sysupgrade.bin factory.bin
  649. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
  650. IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  651. endef
  652. define Device/ubnt-bz
  653. DEVICE_PROFILE := UBNT
  654. IMAGE_SIZE := 7552k
  655. MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
  656. UBNT_TYPE := BZ
  657. UBNT_BOARD := XM
  658. UBNT_CHIP := ar934x
  659. IMAGES := sysupgrade.bin factory.bin
  660. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage-split
  661. IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  662. endef
  663. define Device/rw2458n
  664. $(Device/ubnt-xm)
  665. BOARDNAME := RW2458N
  666. endef
  667. define Device/ubnt-airrouter
  668. $(Device/ubnt-xm)
  669. BOARDNAME := UBNT-AR
  670. endef
  671. define Device/ubnt-bullet-m
  672. $(Device/ubnt-xm)
  673. BOARDNAME := UBNT-BM
  674. endef
  675. define Device/ubnt-rocket-m
  676. $(Device/ubnt-xm)
  677. BOARDNAME := UBNT-RM
  678. endef
  679. define Device/ubnt-nano-m
  680. $(Device/ubnt-xm)
  681. BOARDNAME := UBNT-NM
  682. endef
  683. TARGET_DEVICES += rw2458n ubnt-airrouter ubnt-bullet-m ubnt-rocket-m ubnt-nano-m
  684. define Device/ubnt-unifi
  685. $(Device/ubnt-bz)
  686. BOARDNAME := UBNT-UF
  687. DEVICE_PROFILE := UBNT UBNTUNIFI
  688. endef
  689. define Device/ubnt-unifi-outdoor
  690. $(Device/ubnt-bz)
  691. BOARDNAME := UBNT-U20
  692. DEVICE_PROFILE := UBNT UBNTUNIFIOUTDOOR
  693. endef
  694. TARGET_DEVICES += ubnt-unifi ubnt-unifi-outdoor
  695. define Device/ubnt-nano-m-xw
  696. $(Device/ubnt-xw)
  697. BOARDNAME := UBNT-NM-XW
  698. endef
  699. define Device/ubnt-loco-m-xw
  700. $(Device/ubnt-xw)
  701. BOARDNAME := UBNT-LOCO-XW
  702. endef
  703. define Device/ubnt-rocket-m-xw
  704. $(Device/ubnt-xw)
  705. BOARDNAME := UBNT-RM-XW
  706. endef
  707. define Device/ubnt-rocket-m-ti
  708. $(Device/ubnt-xw)
  709. BOARDNAME := UBNT-RM-TI
  710. UBNT_TYPE := TI
  711. UBNT_BOARD := XM
  712. endef
  713. TARGET_DEVICES += ubnt-nano-m-xw ubnt-loco-m-xw ubnt-rocket-m-xw ubnt-rocket-m-ti
  714. define Device/ubnt-air-gateway
  715. $(Device/ubnt-xm)
  716. BOARDNAME := UBNT-AGW
  717. UBNT_BOARD := XM
  718. UBNT_TYPE := AirGW
  719. UBNT_CHIP := ar933x
  720. CONSOLE = ttyATH0,115200
  721. endef
  722. TARGET_DEVICES += ubnt-air-gateway
  723. define Device/ubdev01
  724. $(Device/ubnt-xm)
  725. MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
  726. BOARDNAME := UBNT-UF
  727. UBNT_BOARD := XM
  728. UBNT_TYPE := XM
  729. UBNT_CHIP := ar7240
  730. endef
  731. TARGET_DEVICES += ubdev01
  732. define Device/ubnt-routerstation
  733. IMAGE_SIZE := 16128k
  734. IMAGES := sysupgrade.bin factory.bin
  735. IMAGE/factory.bin = append-rootfs | pad-rootfs | mkubntimage
  736. IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE)
  737. KERNEL := kernel-bin | patch-cmdline | lzma | pad-to $$(BLOCKSIZE)
  738. endef
  739. define Device/ubnt-rs
  740. $(Device/ubnt-routerstation)
  741. BOARDNAME := UBNT-RS
  742. DEVICE_PROFILE := Madwifi UBNT UBNTRS
  743. UBNT_BOARD := RS
  744. UBNT_TYPE := RSx
  745. UBNT_CHIP := ar7100
  746. endef
  747. define Device/ubnt-rspro
  748. $(Device/ubnt-routerstation)
  749. BOARDNAME := UBNT-RSPRO
  750. DEVICE_PROFILE := Madwifi UBNT UBNTRSPRO
  751. UBNT_BOARD := RSPRO
  752. UBNT_TYPE := RSPRO
  753. UBNT_CHIP := ar7100pro
  754. endef
  755. define Device/ubnt-ls-sr71
  756. $(Device/ubnt-routerstation)
  757. BOARDNAME := UBNT-LS-SR71
  758. DEVICE_PROFILE := Madwifi UBNT
  759. UBNT_BOARD := LS-SR71
  760. UBNT_TYPE := LS-SR71
  761. UBNT_CHIP := ar7100
  762. endef
  763. TARGET_DEVICES += ubnt-rs ubnt-rspro ubnt-ls-sr71
  764. define Device/ubnt-uap-pro
  765. IMAGE_SIZE := 15744k
  766. 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)
  767. UBNT_TYPE := BZ
  768. UBNT_CHIP := ar934x
  769. BOARDNAME := UAP-PRO
  770. DEVICE_PROFILE := UBNT UAPPRO
  771. KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | mkubntkernelimage
  772. IMAGES := sysupgrade.bin factory.bin
  773. IMAGE/sysupgrade.bin = append-kernel 1536k | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
  774. IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage2
  775. endef
  776. define Device/ubnt-unifi-outdoor-plus
  777. $(Device/ubnt-uap-pro)
  778. UBNT_CHIP := ar7240
  779. BOARDNAME := UBNT-UOP
  780. DEVICE_PROFILE := UBNT
  781. endef
  782. TARGET_DEVICES += ubnt-uap-pro ubnt-unifi-outdoor-plus
  783. rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
  784. # $(1): rootfs type.
  785. # $(2): board name.
  786. define imgname
  787. $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(call rootfs_type,$(1))
  788. endef
  789. define rootfs_align
  790. $(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1))))))
  791. endef
  792. define sysupname
  793. $(call imgname,$(1),$(2))-sysupgrade.bin
  794. endef
  795. define factoryname
  796. $(call imgname,$(1),$(2))-factory.bin
  797. endef
  798. COMMA:=,
  799. define mkcmdline
  800. $(if $(1),board=$(1) )$(if $(2),console=$(2)$(COMMA)$(3))
  801. endef
  802. define mtdpartsize
  803. $(shell sz=`echo '$(2)' | sed -ne 's/.*[:$(COMMA)]\([0-9]*\)k[@]*[0-9a-zx]*($(1)).*/\1/p'`; [ -n "$$sz" ] && echo $$(($$sz * 1024)))
  804. endef
  805. SINGLE_PROFILES:=
  806. # $(1) : name of image build method to be used, e.g., TPLINK-LZMA, AthLzma.
  807. # $(2) : name of the build template to be used, e.g. 64k, 64kraw, 128k, etc.
  808. # $(3) : name of the profile to be defined.
  809. # $(4) : board name.
  810. # $(5)~$(7) : arguments for $(mkcmdline)
  811. # board=$(1) console=$(2),$(3)
  812. # $(8)~$(14): extra arguments.
  813. define SingleProfile
  814. # $(1): action name, e.g. loader, buildkernel, squashfs, etc.
  815. define Image/Build/Profile/$(3)
  816. $$(call Image/Build/Template/$(2)/$$(1),$(1),$(4),$$(call mkcmdline,$(5),$(6),$(7)),$(8),$(9),$(10),$(11),$(12),$(13),$(14))
  817. endef
  818. SINGLE_PROFILES += $(3)
  819. endef
  820. # $(1), name of the MultiProfile to be added.
  821. # $(2), name of Profiles to be included in the MultiProfile.
  822. define MultiProfile
  823. define Image/Build/Profile/$(1)
  824. $(foreach p,$(2),
  825. $$(call Image/Build/Profile/$p,$$(1))
  826. )
  827. endef
  828. endef
  829. LOADER_MAKE := $(NO_TRACE_MAKE) -C lzma-loader KDIR=$(KDIR)
  830. KDIR_TMP:=$(KDIR)/tmp
  831. VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux
  832. UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
  833. # $(1): input file.
  834. # $(2): output file.
  835. # $(3): extra arguments for lzma.
  836. define CompressLzma
  837. $(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(3) $(2)
  838. endef
  839. define PatchKernel
  840. cp $(KDIR)/vmlinux$(3) $(KDIR_TMP)/vmlinux$(3)-$(1)
  841. $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR_TMP)/vmlinux$(3)-$(1) "$(strip $(2))"
  842. endef
  843. define PatchKernel/initramfs
  844. $(call PatchKernel,$(1),$(2),-initramfs)
  845. cp $(KDIR_TMP)/vmlinux-initramfs-$(1) $(call imgname,initramfs,$(1)).bin
  846. endef
  847. # $(1): board name.
  848. # $(2): kernel command line.
  849. # $(3): extra argumetns for lzma.
  850. # $(4): name suffix, e.g. "-initramfs".
  851. define PatchKernelLzma
  852. cp $(KDIR)/vmlinux$(4) $(KDIR_TMP)/vmlinux$(4)-$(1)
  853. $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR_TMP)/vmlinux$(4)-$(1) "$(strip $(2))"
  854. $(call CompressLzma,$(KDIR_TMP)/vmlinux$(4)-$(1),$(KDIR_TMP)/vmlinux$(4)-$(1).bin.lzma,$(3))
  855. endef
  856. define PatchKernelGzip
  857. cp $(KDIR)/vmlinux$(3) $(KDIR_TMP)/vmlinux$(3)-$(1)
  858. $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR_TMP)/vmlinux$(3)-$(1) "$(strip $(2))"
  859. gzip -9n -c $(KDIR_TMP)/vmlinux$(3)-$(1) > $(KDIR_TMP)/vmlinux$(3)-$(1).bin.gz
  860. endef
  861. ifneq ($(SUBTARGET),mikrotik)
  862. # $(1): compression method of the data.
  863. # $(2): extra arguments.
  864. # $(3): input data file.
  865. # $(4): output file.
  866. define MkuImage
  867. mkimage -A mips -O linux -T kernel -a 0x80060000 -C $(1) $(2) \
  868. -e 0x80060000 -n 'MIPS libreCMC Linux-$(LINUX_VERSION)' \
  869. -d $(3) $(4)
  870. endef
  871. # $(1): board name.
  872. # $(2): kernel command line.
  873. # $(3): extra arguments for lzma.
  874. # $(4): name suffix, e.g. "-initramfs".
  875. # $(5): extra arguments for mkimage.
  876. define MkuImageLzma
  877. $(call PatchKernelLzma,$(1),$(2),$(3),$(4))
  878. $(call MkuImage,lzma,$(5),$(KDIR_TMP)/vmlinux$(4)-$(1).bin.lzma,$(KDIR_TMP)/vmlinux$(4)-$(1).uImage)
  879. endef
  880. define MkuImageLzma/initramfs
  881. $(call PatchKernelLzma,$(1),$(2),$(3),-initramfs)
  882. $(call MkuImage,lzma,$(4),$(KDIR_TMP)/vmlinux-initramfs-$(1).bin.lzma,$(call imgname,initramfs,$(1))-uImage.bin)
  883. endef
  884. define MkuImageGzip
  885. $(call PatchKernelGzip,$(1),$(2))
  886. $(call MkuImage,gzip,,$(KDIR_TMP)/vmlinux-$(1).bin.gz,$(KDIR_TMP)/vmlinux-$(1).uImage)
  887. endef
  888. define MkuImageGzip/initramfs
  889. $(call PatchKernelGzip,$(1),$(2),-initramfs)
  890. $(call MkuImage,gzip,,$(KDIR_TMP)/vmlinux-initramfs-$(1).bin.gz,$(call imgname,initramfs,$(1))-uImage.bin)
  891. endef
  892. define MkuImageOKLI
  893. $(call MkuImage,lzma,-M 0x4f4b4c49,$(KDIR)/vmlinux.bin.lzma,$(KDIR_TMP)/vmlinux-$(1).okli)
  894. endef
  895. endif
  896. # $(1): name of the 1st file.
  897. # $(2): size limit of the 1st file if it is greater than 262144, or
  898. # the erase size of the flash if it is greater than zero and less
  899. # than 262144
  900. # $(3): name of the 2nd file.
  901. # $(4): size limit of the 2nd file if $(2) is greater than 262144, otherwise
  902. # it is the size limit of the output file
  903. # $(5): name of the output file.
  904. # $(6): padding size.
  905. define CatFiles
  906. if [ $(2) -eq 0 ]; then \
  907. filename="$(3)"; fstype=$$$${filename##*\.}; \
  908. case "$$$${fstype}" in \
  909. "jffs2-64k") bs=65536;; \
  910. "jffs2-128k") bs=131072;; \
  911. "jffs2-256k") bs=262144;; \
  912. *) bs=`stat -c%s $(1)`;; \
  913. esac; \
  914. ( dd if=$(1) bs=$$$${bs} conv=sync; cat $(3) ) > $(5); \
  915. if [ -n "$(6)" ]; then \
  916. case "$$$${fstype}" in \
  917. squashfs*) \
  918. padjffs2 $(5) $(6); \
  919. ;; \
  920. esac; \
  921. fi; \
  922. if [ `stat -c%s $(5)` -gt $(4) ]; then \
  923. echo "Warning: $(5) is too big (> $(4) bytes)" >&2; \
  924. rm -f $(5); \
  925. fi; \
  926. else if [ $(2) -gt 262144 ]; then \
  927. if [ `stat -c%s "$(1)"` -gt $(2) ]; then \
  928. echo "Warning: $(1) is too big (> $(2) bytes)" >&2; \
  929. else if [ `stat -c%s $(3)` -gt $(4) ]; then \
  930. echo "Warning: $(3) is too big (> $(4) bytes)" >&2; \
  931. else \
  932. ( dd if=$(1) bs=$(2) conv=sync; dd if=$(3) ) > $(5); \
  933. fi; fi; \
  934. else \
  935. ( dd if=$(1) bs=$(2) conv=sync; dd if=$(3) ) > $(5); \
  936. if [ `stat -c%s $(5)` -gt $(4) ]; then \
  937. echo "Warning: $(5) is too big (> $(4) bytes)" >&2; \
  938. rm -f $(5); \
  939. fi; \
  940. fi; fi
  941. endef
  942. # $(1): rootfs type.
  943. # $(2): board name.
  944. # $(3): kernel image size limit.
  945. # $(4): rootfs image size limit.
  946. # $(5): padding argument for padjffs2.
  947. Sysupgrade/KR=$(call CatFiles,$(2),$(3),$(KDIR)/root.$(1),$(4),$(call sysupname,$(1),$(5)))
  948. Sysupgrade/KRuImage=$(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage,$(3),$(KDIR)/root.$(1),$(4),$(call sysupname,$(1),$(2)),$(5))
  949. Sysupgrade/RKuImage=$(call CatFiles,$(KDIR)/root.$(1),$(4),$(KDIR_TMP)/vmlinux-$(2).uImage,$(3),$(call sysupname,$(1),$(2)))
  950. # $(1): ubinize ini file
  951. # $(2): working directory
  952. # $(3): output file
  953. # $(4): physical erase block size
  954. # $(5): minimum I/O unit size
  955. # $(6): custom options
  956. define ubinize
  957. $(CP) $(1) $(2)
  958. ( cd $(2); $(STAGING_DIR_HOST)/bin/ubinize -o $(3) -p $(4) -m $(5) $(6) $(1))
  959. endef
  960. #
  961. # Embed lzma-compressed kernel inside lzma-loader.
  962. #
  963. # $(1), suffix of output filename, e.g. generic, lowercase board name, etc.
  964. # $(2), suffix of target file to build, e.g. bin, gz, elf
  965. # $(3), kernel command line to pass from lzma-loader to kernel
  966. # $(4), unused here
  967. # $(5), suffix of kernel filename, e.g. -initramfs, or empty
  968. define Image/BuildLoader
  969. -rm -rf $(KDIR)/lzma-loader
  970. $(LOADER_MAKE) LOADER=loader-$(1).$(2) KERNEL_CMDLINE="$(3)"\
  971. LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
  972. LOADER_DATA="$(KDIR)/vmlinux$(5).bin.lzma" BOARD="$(1)" \
  973. compile loader.$(2)
  974. -$(CP) $(KDIR)/loader-$(1).$(2) $(KDIR)/loader-$(1)$(5).$(2)
  975. endef
  976. #
  977. # Embed patched lzma-compressed kernel inside lzma-loader.
  978. #
  979. # Specifying the command line via the lzma-loader doesn't work with some
  980. # models (like the TP-LINK CPE series), so this version first patches the
  981. # command line in the image and then builds the loader around it.
  982. #
  983. # $(1), suffix of output filename, e.g. generic, lowercase board name, etc.
  984. # $(2), suffix of target file to build, e.g. bin, gz, elf
  985. # $(3), kernel command line to pass from lzma-loader to kernel
  986. # $(4), unused here
  987. # $(5), suffix of kernel filename, e.g. -initramfs, or empty
  988. define Image/BuildLoaderPatched
  989. $(call PatchKernelLzma,$(1),$(3))
  990. -rm -rf $(KDIR)/lzma-loader
  991. $(LOADER_MAKE) LOADER=loader-$(1).$(2) \
  992. LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
  993. LOADER_DATA="$(KDIR_TMP)/vmlinux-$(1)$(5).bin.lzma" BOARD="$(1)" \
  994. compile loader.$(2)
  995. -$(CP) $(KDIR)/loader-$(1).$(2) $(KDIR)/loader-$(1)$(5).$(2)
  996. endef
  997. #
  998. # Build lzma-loader alone which will search for lzma-compressed kernel identified by
  999. # uImage header with magic "OKLI" at boot time.
  1000. #
  1001. # $(4), offset into the flash space to start searching uImage magic "OKLI".
  1002. # $(5), size of search range starting at $(4). With 0 as the value, uImage
  1003. # header is expected to be at precisely $(4)
  1004. define Image/BuildLoaderAlone
  1005. -rm -rf $(KDIR)/lzma-loader
  1006. $(LOADER_MAKE) LOADER=loader-$(1).$(2) KERNEL_CMDLINE="$(3)" \
  1007. LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
  1008. BOARD="$(1)" FLASH_OFFS=$(4) FLASH_MAX=$(5) \
  1009. compile loader.$(2)
  1010. endef
  1011. define Build/Clean
  1012. $(LOADER_MAKE) clean
  1013. endef
  1014. alfa_ap96_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13312k(rootfs),2048k(kernel),512k(caldata)ro,15360k@0x80000(firmware)
  1015. alfa_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1600k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
  1016. alfa_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,15936k(firmware),64k(nvram),64k(art)ro
  1017. all0258n_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),6272k(firmware),1536k(failsafe),64k(art)
  1018. all0315n_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env),13568k(firmware),2048k(failsafe),256k(art)ro
  1019. ap81_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,5120k(rootfs),2688k(kernel),64k(art)ro,7808k@0x50000(firmware)
  1020. ap83_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,128k(u-boot-env)ro,4096k(rootfs),3648k(kernel),64k(art)ro,7744k@0x60000(firmware)
  1021. ap96_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1728k(kernel),64k(art)ro,7872k@0x40000(firmware)
  1022. ap113_mtd_layout=mtdparts=spi0.0:64k(u-boot),3008k(rootfs),896k(uImage),64k(NVRAM),64k(ART),3904k@0x10000(firmware)
  1023. ap121_mtdlayout_2M=mtdparts=spi0.0:64k(u-boot)ro,1216k(rootfs),704k(kernel),64k(art)ro,1920k@0x10000(firmware)
  1024. ap121_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2752k(rootfs),896k(kernel),64k(nvram),64k(art)ro,3648k@0x50000(firmware)
  1025. ap132_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),6400k(rootfs),64k(art),7808k@0x50000(firmware)
  1026. ap135_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware)
  1027. ap136_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(mib0),64k(art)ro,7744k@0x50000(firmware)
  1028. ap143_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1472k(kernel),64k(art)ro,7744k@0x50000(firmware)
  1029. ap143_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware)
  1030. ap147_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art),16000k@0x50000(firmware)
  1031. bxu2000n2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),8448k(rootfs),6016k(user),64k(cfg),64k(oem),64k(art)ro
  1032. cameo_ap81_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,3840k(firmware),64k(art)ro
  1033. cameo_ap91_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,3712k(firmware),64k(mac)ro,64k(art)ro
  1034. cameo_ap99_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,3520k(firmware),64k(mac)ro,192k(lp)ro,64k(art)ro
  1035. cameo_ap121_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,192k(language)ro,3648k(firmware)
  1036. cameo_ap121_mtdlayout_8M=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,256k(language)ro,7680k@0x80000(firmware)
  1037. cameo_ap123_mtdlayout_4M=mtdparts=spi0.0:64k(u-boot)ro,64k(nvram)ro,3712k(firmware),192k(lang)ro,64k(art)ro
  1038. cameo_db120_mtdlayout=mtdparts=spi0.0:64k(uboot)ro,64k(nvram)ro,15936k(firmware),192k(lang)ro,64k(mac)ro,64k(art)ro
  1039. cameo_db120_mtdlayout_8M=mtdparts=spi0.0:64k(uboot)ro,64k(nvram)ro,7872k(firmware),128k(lang)ro,64k(art)ro
  1040. cap4200ag_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),320k(custom)ro,1536k(kernel),12096k(rootfs),2048k(failsafe),64k(art),13632k@0xa0000(firmware)
  1041. cpe510_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(pation-table)ro,64k(product-info)ro,1536k(kernel),6144k(rootfs),192k(config)ro,64k(ART)ro,7680k@0x40000(firmware)
  1042. eap300v2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),320k(custom),13632k(firmware),2048k(failsafe),64k(art)ro
  1043. db120_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
  1044. dgl_5500_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,15296k(firmware),192k(lang)ro,512k(my-dlink)ro,64k(mac)ro,64k(art)ro
  1045. dlan_pro_500_wp_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(Config1)ro,64k(Config2)ro,7680k@0x70000(firmware),64k(art)ro
  1046. dlan_pro_1200_ac_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(Config1)ro,64k(Config2)ro,15872k@0x70000(firmware),64k(art)ro
  1047. cameo_ap94_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,6208k(firmware),64k(caldata)ro,1600k(unknown)ro,64k@0x7f0000(caldata_copy)
  1048. cameo_ap94_mtdlayout_fat=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,7808k(firmware),64k(caldata)ro,64k@0x660000(caldata_orig),6208k@0x50000(firmware_orig)
  1049. esr900_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),13248k(rootfs),1024k(manufacture)ro,64k(backup)ro,320k(storage)ro,64k(caldata)ro,14656k@0x40000(firmware)
  1050. esr1750_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),13248k(rootfs),1024k(manufacture)ro,64k(backup)ro,320k(storage)ro,64k(caldata)ro,14656k@0x40000(firmware)
  1051. epg5000_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),13248k(rootfs),1024k(manufacture)ro,64k(backup)ro,320k(storage)ro,64k(caldata)ro,14656k@0x40000(firmware)
  1052. ew-dorin_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),3712k(firmware),64k(art)
  1053. ew-dorin_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),16000k(firmware),64k(art)ro
  1054. f9k1115v2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),14464k(rootfs),1408k(kernel),64k(nvram)ro,64k(envram)ro,64k(art)ro,15872k@0x50000(firmware)
  1055. dlrtdev_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,6208k(firmware),64k(caldata)ro,640k(certs),960k(unknown)ro,64k@0x7f0000(caldata_copy)
  1056. dlrtdev_mtdlayout_fat=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,7168k(firmware),640k(certs),64k(caldata)ro,64k@0x660000(caldata_orig),6208k@0x50000(firmware_orig)
  1057. dragino2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,16000k(firmware),64k(config)ro,64k(art)ro
  1058. hiwifi_hc6361_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(bdinfo)ro,1280k(kernel),14848k(rootfs),64k(backup)ro,64k(art)ro,16128k@0x20000(firmware)
  1059. mr12_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13440k(rootfs),2304k(kernel),128k(art)ro,15744k@0x80000(firmware)
  1060. mr16_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13440k(rootfs),2304k(kernel),128k(art)ro,15744k@0x80000(firmware)
  1061. pb92_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2752k(rootfs),896k(kernel),64k(nvram),64k(art)ro,3648k@0x50000(firmware)
  1062. planex_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),128k(art)ro
  1063. ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
  1064. uap_pro_mtdlayout=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)
  1065. ubdev_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
  1066. whrhpg300n_mtdlayout=mtdparts=spi0.0:248k(u-boot)ro,8k(u-boot-env)ro,3712k(firmware),64k(art)ro
  1067. wlr8100_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),14080k(rootfs),192k(unknown)ro,64k(art)ro,384k(unknown2)ro,15488k@0x40000(firmware)
  1068. wpj344_mtdlayout_16M=mtdparts=spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
  1069. wpj531_mtdlayout_16M=mtdparts=spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
  1070. wpj558_mtdlayout_16M=mtdparts=spi0.0:192k(u-boot)ro,16128k(firmware),64k(art)ro
  1071. wndap360_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1728k(kernel),6016k(rootfs),64k(nvram)ro,64k(art)ro,7744k@0x50000(firmware)
  1072. wnr2200_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7808k(firmware),64k(art)ro
  1073. wnr2000v3_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,3712k(firmware),64k(art)ro
  1074. wnr2000v4_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,3776k(firmware),64k(art)ro
  1075. r6100_mtdlayout=mtdparts=ar934x-nfc:128k(u-boot)ro,256k(caldata),256k(caldata-backup),512k(config),512k(pot),2048k(kernel),122240k(ubi),25600k@0x1a0000(firmware),2048k(language),3072k(traffic_meter)
  1076. wndr4300_mtdlayout=mtdparts=ar934x-nfc:256k(u-boot)ro,256k(u-boot-env)ro,256k(caldata),512k(pot),2048k(language),512k(config),3072k(traffic_meter),2048k(kernel),23552k(ubi),25600k@0x6c0000(firmware),256k(caldata_backup),-(reserved)
  1077. zcn1523h_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6208k(rootfs),1472k(kernel),64k(configure)ro,64k(mfg)ro,64k(art)ro,7680k@0x50000(firmware)
  1078. mynet_n600_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(devdata)ro,64k(devconf)ro,15872k(firmware),64k(radiocfg)ro
  1079. mynet_rext_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,7808k(firmware),64k(nvram)ro,64k(ART)ro
  1080. zyx_nbg6716_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(env)ro,64k(RFdata)ro,-(nbu);ar934x-nfc:2048k(zyxel_rfsd),2048k(romd),1024k(header),2048k(kernel),-(ubi)
  1081. qihoo_c301_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg)ro;spi0.1:15360k(upgrade2),1024k(privatedata)
  1082. define Image/BuildKernel
  1083. cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
  1084. cp $(KDIR)/vmlinux $(VMLINUX).bin
  1085. dd if=$(KDIR)/vmlinux.bin.lzma of=$(VMLINUX).lzma bs=65536 conv=sync
  1086. dd if=$(KDIR)/vmlinux.bin.gz of=$(VMLINUX).gz bs=65536 conv=sync
  1087. $(call MkuImage,gzip,,$(KDIR)/vmlinux.bin.gz,$(UIMAGE)-gzip.bin)
  1088. $(call MkuImage,lzma,,$(KDIR)/vmlinux.bin.lzma,$(UIMAGE)-lzma.bin)
  1089. cp $(KDIR)/loader-generic.elf $(VMLINUX)-lzma.elf
  1090. -mkdir -p $(KDIR_TMP)
  1091. $(call Image/Build/Profile/$(IMAGE_PROFILE),buildkernel)
  1092. endef
  1093. define Image/BuildKernel/Initramfs
  1094. cp $(KDIR)/vmlinux-initramfs.elf $(VMLINUX)-initramfs.elf
  1095. cp $(KDIR)/vmlinux-initramfs $(VMLINUX)-initramfs.bin
  1096. dd if=$(KDIR)/vmlinux-initramfs.bin.lzma of=$(VMLINUX)-initramfs.lzma bs=65536 conv=sync
  1097. dd if=$(KDIR)/vmlinux-initramfs.bin.gz of=$(VMLINUX)-initramfs.gz bs=65536 conv=sync
  1098. $(call MkuImage,gzip,,$(KDIR)/vmlinux-initramfs.bin.gz,$(UIMAGE)-initramfs-gzip.bin)
  1099. $(call MkuImage,lzma,,$(KDIR)/vmlinux-initramfs.bin.lzma,$(UIMAGE)-initramfs-lzma.bin)
  1100. cp $(KDIR)/loader-generic-initramfs.elf $(VMLINUX)-initramfs-lzma.elf
  1101. $(call Image/Build/Initramfs)
  1102. endef
  1103. Image/Build/WRT400N/buildkernel=$(call MkuImageLzma,$(2),$(3))
  1104. define Image/Build/WRT400N
  1105. $(call Sysupgrade/KRuImage,$(1),$(2),1310720,6488064)
  1106. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  1107. wrt400n $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR)/root.$(1) $(call factoryname,$(1),$(2)); \
  1108. fi
  1109. endef
  1110. define Image/Build/CameoAP94/buildkernel
  1111. $(call MkuImageLzma,$(2),$(3) $(4))
  1112. $(call MkuImageLzma,$(2)-fat,$(3) $(5))
  1113. endef
  1114. define Image/Build/CameoAP94
  1115. $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
  1116. $(eval fwsize_fat=$(call mtdpartsize,firmware,$(5)))
  1117. $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
  1118. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  1119. ( \
  1120. dd if=$(call sysupname,$(1),$(2)); \
  1121. echo -n "$(6)"; \
  1122. ) > $(call imgname,$(1),$(2))-backup-loader.bin; \
  1123. if [ `stat -c%s $(call sysupname,$(1),$(2))` -gt 4194304 ]; then \
  1124. echo "Warning: $(call sysupname,$(1),$(2)) is too big" >&2; \
  1125. else \
  1126. ( \
  1127. dd if=$(call sysupname,$(1),$(2)) bs=4096k conv=sync; \
  1128. echo -n "$(7)"; \
  1129. ) > $(call factoryname,$(1),$(2)); \
  1130. fi; \
  1131. fi
  1132. $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2)-fat.uImage,0,$(KDIR)/root.$(1),$$$$(($(fwsize_fat)-4*64*1024)),$(KDIR_TMP)/$(2)-fat.bin,64)
  1133. if [ -e "$(KDIR_TMP)/$(2)-fat.bin" ]; then \
  1134. echo -n "" > $(KDIR_TMP)/$(2)-fat.dummy; \
  1135. sh $(TOPDIR)/scripts/combined-image.sh \
  1136. "$(KDIR_TMP)/$(2)-fat.bin" \
  1137. "$(KDIR_TMP)/$(2)-fat.dummy" \
  1138. $(call sysupname,$(1),$(2)-fat); \
  1139. fi
  1140. endef
  1141. define Image/Build/WZRHP
  1142. $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(3)-4*$(4)*1024)),$(4))
  1143. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  1144. ( \
  1145. echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
  1146. dd if=$(call sysupname,$(1),$(2)); \
  1147. ) > $(call imgname,$(1),$(2))-tftp.bin; \
  1148. buffalo-enc -p $(5) -v 1.99 \
  1149. -i $(call sysupname,$(1),$(2)) \
  1150. -o $(KDIR_TMP)/$(2).enc; \
  1151. buffalo-tag -b $(5) -p $(5) -a ath -v 1.99 -m 1.01 -l mlang8 \
  1152. -w 3 -c 0x80041000 -d 0x801e8000 -f 1 -r M_ \
  1153. -i $(KDIR_TMP)/$(2).enc \
  1154. -o $(call factoryname,$(1),$(2)); \
  1155. fi
  1156. endef
  1157. Image/Build/WZRHP64K/buildkernel=$(call MkuImageLzma,$(2),$(3))
  1158. Image/Build/WZRHP64K/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
  1159. Image/Build/WZRHP64K=$(call Image/Build/WZRHP,$(1),$(2),33095680,64,$(4))
  1160. Image/Build/WZRHP128K/buildkernel=$(call MkuImageLzma,$(2),$(3))
  1161. Image/Build/WZRHP128K/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
  1162. Image/Build/WZRHP128K=$(call Image/Build/WZRHP,$(1),$(2),33030144,128,$(4))
  1163. Image/Build/WHRHPG300N/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
  1164. Image/Build/WHRHPG300N/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
  1165. define Image/Build/WHRHPG300N
  1166. $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
  1167. $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
  1168. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  1169. ( \
  1170. echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
  1171. dd if=$(call sysupname,$(1),$(2)); \
  1172. ) > $(call imgname,$(1),$(2))-tftp.bin; \
  1173. buffalo-enc -p $(5) -v 1.99 \
  1174. -i $(call sysupname,$(1),$(2)) \
  1175. -o $(KDIR_TMP)/$(2).enc; \
  1176. buffalo-tag -b $(5) -p $(5) -a ath -v 1.99 -m 1.01 -l mlang8 \
  1177. -w 3 -c 0x80041000 -d 0x801e8000 -f 1 -r M_ \
  1178. -i $(KDIR_TMP)/$(2).enc \
  1179. -o $(call factoryname,$(1),$(2)); \
  1180. fi
  1181. endef
  1182. define Image/Build/Cameo
  1183. $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
  1184. $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
  1185. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  1186. factory_size=$$$$(($(fwsize) - $(6))); \
  1187. ( \
  1188. dd if=$(call sysupname,$(1),$(2)) bs=$$$${factory_size} conv=sync; \
  1189. echo -n $(5); \
  1190. ) > $(call factoryname,$(1),$(2)); \
  1191. fi
  1192. endef
  1193. Image/Build/CameoAP81/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap81_mtdlayout))
  1194. Image/Build/CameoAP81=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_ap81_mtdlayout),$(4),65536)
  1195. Image/Build/CameoAP81/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap81_mtdlayout))
  1196. Image/Build/CameoAP91/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap91_mtdlayout))
  1197. Image/Build/CameoAP91=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_ap91_mtdlayout),$(4),65536)
  1198. Image/Build/CameoAP91/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap91_mtdlayout))
  1199. Image/Build/CameoAP99/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap99_mtdlayout))
  1200. Image/Build/CameoAP99=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_ap99_mtdlayout),$(4),65536)
  1201. Image/Build/CameoAP99/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap99_mtdlayout))
  1202. Image/Build/CameoAP123_4M/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap123_mtdlayout_4M))
  1203. Image/Build/CameoAP123_4M=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_ap123_mtdlayout_4M),$(4),26)
  1204. Image/Build/CameoAP123_4M/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap123_mtdlayout_4M))
  1205. Image/Build/CameoAP135/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
  1206. Image/Build/CameoAP135=$(call Image/Build/Cameo,$(1),$(2),$(3),$(4),$(5),26)
  1207. Image/Build/CameoAP135/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
  1208. Image/Build/CameoDB120/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_db120_mtdlayout))
  1209. Image/Build/CameoDB120=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_db120_mtdlayout),$(4),26)
  1210. Image/Build/CameoDB120/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_db120_mtdlayout))
  1211. Image/Build/CameoDB120_8M/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_db120_mtdlayout_8M))
  1212. Image/Build/CameoDB120_8M=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_db120_mtdlayout_8M),$(4),26)
  1213. Image/Build/CameoDB120_8M/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_db120_mtdlayout_8M))
  1214. define Image/Build/CameoHornet
  1215. $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
  1216. $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
  1217. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  1218. for r in $(7); do \
  1219. [ -n "$$$$r" ] && dashr="-$$$$r" || dashr=; \
  1220. [ -z "$$$$r" ] && r="DEF"; \
  1221. mkcameofw -M HORNET -R "$$$$r" -S $(5) -V $(6) -c \
  1222. -K $(8) -I $(fwsize) \
  1223. -k "$(call sysupname,$(1),$(2))" \
  1224. -o $(call imgname,$(1),$(2))-factory$$$$dashr.bin; \
  1225. true; \
  1226. done; \
  1227. fi
  1228. endef
  1229. Image/Build/CameoAP121/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap121_mtdlayout))
  1230. Image/Build/CameoAP121=$(call Image/Build/CameoHornet,$(1),$(2),$(3),$(cameo_ap121_mtdlayout),$(4),$(5),$(6),0xe0000)
  1231. Image/Build/CameoAP121/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap121_mtdlayout))
  1232. Image/Build/CameoAP121_8M/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap121_mtdlayout_8M))
  1233. Image/Build/CameoAP121_8M=$(call Image/Build/CameoHornet,$(1),$(2),$(3),$(cameo_ap121_mtdlayout_8M),$(4),$(5),$(6),0x100000)
  1234. Image/Build/CameoAP121_8M/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap121_mtdlayout_8M))
  1235. define Image/Build/dLAN
  1236. $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
  1237. $(eval rootsize=$(call mtdpartsize,rootfs,$(4)))
  1238. $(eval kernsize=$(call mtdpartsize,kernel,$(4)))
  1239. $(call Sysupgrade/$(5),$(1),$(2),$(if $(6),$(6),$(kernsize)),$(if $(rootsize),$(rootsize),$(fwsize)))
  1240. if [ -e "$(call factoryname,$(1),$(2))" ]; then \
  1241. dd if=$(KDIR_TMP)/vmlinux-$(2).uImage \
  1242. of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
  1243. dd if=$(KDIR)/root.$(1) \
  1244. of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
  1245. fi
  1246. endef
  1247. Image/Build/dLANLzma/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
  1248. Image/Build/dLANLzma=$(call Image/Build/dLAN,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
  1249. Image/Build/dLANLzma/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
  1250. define Image/Build/Ath
  1251. $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
  1252. $(eval rootsize=$(call mtdpartsize,rootfs,$(4)))
  1253. $(eval kernsize=$(call mtdpartsize,kernel,$(4)))
  1254. $(call Sysupgrade/$(5),$(1),$(2),$(if $(6),$(6),$(kernsize)),$(if $(rootsize),$(rootsize),$(fwsize)))
  1255. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  1256. dd if=$(KDIR_TMP)/vmlinux-$(2).uImage \
  1257. of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
  1258. dd if=$(KDIR)/root.$(1) \
  1259. of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
  1260. fi
  1261. endef
  1262. Image/Build/AthGzip/buildkernel=$(call MkuImageGzip,$(2),$(3) $(4))
  1263. Image/Build/AthGzip=$(call Image/Build/Ath,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
  1264. Image/Build/AthGzip/initramfs=$(call MkuImageGzip/initramfs,$(2),$(3) $(4))
  1265. Image/Build/AthLzma/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
  1266. Image/Build/AthLzma=$(call Image/Build/Ath,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
  1267. Image/Build/AthLzma/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
  1268. Image/Build/Belkin/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
  1269. Image/Build/Belkin/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
  1270. define Image/Build/Belkin
  1271. $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
  1272. $(eval kernsize=$(call mtdpartsize,kernel,$(4)))
  1273. $(eval rootsize=$(call mtdpartsize,rootfs,$(4)))
  1274. $(call Sysupgrade/RKuImage,$(1),$(2),$(kernsize),$(rootsize))
  1275. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  1276. edimax_fw_header -m $(5) -v "libreCMC$(REVISION)" \
  1277. -n "uImage" \
  1278. -i $(KDIR_TMP)/vmlinux-$(2).uImage \
  1279. -o $(KDIR_TMP)/$(2)-uImage; \
  1280. edimax_fw_header -m $(5) -v "libreCMC$(REVISION)" \
  1281. -n "rootfs" \
  1282. -i $(KDIR)/root.$(1) \
  1283. -o $(KDIR_TMP)/$(2)-rootfs; \
  1284. ( \
  1285. dd if=$(KDIR_TMP)/$(2)-rootfs; \
  1286. dd if=$(KDIR_TMP)/$(2)-uImage; \
  1287. ) > "$(call factoryname,$(1),$(2))"; \
  1288. fi
  1289. endef
  1290. define Image/Build/EnGenius
  1291. $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
  1292. $(eval rootsize=$(call mtdpartsize,rootfs,$(4)))
  1293. $(eval kernsize=$(call mtdpartsize,kernel,$(4)))
  1294. $(call Sysupgrade/$(5),$(1),$(2),$(if $(6),$(6),$(kernsize)),$(if $(rootsize),$(rootsize),$(fwsize)))
  1295. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  1296. dd if=$(KDIR_TMP)/vmlinux-$(2).uImage \
  1297. of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
  1298. dd if=$(KDIR)/root.$(1) \
  1299. of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
  1300. mksenaofw -e $(call sysupname,$(1),$(2)) \
  1301. -o $(call imgname,$(1),$(2))-factory.dlf \
  1302. -r 0x101 -p $(7) -t 2; \
  1303. fi
  1304. endef
  1305. Image/Build/EnGenius/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
  1306. Image/Build/EnGenius/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
  1307. define MkuImageHiWiFi
  1308. # Field ih_name needs to start with "tw150v1"
  1309. mkimage -A mips -O linux -T kernel -a 0x80060000 -C $(1) $(2) \
  1310. -e 0x80060000 -n 'tw150v1 MIPS libreCMC Linux-$(LINUX_VERSION)' \
  1311. -d $(3) $(4)
  1312. endef
  1313. define MkuImageLzmaHiWiFi
  1314. $(call PatchKernelLzma,$(1),$(2),$(3),$(4))
  1315. $(call MkuImageHiWiFi,lzma,$(5),$(KDIR_TMP)/vmlinux$(4)-$(1).bin.lzma,$(KDIR_TMP)/vmlinux$(4)-$(1).uImage)
  1316. endef
  1317. Image/Build/HiWiFi/buildkernel=$(call MkuImageLzmaHiWiFi,$(2),$(3) $(4))
  1318. Image/Build/HiWiFi=$(call Image/Build/Ath,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
  1319. Image/Build/HiWiFi/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
  1320. Image/Build/PB4X/buildkernel=$(call PatchKernelLzma,$(2),$(3))
  1321. define Image/Build/PB4X
  1322. dd if=$(KDIR_TMP)/vmlinux-$(2).bin.lzma \
  1323. of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync
  1324. dd if=$(KDIR)/root.$(1) \
  1325. of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync
  1326. -sh $(TOPDIR)/scripts/combined-image.sh \
  1327. "$(call imgname,kernel,$(2)).bin" \
  1328. "$(call imgname,$(1),$(2)-rootfs).bin" \
  1329. $(call sysupname,$(1),$(2))
  1330. endef
  1331. Image/Build/MyLoader/buildkernel=$(call PatchKernelLzma,$(2),$(3))
  1332. Image/Build/MyLoader/initramfs=$(call PatchKernel/initramfs,$(2),$(3))
  1333. define Image/Build/MyLoader
  1334. $(eval fwsize=$(shell echo $$(($(4)-0x30000-4*64*1024))))
  1335. $(eval fwimage=$(KDIR_TMP)/$(2)-$(5)-firmware.bin)
  1336. $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).bin.lzma,65536,$(KDIR)/root.$(1),$(fwsize),$(fwimage))
  1337. if [ -e "$(fwimage)" ]; then \
  1338. $(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) -s $(4) -v \
  1339. -p0x00030000:0:al:0x80060000:firmware:$(fwimage) \
  1340. $(call imgname,$(1),$(2))-$(5)-factory.img; \
  1341. echo -n "" > $(KDIR_TMP)/empty.bin; \
  1342. sh $(TOPDIR)/scripts/combined-image.sh \
  1343. $(fwimage) $(KDIR_TMP)/empty.bin \
  1344. $(call imgname,$(1),$(2))-$(5)-sysupgrade.bin; \
  1345. fi
  1346. endef
  1347. Image/Build/Planex/initramfs=$(call MkuImageGzip/initramfs,$(2),$(3) $(planex_mtdlayout))
  1348. Image/Build/Planex/loader=$(call Image/BuildLoaderAlone,$(1),gz,$(2) $(planex_mtdlayout),0x52000,0)
  1349. define Image/Build/Planex/buildkernel
  1350. [ -e "$(KDIR)/loader-$(2).gz" ]
  1351. $(call MkuImageOKLI,$(2))
  1352. ( \
  1353. dd if=$(KDIR)/loader-$(2).gz bs=8128 count=1 conv=sync; \
  1354. dd if=$(KDIR_TMP)/vmlinux-$(2).okli; \
  1355. ) > $(KDIR_TMP)/kernel-$(2).bin
  1356. $(call MkuImage,gzip,,$(KDIR_TMP)/kernel-$(2).bin,$(KDIR_TMP)/vmlinux-$(2).uImage)
  1357. endef
  1358. define Image/Build/Planex
  1359. $(eval fwsize=$(call mtdpartsize,firmware,$(planex_mtdlayout)))
  1360. $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
  1361. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  1362. $(STAGING_DIR_HOST)/bin/mkplanexfw \
  1363. -B $(2) \
  1364. -v 2.00.00 \
  1365. -i $(call sysupname,$(1),$(2)) \
  1366. -o $(call factoryname,$(1),$(2)); \
  1367. fi
  1368. endef
  1369. Image/Build/ALFA/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
  1370. Image/Build/ALFA/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
  1371. define Image/Build/ALFA
  1372. $(call Sysupgrade/RKuImage,$(1),$(2),$(5),$(6))
  1373. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  1374. rm -rf $(KDIR)/$(1); \
  1375. mkdir -p $(KDIR)/$(1); \
  1376. cd $(KDIR)/$(1); \
  1377. cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR)/$(1)/$(7); \
  1378. cp $(KDIR)/root.$(1) $(KDIR)/$(1)/$(8); \
  1379. $(TAR) zcf $(call factoryname,$(1),$(2)) -C $(KDIR)/$(1) $(7) $(8); \
  1380. ( \
  1381. echo WRM7222C | dd bs=32 count=1 conv=sync; \
  1382. echo -ne '\xfe'; \
  1383. ) >> $(call factoryname,$(1),$(2)); \
  1384. fi
  1385. endef
  1386. Image/Build/Seama/loader=$(call Image/BuildLoader,$(1),bin,$(2) $(3),0x80060000)
  1387. define Image/Build/Seama
  1388. [ -e "$(KDIR)/loader-$(2).bin" ]
  1389. $(call CompressLzma,$(KDIR)/loader-$(2).bin,$(KDIR_TMP)/loader-$(2).bin.lzma)
  1390. -rm -f $(KDIR_TMP)/image-$(2).tmp
  1391. $(call CatFiles,$(KDIR_TMP)/loader-$(2).bin.lzma,$$$$(($(6) - 64)),$(KDIR)/root.$(1),$(7),$(KDIR_TMP)/image-$(2).tmp)
  1392. [ -e "$(KDIR_TMP)/image-$(2).tmp" ] && { \
  1393. head -c -4 "$(KDIR_TMP)/image-$(2).tmp" > "$(KDIR_TMP)/image-$(2).no-jffs2mark.tmp"; \
  1394. $(STAGING_DIR_HOST)/bin/seama \
  1395. -i $(KDIR_TMP)/image-$(2).no-jffs2mark.tmp \
  1396. -m "dev=/dev/mtdblock/1" -m "type=firmware"; \
  1397. $(STAGING_DIR_HOST)/bin/seama \
  1398. -s $(call imgname,$(1),$(2))-factory.bin \
  1399. -m "signature=$(5)" \
  1400. -i $(KDIR_TMP)/image-$(2).no-jffs2mark.tmp.seama; \
  1401. tail -c 4 "$(KDIR_TMP)/image-$(2).tmp" >> $(call imgname,$(1),$(2))-factory.bin; \
  1402. }
  1403. cat $(KDIR_TMP)/loader-$(2).bin.lzma > $(KDIR_TMP)/image-$(2)-sysupgrade.tmp
  1404. $(STAGING_DIR_HOST)/bin/seama \
  1405. -i $(KDIR_TMP)/image-$(2)-sysupgrade.tmp \
  1406. -m "dev=/dev/mtdblock/1" -m "type=firmware"
  1407. $(call CatFiles,$(KDIR_TMP)/image-$(2)-sysupgrade.tmp.seama,$(6),$(KDIR)/root.$(1),$(7),$(call sysupname,$(1),$(2)))
  1408. endef
  1409. define Image/Build/Seama/initramfs
  1410. $(call PatchKernelLzma,$(2),$(3) $(4),,-initramfs)
  1411. $(STAGING_DIR_HOST)/bin/seama \
  1412. -i $(KDIR_TMP)/vmlinux-initramfs-$(2).bin.lzma \
  1413. -m "dev=/dev/mtdblock/1" -m "type=firmware"
  1414. cat $(KDIR_TMP)/vmlinux-initramfs-$(2).bin.lzma.seama > $(call imgname,initramfs,$(2))-seama.bin
  1415. endef
  1416. Image/Build/Senao/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
  1417. Image/Build/Senao/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
  1418. define Image/Build/Senao
  1419. mkdir -p $(KDIR_TMP)/$(2)/
  1420. touch $(KDIR_TMP)/$(2)/FWINFO-libreCMC-$(REVISION)-$(2)
  1421. -$(CP) ./$(2)/* $(KDIR_TMP)/$(2)/
  1422. dd if=$(KDIR_TMP)/vmlinux-$(2).uImage \
  1423. of=$(KDIR_TMP)/$(2)/librecmc-senao-$(2)-uImage-lzma.bin bs=64k conv=sync
  1424. dd if=$(KDIR)/root.$(1) \
  1425. of=$(KDIR_TMP)/$(2)/librecmc-senao-$(2)-root.$(1) bs=64k conv=sync
  1426. ( \
  1427. cd $(KDIR_TMP)/$(2)/; \
  1428. $(TAR) -cz -f $(call factoryname,$(1),$(2)) * \
  1429. )
  1430. -rm -rf $(KDIR_TMP)/$(2)/
  1431. -sh $(TOPDIR)/scripts/combined-image.sh \
  1432. $(KDIR_TMP)/vmlinux-$(2).uImage \
  1433. $(KDIR)/root.$(1) \
  1434. $(call sysupname,$(1),$(2))
  1435. endef
  1436. Image/Build/TPLINKOLD/loader=$(call Image/BuildLoaderAlone,$(1),gz,$(2),0x22000,0)
  1437. define Image/Build/TPLINKOLD
  1438. [ -e "$(KDIR)/loader-$(2).gz" ]
  1439. $(call MkuImageOKLI,$(2))
  1440. ( \
  1441. dd if=$(KDIR)/loader-$(2).gz bs=7680 count=1 conv=sync; \
  1442. dd if=$(KDIR_TMP)/vmlinux-$(2).okli conv=sync; \
  1443. ) > $(KDIR_TMP)/kernel-$(2).bin
  1444. -$(STAGING_DIR_HOST)/bin/mktplinkfw \
  1445. -H $(4) -W $(5) -F $(6) -N libreCMC -V $(REVISION)\
  1446. -X 0x40000 \
  1447. -k $(KDIR_TMP)/kernel-$(2).bin \
  1448. -r $(KDIR)/root.$(1) \
  1449. -o $(call factoryname,$(1),$(2))
  1450. -$(STAGING_DIR_HOST)/bin/mktplinkfw \
  1451. -H $(4) -W $(5) -F $(6) -N libreCMC -V $(REVISION) -s\
  1452. -X 0x40000 \
  1453. -k $(KDIR_TMP)/kernel-$(2).bin \
  1454. -r $(KDIR)/root.$(1) \
  1455. -o $(call sysupname,$(1),$(2))
  1456. endef
  1457. define Image/Build/TPLINKOLD/initramfs
  1458. $(call Image/BuildLoader,$(2),gz,$(3),0x80060000,-initramfs)
  1459. -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
  1460. -H $(4) -W $(5) -F $(6) -N libreCMC -V $(REVISION) -s\
  1461. -k $(KDIR)/loader-$(2)-initramfs.gz \
  1462. -o $(call imgname,$(1),$(2))-initramfs-uImage.bin
  1463. endef
  1464. Image/Build/TPLINK/loader=$(call Image/BuildLoaderAlone,$(1),gz,$(2),0x22000,0)
  1465. define Image/Build/TPLINK
  1466. [ -e "$(KDIR)/loader-$(2).gz" ]
  1467. $(call MkuImageOKLI,$(2))
  1468. ( \
  1469. dd if=$(KDIR)/loader-$(2).gz bs=7680 count=1 conv=sync; \
  1470. dd if=$(KDIR_TMP)/vmlinux-$(2).okli conv=sync; \
  1471. ) > $(KDIR_TMP)/kernel-$(2).bin
  1472. -$(STAGING_DIR_HOST)/bin/mktplinkfw \
  1473. -H $(4) -W $(5) -F $(6) -N libreCMC -V $(REVISION)\
  1474. -X 0x40000 \
  1475. -k $(KDIR_TMP)/kernel-$(2).bin \
  1476. -r $(KDIR)/root.$(1) \
  1477. -a $(call rootfs_align,$(1)) -j \
  1478. -o $(call factoryname,$(1),$(2))
  1479. -$(STAGING_DIR_HOST)/bin/mktplinkfw \
  1480. -H $(4) -W $(5) -F $(6) -N libreCMC -V $(REVISION) -s\
  1481. -X 0x40000 \
  1482. -k $(KDIR_TMP)/kernel-$(2).bin \
  1483. -r $(KDIR)/root.$(1) \
  1484. -a $(call rootfs_align,$(1)) -j \
  1485. -o $(call sysupname,$(1),$(2))
  1486. endef
  1487. define Image/Build/TPLINK/initramfs
  1488. $(call Image/BuildLoader,$(2),gz,$(3),0x80060000,-initramfs)
  1489. -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
  1490. -H $(4) -W $(5) -F $(6) -N libreCMC -V $(REVISION) -s\
  1491. -k $(KDIR)/loader-$(2)-initramfs.gz \
  1492. -o $(call imgname,$(1),$(2))-uImage.bin
  1493. endef
  1494. Image/Build/TPLINK-LZMA/buildkernel=$(call PatchKernelLzma,$(2),$(3))
  1495. define Image/Build/TPLINK-LZMA
  1496. -$(STAGING_DIR_HOST)/bin/mktplinkfw \
  1497. -H $(4) -W $(5) -F $(6) -N libreCMC -V $(REVISION) $(7) \
  1498. -X 0x40000 \
  1499. -k $(KDIR_TMP)/vmlinux-$(2).bin.lzma \
  1500. -r $(KDIR)/root.$(1) \
  1501. -a $(call rootfs_align,$(1)) -j \
  1502. -o $(call factoryname,$(1),$(2))
  1503. -$(STAGING_DIR_HOST)/bin/mktplinkfw \
  1504. -H $(4) -W $(5) -F $(6) -N libreCMC -V $(REVISION) $(7) -s \
  1505. -X 0x40000 \
  1506. -k $(KDIR_TMP)/vmlinux-$(2).bin.lzma \
  1507. -r $(KDIR)/root.$(1) \
  1508. -a $(call rootfs_align,$(1)) -j \
  1509. -o $(call sysupname,$(1),$(2))
  1510. endef
  1511. define Image/Build/TPLINK-LZMA/initramfs
  1512. $(call PatchKernelLzma,$(2),$(3),,-initramfs)
  1513. -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
  1514. -H $(4) -W $(5) -F $(6) -N libreCMC -V $(REVISION) $(7) -s \
  1515. -k $(KDIR_TMP)/vmlinux-initramfs-$(2).bin.lzma \
  1516. -o $(call imgname,$(1),$(2))-uImage.bin
  1517. endef
  1518. Image/Build/TPLINK-SAFELOADER/loader = $(call Image/BuildLoaderPatched,$(1),elf,$(2) $(3))
  1519. define Image/Build/TPLINK-SAFELOADER
  1520. [ -e "$(KDIR)/loader-$(2).elf" ]
  1521. -$(STAGING_DIR_HOST)/bin/tplink-safeloader \
  1522. -B $(5) \
  1523. -k $(KDIR)/loader-$(2).elf \
  1524. -r $(KDIR)/root.$(1) \
  1525. -V $(REVISION) \
  1526. -j \
  1527. -o $(call factoryname,$(1),$(2))
  1528. -$(STAGING_DIR_HOST)/bin/tplink-safeloader \
  1529. -B $(5) \
  1530. -k $(KDIR)/loader-$(2).elf \
  1531. -r $(KDIR)/root.$(1) \
  1532. -V $(REVISION) \
  1533. -j -S \
  1534. -o $(call sysupname,$(1),$(2))
  1535. endef
  1536. define Image/Build/CyberTAN
  1537. echo -n '' > $(KDIR_TMP)/empty.bin
  1538. $(STAGING_DIR_HOST)/bin/trx -o $(KDIR)/image.tmp \
  1539. -f $(KDIR_TMP)/vmlinux-$(2).uImage -F $(KDIR_TMP)/empty.bin \
  1540. -x 32 -a 0x10000 -x -32 -f $(KDIR)/root.$(1)
  1541. -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(5) \
  1542. -i $(KDIR)/image.tmp \
  1543. -o $(call sysupname,$(1),$(2))
  1544. $(STAGING_DIR_HOST)/bin/trx -o $(KDIR)/image.tmp -f $(KDIR_TMP)/vmlinux-$(2).uImage \
  1545. -x 32 -a 0x10000 -x -32 -f $(KDIR)/root.$(1)
  1546. -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(5) -g \
  1547. -i $(KDIR)/image.tmp \
  1548. -o $(call factoryname,$(1),$(2))
  1549. rm $(KDIR)/image.tmp
  1550. endef
  1551. Image/Build/CyberTANGZIP/loader=$(call Image/BuildLoader,$(1),gz,$(2),0x80060000)
  1552. Image/Build/CyberTANGZIP/buildkernel=$(call MkuImage,gzip,,$(KDIR)/loader-$(2).gz,$(KDIR_TMP)/vmlinux-$(2).uImage)
  1553. Image/Build/CyberTANGZIP=$(call Image/Build/CyberTAN,$(1),$(2),$(3),$(4),$(5))
  1554. Image/Build/CyberTANLZMA/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
  1555. Image/Build/CyberTANLZMA=$(call Image/Build/CyberTAN,$(1),$(2),$(3),$(4),$(5))
  1556. Image/Build/Netgear/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4),,-M $(5))
  1557. define Image/Build/Netgear/buildkernel
  1558. $(call MkuImageLzma,$(2),$(3) $(4),-d20,,-M $(5))
  1559. -rm -rf $(KDIR_TMP)/$(2)
  1560. mkdir -p $(KDIR_TMP)/$(2)/image
  1561. cat $(KDIR_TMP)/vmlinux-$(2).uImage > $(KDIR_TMP)/$(2)/image/uImage
  1562. $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
  1563. $(KDIR_TMP)/$(2) $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp1 \
  1564. -noappend -root-owned -be -b 65536
  1565. ( \
  1566. cat $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp1; \
  1567. dd if=/dev/zero bs=1k count=1 \
  1568. ) > $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp2
  1569. mkimage -A mips -O linux -T filesystem -C none -M $(5) \
  1570. -a 0xbf070000 -e 0xbf070000 \
  1571. -n 'MIPS libreCMC Linux-$(LINUX_VERSION)' \
  1572. -d $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs.tmp2 \
  1573. $(KDIR_TMP)/vmlinux-$(2).uImage.squashfs
  1574. endef
  1575. define Image/Build/Netgear
  1576. $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
  1577. $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage.squashfs,0,$(KDIR)/root.$(1),$(fwsize),$(call sysupname,$(1),$(2)),64)
  1578. if [ -e $(call sysupname,$(1),$(2)) ]; then \
  1579. for r in $(7) ; do \
  1580. [ -n "$$$$r" ] && dashr="-$$$$r" || dashr= ; \
  1581. $(STAGING_DIR_HOST)/bin/mkdniimg \
  1582. -B $(6) -v libreCMC.$(REVISION) -r "$$$$r" $(8) \
  1583. -i $(call sysupname,$(1),$(2)) \
  1584. -o $(call imgname,$(1),$(2))-factory$$$$dashr.img; \
  1585. done; \
  1586. fi
  1587. endef
  1588. Image/Build/NetgearLzma/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4),,-M $(5))
  1589. Image/Build/NetgearLzma/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4),-d20,,-M $(5))
  1590. define Image/Build/NetgearLzma
  1591. $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
  1592. $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage,0,$(KDIR)/root.$(1),$(fwsize),$(call sysupname,$(1),$(2)),64)
  1593. endef
  1594. Image/Build/NetgearNAND/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4),,-M $(5))
  1595. # $(1): (empty)
  1596. # $(2): Board name (small caps)
  1597. # $(3): Kernel board specific cmdline
  1598. # $(4): Kernel mtdparts definition
  1599. # $(5): U-Boot magic
  1600. define Image/Build/NetgearNAND/buildkernel
  1601. $(eval kernelsize=$(call mtdpartsize,kernel,$(4)))
  1602. $(call PatchKernelLzma,$(2),$(3) $(4),-d20)
  1603. dd if=$(KDIR_TMP)/vmlinux-$(2).bin.lzma \
  1604. of=$(KDIR_TMP)/vmlinux-$(2).bin.tmp \
  1605. bs=$$$$(($(kernelsize)-131072-2*64-1)) \
  1606. count=1 conv=sync
  1607. $(call MkuImage,lzma,-M $(5),$(KDIR_TMP)/vmlinux-$(2).bin.tmp,$(KDIR_TMP)/vmlinux-$(2).uImage)
  1608. echo -ne '\xff' >> $(KDIR_TMP)/vmlinux-$(2).uImage
  1609. # create a fake rootfs image
  1610. dd if=/dev/zero of=$(KDIR_TMP)/fakeroot-$(2) bs=131072 count=1
  1611. mkimage -A mips -O linux -T filesystem -C none \
  1612. -a 0xbf070000 -e 0xbf070000 \
  1613. -n 'MIPS libreCMC fakeroot' \
  1614. -d $(KDIR_TMP)/fakeroot-$(2) \
  1615. -M $(5) \
  1616. $(KDIR_TMP)/fakeroot-$(2).uImage
  1617. # append the fake rootfs image to the kernel, it will reside in the last
  1618. # erase block of the kernel partition
  1619. cat $(KDIR_TMP)/fakeroot-$(2).uImage >> $(KDIR_TMP)/vmlinux-$(2).uImage
  1620. endef
  1621. # $(1): rootfs image suffix
  1622. # $(2): Board name (small caps)
  1623. # $(3): Kernel board specific cmdline
  1624. # $(4): Kernel mtdparts definition
  1625. # $(5): U-Boot magic
  1626. # $(6): Board name (upper caps)
  1627. # $(7): firmware region code (not used yet)
  1628. # $(8): DNI Hardware version
  1629. # $(9): suffix of the configuration file for ubinize
  1630. define Image/Build/NetgearNAND
  1631. $(eval firmwaresize=$(call mtdpartsize,firmware,$(4)))
  1632. $(eval kernelsize=$(call mtdpartsize,kernel,$(4)))
  1633. $(eval imageraw=$(KDIR_TMP)/$(2)-raw.img)
  1634. $(CP) $(KDIR)/root.squashfs-raw $(KDIR_TMP)/root.squashfs
  1635. echo -ne '\xde\xad\xc0\xde' > $(KDIR_TMP)/jffs2.eof
  1636. $(call ubinize,ubinize-$(9).ini,$(KDIR_TMP),$(KDIR_TMP)/$(2)-root.ubi,128KiB,2048,-E 5)
  1637. ( \
  1638. dd if=$(KDIR_TMP)/vmlinux-$(2).uImage; \
  1639. dd if=$(KDIR_TMP)/$(2)-root.ubi \
  1640. ) > $(imageraw)
  1641. $(STAGING_DIR_HOST)/bin/mkdniimg \
  1642. -B $(6) -v libreCMC.$(REVISION) -r "$$$$r" $(8) \
  1643. -i $(imageraw) \
  1644. -o $(call imgname,ubi,$(2))-factory.img
  1645. $(call Image/Build/SysupgradeNAND,$(2),squashfs,$(KDIR_TMP)/vmlinux-$(2).uImage)
  1646. endef
  1647. ifdef CONFIG_PACKAGE_uboot-ar71xx-nbg460n_550n_550nh
  1648. Image/Build/ZyXEL/buildkernel=$(call MkuImageLzma,$(2),$(3))
  1649. define Image/Build/ZyXEL
  1650. $(call Sysupgrade/KRuImage,$(1),$(2),917504,2752512)
  1651. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  1652. if [ ! -f $(BIN_DIR)/$(IMG_PREFIX)-$(2)-u-boot.bin ]; then \
  1653. echo "Warning: $(IMG_PREFIX)-$(2)-u-boot.bin not found" >&2; \
  1654. else \
  1655. $(STAGING_DIR_HOST)/bin/mkzynfw \
  1656. -B $(4) \
  1657. -b $(BIN_DIR)/$(IMG_PREFIX)-$(2)-u-boot.bin \
  1658. -r $(call sysupname,$(1),$(2)):0x10000 \
  1659. -o $(call factoryname,$(1),$(2)); \
  1660. fi; fi
  1661. endef
  1662. endif
  1663. define Image/Build/ZyXELNAND/buildkernel
  1664. $(eval kernelsize=$(call mtdpartsize,kernel,$(5)))
  1665. $(call MkuImageLzma,$(2),$(3) $(5) $(6))
  1666. mkdir -p $(KDIR_TMP)/$(2)/image/boot
  1667. cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/boot/vmlinux.lzma.uImage
  1668. $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
  1669. --pad=$(kernelsize) --big-endian --squash-uids -v -e 128KiB \
  1670. -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
  1671. -d $(KDIR_TMP)/$(2)/image \
  1672. 2>&1 1>/dev/null | awk '/^.+$$$$/'
  1673. -rm -rf $(KDIR_TMP)/$(2)
  1674. endef
  1675. define Image/Build/ZyXELNAND
  1676. if [ "$(1)" != "squashfs" ]; then \
  1677. echo Only squashfs is supported; \
  1678. return 0; \
  1679. fi
  1680. $(eval firmwaresize=$(call mtdpartsize,firmware,$(4)))
  1681. $(eval kernelsize=$(call mtdpartsize,kernel,$(4)))
  1682. $(eval imageraw=$(KDIR_TMP)/$(2)-raw.img)
  1683. $(CP) $(KDIR)/root.$(1) $(KDIR_TMP)/ubi_root.img
  1684. $(call ubinize,ubinize-$(2).ini,$(KDIR_TMP),$(KDIR_TMP)/$(2)-root.ubi,128KiB,2048,-E 5)
  1685. ( \
  1686. dd if=$(KDIR_TMP)/$(2)-kernel.jffs2; \
  1687. dd if=$(KDIR_TMP)/$(2)-root.ubi \
  1688. ) > $(imageraw)
  1689. dd if=$(imageraw) of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory.bin \
  1690. bs=128k conv=sync
  1691. $(call Image/Build/SysupgradeNAND,$(2),squashfs,$(KDIR_TMP)/$(2)-kernel.jffs2)
  1692. endef
  1693. Image/Build/OpenMesh/buildkernel=$(call MkuImageLzma,$(2))
  1694. define Image/Build/OpenMesh
  1695. -sh $(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \
  1696. "$(4)" \
  1697. "$(BUILD_DIR)/fwupgrade.cfg-$(4)" \
  1698. "$(KDIR_TMP)/vmlinux-$(2).uImage" \
  1699. "$(KDIR)/root.$(1)"
  1700. -sh $(TOPDIR)/scripts/combined-ext-image.sh \
  1701. "$(4)" "$(call factoryname,$(1),$(2))" \
  1702. "$(BUILD_DIR)/fwupgrade.cfg-$(4)" "fwupgrade.cfg" \
  1703. "$(KDIR_TMP)/vmlinux-$(2).uImage" "kernel" \
  1704. "$(KDIR)/root.$(1)" "rootfs"
  1705. endef
  1706. Image/Build/Zcomax/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
  1707. Image/Build/Zcomax/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
  1708. define Image/Build/Zcomax
  1709. $(call Sysupgrade/RKuImage,$(1),$(2),1507328,6356992)
  1710. if [ -e "$(call sysupname,$(1),$(2))" ]; then \
  1711. $(STAGING_DIR_HOST)/bin/mkzcfw \
  1712. -B $(2) \
  1713. -k $(KDIR_TMP)/vmlinux-$(2).uImage \
  1714. -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
  1715. -o $(call imgname,$(1),$(2))-factory.img; \
  1716. fi
  1717. endef
  1718. # $(1): template name to be defined, etc. squashfs-only, 64k, 64kraw, etc.
  1719. # $(2): jffs2 blocksize.
  1720. define Jffs2Template
  1721. define Image/Build/Template/$(1)/jffs2-$(2)
  1722. $$(call Image/Build/$$(1),jffs2-$(2),$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
  1723. endef
  1724. endef
  1725. # $(1): template name to be defined.
  1726. # $(2): squashfs suffix to be used.
  1727. # $(3): jffs2 suffix to be used.
  1728. define BuildTemplate
  1729. # $(1) : name of build method.
  1730. # $(2) : board name.
  1731. # $(3) : kernel command line.
  1732. # $(4)~$(8): extra arguments.
  1733. define Image/Build/Template/$(1)/initramfs
  1734. $$(call Image/Build/$$(1)/initramfs,initramfs,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
  1735. endef
  1736. define Image/Build/Template/$(1)/loader
  1737. $$(call Image/Build/$$(1)/loader,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
  1738. endef
  1739. define Image/Build/Template/$(1)/buildkernel
  1740. $$(call Image/Build/$$(1)/buildkernel,,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
  1741. endef
  1742. define Image/Build/Template/$(1)/squashfs
  1743. $$(call Image/Build/$$(1),squashfs$(2),$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
  1744. endef
  1745. $(if $(3),$(foreach bs,$(3),$(eval $(call Jffs2Template,$(1),$(bs)))))
  1746. endef
  1747. $(eval $(call BuildTemplate,squashfs-only))
  1748. $(eval $(call BuildTemplate,64k,-64k,64k))
  1749. $(eval $(call BuildTemplate,64kraw,-raw,64k))
  1750. $(eval $(call BuildTemplate,64kraw-nojffs,-raw))
  1751. $(eval $(call BuildTemplate,128k,,128k))
  1752. $(eval $(call BuildTemplate,128kraw,-raw,128k))
  1753. $(eval $(call BuildTemplate,256k,,256k))
  1754. $(eval $(call BuildTemplate,all,,64k 128k 256k))
  1755. ifeq ($(SUBTARGET),generic)
  1756. $(eval $(call SingleProfile,ALFA,64k,ALFANX,alfa-nx,ALFA-NX,ttyS0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,vmlinux.gz.uImage,pb9x-2.6.31-jffs2))
  1757. $(eval $(call SingleProfile,ALFA,64k,HORNETUB,hornet-ub,HORNET-UB,ttyATH0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,kernel_image,rootfs_image))
  1758. $(eval $(call SingleProfile,ALFA,64k,TUBE2H8M,tube2h-8M,TUBE2H,ttyATH0,115200,$$(alfa_mtdlayout_8M),1638400,6291456,kernel.image,rootfs.image))
  1759. $(eval $(call SingleProfile,AthGzip,64k,AP81,ap81,AP81,ttyS0,115200,$$(ap81_mtdlayout),RKuImage))
  1760. $(eval $(call SingleProfile,AthGzip,64k,AP83,ap83,AP83,ttyS0,115200,$$(ap83_mtdlayout),RKuImage))
  1761. $(eval $(call SingleProfile,AthGzip,64k,AP96,ap96,AP96,ttyS0,115200,$$(ap96_mtdlayout),RKuImage))
  1762. $(eval $(call SingleProfile,AthGzip,64k,WNDAP360,wndap360,WNDAP360,ttyS0,9600,$$(wndap360_mtdlayout),KRuImage))
  1763. $(eval $(call SingleProfile,AthLzma,64k,ALFAAP96,alfa-ap96,ALFA-AP96,ttyS0,115200,$$(alfa_ap96_mtdlayout),RKuImage))
  1764. $(eval $(call SingleProfile,AthLzma,64k,ALL0258N,all0258n,ALL0258N,ttyS0,115200,$$(all0258n_mtdlayout),KRuImage,65536))
  1765. $(eval $(call SingleProfile,AthLzma,256k,ALL0315N,all0315n,ALL0315N,ttyS0,115200,$$(all0315n_mtdlayout),KRuImage,262144))
  1766. $(eval $(call SingleProfile,AthLzma,64k,AP113,ap113,AP113,ttyS0,115200,$$(ap113_mtd_layout),RK))
  1767. $(eval $(call SingleProfile,AthLzma,64k,AP121_2M,ap121-2M,AP121,ttyATH0,115200,$$(ap121_mtdlayout_2M),RKuImage))
  1768. $(eval $(call SingleProfile,AthLzma,64k,AP121_4M,ap121-4M,AP121,ttyATH0,115200,$$(ap121_mtdlayout_4M),RKuImage))
  1769. $(eval $(call SingleProfile,AthLzma,64k,AP121MINI,ap121-mini,AP121-MINI,ttyATH0,115200,$$(ap121_mtdlayout_4M),RKuImage))
  1770. $(eval $(call SingleProfile,AthLzma,64k,AP132,ap132,AP132,ttyS0,115200,$$(ap132_mtdlayout),KRuImage))
  1771. $(eval $(call SingleProfile,AthLzma,64k,AP135,ap135-020,AP135-020,ttyS0,115200,$$(ap135_mtdlayout),RKuImage))
  1772. $(eval $(call SingleProfile,AthLzma,64k,AP136_010,ap136-010,AP136-010,ttyS0,115200,$$(ap136_mtdlayout),RKuImage))
  1773. $(eval $(call SingleProfile,AthLzma,64k,AP136_020,ap136-020,AP136-020,ttyS0,115200,$$(ap136_mtdlayout),RKuImage))
  1774. $(eval $(call SingleProfile,AthLzma,64k,AP143_8M,ap143-8M,AP143,ttyS0,115200,$$(ap143_mtdlayout_8M),RKuImage))
  1775. $(eval $(call SingleProfile,AthLzma,64k,AP143_16M,ap143-16M,AP143,ttyS0,115200,$$(ap143_mtdlayout_16M),RKuImage))
  1776. $(eval $(call SingleProfile,AthLzma,64k,AP147_010,ap147-010,AP147-010,ttyS0,115200,$$(ap147_mtdlayout),RKuImage))
  1777. $(eval $(call SingleProfile,AthLzma,64k,BXU2000N2,bxu2000n-2-a1,BXU2000n-2-A1,ttyS0,115200,$$(bxu2000n2_mtdlayout),RKuImage))
  1778. $(eval $(call SingleProfile,AthLzma,64k,CAP4200AG,cap4200ag,CAP4200AG,ttyS0,115200,$$(cap4200ag_mtdlayout),KRuImage))
  1779. $(eval $(call SingleProfile,AthLzma,64k,DB120,db120,DB120,ttyS0,115200,$$(db120_mtdlayout),RKuImage))
  1780. $(eval $(call SingleProfile,AthLzma,64k,DRAGINO2,dragino2,DRAGINO2,ttyATH0,115200,$$(dragino2_mtdlayout),KRuImage,65536))
  1781. $(eval $(call SingleProfile,AthLzma,64k,EWDORINAP,ew-dorin,EW-DORIN,ttyATH0,115200,$$(ew-dorin_mtdlayout_4M),KRuImage,65536))
  1782. $(eval $(call SingleProfile,AthLzma,64k,EWDORINRT,ew-dorin-router,EW-DORIN-ROUTER,ttyATH0,115200,$$(ew-dorin_mtdlayout_4M),KRuImage,65536))
  1783. $(eval $(call SingleProfile,AthLzma,64k,EWDORIN16M,ew-dorin-16M,EW-DORIN,ttyATH0,115200,$$(ew-dorin_mtdlayout_16M),KRuImage,65536))
  1784. $(eval $(call SingleProfile,AthLzma,64k,HORNETUBx2,hornet-ub-x2,HORNET-UB,ttyATH0,115200,$$(alfa_mtdlayout_16M),KRuImage,65536))
  1785. $(eval $(call SingleProfile,AthLzma,64k,MR12,mr12,MR12,ttyS0,115200,$$(mr12_mtdlayout),RKuImage))
  1786. $(eval $(call SingleProfile,AthLzma,64k,MR16,mr16,MR16,ttyS0,115200,$$(mr16_mtdlayout),RKuImage))
  1787. $(eval $(call SingleProfile,AthLzma,64k,PB92,pb92,PB92,ttyS0,115200,$$(pb92_mtdlayout),KRuImage))
  1788. $(eval $(call SingleProfile,AthLzma,64k,TUBE2H16M,tube2h-16M,TUBE2H,ttyATH0,115200,$$(alfa_mtdlayout_16M),KRuImage,65536))
  1789. $(eval $(call SingleProfile,AthLzma,64k,WLR8100,wlr8100,WLR8100,ttyS0,115200,$$(wlr8100_mtdlayout),KRuImage))
  1790. $(eval $(call SingleProfile,AthLzma,64k,WPJ344_16M,wpj344-16M,WPJ344,ttyS0,115200,$$(wpj344_mtdlayout_16M),KRuImage,65536))
  1791. $(eval $(call SingleProfile,AthLzma,64k,WPJ531_16M,wpj531-16M,WPJ531,ttyS0,115200,$$(wpj531_mtdlayout_16M),KRuImage,65536))
  1792. $(eval $(call SingleProfile,AthLzma,64k,WPJ558_16M,wpj558-16M,WPJ558,ttyS0,115200,$$(wpj558_mtdlayout_16M),KRuImage,65536))
  1793. $(eval $(call SingleProfile,Belkin,64k,F9K1115V2,f9k1115v2,F9K1115V2,ttyS0,115200,$$(f9k1115v2_mtdlayout),BR-6679BAC))
  1794. $(eval $(call SingleProfile,CameoAP91,64kraw,DIR600A1,dir-600-a1,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-00"))
  1795. $(eval $(call SingleProfile,CameoAP91,64kraw,DIR601A1,dir-601-a1,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-02"))
  1796. $(eval $(call SingleProfile,CameoAP91,64kraw,FR54RTR,fr-54rtr,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-01"))
  1797. $(eval $(call SingleProfile,CameoAP99,64kraw,DIR615E1,dir-615-e1,DIR-615-E1,ttyS0,115200,"AP93-AR7240-RT-081028-00"))
  1798. $(eval $(call SingleProfile,CameoAP99,64kraw,DIR615E4,dir-615-e4,DIR-615-E4,ttyS0,115200,"AP99-AR7240-RT-091105-05"))
  1799. $(eval $(call SingleProfile,CameoAP123_4M,64kraw,DIR615I1,dir-615-i1,DIR-615-I1,ttyS0,115200,"00DB120AR9341-RT-1012I1-00"))
  1800. $(eval $(call SingleProfile,CameoAP123_4M,64kraw,DIR615I3,dir-615-i3,DIR-615-I1,ttyS0,115200,"00DB120AR9341-RT-101214-00"))
  1801. $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,A02RBW300N,a02-rb-w300n,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-070614-03"))
  1802. $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,DIR615C1,dir-615-c1,DIR-615-C1,ttyS0,115200,"AP81-AR9130-RT-070614-02"))
  1803. $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,TEW632BRP,tew-632brp,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-070614-00"))
  1804. $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,TEW652BRP_FW,tew-652brp,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-080609-05"))
  1805. $(eval $(call SingleProfile,CameoAP81,64kraw-nojffs,TEW652BRP_RECOVERY,tew-652brp-recovery,TEW-632BRP,ttyS0,115200,"AP81-AR9130-RT-070614-02"))
  1806. $(eval $(call SingleProfile,CameoAP121,64kraw-nojffs,TEW712BR,tew-712br,TEW-712BR,ttyATH0,115200,"HORNET-RT-TEW712BR-3",1.99,""))
  1807. $(eval $(call SingleProfile,CameoAP121,64kraw-nojffs,DIR601B1,dir-601-b1,TEW-712BR,ttyATH0,115200,"HORNET-RT-DIR601B1-3",2.99.99,"" "NA"))
  1808. $(eval $(call SingleProfile,CameoAP121_8M,64kraw-nojffs,DIR505A1,dir-505-a1,DIR-505-A1,ttyATH0,115200,"HORNET-PACKET-DIR505A1-3",1.99.99,""))
  1809. $(eval $(call SingleProfile,CameoAP135,64kraw,DGL5500A1,dgl-5500-a1,DGL-5500-A1,ttyS0,115200,$$(dgl_5500_mtdlayout),"00AP135AR9558-RT-130508-00"))
  1810. $(eval $(call SingleProfile,CameoDB120,64kraw,DHP1565A1,dhp-1565-a1,DHP-1565-A1,ttyS0,115200,"00DB120AR9344-RT-101214-00"))
  1811. $(eval $(call SingleProfile,CameoDB120,64kraw,DIR825C1,dir-825-c1,DIR-825-C1,ttyS0,115200,"00DB120AR9344-RT-101214-00"))
  1812. $(eval $(call SingleProfile,CameoDB120,64kraw,DIR835A1,dir-835-a1,DIR-835-A1,ttyS0,115200,"00DB120AR9344-RT-101214-00"))
  1813. $(eval $(call SingleProfile,CameoDB120_8M,64kraw,TEW732BR,tew-732br,TEW-732BR,ttyS0,115200,"00DB120AR9341-RT-120906-NA"))
  1814. $(eval $(call SingleProfile,CyberTANGZIP,64k,WRT160NL,wrt160nl,WRT160NL,ttyS0,115200,,1.00.01))
  1815. $(eval $(call SingleProfile,CyberTANLZMA,64k,MYNETREXT,mynet-rext,MYNET-REXT,ttyS0,115200,$$(mynet_rext_mtdlayout) root=31:2,1.00.01))
  1816. $(eval $(call SingleProfile,CameoAP94,64kraw,DIR825B1,dir-825-b1,DIR-825-B1,ttyS0,115200,$$(cameo_ap94_mtdlayout),$$(cameo_ap94_mtdlayout_fat),01AP94-AR7161-RT-080619-00,00AP94-AR7161-RT-080619-00))
  1817. $(eval $(call SingleProfile,CameoAP94,64kraw,TEW673GRU,tew-673gru,TEW-673GRU,ttyS0,115200,$$(cameo_ap94_mtdlayout),$$(cameo_ap94_mtdlayout_fat),01AP94-AR7161-RT-080619-01,00AP94-AR7161-RT-080619-01))
  1818. $(eval $(call SingleProfile,CameoAP94,64kraw,DLRTDEV01,dlrtdev01,DIR-825-B1,ttyS0,115200,$$(dlrtdev_mtdlayout),$$(dlrtdev_mtdlayout_fat),01AP94-AR7161-RT-080619-00,00AP94-AR7161-RT-080619-00))
  1819. $(eval $(call SingleProfile,dLANLzma,64k,dLAN_pro_500_wp,dlan-pro-500-wp,dLAN-pro-500-wp,ttyS0,115200,$$(dlan_pro_500_wp_mtdlayout) mem=128M,KRuImage,64k))
  1820. $(eval $(call SingleProfile,dLANLzma,64k,dLAN_pro_1200_ac,dlan-pro-1200-ac,dLAN-pro-1200-ac,ttyS0,115200,$$(dlan_pro_1200_ac_mtdlayout) mem=128M,KRuImage,64k))
  1821. $(eval $(call SingleProfile,EnGenius,64k,ESR900,esr900,ESR900,ttyS0,115200,$$(esr900_mtdlayout),KRuImage,,0x4e))
  1822. $(eval $(call SingleProfile,EnGenius,64k,ESR1750,esr1750,ESR1750,ttyS0,115200,$$(esr1750_mtdlayout),KRuImage,,0x61))
  1823. $(eval $(call SingleProfile,EnGenius,64k,EPG5000,epg5000,EPG5000,ttyS0,115200,$$(epg5000_mtdlayout),KRuImage,,0x71))
  1824. $(eval $(call SingleProfile,HiWiFi,64k,HIWIFI_HC6361,hiwifi-hc6361,HiWiFi-HC6361,ttyATH0,115200,$$(hiwifi_hc6361_mtdlayout),KRuImage))
  1825. $(eval $(call SingleProfile,MyLoader,64k,WP543_2M,wp543,,ttyS0,115200,0x200000,2M))
  1826. $(eval $(call SingleProfile,MyLoader,64k,WP543_4M,wp543,,ttyS0,115200,0x400000,4M))
  1827. $(eval $(call SingleProfile,MyLoader,64k,WP543_8M,wp543,,ttyS0,115200,0x800000,8M))
  1828. $(eval $(call SingleProfile,MyLoader,64k,WP543_16M,wp543,,ttyS0,115200,0x1000000,16M))
  1829. $(eval $(call SingleProfile,MyLoader,64k,WPE72_4M,wpe72,,ttyS0,115200,0x400000,4M))
  1830. $(eval $(call SingleProfile,MyLoader,64k,WPE72_8M,wpe72,,ttyS0,115200,0x800000,8M))
  1831. $(eval $(call SingleProfile,MyLoader,64k,WPE72_16M,wpe72,,ttyS0,115200,0x1000000,16M))
  1832. $(eval $(call SingleProfile,Netgear,64kraw,WNR2000V3,wnr2000v3,WNR2000V3,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303033,WNR2000V3,"" NA,-H 29763551+04+32))
  1833. $(eval $(call SingleProfile,NetgearLzma,64kraw,WNR2000V4,wnr2000v4,WNR2000V4,ttyS0,115200,$$(wnr2000v4_mtdlayout),0x32303034,WNR2000V4,"" NA,))
  1834. $(eval $(call SingleProfile,Netgear,64kraw,WNR2200,wnr2200,WNR2200,ttyS0,115200,$$(wnr2200_mtdlayout),0x32323030,WNR2200,"" NA,))
  1835. $(eval $(call SingleProfile,Netgear,64kraw,REALWNR612V2,wnr612v2,WNR612V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303631,WNR612V2,"",))
  1836. $(eval $(call SingleProfile,Netgear,64kraw,N150R,n150r,WNR612V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x32303631,N150R,"",))
  1837. $(eval $(call SingleProfile,Netgear,64kraw,REALWNR1000V2,wnr1000v2,WNR1000V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x31303031,WNR1000V2,"",))
  1838. $(eval $(call SingleProfile,Netgear,64kraw,WNR1000V2_VC,wnr1000v2-vc,WNR1000V2,ttyS0,115200,$$(wnr2000v3_mtdlayout),0x31303030,WNR1000V2-VC,"",))
  1839. $(eval $(call SingleProfile,OpenMesh,squashfs-only,OM2P,om2p,,,,OM2P))
  1840. $(eval $(call SingleProfile,OpenMesh,squashfs-only,OM5P,om5p,,,,OM5P))
  1841. $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR600,mr600,,,,MR600))
  1842. $(eval $(call SingleProfile,OpenMesh,squashfs-only,MR900,mr900,,,,MR900))
  1843. $(eval $(call SingleProfile,PB4X,128k,ALL0305,all0305,ALL0305,ttyS0,115200))
  1844. $(eval $(call SingleProfile,PB4X,128k,EAP7660D,eap7660d,EAP7660D,ttyS0,115200))
  1845. $(eval $(call SingleProfile,PB4X,64k,JA76PF,ja76pf,JA76PF,ttyS0,115200))
  1846. $(eval $(call SingleProfile,PB4X,64k,JA76PF2,ja76pf2,JA76PF2,ttyS0,115200))
  1847. $(eval $(call SingleProfile,PB4X,64k,JWAP003,jwap003,JWAP003,ttyS0,115200))
  1848. $(eval $(call SingleProfile,PB4X,64k,PB42,pb42,PB42,ttyS0,115200))
  1849. $(eval $(call SingleProfile,PB4X,64k,PB44,pb44,PB44,ttyS0,115200))
  1850. $(eval $(call SingleProfile,Planex,64kraw,MZKW04NU,mzk-w04nu,MZK-W04NU,ttyS0,115200))
  1851. $(eval $(call SingleProfile,Planex,64kraw,MZKW300NH,mzk-w300nh,MZK-W300NH,ttyS0,115200))
  1852. $(eval $(call SingleProfile,Seama,64k,MYNETN600,mynet-n600,MYNET-N600,ttyS0,115200,$$(mynet_n600_mtdlayout),wrgnd16_wd_db600,1310720,16187392))
  1853. $(eval $(call SingleProfile,Seama,64k,MYNETN750,mynet-n750,MYNET-N750,ttyS0,115200,$$(mynet_n600_mtdlayout),wrgnd13_wd_av,1310720,16187392))
  1854. $(eval $(call SingleProfile,Seama,64k,QIHOO360,qihoo-c301,QIHOO-C301,ttyS0,115200,$$(qihoo_c301_mtdlayout),wrgac26_qihoo360_360rg,1310720,16121856))
  1855. $(eval $(call SingleProfile,Senao,squashfs-only,EAP300V2,eap300v2,EAP300V2,ttyS0,115200,$$(eap300v2_mtdlayout)))
  1856. $(eval $(call SingleProfile,TPLINKOLD,squashfs-only,TLWR841NV15,tl-wr841nd-v1.5,TL-WR841N-v1.5,ttyS0,115200,0x08410002,2,4M))
  1857. $(eval $(call SingleProfile,TPLINK,64kraw,RNXN360RT,rnx-n360rt,TL-WR941ND,ttyS0,115200,0x09410002,0x00420001,4M))
  1858. $(eval $(call SingleProfile,TPLINK,64kraw,TLMR3220V1,tl-mr3220-v1,TL-MR3220,ttyS0,115200,0x32200001,1,4M))
  1859. $(eval $(call SingleProfile,TPLINK,64kraw,TLMR3420V1,tl-mr3420-v1,TL-MR3420,ttyS0,115200,0x34200001,1,4M))
  1860. $(eval $(call SingleProfile,TPLINK,64kraw,TLWA701NV1,tl-wa701n-v1,TL-WA901ND,ttyS0,115200,0x07010001,1,4M))
  1861. $(eval $(call SingleProfile,TPLINK,64kraw,TLWA730REV1,tl-wa730rev1,TL-WA901ND,ttyS0,115200,0x07300001,1,4M))
  1862. $(eval $(call SingleProfile,TPLINK,64kraw,TLWA7510NV1,tl-wa7510n,TL-WA7510N,ttyS0,115200,0x75100001,1,4M))
  1863. $(eval $(call SingleProfile,TPLINK,64kraw,TLWA801NV1,tl-wa801nd-v1,TL-WA901ND,ttyS0,115200,0x08010001,1,4M))
  1864. $(eval $(call SingleProfile,TPLINK,64kraw,TLWA830RV1,tl-wa830re-v1,TL-WA901ND,ttyS0,115200,0x08300010,1,4M))
  1865. $(eval $(call SingleProfile,TPLINK,64kraw,TLWA901NV1,tl-wa901nd-v1,TL-WA901ND,ttyS0,115200,0x09010001,1,4M))
  1866. $(eval $(call SingleProfile,TPLINK,64kraw,TLWA901NV2,tl-wa901nd-v2,TL-WA901ND-v2,ttyS0,115200,0x09010002,1,4M))
  1867. $(eval $(call SingleProfile,TPLINK,64kraw,TLWR740NV1,tl-wr740n-v1,TL-WR741ND,ttyS0,115200,0x07400001,1,4M))
  1868. $(eval $(call SingleProfile,TPLINK,64kraw,TLWR740NV3,tl-wr740n-v3,TL-WR741ND,ttyS0,115200,0x07400003,1,4M))
  1869. $(eval $(call SingleProfile,TPLINK,64kraw,TLWR743NV1,tl-wr743nd-v1,TL-WR741ND,ttyS0,115200,0x07430001,1,4M))
  1870. $(eval $(call SingleProfile,TPLINK,64kraw,TLWR841NV3,tl-wr841nd-v3,TL-WR941ND,ttyS0,115200,0x08410003,3,4M))
  1871. $(eval $(call SingleProfile,TPLINK,64kraw,TLWR841NV5,tl-wr841nd-v5,TL-WR741ND,ttyS0,115200,0x08410005,1,4M))
  1872. $(eval $(call SingleProfile,TPLINK,64kraw,TLWR841NV7,tl-wr841nd-v7,TL-WR841N-v7,ttyS0,115200,0x08410007,1,4M))
  1873. $(eval $(call SingleProfile,TPLINK,64kraw,TLWR842V1,tl-wr842n-v1,TL-MR3420,ttyS0,115200,0x08420001,1,8M))
  1874. $(eval $(call SingleProfile,TPLINK,64kraw,TLWR941NV2,tl-wr941nd-v2,TL-WR941ND,ttyS0,115200,0x09410002,2,4M))
  1875. $(eval $(call SingleProfile,TPLINK,64kraw,TLWR941NV3,tl-wr941nd-v3,TL-WR941ND,ttyS0,115200,0x09410002,2,4M))
  1876. $(eval $(call SingleProfile,TPLINK,64kraw,TLWR941NV4,tl-wr941nd-v4,TL-WR741ND,ttyS0,115200,0x09410004,1,4M))
  1877. $(eval $(call SingleProfile,TPLINK,64kraw,TLWR1043V1,tl-wr1043nd-v1,TL-WR1043ND,ttyS0,115200,0x10430001,1,8M))
  1878. $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR1043V2,tl-wr1043nd-v2,TL-WR1043ND-v2,ttyS0,115200,0x10430002,1,8M))
  1879. $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR2543,tl-wr2543-v1,TL-WR2543N,ttyS0,115200,0x25430001,1,8Mlzma,-v 3.13.99))
  1880. $(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510,cpe210-220-510-520,CPE510,ttyS0,115200,$$(cpe510_mtdlayout),CPE510))
  1881. $(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRG301N,whr-g301n,WHR-G301N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-G301N))
  1882. $(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRHPG300N,whr-hp-g300n,WHR-HP-G300N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-HP-G300N))
  1883. $(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRHPGN,whr-hp-gn,WHR-HP-GN,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-HP-GN))
  1884. $(eval $(call SingleProfile,WHRHPG300N,64kraw,WLAEAG300N,wlae-ag300n,WLAE-AG300N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WLAE-AG300N))
  1885. $(eval $(call SingleProfile,WRT400N,64k,WRT400N,wrt400n,WRT400N,ttyS0,115200))
  1886. $(eval $(call SingleProfile,WZRHP128K,128kraw,WZRHPG300NH,wzr-hp-g300nh,WZR-HP-G300NH,ttyS0,115200,WZR-HP-G300NH))
  1887. $(eval $(call SingleProfile,WZRHP64K,64kraw,WZRHPG300NH2,wzr-hp-g300nh2,WZR-HP-G300NH2,ttyS0,115200,WZR-HP-G300NH2))
  1888. $(eval $(call SingleProfile,WZRHP64K,64kraw,WZRHPAG300H,wzr-hp-ag300h,WZR-HP-AG300H,ttyS0,115200,WZR-HP-AG300H))
  1889. $(eval $(call SingleProfile,WZRHP64K,64kraw,WZRHPG450H,wzr-hp-g450h,WZR-HP-G450H,ttyS0,115200,WZR-HP-AG450H))
  1890. $(eval $(call SingleProfile,WZRHP64K,64kraw,WZR600DHP,wzr-600dhp,WZR-HP-AG300H,ttyS0,115200,WZR-600DHP))
  1891. $(eval $(call SingleProfile,WZRHP64K,64kraw,WZR450HP2,wzr-450hp2,WZR-450HP2,ttyS0,115200,WZR-450HP2))
  1892. $(eval $(call SingleProfile,Zcomax,64k,ZCN1523H28,zcn-1523h-2-8,ZCN-1523H-2,ttyS0,115200,$$(zcn1523h_mtdlayout)))
  1893. $(eval $(call SingleProfile,Zcomax,64k,ZCN1523H516,zcn-1523h-5-16,ZCN-1523H-5,ttyS0,115200,$$(zcn1523h_mtdlayout)))
  1894. $(eval $(call SingleProfile,ZyXEL,64k,NBG_460N_550N_550NH,nbg460n_550n_550nh,NBG460N,ttyS0,115200,NBG-460N))
  1895. $(eval $(call MultiProfile,AP121,AP121_2M AP121_4M))
  1896. $(eval $(call MultiProfile,AP136,AP136_010 AP136_020))
  1897. $(eval $(call MultiProfile,AP143,AP143_8M AP143_16M))
  1898. $(eval $(call MultiProfile,AP147,AP147_010))
  1899. $(eval $(call MultiProfile,DIR615IX,DIR615I1 DIR615I3))
  1900. $(eval $(call MultiProfile,EWDORIN, EWDORINAP EWDORINRT EWDORIN16M))
  1901. $(eval $(call MultiProfile,OPENMESH,OM2P OM5P MR600 MR900))
  1902. $(eval $(call MultiProfile,TEW652BRP,TEW652BRP_FW TEW652BRP_RECOVERY))
  1903. $(eval $(call MultiProfile,TLMR3220,TLMR3220V1))
  1904. $(eval $(call MultiProfile,TLMR3420,TLMR3420V1))
  1905. $(eval $(call MultiProfile,TLWA701,TLWA701NV1))
  1906. $(eval $(call MultiProfile,TLWA730RE,TLWA730REV1))
  1907. $(eval $(call MultiProfile,TLWA801,TLWA801NV1))
  1908. $(eval $(call MultiProfile,TLWA830,TLWA830RV1))
  1909. $(eval $(call MultiProfile,TLWA901,TLWA901NV1 TLWA901NV2))
  1910. $(eval $(call MultiProfile,TLWA7510,TLWA7510NV1))
  1911. $(eval $(call MultiProfile,TLWR740,TLWR740NV1 TLWR740NV3))
  1912. $(eval $(call MultiProfile,TLWR741,TLWR741NV1 TLWR741NV2))
  1913. $(eval $(call MultiProfile,TLWR743,TLWR743NV1))
  1914. $(eval $(call MultiProfile,TLWR841,TLWR841NV15 TLWR841NV3 TLWR841NV5 TLWR841NV7))
  1915. $(eval $(call MultiProfile,TLWR842,TLWR842V1))
  1916. $(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4))
  1917. $(eval $(call MultiProfile,TLWR1043,TLWR1043V1 TLWR1043V2))
  1918. $(eval $(call MultiProfile,TLWDR4300,TLWDR3500V1 TLWDR3600V1 TLWDR4300V1 TLWDR4300V1IL TLWDR4310V1 MW4530RV1))
  1919. $(eval $(call MultiProfile,TUBE2H,TUBE2H8M TUBE2H16M))
  1920. $(eval $(call MultiProfile,WNR612V2,REALWNR612V2 N150R))
  1921. $(eval $(call MultiProfile,WNR1000V2,REALWNR1000V2 WNR1000V2_VC))
  1922. $(eval $(call MultiProfile,WP543,WP543_2M WP543_4M WP543_8M WP543_16M))
  1923. $(eval $(call MultiProfile,WPE72,WPE72_4M WPE72_8M WPE72_16M))
  1924. $(eval $(call MultiProfile,WPJ344,WPJ344_16M))
  1925. $(eval $(call MultiProfile,WPJ531,WPJ531_16M))
  1926. $(eval $(call MultiProfile,WPJ558,WPJ558_16M))
  1927. $(eval $(call MultiProfile,Minimal,$(SINGLE_PROFILES)))
  1928. $(eval $(call MultiProfile,Madwifi,EAP7660D WP543))
  1929. endif # ifeq ($(SUBTARGET),generic)
  1930. ifeq ($(SUBTARGET),nand)
  1931. $(eval $(call SingleProfile,NetgearNAND,64k,WNDR3700V4,wndr3700v4,WNDR3700_V4,ttyS0,115200,$$(wndr4300_mtdlayout),0x33373033,WNDR3700v4,"",-H 29763948+128+128,wndr4300))
  1932. $(eval $(call SingleProfile,NetgearNAND,64k,WNDR4300V1,wndr4300,WNDR4300,ttyS0,115200,$$(wndr4300_mtdlayout),0x33373033,WNDR4300,"",-H 29763948+0+128+128+2x2+3x3,wndr4300))
  1933. $(eval $(call SingleProfile,NetgearNAND,64k,R6100,r6100,R6100,ttyS0,115200,$$(r6100_mtdlayout),0x36303030,R6100,"",-H 29764434+0+128+128+2x2+2x2,wndr4300))
  1934. $(eval $(call SingleProfile,ZyXELNAND,128k,NBG6716,nbg6716,NBG6716,ttyS0,115200,NBG6716,$$(zyx_nbg6716_mtdlayout),mem=256M))
  1935. $(eval $(call MultiProfile,WNDR4300,WNDR3700V4 WNDR4300V1))
  1936. endif # ifeq ($(SUBTARGET),nand)
  1937. $(eval $(call MultiProfile,Default,$(SINGLE_PROFILES)))
  1938. define Image/Build/squashfs
  1939. cp $(KDIR)/root.squashfs $(KDIR)/root.squashfs-raw
  1940. cp $(KDIR)/root.squashfs $(KDIR)/root.squashfs-64k
  1941. $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR)/root.squashfs-64k 64
  1942. cp $(KDIR)/root.squashfs-64k $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs-64k
  1943. $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
  1944. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
  1945. endef
  1946. define Image/Build/jffs2
  1947. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
  1948. endef
  1949. define Image/Build/Initramfs
  1950. $(call Image/Build/Profile/$(IMAGE_PROFILE),initramfs)
  1951. endef
  1952. define Image/Prepare
  1953. gzip -9n -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
  1954. $(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma)
  1955. ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
  1956. gzip -9n -c $(KDIR)/vmlinux-initramfs > $(KDIR)/vmlinux-initramfs.bin.gz
  1957. $(call CompressLzma,$(KDIR)/vmlinux-initramfs,$(KDIR)/vmlinux-initramfs.bin.lzma)
  1958. $(call Image/BuildLoader,generic,elf,,,-initramfs)
  1959. endif
  1960. $(call Image/BuildLoader,generic,elf)
  1961. $(call Image/Build/Profile/$(if $(CONFIG_IB),Default,$(IMAGE_PROFILE)),loader)
  1962. endef
  1963. # $(1): filesystem type.
  1964. define Image/Build
  1965. $(call Image/Build/$(call rootfs_type,$(1)),$(1))
  1966. $(call Image/Build/Profile/$(IMAGE_PROFILE),$(1))
  1967. endef
  1968. $(eval $(call BuildImage))