Makefile 2.8 KB

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