Makefile 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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 $(BIN_DIR)/$(IMG_PREFIX)-dir685-fwupdate.bin \
  15. -d /dev/mtdblock/1 \
  16. -s wrgns01_dlwbr_dir685RBWW \
  17. -v 'N/A' \
  18. -m dir685 \
  19. -B 96bb
  20. endef
  21. # Build D-Link DNS-313 images using the special header tool.
  22. # rootfs.tgz and rd.tgz contains nothing, we only need them
  23. # to satisfy the boot loader on the device. The zImage is
  24. # the only real content.
  25. define Build/dns313-images
  26. if [ -d $(BIN_DIR)/.boot ] ; then rm -rf $(BIN_DIR)/.boot ; fi
  27. mkdir -p $(BIN_DIR)/.boot
  28. echo "dummy" > $(BIN_DIR)/.boot/dummyfile
  29. dns313-header $(BIN_DIR)/.boot/dummyfile \
  30. $(BIN_DIR)/.boot/rootfs.tgz
  31. dns313-header $(BIN_DIR)/.boot/dummyfile \
  32. $(BIN_DIR)/.boot/rd.gz
  33. dns313-header $(IMAGE_KERNEL) \
  34. $(BIN_DIR)/.boot/zImage
  35. rm -f $(BIN_DIR)/.boot/dummyfile
  36. (cd $(BIN_DIR); tar -czf $(IMG_PREFIX)-dns313-bootpart.tar.gz .boot)
  37. if [ -d $(BIN_DIR)/.boot ] ; then rm -rf $(BIN_DIR)/.boot ; fi
  38. endef
  39. # Create the special NAS4220B image format with the squashfs
  40. # split across two "partitions" named rd.gz and hddapp.tgz but
  41. # essentially just being used by OpenWRT as one big partition
  42. define Build/nas4220b-images
  43. dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/rd.gz bs=6144k conv=sync
  44. dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/hddapp.tgz bs=6144k count=1 seek=1
  45. cp $(IMAGE_KERNEL) $(BIN_DIR)/zImage
  46. cp ./ImageInfo-ib4220 $(BIN_DIR)/ImageInfo
  47. (cd $(BIN_DIR); tar -czf $(IMG_PREFIX)-sysupgrade-ib4220b.tar.gz ImageInfo zImage rd.gz hddapp.tgz)
  48. mv $(BIN_DIR)/rd.gz $(BIN_DIR)/$(IMG_PREFIX)-nas4220b-rd.gz
  49. mv $(BIN_DIR)/hddapp.tgz $(BIN_DIR)/$(IMG_PREFIX)-nas4220b-hddapp.tgz
  50. mv $(BIN_DIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-nas4220b-zImage
  51. rm -f $(BIN_DIR)/ImageInfo
  52. endef
  53. # The Itian Square One SQ201 uses the same method.
  54. define Build/sq201-images
  55. dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/rd.gz bs=6144k conv=sync
  56. dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/hddapp.tgz bs=6144k count=1 seek=1
  57. cp $(IMAGE_KERNEL) $(BIN_DIR)/zImage
  58. cp ./ImageInfo-sq201 $(BIN_DIR)/ImageInfo
  59. sed -i -e "s/DATESTR/`date +%Y%m%d`/g" $(BIN_DIR)/ImageInfo
  60. (cd $(BIN_DIR); tar -czf $(IMG_PREFIX)-sysupgrade-sq201.tar.gz ImageInfo zImage rd.gz hddapp.tgz)
  61. mv $(BIN_DIR)/rd.gz $(BIN_DIR)/$(IMG_PREFIX)-sq201-rd.gz
  62. mv $(BIN_DIR)/hddapp.tgz $(BIN_DIR)/$(IMG_PREFIX)-sq201-hddapp.tgz
  63. mv $(BIN_DIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-sq201-zImage
  64. rm -f $(BIN_DIR)/ImageInfo
  65. endef
  66. # WBD-111 and WBD-222:
  67. # work around the bootloader's bug with extra nops
  68. # FIXME: is this really needed now that we no longer append the code
  69. # to change the machine ID number? Needs testing on Wiliboard.
  70. define Build/wbd-nops
  71. mv $@ [email protected]
  72. echo -en "\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1" > $@
  73. cat [email protected] >> $@
  74. rm -f [email protected]
  75. endef
  76. # All DTB files are prefixed with "gemini-"
  77. define Device/Default
  78. DEVICE_DTS := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(1).dtb)))
  79. KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
  80. KERNEL_NAME := zImage
  81. KERNEL := kernel-bin | append-dtb
  82. FILESYSTEMS := squashfs
  83. IMAGE_NAME := $$(IMAGE_PREFIX)-$$(1).$$(2)
  84. BLOCKSIZE := 128k
  85. PAGESIZE := 2048
  86. endef
  87. # A reasonable set of default packages handling the NAS type
  88. # of devices out of the box (former NAS42x0 IcyBox defaults)
  89. GEMINI_NAS_PACKAGES:=kmod-md-mod kmod-md-linear kmod-md-multipath \
  90. kmod-md-raid0 kmod-md-raid1 kmod-md-raid10 kmod-md-raid456 \
  91. kmod-fs-btrfs kmod-fs-cifs kmod-fs-nfs \
  92. kmod-fs-nfsd kmod-fs-ntfs kmod-fs-reiserfs kmod-fs-vfat \
  93. kmod-nls-utf8 kmod-usb-storage-extras \
  94. samba36-server mdadm cfdisk fdisk e2fsprogs badblocks
  95. define Device/dlink-dir-685
  96. DEVICE_TITLE := D-Link DIR-685 Xtreme N Storage Router
  97. DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) \
  98. kmod-switch-rtl8366rb swconfig \
  99. rt2800-pci
  100. IMAGES += dir685-image
  101. IMAGE/dir685-image := dir685-images
  102. endef
  103. TARGET_DEVICES += dlink-dir-685
  104. define Device/dlink-dns-313
  105. DEVICE_TITLE := D-Link DNS-313 1-Bay Network Storage Enclosure
  106. DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
  107. IMAGES += dns313-image
  108. IMAGE/dns313-image := dns313-images
  109. endef
  110. TARGET_DEVICES += dlink-dns-313
  111. define Device/nas4220b
  112. DEVICE_TITLE := Raidsonic NAS IB-4220-B
  113. IMAGES += nas4220b-image
  114. IMAGE/nas4220b-image := nas4220b-images
  115. DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
  116. endef
  117. TARGET_DEVICES += nas4220b
  118. define Device/rut1xx
  119. DEVICE_TITLE := Teltonika RUT1xx
  120. DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
  121. endef
  122. TARGET_DEVICES += rut1xx
  123. define Device/sq201
  124. DEVICE_TITLE := ITian Square One SQ201
  125. IMAGES += sq201-image
  126. IMAGE/sq201-image := sq201-images
  127. DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) rt61-pci
  128. endef
  129. TARGET_DEVICES += sq201
  130. define Device/wbd111
  131. DEVICE_TITLE := Wiliboard WBD-111
  132. KERNEL := kernel-bin | append-dtb | wbd-nops
  133. endef
  134. TARGET_DEVICES += wbd111
  135. define Device/wbd222
  136. DEVICE_TITLE := Wiliboard WBD-222
  137. KERNEL := kernel-bin | append-dtb | wbd-nops
  138. endef
  139. TARGET_DEVICES += wbd222
  140. $(eval $(call BuildImage))