Makefile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 = fsl/p1010rdb-pa tl-wdr4900-v1 fsl/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)-$(notdir $(dts)).fdt
  24. )
  25. endef
  26. define Image/BuildKernel/Initramfs
  27. cp $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-initramfs-zImage
  28. ifeq ($(SUBTARGET),generic)
  29. cp $(KDIR)/cuImage.tl-wdr4900-v1-initramfs $(BIN_DIR)/$(IMG_PREFIX)-tl-wdr4900-v1-initramfs.uImage
  30. endif
  31. endef
  32. define Image/Build/TPLINK
  33. -$(STAGING_DIR_HOST)/bin/mktplinkfw \
  34. -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) \
  35. -k $(KDIR)/$(3) \
  36. -r $(KDIR)/root.$(1) \
  37. -o $(call factoryname,$(1),$(2))
  38. -$(STAGING_DIR_HOST)/bin/mktplinkfw \
  39. -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) -s \
  40. -k $(KDIR)/$(3) \
  41. -r $(KDIR)/root.$(1) \
  42. -o $(call sysupname,$(1),$(2))
  43. endef
  44. define Image/Build/Profile/TLWDR4900
  45. $(call Image/Build/TPLINK,$(1),tl-wdr4900-v1,cuImage.tl-wdr4900-v1,0x49000001,1,16Mppc)
  46. endef
  47. define Image/Build/Profile/Default
  48. $(call Image/Build/Profile/TLWDR4900,$(1))
  49. endef
  50. define Image/Build/ext2
  51. cp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-ext2.img
  52. endef
  53. define Image/Build/squashfs
  54. $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
  55. cp $(KDIR)/root.squashfs $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs
  56. endef
  57. PROFILE ?= Default
  58. define Image/Build
  59. $(call Image/Build/$(1),$(1))
  60. $(call Image/Build/Profile/$(PROFILE),$(1))
  61. endef
  62. $(eval $(call BuildImage))