Makefile 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. # and overlay inside the "rd.gz" file. We pad it out to 6144K
  41. # which is the size of the initramfs partition.
  42. #
  43. # The "application" partition is just blank. You can put anything
  44. # there when using OpenWRT. We just use that to create the
  45. # "sysupgrade" firmware image.
  46. define Build/nas4220b-images
  47. dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/rd.gz bs=6144k conv=sync
  48. dd if=/dev/zero of=$(BIN_DIR)/hddapp.tgz bs=6144k count=1
  49. cp $(IMAGE_KERNEL) $(BIN_DIR)/zImage
  50. cp ./ImageInfo-ib4220 $(BIN_DIR)/ImageInfo
  51. (cd $(BIN_DIR); tar -czf $(IMG_PREFIX)-sysupgrade-ib4220b.tar.gz ImageInfo zImage rd.gz hddapp.tgz)
  52. mv $(BIN_DIR)/rd.gz $(BIN_DIR)/$(IMG_PREFIX)-nas4220b-rd.gz
  53. rm $(BIN_DIR)/hddapp.tgz
  54. mv $(BIN_DIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-nas4220b-zImage
  55. rm -f $(BIN_DIR)/ImageInfo
  56. endef
  57. # The Itian Square One SQ201 uses the same method.
  58. define Build/sq201-images
  59. dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/rd.gz bs=6144k conv=sync
  60. dd if=/dev/zero of=$(BIN_DIR)/hddapp.tgz bs=6144k count=1
  61. cp $(IMAGE_KERNEL) $(BIN_DIR)/zImage
  62. cp ./ImageInfo-sq201 $(BIN_DIR)/ImageInfo
  63. sed -i -e "s/DATESTR/`date +%Y%m%d`/g" $(BIN_DIR)/ImageInfo
  64. (cd $(BIN_DIR); tar -czf $(IMG_PREFIX)-sysupgrade-sq201.tar.gz ImageInfo zImage rd.gz hddapp.tgz)
  65. mv $(BIN_DIR)/rd.gz $(BIN_DIR)/$(IMG_PREFIX)-sq201-rd.gz
  66. rm $(BIN_DIR)/hddapp.tgz
  67. mv $(BIN_DIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-sq201-zImage
  68. rm -f $(BIN_DIR)/ImageInfo
  69. endef
  70. # WBD-111 and WBD-222:
  71. # work around the bootloader's bug with extra nops
  72. # FIXME: is this really needed now that we no longer append the code
  73. # to change the machine ID number? Needs testing on Wiliboard.
  74. define Build/wbd-nops
  75. mv $@ [email protected]
  76. echo -en "\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1" > $@
  77. cat [email protected] >> $@
  78. rm -f [email protected]
  79. endef
  80. # All DTB files are prefixed with "gemini-"
  81. define Device/Default
  82. DEVICE_DTS := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(1).dtb)))
  83. KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
  84. KERNEL_NAME := zImage
  85. KERNEL := kernel-bin | append-dtb
  86. FILESYSTEMS := squashfs
  87. IMAGE_NAME := $$(IMAGE_PREFIX)-$$(1).$$(2)
  88. BLOCKSIZE := 128k
  89. PAGESIZE := 2048
  90. endef
  91. # A reasonable set of default packages handling the NAS type
  92. # of devices out of the box (former NAS42x0 IcyBox defaults)
  93. GEMINI_NAS_PACKAGES:=kmod-md-mod kmod-md-linear kmod-md-multipath \
  94. kmod-md-raid0 kmod-md-raid1 kmod-md-raid10 kmod-md-raid456 \
  95. kmod-fs-btrfs kmod-fs-cifs kmod-fs-nfs \
  96. kmod-fs-nfsd kmod-fs-ntfs kmod-fs-reiserfs kmod-fs-vfat \
  97. kmod-nls-utf8 kmod-usb-storage-extras \
  98. samba36-server mdadm cfdisk fdisk e2fsprogs badblocks
  99. define Device/dlink-dir-685
  100. DEVICE_TITLE := D-Link DIR-685 Xtreme N Storage Router
  101. DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) \
  102. kmod-switch-rtl8366rb swconfig \
  103. rt2800-pci
  104. IMAGES += dir685-image
  105. IMAGE/dir685-image := dir685-images
  106. endef
  107. TARGET_DEVICES += dlink-dir-685
  108. define Device/dlink-dns-313
  109. DEVICE_TITLE := D-Link DNS-313 1-Bay Network Storage Enclosure
  110. DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
  111. IMAGES += dns313-image
  112. IMAGE/dns313-image := dns313-images
  113. endef
  114. TARGET_DEVICES += dlink-dns-313
  115. define Device/nas4220b
  116. DEVICE_TITLE := Raidsonic NAS IB-4220-B
  117. IMAGES += nas4220b-image
  118. IMAGE/nas4220b-image := nas4220b-images
  119. DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
  120. endef
  121. TARGET_DEVICES += nas4220b
  122. define Device/rut1xx
  123. DEVICE_TITLE := Teltonika RUT1xx
  124. DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
  125. endef
  126. TARGET_DEVICES += rut1xx
  127. define Device/sq201
  128. DEVICE_TITLE := ITian Square One SQ201
  129. IMAGES += sq201-image
  130. IMAGE/sq201-image := sq201-images
  131. DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) rt61-pci usb2-pci
  132. endef
  133. TARGET_DEVICES += sq201
  134. define Device/wbd111
  135. DEVICE_TITLE := Wiliboard WBD-111
  136. KERNEL := kernel-bin | append-dtb | wbd-nops
  137. endef
  138. TARGET_DEVICES += wbd111
  139. define Device/wbd222
  140. DEVICE_TITLE := Wiliboard WBD-222
  141. KERNEL := kernel-bin | append-dtb | wbd-nops
  142. endef
  143. TARGET_DEVICES += wbd222
  144. $(eval $(call BuildImage))