Makefile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #
  2. # Copyright (C) 2006-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 Build/mkfwimage
  10. $(STAGING_DIR_HOST)/bin/mkfwimage \
  11. -B $(1).OpenWrt.$(REVISION) \
  12. -k $(IMAGE_KERNEL) \
  13. -r $(IMAGE_ROOTFS) \
  14. -o $@.new && \
  15. mv $@.new $@
  16. endef
  17. define Build/combined-image
  18. -sh $(TOPDIR)/scripts/combined-image.sh \
  19. "$(IMAGE_KERNEL)" \
  20. "$(IMAGE_ROOTFS)" \
  21. "$@.new" && \
  22. mv $@.new $@
  23. endef
  24. define Build/mkmylofw
  25. $(STAGING_DIR_HOST)/bin/mkmylofw -B $(1) \
  26. -p0x020000:0x130000:ah:0x80041000:linux:$(IMAGE_KERNEL) \
  27. -p0x150000:0x2a0000:::rootfs:$(IMAGE_ROOTFS) \
  28. $@.new && \
  29. mv $@.new $@
  30. endef
  31. define Build/gzip-kernel
  32. gzip -9n -c $@ > $@.gz
  33. dd if=$@.gz of=$@ bs=65536 conv=sync
  34. endef
  35. define Build/lzma-kernel
  36. $(STAGING_DIR_HOST)/bin/lzma e $@ $@.l7
  37. dd if=$@.l7 of=$@ bs=65536 conv=sync
  38. endef
  39. define Build/copy-kernel
  40. rm -f $@ $@.elf
  41. cp $< $@
  42. cp $< $@.elf
  43. endef
  44. define Build/elf-kernel
  45. cp $(IMAGE_KERNEL).elf $@
  46. endef
  47. define Device/Default
  48. PROFILES = Default $$(DEVICE_NAME)
  49. KERNEL := copy-kernel | lzma-kernel
  50. IMAGES := sysupgrade.bin
  51. FILESYSTEMS := squashfs
  52. endef
  53. define Device/generic
  54. DEVICE_TITLE := Generic Images
  55. IMAGES := kernel.lzma kernel.elf kernel.gz rootfs.bin sysupgrade.bin
  56. IMAGE/kernel.gz := elf-kernel | gzip-kernel
  57. IMAGE/kernel.elf := elf-kernel
  58. IMAGE/kernel.lzma := elf-kernel | lzma-kernel
  59. IMAGE/rootfs.bin := append-rootfs | pad-rootfs | pad-to 128k
  60. IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | combined-image
  61. IMAGE_NAME = $$(IMAGE_PREFIX)-$$(if $$(findstring kernel,$$(2)),,$$(1)-)$$(2)
  62. endef
  63. TARGET_DEVICES += generic
  64. define Device/ubnt2-pico2
  65. DEVICE_TITLE := Ubiquiti XS2-8
  66. IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkfwimage XS2-8 -v XS2.ar2316
  67. endef
  68. TARGET_DEVICES += ubnt2-pico2
  69. define Device/ubnt2
  70. DEVICE_TITLE := Ubiquiti XS2
  71. IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkfwimage XS2 -v XS2.ar2316
  72. endef
  73. TARGET_DEVICES += ubnt2
  74. define Device/ubnt5
  75. DEVICE_TITLE := Ubiquiti XS5
  76. IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkfwimage XS5 -v XS5.ar2313
  77. endef
  78. TARGET_DEVICES += ubnt5
  79. define Device/np25g
  80. DEVICE_TITLE := np25g
  81. KERNEL := kernel-bin | gzip-kernel
  82. IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkmylofw np25g
  83. endef
  84. #TARGET_DEVICES += np25g
  85. define Device/wpe53g
  86. DEVICE_TITLE := wpe53g
  87. KERNEL := kernel-bin | gzip-kernel
  88. IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkmylofw wpe53g
  89. endef
  90. #TARGET_DEVICES += wpe53g
  91. $(eval $(call BuildImage))