Makefile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #
  2. # Copyright (C) 2006-2013 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. KERNEL_LOADADDR := 0x20008000
  10. define Build/at91-install-zImage
  11. $(CP) $(KDIR)/zImage $@
  12. endef
  13. ifeq ($(SUBTARGET),legacy)
  14. include ./legacy.mk
  15. endif
  16. ifeq ($(SUBTARGET),sama5d2)
  17. include ./sama5d2.mk
  18. endif
  19. ifeq ($(SUBTARGET),sama5d3)
  20. include ./sama5d3.mk
  21. endif
  22. ifeq ($(SUBTARGET),sama5d4)
  23. include ./sama5d4.mk
  24. endif
  25. AT91_SD_BOOT_PARTSIZE:=64
  26. FAT32_BLOCK_SIZE:=1024
  27. FAT32_BLOCKS:=$(shell echo \
  28. $$(($(AT91_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
  29. define Device/Default
  30. $(Device/default-nand)
  31. PROFILES := Default
  32. FILESYSTEMS := squashfs ubifs ext4
  33. DEVICE_DTS := $(1)
  34. KERNEL_NAME := zImage
  35. KERNEL_SIZE := 4096k
  36. KERNEL := kernel-bin | append-dtb | lzma | uImage lzma
  37. DTB_SIZE := 128k
  38. endef
  39. define Device/dtb
  40. KERNEL := kernel-bin | lzma | uImage lzma
  41. endef
  42. define Build/at91-sdcard
  43. $(if $(findstring ext4,$@), \
  44. rm -f [email protected]
  45. mkfs.fat -C [email protected] $(FAT32_BLOCKS)
  46. mcopy -i [email protected] $(KDIR)/zImage ::zImage
  47. $(foreach dts,$(DEVICE_DTS), \
  48. mcopy -i [email protected] $(DTS_DIR)/$(dts).dtb \
  49. ::$(dts).dtb)
  50. mcopy -i [email protected] \
  51. $(BIN_DIR)/u-boot-$(DEVICE_NAME:at91-%=%)_mmc/u-boot.bin \
  52. ::u-boot.bin
  53. mcopy -i [email protected] \
  54. $(BIN_DIR)/at91bootstrap-$(DEVICE_NAME:at91-%=%)sd*/at91bootstrap.bin \
  55. ::BOOT.bin
  56. ./gen_at91_sdcard_img.sh \
  57. [email protected] \
  58. [email protected] \
  59. $(KDIR)/root.ext4 \
  60. $(AT91_SD_BOOT_PARTSIZE) \
  61. $(CONFIG_TARGET_ROOTFS_PARTSIZE)
  62. gzip -nc9 [email protected] > $@
  63. rm -f [email protected] [email protected] )
  64. endef
  65. define Device/evaluation-sdimage
  66. IMAGES += sdcard.img.gz
  67. IMAGE/sdcard.img.gz := at91-sdcard
  68. endef
  69. define Device/evaluation
  70. KERNEL_INSTALL := 1
  71. KERNEL_SUFFIX := -uImage
  72. IMAGES := root.ubi
  73. IMAGE/root.ubi := append-ubi
  74. endef
  75. define Device/evaluation-zImage
  76. IMAGES += zImage
  77. IMAGE/zImage := at91-install-zImage
  78. endef
  79. define Device/evaluation-dtb
  80. $(Device/evaluation)
  81. $(Device/dtb)
  82. $(Device/evaluation-zImage)
  83. IMAGES += dtb
  84. IMAGE/dtb := install-dtb
  85. endef
  86. define Device/evaluation-fit
  87. $(Device/evaluation)
  88. KERNEL_SUFFIX := -fit-uImage.itb
  89. KERNEL := kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb
  90. endef
  91. define Device/production
  92. UBINIZE_OPTS := -E 5
  93. IMAGES := factory.bin
  94. IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
  95. endef
  96. define Device/production-dtb
  97. $(Device/production)
  98. $(Device/dtb)
  99. IMAGE/factory.bin := append-dtb | pad-to $$$$(DTB_SIZE) \
  100. | append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
  101. endef
  102. $(eval $(call BuildImage))