Makefile 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #
  2. # Copyright (C) 2010-2012 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 Image/Prepare
  10. mkimage -A arm -O linux -T kernel -C none -a 0x20008000 -e 0x20008000 -n 'OpenWrt Linux-$(LINUX_VERSION)' -d $(KDIR)/zImage $(KDIR)/uImage
  11. endef
  12. # Build sysupgrade image
  13. define BuildFirmware/Generic
  14. dd if=$(KDIR)/uImage of=$(KDIR)/uImage.pad bs=64k conv=sync; \
  15. dd if=$(KDIR)/root.$(1) of=$(KDIR)/root.$(1).pad bs=128k conv=sync; \
  16. sh $(TOPDIR)/scripts/combined-image.sh \
  17. $(KDIR)/uImage.pad \
  18. $(KDIR)/root.$(1).pad \
  19. $(BIN_DIR)/$(IMG_PREFIX)-$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))-sysupgrade.bin
  20. endef
  21. define Image/BuildKernel/Initramfs
  22. mkimage -A arm -O linux -T kernel -C none -a 0x20008000 -e 0x20008000 -n 'OpenWrt Linux-$(LINUX_VERSION)' -d $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-initramfs-uImage
  23. endef
  24. define Image/Build
  25. $(call Image/Build/$(1),$(1))
  26. $(call BuildFirmware/Generic,$(1))
  27. cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
  28. endef
  29. define Image/Build/jffs2-64k
  30. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=64k conv=sync
  31. ( \
  32. dd if=$(KDIR)/uImage bs=2048k conv=sync; \
  33. dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
  34. ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin
  35. endef
  36. define Image/Build/jffs2-128k
  37. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=128k conv=sync
  38. ( \
  39. dd if=$(KDIR)/uImage bs=2048k conv=sync; \
  40. dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
  41. ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin
  42. endef
  43. define Image/Build/squashfs
  44. $(call prepare_generic_squashfs,$(KDIR)/root.$(1))
  45. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=128k conv=sync
  46. ( \
  47. dd if=$(KDIR)/uImage bs=2048k conv=sync; \
  48. dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
  49. ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1)_laguna_nor.bin
  50. ( \
  51. dd if=$(KDIR)/uImage bs=1536k conv=sync; \
  52. dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \
  53. ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1)_laguna_spi.bin
  54. endef
  55. $(eval $(call BuildImage))