Makefile 5.7 KB

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