Makefile 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. #
  2. # Copyright (C) 2009-2018 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. # Cook a "WRGG" image, this board is apparently one in the D-Link
  10. # WRGG family and uses the exact same firmware format as other
  11. # D-Link devices.
  12. define Build/dir685-images
  13. mkwrggimg -i $(IMAGE_KERNEL) \
  14. -o [email protected] \
  15. -d /dev/mtdblock/1 \
  16. -s wrgns01_dlwbr_dir685RBWW \
  17. -v 'N/A' \
  18. -m dir685 \
  19. -B 96bb
  20. mv [email protected] $@
  21. endef
  22. # Build D-Link DNS-313 images using the special header tool.
  23. # rootfs.tgz and rd.tgz contains nothing, we only need them
  24. # to satisfy the boot loader on the device. The zImage is
  25. # the only real content.
  26. define Build/dns313-images
  27. mkdir -p [email protected]/.boot
  28. echo "dummy" > [email protected]/dummyfile
  29. dns313-header [email protected]/dummyfile \
  30. [email protected]/.boot/rootfs.tgz
  31. dns313-header [email protected]/dummyfile \
  32. [email protected]/.boot/rd.gz
  33. dns313-header $(IMAGE_KERNEL) \
  34. [email protected]/.boot/zImage
  35. tar --sort=name --owner=0 --group=0 --numeric-owner -czf $@ \
  36. -C [email protected] .boot \
  37. $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)")
  38. rm -rf [email protected]
  39. endef
  40. define Build/wiligear-image
  41. $(STAGING_DIR_HOST)/bin/mkfwimage2 \
  42. -m GEOS -f 0x30000000 -z \
  43. -v $(1).v5.00.SL3512.OpenWrt.00000.000000.000000 \
  44. -p Kernel:0x020000:0x100000:0:0:$(IMAGE_KERNEL) \
  45. -p Ramdisk:0x120000:0x500000:0:0:$@ \
  46. -o [email protected]
  47. mv [email protected] $@
  48. endef
  49. # Create the special NAS4220B and Itian Square One SQ201 image
  50. # format with the squashfs and overlay inside the "rd.gz" file.
  51. # We pad it out to 6144K which is the size of the initramfs partition.
  52. #
  53. # The "application" partition is just blank. You can put anything
  54. # there when using OpenWRT. We just use that to create the
  55. # "sysupgrade" firmware image.
  56. define Build/nas4220b-sq201-images
  57. mkdir -p [email protected]
  58. mv $@ [email protected]/rd.gz
  59. dd if=/dev/zero [email protected]/hddapp.tgz bs=6144k count=1
  60. cp $(IMAGE_KERNEL) [email protected]/zImage
  61. cp ./ImageInfo-$(1) [email protected]/ImageInfo
  62. sed -i -e "s/DATESTR/`date +%Y%m%d $(if $(SOURCE_DATE_EPOCH),--date "@$(SOURCE_DATE_EPOCH)")`/g" [email protected]/ImageInfo
  63. (cd [email protected]; tar --sort=name --owner=0 --group=0 --numeric-owner -czf $@ * \
  64. $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)"))
  65. rm -rf [email protected]
  66. endef
  67. # WBD-111 and WBD-222:
  68. # work around the bootloader's bug with extra nops
  69. # FIXME: is this really needed now that we no longer append the code
  70. # to change the machine ID number? Needs testing on Wiliboard.
  71. define Build/wbd-nops
  72. mv $@ [email protected]
  73. echo -en "\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1" > $@
  74. cat [email protected] >> $@
  75. rm -f [email protected]
  76. endef
  77. # All DTB files are prefixed with "gemini-"
  78. define Device/Default
  79. PROFILES := Default
  80. KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
  81. KERNEL_NAME := zImage
  82. KERNEL := kernel-bin | append-dtb
  83. BLOCKSIZE := 128k
  84. endef
  85. # A reasonable set of default packages handling the NAS type
  86. # of devices out of the box (former NAS42x0 IcyBox defaults)
  87. GEMINI_NAS_PACKAGES:=kmod-md-mod kmod-md-linear kmod-md-multipath \
  88. kmod-md-raid0 kmod-md-raid1 kmod-md-raid10 kmod-md-raid456 \
  89. kmod-fs-btrfs kmod-fs-cifs kmod-fs-nfs \
  90. kmod-fs-nfsd kmod-fs-ntfs kmod-fs-reiserfs kmod-fs-vfat \
  91. kmod-nls-utf8 kmod-usb-storage-extras \
  92. samba36-server mdadm cfdisk fdisk e2fsprogs badblocks
  93. define Device/dlink_dir-685
  94. DEVICE_TITLE := D-Link DIR-685 Xtreme N Storage Router
  95. DEVICE_DTS := gemini-dlink-dir-685
  96. DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) \
  97. kmod-switch-rtl8366rb swconfig \
  98. kmod-rt2800-pci
  99. IMAGES := factory.bin
  100. IMAGE/factory.bin := dir685-images
  101. endef
  102. TARGET_DEVICES += dlink_dir-685
  103. define Device/dlink_dns-313
  104. DEVICE_TITLE := D-Link DNS-313 1-Bay Network Storage Enclosure
  105. DEVICE_DTS := gemini-dlink-dns-313
  106. DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
  107. IMAGES := bootpart.tar.gz
  108. IMAGE/bootpart.tar.gz := dns313-images
  109. endef
  110. TARGET_DEVICES += dlink_dns-313
  111. define Device/itian-raidsonic
  112. IMAGES := factory.bin
  113. IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 6144k | \
  114. nas4220b-sq201-images $(1)
  115. DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
  116. endef
  117. define Device/itian_sq201
  118. $(Device/itian-raidsonic)
  119. DEVICE_TITLE := ITian Square One SQ201
  120. DEVICE_DTS := gemini-sq201
  121. DEVICE_PACKAGES += kmod-rt61-pci kmod-usb2-pci
  122. endef
  123. TARGET_DEVICES += itian_sq201
  124. define Device/raidsonic_ib-4220-b
  125. $(Device/itian-raidsonic)
  126. DEVICE_TITLE := Raidsonic NAS IB-4220-B
  127. DEVICE_DTS := gemini-nas4220b
  128. endef
  129. TARGET_DEVICES += raidsonic_ib-4220-b
  130. # The wiliboard images need some changes to be functional and buildable.
  131. #
  132. # The dts would need to use the ecoscentric,redboot-fis-partitions partition
  133. # parser to get the correct partition offsets and size.
  134. #
  135. # The mkfwimage2 call need to be adjusted to reflect the real size of kernel
  136. # and rootfs. It is expected that the OEM firmware adjusts the on flash
  137. # partition table with the values defined in the image header.
  138. define Device/wiliboard_wbd111
  139. DEVICE_TITLE := Wiliboard WBD-111
  140. DEVICE_DTS := gemini-wbd111
  141. KERNEL := kernel-bin | append-dtb | wbd-nops
  142. IMAGES := factory.bin
  143. IMAGE/factory.bin := append-rootfs | pad-rootfs | wiligear-image "WILI-S.WILIBOARD"
  144. endef
  145. define Device/wiliboard_wbd222
  146. DEVICE_TITLE := Wiliboard WBD-222
  147. DEVICE_DTS := gemini-wbd222
  148. KERNEL := kernel-bin | append-dtb | wbd-nops
  149. IMAGES := factory.bin
  150. IMAGE/factory.bin := append-rootfs | pad-rootfs | wiligear-image "WILI-S.WBD222"
  151. endef
  152. $(eval $(call BuildImage))