Makefile 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Copyright (c) 2014 The Linux Foundation. All rights reserved.
  2. #
  3. include $(TOPDIR)/rules.mk
  4. include $(INCLUDE_DIR)/image.mk
  5. define Image/BuilduImage
  6. $(CP) $(KDIR)/zImage$(2) $(KDIR)/zImage-$(1)$(2)
  7. cat $(LINUX_DIR)/arch/arm/boot/dts/mt7623-$1.dtb >> $(KDIR)/zImage-$(1)$(2)
  8. mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' -d $(KDIR)/zImage-$(1)$(2) $(KDIR)/uImage-$(1)$(2)
  9. endef
  10. define Image/Build/SysupgradeCombined
  11. $(call Image/BuilduImage,$1)
  12. ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
  13. $(call Image/BuilduImage,$1,-initramfs)
  14. $(CP) $(KDIR)/uImage-$(1)-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-$(1)-initramfs
  15. endif
  16. mkdir -p "$(KDIR_TMP)/sysupgrade-$(1)/"
  17. echo "BOARD=$(1)" > "$(KDIR_TMP)/sysupgrade-$(1)/CONTROL"
  18. $(CP) "$(KDIR)/root.$(2)" "$(KDIR_TMP)/sysupgrade-$(1)/root"
  19. $(CP) "$(KDIR)/uImage-$(1)" "$(KDIR_TMP)/sysupgrade-$(1)/kernel"
  20. (cd "$(KDIR_TMP)"; $(TAR) cvf \
  21. "$(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.tar" sysupgrade-$(1) \
  22. $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
  23. )
  24. endef
  25. define Image/Build/squashfs
  26. $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
  27. $(CP) $(KDIR)/root.squashfs $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs
  28. $(call Image/Build/SysupgradeCombined,eMMC,squashfs)
  29. $(call Image/BuilduImage,NAND)
  30. ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
  31. $(call Image/BuilduImage,NAND,-initramfs)
  32. $(CP) $(KDIR)/uImage-NAND-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-NAND-initramfs
  33. endif
  34. $(call Image/Build/SysupgradeNAND,NAND,$(1),$(KDIR)/uImage-NAND)
  35. endef
  36. define Image/Build
  37. $(call Image/Build/$(1),$(1))
  38. endef
  39. $(eval $(call BuildImage))