Makefile 2.5 KB

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