Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #
  2. # Copyright (C) 2006 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. DROP_SECTIONS:=.reginfo .mdebug .comment .note .pdr .options .MIPS.options
  10. OBJCOPY_SREC:=$(TARGET_CROSS)objcopy -S -O srec $(addprefix --remove-section=,$(DROP_SECTIONS))
  11. LOADADDR:=0x94600000
  12. KERNEL_ENTRY:=0x94100000
  13. RAMSTART:=0x94000000
  14. RAMSIZE:=0x00100000
  15. EVA_LOADADDR := 0x94100000
  16. LOADER_MAKEOPTS= \
  17. KDIR=$(KDIR) \
  18. LOADADDR=$(LOADADDR) \
  19. KERNEL_ENTRY=$(KERNEL_ENTRY) \
  20. RAMSTART=$(RAMSTART) \
  21. RAMSIZE=$(RAMSIZE)
  22. CFLAGS := -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
  23. -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \
  24. -pipe -mlong-calls -fno-common \
  25. -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap \
  26. -DLOADADDR=$(LOADADDR)
  27. define Build/Clean
  28. $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean
  29. endef
  30. define Image/Prepare
  31. cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
  32. $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \
  33. $(LOADER_MAKEOPTS) \
  34. clean compile
  35. $(OBJCOPY_SREC) $(KDIR)/loader.elf $(KDIR)/loader.srec
  36. srec2bin $(KDIR)/loader.srec $(KDIR)/loader.bin
  37. endef
  38. define align/jffs2-64k
  39. bs=65536 conv=sync
  40. endef
  41. define align/jffs2-128k
  42. bs=131072 conv=sync
  43. endef
  44. define Image/Build/CyberTAN
  45. (dd if=/dev/zero bs=16 count=1; cat $(BIN_DIR)/openwrt-$(BOARD)-$(1).bin) | \
  46. $(STAGING_DIR_HOST)/bin/addpattern -p $(3) -o $(BIN_DIR)/openwrt-$(2)-$(4).bin
  47. endef
  48. #define Image/Build/sErCoMm
  49. # cat sercomm/adam2.bin "$(BIN_DIR)/openwrt-$(BOARD)-$(1).bin" > "$(KDIR)/dgfw.tmp"
  50. # dd if=sercomm/$(2) of="$(KDIR)/dgfw.tmp" bs=$$$$((0x3e0000 - 80)) seek=1 conv=notrunc
  51. # $(STAGING_DIR_HOST)/bin/dgfirmware -f -w "$(BIN_DIR)/openwrt-$(2)-$(3).img" "$(KDIR)/dgfw.tmp"
  52. # rm -f "$(KDIR)/dgfw.tmp"
  53. #endef
  54. define Image/Build/EVA
  55. $(STAGING_DIR_HOST)/bin/lzma2eva $(KERNEL_ENTRY) $(KERNEL_ENTRY) $(KDIR)/vmlinux.lzma $(BIN_DIR)/openwrt-$(2)-$(1).bin
  56. cat $(KDIR)/root.$(1) >> $(BIN_DIR)/openwrt-$(2)-$(1).bin
  57. $(call prepare_generic_squashfs,$(BIN_DIR)/openwrt-$(2)-$(1).bin)
  58. endef
  59. define Image/Build
  60. dd if=$(KDIR)/loader.bin $(call align/$(1)) > $(BIN_DIR)/openwrt-$(BOARD)-$(1).bin
  61. cat $(KDIR)/root.$(1) >> $(BIN_DIR)/openwrt-$(BOARD)-$(1).bin
  62. $(call prepare_generic_squashfs,$(BIN_DIR)/openwrt-$(BOARD)-$(1).bin)
  63. $(call Image/Build/CyberTAN,$(1),AG1B,AG1B,$(1))
  64. $(call Image/Build/CyberTAN,$(1),WA21,WA21,$(1))
  65. $(call Image/Build/CyberTAN,$(1),WA22,WA22,$(1))
  66. $(call Image/Build/CyberTAN,$(1),WAG2,WAG2,$(1))
  67. $(call Image/Build/CyberTAN,$(1),WA31,WA31 -b,$(1))
  68. $(call Image/Build/CyberTAN,$(1),WA32,WA32 -b,$(1))
  69. $(call Image/Build/CyberTAN,$(1),WA7A,WA7A -b,$(1))
  70. $(call Image/Build/CyberTAN,$(1),WA7B,WA7B -b,$(1))
  71. # $(call Image/Build/sErCoMm,$(1),dg834,$(1))
  72. # $(call Image/Build/sErCoMm,$(1),jdr454wb,$(1))
  73. $(call Image/Build/EVA,$(1),EVA)
  74. endef
  75. $(eval $(call BuildImage))