Makefile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. LEGACY_NOR_KERNEL_SIZE = 2048k
  13. LEGACY_SPI_KERNEL_SIZE = 1536k
  14. # Build sysupgrade image
  15. define BuildFirmware/Legacy
  16. dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin \
  17. of=$(KDIR)/uImage.pad bs=$(3) count=1
  18. dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin \
  19. of=$(KDIR)/root.$(1).pad bs=$(3) skip=1
  20. sh $(TOPDIR)/scripts/combined-image.sh \
  21. $(KDIR)/uImage.pad \
  22. $(KDIR)/root.$(1).pad \
  23. $(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2)-legacy-sysupgrade.bin
  24. endef
  25. define Image/BuildKernel/Initramfs
  26. 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
  27. endef
  28. define Image/Build
  29. cat $(KDIR)/uImage $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin
  30. $(call Image/Build/$(1),$(1))
  31. $(call BuildFirmware/Legacy,$(1),laguna_spi,$(LEGACY_SPI_KERNEL_SIZE))
  32. $(call BuildFirmware/Legacy,$(1),laguna_nor,$(LEGACY_NOR_KERNEL_SIZE))
  33. endef
  34. define Image/Build/squashfs
  35. $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin)
  36. endef
  37. $(eval $(call BuildImage))