Makefile 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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. IMAGES := sysupgrade.bin
  119. endef
  120. TARGET_DEVICES += checkpoint_l-50
  121. define Device/cisco_on100
  122. DEVICE_VENDOR := Cisco Systems
  123. DEVICE_MODEL := ON100
  124. KERNEL_SIZE := 5376k
  125. KERNEL_IN_UBI :=
  126. UBINIZE_OPTS := -E 5
  127. IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
  128. DEVICE_PACKAGES := kmod-mvsdio kmod-rtc-mv
  129. SUPPORTED_DEVICES += on100
  130. endef
  131. TARGET_DEVICES += cisco_on100
  132. define Device/cloudengines_pogoe02
  133. DEVICE_VENDOR := Cloud Engines
  134. DEVICE_MODEL := Pogoplug E02
  135. DEVICE_DTS := kirkwood-pogo_e02
  136. DEVICE_PACKAGES := kmod-rtc-mv
  137. SUPPORTED_DEVICES += pogo_e02
  138. endef
  139. TARGET_DEVICES += cloudengines_pogoe02
  140. define Device/cloudengines_pogoplugv4
  141. DEVICE_VENDOR := Cloud Engines
  142. DEVICE_MODEL := Pogoplug V4
  143. DEVICE_DTS := kirkwood-pogoplug-series-4
  144. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-mvsdio kmod-usb3 \
  145. kmod-gpio-button-hotplug kmod-rtc-mv
  146. endef
  147. TARGET_DEVICES += cloudengines_pogoplugv4
  148. define Device/ctera_c200-v1
  149. DEVICE_VENDOR := Ctera
  150. DEVICE_MODEL := C200
  151. DEVICE_VARIANT := V1
  152. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-gpio-button-hotplug \
  153. kmod-hwmon-lm63 kmod-rtc-s35390a kmod-usb-ledtrig-usbport
  154. KERNEL := kernel-bin | append-dtb | uImage none | ctera-firmware
  155. KERNEL_IN_UBI :=
  156. KERNEL_SUFFIX := -factory.firm
  157. IMAGES := sysupgrade.bin
  158. endef
  159. TARGET_DEVICES += ctera_c200-v1
  160. define Device/dlink_dns320l
  161. DEVICE_VENDOR := D-Link
  162. DEVICE_MODEL := DNS-320L
  163. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-gpio-button-hotplug \
  164. kmod-usb-storage kmod-usb-ledtrig-usbport dns320l-mcu kmod-rtc-mv
  165. endef
  166. TARGET_DEVICES += dlink_dns320l
  167. define Device/endian_4i-edge-200
  168. DEVICE_VENDOR := Endian
  169. DEVICE_MODEL := 4i Edge 200
  170. DEVICE_ALT0_VENDOR := Endian
  171. DEVICE_ALT0_MODEL := UTM Mini Firewall
  172. DEVICE_PACKAGES := kmod-ath9k kmod-mvsdio wpad-basic-mbedtls kmod-rtc-mv
  173. KERNEL_SIZE := 4096k
  174. IMAGES := sysupgrade.bin
  175. endef
  176. TARGET_DEVICES += endian_4i-edge-200
  177. define Device/globalscale_sheevaplug
  178. DEVICE_VENDOR := Globalscale
  179. DEVICE_MODEL := Sheevaplug
  180. DEVICE_PACKAGES := kmod-mvsdio kmod-rtc-mv
  181. endef
  182. TARGET_DEVICES += globalscale_sheevaplug
  183. define Device/iom_iconnect-1.1
  184. DEVICE_VENDOR := Iomega
  185. DEVICE_MODEL := Iconnect
  186. DEVICE_PACKAGES := kmod-rtc-mv
  187. DEVICE_DTS := kirkwood-iconnect
  188. SUPPORTED_DEVICES += iconnect
  189. endef
  190. TARGET_DEVICES += iom_iconnect-1.1
  191. define Device/iom_ix2-200
  192. $(Device/kernel-size-migration-iomega)
  193. DEVICE_VENDOR := Iomega
  194. DEVICE_MODEL := StorCenter ix2-200
  195. DEVICE_DTS := kirkwood-iomega_ix2_200
  196. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
  197. kmod-gpio-button-hotplug kmod-hwmon-lm63 kmod-rtc-mv
  198. PAGESIZE := 512
  199. SUBPAGESIZE := 256
  200. BLOCKSIZE := 16k
  201. KERNEL_SIZE := 4096k
  202. KERNEL_IN_UBI :=
  203. UBINIZE_OPTS := -E 5
  204. IMAGE_SIZE := 31744k
  205. IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
  206. check-size
  207. endef
  208. TARGET_DEVICES += iom_ix2-200
  209. define Device/iom_ix4-200d
  210. $(Device/kernel-size-migration-iomega)
  211. DEVICE_VENDOR := Iomega
  212. DEVICE_MODEL := StorCenter ix4-200d
  213. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
  214. kmod-gpio-button-hotplug kmod-gpio-nxp-74hc164 \
  215. kmod-hwmon-adt7475 kmod-mvsdio kmod-spi-gpio kmod-rtc-mv
  216. PAGESIZE := 512
  217. SUBPAGESIZE := 256
  218. BLOCKSIZE := 16k
  219. KERNEL_SIZE := 4096k
  220. KERNEL_IN_UBI :=
  221. UBINIZE_OPTS := -E 5
  222. IMAGE_SIZE := 31744k
  223. IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
  224. check-size
  225. endef
  226. TARGET_DEVICES += iom_ix4-200d
  227. define Device/iptime_nas1
  228. DEVICE_VENDOR := ipTIME
  229. DEVICE_MODEL := NAS1
  230. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
  231. kmod-gpio-button-hotplug kmod-gpio-pca953x kmod-hwmon-drivetemp \
  232. kmod-hwmon-gpiofan kmod-usb-ledtrig-usbport kmod-rtc-mv kmod-thermal \
  233. -uboot-envtools
  234. KERNEL := $$(KERNEL) | iptime-naspkg nas1
  235. BLOCKSIZE := 256k
  236. IMAGE_SIZE := 15872k
  237. IMAGES := sysupgrade.bin
  238. IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \
  239. check-size | append-metadata
  240. endef
  241. TARGET_DEVICES += iptime_nas1
  242. define Device/linksys
  243. $(Device/kernel-size-migration-linksys)
  244. DEVICE_VENDOR := Linksys
  245. DEVICE_PACKAGES := kmod-mwl8k wpad-basic-mbedtls kmod-gpio-button-hotplug \
  246. kmod-rtc-mv
  247. KERNEL_IN_UBI :=
  248. KERNEL_SIZE := 4096k
  249. UBINIZE_OPTS := -E 5
  250. IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
  251. endef
  252. define Device/linksys_e4200-v2
  253. $(Device/linksys)
  254. DEVICE_MODEL := E4200
  255. DEVICE_VARIANT := v2
  256. SUPPORTED_DEVICES += linksys,viper linksys-viper
  257. endef
  258. TARGET_DEVICES += linksys_e4200-v2
  259. define Device/linksys_ea3500
  260. $(Device/linksys)
  261. DEVICE_MODEL := EA3500
  262. PAGESIZE := 512
  263. SUBPAGESIZE := 256
  264. BLOCKSIZE := 16k
  265. SUPPORTED_DEVICES += linksys,audi linksys-audi
  266. endef
  267. TARGET_DEVICES += linksys_ea3500
  268. define Device/linksys_ea4500
  269. $(Device/linksys)
  270. DEVICE_MODEL := EA4500
  271. SUPPORTED_DEVICES += linksys,viper linksys-viper
  272. endef
  273. TARGET_DEVICES += linksys_ea4500
  274. define Device/netgear_readynas-duo-v2
  275. DEVICE_VENDOR := NETGEAR
  276. DEVICE_MODEL := ReadyNAS Duo
  277. DEVICE_VARIANT := v2
  278. DEVICE_DTS := kirkwood-netgear_readynas_duo_v2
  279. KERNEL_IN_UBI :=
  280. IMAGES := sysupgrade.bin
  281. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
  282. kmod-gpio-button-hotplug kmod-hwmon-g762 kmod-rtc-rs5c372a kmod-usb3
  283. endef
  284. TARGET_DEVICES += netgear_readynas-duo-v2
  285. define Device/netgear_stora
  286. DEVICE_VENDOR := Netgear
  287. DEVICE_MODEL := Stora (MS2000/2110)
  288. DEVICE_DTS := kirkwood-stora
  289. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
  290. kmod-rtc-pcf8563 kmod-hwmon-lm75 kmod-hwmon-tc654 \
  291. kmod-gpio-button-hotplug
  292. endef
  293. TARGET_DEVICES += netgear_stora
  294. define Device/raidsonic_ib-nas62x0
  295. DEVICE_VENDOR := RaidSonic
  296. DEVICE_MODEL := ICY BOX IB-NAS62x0
  297. DEVICE_DTS := kirkwood-ib62x0
  298. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-rtc-mv
  299. SUPPORTED_DEVICES += ib62x0
  300. endef
  301. TARGET_DEVICES += raidsonic_ib-nas62x0
  302. define Device/seagate_blackarmor-nas220
  303. DEVICE_VENDOR := Seagate
  304. DEVICE_MODEL := Blackarmor NAS220
  305. DEVICE_PACKAGES := kmod-hwmon-adt7475 kmod-fs-ext4 kmod-ata-marvell-sata \
  306. mdadm kmod-gpio-button-hotplug kmod-rtc-mv
  307. PAGESIZE := 512
  308. SUBPAGESIZE := 256
  309. BLOCKSIZE := 16k
  310. UBINIZE_OPTS := -e 1
  311. endef
  312. TARGET_DEVICES += seagate_blackarmor-nas220
  313. define Device/seagate_dockstar
  314. DEVICE_VENDOR := Seagate
  315. DEVICE_MODEL := FreeAgent Dockstar
  316. DEVICE_PACKAGES := kmod-rtc-mv
  317. SUPPORTED_DEVICES += dockstar
  318. endef
  319. TARGET_DEVICES += seagate_dockstar
  320. define Device/seagate_goflexnet
  321. DEVICE_VENDOR := Seagate
  322. DEVICE_MODEL := GoFlexNet
  323. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-rtc-mv
  324. SUPPORTED_DEVICES += goflexnet
  325. endef
  326. TARGET_DEVICES += seagate_goflexnet
  327. define Device/seagate_goflexhome
  328. DEVICE_VENDOR := Seagate
  329. DEVICE_MODEL := GoFlexHome
  330. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-rtc-mv
  331. SUPPORTED_DEVICES += goflexhome
  332. endef
  333. TARGET_DEVICES += seagate_goflexhome
  334. define Device/zyxel_nsa310b
  335. DEVICE_VENDOR := Zyxel
  336. DEVICE_MODEL := NSA310b
  337. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-r8169 kmod-fs-ext4 \
  338. kmod-gpio-button-hotplug kmod-hwmon-lm85 kmod-rtc-mv
  339. SUPPORTED_DEVICES += nsa310b
  340. endef
  341. TARGET_DEVICES += zyxel_nsa310b
  342. define Device/zyxel_nsa310s
  343. DEVICE_VENDOR := Zyxel
  344. DEVICE_MODEL := NSA310S
  345. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
  346. kmod-gpio-button-hotplug kmod-rtc-mv
  347. endef
  348. TARGET_DEVICES += zyxel_nsa310s
  349. define Device/zyxel_nsa325
  350. DEVICE_VENDOR := Zyxel
  351. DEVICE_MODEL := NSA325
  352. DEVICE_VARIANT := v1/v2
  353. DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
  354. kmod-gpio-button-hotplug kmod-rtc-pcf8563 kmod-usb3
  355. SUPPORTED_DEVICES += nsa325
  356. endef
  357. TARGET_DEVICES += zyxel_nsa325
  358. $(eval $(call BuildImage))