Makefile 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #
  2. # Copyright (C) 2010 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. define imgname
  10. $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
  11. endef
  12. define sysupname
  13. $(call imgname,$(1),$(2))-sysupgrade.bin
  14. endef
  15. define factoryname
  16. $(call imgname,$(1),$(2))-factory.bin
  17. endef
  18. zImage:=$(BIN_DIR)/$(IMG_PREFIX)-zImage
  19. DTS_TARGETS = mpc8548cds_32b p1010rdb-pa tl-wdr4900-v1 p1020rdb
  20. define Image/BuildKernel
  21. cp $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
  22. $(foreach dts,$(DTS_TARGETS),
  23. $(LINUX_DIR)/scripts/dtc/dtc -I dts -O dtb $(DTS_DIR)/$(dts).dts > $(BIN_DIR)/$(IMG_PREFIX)-$(dts).fdt
  24. )
  25. endef
  26. define Image/BuildKernel/Initramfs
  27. cp $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-initramfs-zImage
  28. cp $(KDIR)/cuImage.tl-wdr4900-v1-initramfs $(BIN_DIR)/$(IMG_PREFIX)-tl-wdr4900-v1-initramfs.uImage
  29. endef
  30. define Image/Build/TPLINK
  31. -$(STAGING_DIR_HOST)/bin/mktplinkfw \
  32. -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) \
  33. -k $(KDIR)/$(3) \
  34. -r $(KDIR)/root.$(1) \
  35. -o $(call factoryname,$(1),$(2))
  36. -$(STAGING_DIR_HOST)/bin/mktplinkfw \
  37. -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) -s \
  38. -k $(KDIR)/$(3) \
  39. -r $(KDIR)/root.$(1) \
  40. -o $(call sysupname,$(1),$(2))
  41. endef
  42. define Image/Build/Profile/TLWDR4900
  43. $(call Image/Build/TPLINK,$(1),tl-wdr4900-v1,cuImage.tl-wdr4900-v1,0x49000001,1,16Mppc)
  44. endef
  45. define Image/Build/Profile/Default
  46. $(call Image/Build/Profile/TLWDR4900,$(1))
  47. endef
  48. define Image/Build/ext2
  49. cp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-ext2.img
  50. endef
  51. define Image/Build/squashfs
  52. $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
  53. cp $(KDIR)/root.squashfs $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs
  54. endef
  55. PROFILE ?= Default
  56. define Image/Build
  57. $(call Image/Build/$(1),$(1))
  58. $(call Image/Build/Profile/$(PROFILE),$(1))
  59. endef
  60. $(eval $(call BuildImage))