Makefile 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #
  2. # Copyright (C) 2009-2014 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. ifeq ($(SUBTARGET),wiligear)
  10. define Image/Prepare
  11. # WBD111: mach id 1690 (0x69a)
  12. echo -en "\x06\x1c\xa0\xe3\x9a\x10\x81\xe3" > $(KDIR)/$(IMG_PREFIX)-wbd111-zImage
  13. cat $(KDIR)/zImage >> $(KDIR)/$(IMG_PREFIX)-wbd111-zImage
  14. # WBD222: mach id 2753 (0xAC1)
  15. echo -en "\x0a\x1c\xa0\xe3\xc1\x10\x81\xe3" > $(KDIR)/$(IMG_PREFIX)-wbd222-zImage
  16. cat $(KDIR)/zImage >> $(KDIR)/$(IMG_PREFIX)-wbd222-zImage
  17. endef
  18. endif
  19. ifeq ($(SUBTARGET),raidsonic)
  20. define Image/Prepare
  21. # NAS4220: mach id 2038 (0x7F6)
  22. echo -en "\x07\x1c\xa0\xe3\xf6\x10\x81\xe3" > $(KDIR)/$(IMG_PREFIX)-nas4220-zImage
  23. cat $(KDIR)/zImage >> $(KDIR)/$(IMG_PREFIX)-nas4220-zImage
  24. endef
  25. endif
  26. ifeq ($(SUBTARGET),wiligear)
  27. define Image/BuildKernel
  28. # workaround the bootloader's bug with extra nops
  29. echo -en "\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1" > $(BIN_DIR)/$(IMG_PREFIX)-wbd111-zImage
  30. cat $(KDIR)/$(IMG_PREFIX)-wbd111-zImage >> $(BIN_DIR)/$(IMG_PREFIX)-wbd111-zImage
  31. echo -en "\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1" > $(BIN_DIR)/$(IMG_PREFIX)-wbd222-zImage
  32. cat $(KDIR)/$(IMG_PREFIX)-wbd222-zImage >> $(BIN_DIR)/$(IMG_PREFIX)-wbd222-zImage
  33. endef
  34. endif
  35. define Image/Build/jffs2-64k
  36. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=64k conv=sync
  37. endef
  38. define Image/Build/jffs2-128k
  39. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=128k conv=sync
  40. endef
  41. define Image/Build/squashfs
  42. $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
  43. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=128k conv=sync
  44. endef
  45. ifeq ($(SUBTARGET),wiligear)
  46. define Image/Build
  47. $(call Image/Build/$(1),$(1))
  48. -$(STAGING_DIR_HOST)/bin/mkfwimage2 \
  49. -m GEOS -f 0x30000000 -z \
  50. -v WILI-S.WILIBOARD.v5.00.SL3512.OpenWrt.00000.000000.000000 \
  51. -o $(BIN_DIR)/$(IMG_PREFIX)-wbd111-$(1).bin \
  52. -p Kernel:0x020000:0x100000:0:0:$(BIN_DIR)/$(IMG_PREFIX)-wbd111-zImage \
  53. -p Ramdisk:0x120000:0x500000:0:0:$(BIN_DIR)/$(IMG_PREFIX)-$(1).img
  54. -$(STAGING_DIR_HOST)/bin/mkfwimage2 \
  55. -m GEOS -f 0x30000000 -z \
  56. -v WILI-S.WBD222.v5.00.SL3512.OpenWrt.00000.000000.000000 \
  57. -o $(BIN_DIR)/$(IMG_PREFIX)-wbd222-$(1).bin \
  58. -p Kernel:0x020000:0x100000:0:0:$(BIN_DIR)/$(IMG_PREFIX)-wbd222-zImage \
  59. -p Ramdisk:0x120000:0x500000:0:0:$(BIN_DIR)/$(IMG_PREFIX)-$(1).img
  60. endef
  61. endif
  62. ifeq ($(SUBTARGET),raidsonic)
  63. define Image/Build
  64. $(call Image/Build/$(1),$(1))
  65. dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img of=$(BIN_DIR)/rd.gz bs=6144k count=1
  66. # dd if=/dev/zero of=$(BIN_DIR)/hddapp.tgz bs=6144k count=1
  67. dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img of=$(BIN_DIR)/hddapp.tgz bs=6144k count=1 seek=1
  68. cp $(KDIR)/$(IMG_PREFIX)-nas4220-zImage $(BIN_DIR)/zImage
  69. cp ./ImageInfo-ib4220 $(BIN_DIR)/ImageInfo
  70. (cd $(BIN_DIR); tar -czf $(IMG_PREFIX)-sysupgrade-ib4220.tar.gz ImageInfo zImage rd.gz hddapp.tgz)
  71. mv $(BIN_DIR)/rd.gz $(BIN_DIR)/$(IMG_PREFIX)-nas4220-rd.gz
  72. mv $(BIN_DIR)/hddapp.tgz $(BIN_DIR)/$(IMG_PREFIX)-nas4220-hddapp.tgz
  73. rm -f $(BIN_DIR)/zImage $(BIN_DIR)/ImageInfo
  74. endef
  75. endif
  76. $(eval $(call BuildImage))