Makefile 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. #
  3. # Copyright (C) 2009-2013 OpenWrt.org
  4. include $(TOPDIR)/rules.mk
  5. include $(INCLUDE_DIR)/image.mk
  6. KERNEL_LOADADDR:=0x8000
  7. # Some info about Ctera firmware:
  8. # 1. It's simple tar file (GNU standard), but it must have ".firm" suffix.
  9. # 2. It contains two images: kernel and romdisk. Both are required.
  10. # 3. Every image has header and trailer file.
  11. # 4. The struct of tar firmware is: header kernel trailer header romdisk trailer
  12. # 5. In header file are some strings used to describe image. It was decoded from
  13. # factory image.
  14. # 6. Version format in header file is restricted by Original FW.
  15. # 7. Trailer file contains MD5 sum string of header and image file.
  16. # 8. Firmware file must have <=24MB size.
  17. define Build/ctera-firmware
  18. mkdir -p [email protected]
  19. # Prepare header and trailer file for kernel
  20. echo "# CTera firmware information file" > [email protected]/header
  21. echo "image_type=kernel" >> [email protected]/header
  22. echo "arch=Kirkwood" >> [email protected]/header
  23. echo "board=Any" >> [email protected]/header
  24. echo "version=3.1.22.30669" >> [email protected]/header
  25. echo "kernel_cmd=console=ttyS0,115200 earlyprintk" >> [email protected]/header
  26. echo "date=$$(date $(if $(SOURCE_DATE_EPOCH),-d@$(SOURCE_DATE_EPOCH)))" \
  27. >> [email protected]/header
  28. cp $@ [email protected]/kernel
  29. echo "MD5=$$(cat [email protected]/header [email protected]/kernel | $(MKHASH) md5)" \
  30. > [email protected]/trailer
  31. tar $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
  32. -H gnu -C [email protected] -cf [email protected] header kernel trailer
  33. # Prepare header and trailer file for fake romdisk
  34. echo "# CTera firmware information file" > [email protected]/header
  35. echo "image_type=romdisk" >> [email protected]/header
  36. echo "initrd=yes" >> [email protected]/header
  37. echo "arch=Kirkwood" >> [email protected]/header
  38. echo "board=Any" >> [email protected]/header
  39. echo "version=3.1.22.30669" >> [email protected]/header
  40. echo "date=$$(date $(if $(SOURCE_DATE_EPOCH),-d@$(SOURCE_DATE_EPOCH)))" \
  41. >> [email protected]/header
  42. rm -f $@
  43. touch $@
  44. $(call Build/append-uImage-fakehdr, ramdisk)
  45. cp $@ [email protected]/romdisk
  46. echo "MD5=$$(cat [email protected]/header [email protected]/romdisk | $(MKHASH) md5)" \
  47. > [email protected]/trailer
  48. tar $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
  49. -H gnu -C [email protected] -rf [email protected] header romdisk trailer
  50. mv [email protected] $@
  51. rm -rf [email protected]
  52. endef
  53. define Device/kernel-size-migration-iomega
  54. DEVICE_COMPAT_VERSION := 2.0
  55. DEVICE_COMPAT_MESSAGE := \n$\
  56. !The partitioning of the router has changed! \n$\
  57. Partition design has changed compared to \
  58. older versions (up to 23.05) due to kernel size restrictions. \
  59. Upgrade via sysupgrade mechanism is not possible, so new \
  60. installation via initramfs image is required.\n$\
  61. Please adjust bootcmd in u-boot console:\n$\
  62. setenv bootcmd \
  63. 'setenv bootargs $$$${console} $$$${mtdparts} $$$${bootargs_root}; \
  64. nand read.e 0x800000 0x100000 0x400000; bootm 0x00800000'\n$\
  65. saveenv\n$\
  66. or use OpenWrt shell:\n$\
  67. fw_setenv bootcmd \
  68. "setenv bootargs $$$${console} $$$${mtdparts} $$$${bootargs_root};\
  69. nand read.e 0x800000 0x100000 0x400000; bootm 0x00800000"\n$\
  70. and reinstall image with initramfs image. \
  71. Please see original instructions for more details.
  72. endef
  73. define Device/kernel-size-migration-linksys
  74. DEVICE_COMPAT_VERSION := 3.0
  75. DEVICE_COMPAT_MESSAGE := \n$\
  76. !The partitioning of the router has changed! \n$\
  77. Partition design has changed compared to \
  78. older versions (up to 23.05) due to kernel size restrictions. \n$\
  79. Upgrade via sysupgrade mechanism is not possible, so u-boot args \
  80. adjustment and new installation via factory style image is required. \n$\
  81. Upgrade instructions: \n$\
  82. 2. Run folowing commands in console (ssh or serial): \n$\
  83. \t fw_printenv \n$\
  84. \t fw_setenv nandboot \
  85. "$$$$(fw_printenv nandboot | awk -F= '{sub(/^nandboot=/, "");print}' \
  86. | sed 's/0x300000/0x400000/g')"\n$\
  87. \t fw_setenv altnandboot \
  88. "$$$$(fw_printenv altnandboot | awk -F= '{sub(/^altnandboot=/, "");print}' \
  89. | sed 's/0x300000/0x400000/g')"\n$\
  90. 3. Test if envs are ok by 'fw_printenv'. \
  91. It should be the same except last argument of\
  92. 'nand read.e' in 'nandboot' and 'altnandboot'.\n$\
  93. 4. If envs are ok, please apply FACTORY image with command:\n$\
  94. \t sysupgrade -F -n OPENWRT_FACTORY_IMAGE.bin \n$\
  95. 5. System should start normally. If not, serial console will be required.
  96. endef
  97. define Device/Default
  98. PROFILES := Default
  99. DEVICE_DTS_DIR := $(DTS_DIR)/marvell
  100. DEVICE_DTS = kirkwood-$(lastword $(subst _, ,$(1)))
  101. KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
  102. KERNEL := kernel-bin | append-dtb | uImage none
  103. KERNEL_NAME := zImage
  104. KERNEL_SUFFIX := -uImage
  105. KERNEL_IN_UBI := 1
  106. PAGESIZE := 2048
  107. SUBPAGESIZE := 512
  108. BLOCKSIZE := 128k
  109. IMAGES := sysupgrade.bin factory.bin
  110. IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
  111. IMAGE/factory.bin := append-ubi
  112. endef
  113. define Device/checkpoint_l-50
  114. DEVICE_VENDOR := Check Point
  115. DEVICE_MODEL := L-50
  116. DEVICE_PACKAGES := kmod-ath9k kmod-gpio-button-hotplug kmod-mvsdio \
  117. kmod-rtc-s35390a kmod-usb-ledtrig-usbport wpad-basic-mbedtls \
  118. kmod-dsa-mv88e6xxx
  119. IMAGES := sysupgrade.bin
  120. endef
  121. TARGET_DEVICES += checkpoint_l-50
  122. define Device/cisco_on100
  123. DEVICE_VENDOR := Cisco Systems
  124. DEVICE_MODEL := ON100
  125. KERNEL_SIZE := 5376k
  126. KERNEL_IN_UBI :=
  127. UBINIZE_OPTS := -E 5
  128. IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
  129. DEVICE_PACKAGES := kmod-mvsdio kmod-rtc-mv
  130. SUPPORTED_DEVICES += on100
  131. endef
  132. TARGET_DEVICES += cisco_on100
  133. define Device/cloudengines_pogoe02
  134. DEVICE_VENDOR := Cloud Engines
  135. DEVICE_MODEL := Pogoplug E02
  136. DEVICE_DTS := kirkwood-pogo_e02
  137. DEVICE_PACKAGES := kmod-rtc-mv
  138. SUPPORTED_DEVICES += pogo_e02
  139. endef
  140. TARGET_DEVICES += cloudengines_pogoe02
  141. define Device/cloudengines_pogoplugv4
  142. DEVICE_VENDOR := Cloud Engines
  143. DEVICE_MODEL := Pogoplug V4
  144. DEVICE_DTS := kirkwood-pogoplug-series-4
  145. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-mvsdio kmod-usb3 \
  146. kmod-gpio-button-hotplug kmod-rtc-mv
  147. endef
  148. TARGET_DEVICES += cloudengines_pogoplugv4
  149. define Device/ctera_c200-v1
  150. DEVICE_VENDOR := Ctera
  151. DEVICE_MODEL := C200
  152. DEVICE_VARIANT := V1
  153. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-gpio-button-hotplug \
  154. kmod-hwmon-lm63 kmod-rtc-s35390a kmod-usb-ledtrig-usbport
  155. KERNEL := kernel-bin | append-dtb | uImage none | ctera-firmware
  156. KERNEL_IN_UBI :=
  157. KERNEL_SUFFIX := -factory.firm
  158. IMAGES := sysupgrade.bin
  159. endef
  160. TARGET_DEVICES += ctera_c200-v1
  161. define Device/dlink_dns320l
  162. DEVICE_VENDOR := D-Link
  163. DEVICE_MODEL := DNS-320L
  164. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-gpio-button-hotplug \
  165. kmod-usb-storage kmod-usb-ledtrig-usbport dns320l-mcu kmod-rtc-mv
  166. endef
  167. TARGET_DEVICES += dlink_dns320l
  168. define Device/endian_4i-edge-200
  169. DEVICE_VENDOR := Endian
  170. DEVICE_MODEL := 4i Edge 200
  171. DEVICE_ALT0_VENDOR := Endian
  172. DEVICE_ALT0_MODEL := UTM Mini Firewall
  173. DEVICE_PACKAGES := kmod-ath9k kmod-mvsdio wpad-basic-mbedtls kmod-rtc-mv \
  174. kmod-dsa-mv88e6xxx
  175. KERNEL_SIZE := 4096k
  176. IMAGES := sysupgrade.bin
  177. endef
  178. TARGET_DEVICES += endian_4i-edge-200
  179. define Device/globalscale_sheevaplug
  180. DEVICE_VENDOR := Globalscale
  181. DEVICE_MODEL := Sheevaplug
  182. DEVICE_PACKAGES := kmod-mvsdio kmod-rtc-mv
  183. endef
  184. TARGET_DEVICES += globalscale_sheevaplug
  185. define Device/iom_iconnect-1.1
  186. DEVICE_VENDOR := Iomega
  187. DEVICE_MODEL := Iconnect
  188. DEVICE_PACKAGES := kmod-rtc-mv
  189. DEVICE_DTS := kirkwood-iconnect
  190. SUPPORTED_DEVICES += iconnect
  191. endef
  192. TARGET_DEVICES += iom_iconnect-1.1
  193. define Device/iom_ix2-200
  194. $(Device/kernel-size-migration-iomega)
  195. DEVICE_VENDOR := Iomega
  196. DEVICE_MODEL := StorCenter ix2-200
  197. DEVICE_DTS := kirkwood-iomega_ix2_200
  198. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
  199. kmod-gpio-button-hotplug kmod-hwmon-lm63 kmod-rtc-mv
  200. PAGESIZE := 512
  201. SUBPAGESIZE := 256
  202. BLOCKSIZE := 16k
  203. KERNEL_SIZE := 4096k
  204. KERNEL_IN_UBI :=
  205. UBINIZE_OPTS := -E 5
  206. IMAGE_SIZE := 31744k
  207. IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
  208. check-size
  209. endef
  210. TARGET_DEVICES += iom_ix2-200
  211. define Device/iom_ix4-200d
  212. $(Device/kernel-size-migration-iomega)
  213. DEVICE_VENDOR := Iomega
  214. DEVICE_MODEL := StorCenter ix4-200d
  215. DEVICE_PACKAGES := kmod-ata-ahci kmod-ata-marvell-sata kmod-fs-ext4 \
  216. kmod-gpio-button-hotplug kmod-gpio-nxp-74hc164 \
  217. kmod-hwmon-adt7475 kmod-mvsdio kmod-spi-gpio kmod-rtc-mv
  218. PAGESIZE := 512
  219. SUBPAGESIZE := 256
  220. BLOCKSIZE := 16k
  221. KERNEL_SIZE := 4096k
  222. KERNEL_IN_UBI :=
  223. UBINIZE_OPTS := -E 5
  224. IMAGE_SIZE := 31744k
  225. IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
  226. check-size
  227. endef
  228. TARGET_DEVICES += iom_ix4-200d
  229. define Device/iptime_nas1
  230. DEVICE_VENDOR := ipTIME
  231. DEVICE_MODEL := NAS1
  232. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
  233. kmod-gpio-button-hotplug kmod-gpio-pca953x kmod-hwmon-drivetemp \
  234. kmod-hwmon-gpiofan kmod-usb-ledtrig-usbport kmod-rtc-mv kmod-thermal \
  235. -uboot-envtools
  236. KERNEL := $$(KERNEL) | iptime-naspkg nas1
  237. BLOCKSIZE := 256k
  238. IMAGE_SIZE := 15872k
  239. IMAGES := sysupgrade.bin
  240. IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \
  241. check-size | append-metadata
  242. endef
  243. TARGET_DEVICES += iptime_nas1
  244. define Device/linksys
  245. $(Device/kernel-size-migration-linksys)
  246. DEVICE_VENDOR := Linksys
  247. DEVICE_PACKAGES := kmod-mwl8k wpad-basic-mbedtls kmod-gpio-button-hotplug \
  248. kmod-rtc-mv kmod-dsa-mv88e6xxx
  249. KERNEL_IN_UBI :=
  250. KERNEL_SIZE := 4096k
  251. UBINIZE_OPTS := -E 5
  252. IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
  253. endef
  254. define Device/linksys_e4200-v2
  255. $(Device/linksys)
  256. DEVICE_MODEL := E4200
  257. DEVICE_VARIANT := v2
  258. SUPPORTED_DEVICES += linksys,viper linksys-viper
  259. endef
  260. TARGET_DEVICES += linksys_e4200-v2
  261. define Device/linksys_ea3500
  262. $(Device/linksys)
  263. DEVICE_MODEL := EA3500
  264. PAGESIZE := 512
  265. SUBPAGESIZE := 256
  266. BLOCKSIZE := 16k
  267. SUPPORTED_DEVICES += linksys,audi linksys-audi
  268. endef
  269. TARGET_DEVICES += linksys_ea3500
  270. define Device/linksys_ea4500
  271. $(Device/linksys)
  272. DEVICE_MODEL := EA4500
  273. SUPPORTED_DEVICES += linksys,viper linksys-viper
  274. endef
  275. TARGET_DEVICES += linksys_ea4500
  276. define Device/netgear_readynas-duo-v2
  277. DEVICE_VENDOR := NETGEAR
  278. DEVICE_MODEL := ReadyNAS Duo
  279. DEVICE_VARIANT := v2
  280. DEVICE_DTS := kirkwood-netgear_readynas_duo_v2
  281. KERNEL_IN_UBI :=
  282. IMAGES := sysupgrade.bin
  283. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
  284. kmod-gpio-button-hotplug kmod-hwmon-g762 kmod-rtc-rs5c372a kmod-usb3
  285. endef
  286. TARGET_DEVICES += netgear_readynas-duo-v2
  287. define Device/netgear_stora
  288. DEVICE_VENDOR := Netgear
  289. DEVICE_MODEL := Stora (MS2000/2110)
  290. DEVICE_DTS := kirkwood-stora
  291. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
  292. kmod-rtc-pcf8563 kmod-hwmon-lm75 kmod-hwmon-tc654 \
  293. kmod-gpio-button-hotplug
  294. endef
  295. TARGET_DEVICES += netgear_stora
  296. define Device/raidsonic_ib-nas62x0
  297. DEVICE_VENDOR := RaidSonic
  298. DEVICE_MODEL := ICY BOX IB-NAS62x0
  299. DEVICE_DTS := kirkwood-ib62x0
  300. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-rtc-mv
  301. SUPPORTED_DEVICES += ib62x0
  302. endef
  303. TARGET_DEVICES += raidsonic_ib-nas62x0
  304. define Device/seagate_blackarmor-nas220
  305. DEVICE_VENDOR := Seagate
  306. DEVICE_MODEL := Blackarmor NAS220
  307. DEVICE_PACKAGES := kmod-hwmon-adt7475 kmod-fs-ext4 kmod-ata-marvell-sata \
  308. mdadm kmod-gpio-button-hotplug kmod-rtc-mv
  309. PAGESIZE := 512
  310. SUBPAGESIZE := 256
  311. BLOCKSIZE := 16k
  312. UBINIZE_OPTS := -e 1
  313. endef
  314. TARGET_DEVICES += seagate_blackarmor-nas220
  315. define Device/seagate_dockstar
  316. DEVICE_VENDOR := Seagate
  317. DEVICE_MODEL := FreeAgent Dockstar
  318. DEVICE_PACKAGES := kmod-rtc-mv
  319. SUPPORTED_DEVICES += dockstar
  320. endef
  321. TARGET_DEVICES += seagate_dockstar
  322. define Device/seagate_goflexnet
  323. DEVICE_VENDOR := Seagate
  324. DEVICE_MODEL := GoFlexNet
  325. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-rtc-mv
  326. SUPPORTED_DEVICES += goflexnet
  327. endef
  328. TARGET_DEVICES += seagate_goflexnet
  329. define Device/seagate_goflexhome
  330. DEVICE_VENDOR := Seagate
  331. DEVICE_MODEL := GoFlexHome
  332. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-rtc-mv
  333. SUPPORTED_DEVICES += goflexhome
  334. endef
  335. TARGET_DEVICES += seagate_goflexhome
  336. define Device/zyxel_nsa310b
  337. DEVICE_VENDOR := Zyxel
  338. DEVICE_MODEL := NSA310b
  339. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-r8169 kmod-fs-ext4 \
  340. kmod-gpio-button-hotplug kmod-hwmon-lm85 kmod-rtc-mv
  341. SUPPORTED_DEVICES += nsa310b
  342. endef
  343. TARGET_DEVICES += zyxel_nsa310b
  344. define Device/zyxel_nsa310s
  345. DEVICE_VENDOR := Zyxel
  346. DEVICE_MODEL := NSA310S
  347. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
  348. kmod-gpio-button-hotplug kmod-rtc-mv
  349. endef
  350. TARGET_DEVICES += zyxel_nsa310s
  351. define Device/zyxel_nsa325
  352. DEVICE_VENDOR := Zyxel
  353. DEVICE_MODEL := NSA325
  354. DEVICE_VARIANT := v1/v2
  355. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
  356. kmod-gpio-button-hotplug kmod-rtc-pcf8563 kmod-usb3
  357. SUPPORTED_DEVICES += nsa325
  358. endef
  359. TARGET_DEVICES += zyxel_nsa325
  360. $(eval $(call BuildImage))