Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #
  2. # Copyright (C) 2012-2016 OpenWrt.org
  3. # Copyright (C) 2016 LEDE-project.org
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. JFFS2_BLOCKSIZE = 128k
  9. include $(TOPDIR)/rules.mk
  10. include $(INCLUDE_DIR)/image.mk
  11. KERNEL_LOADADDR := 0x00008000
  12. SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH))
  13. define Build/dtb
  14. $(call Image/BuildDTB,$(DTS_DIR)/$(DEVICE_DTS).dts,[email protected])
  15. endef
  16. # SD-Card Images:
  17. # these values are optimized for a 4GB labeled sdcard that actually holds 7744512 sectors of 512 byte
  18. # MBR: 2048 sectors
  19. # Partition 1: 32768 sectors
  20. # Partition 2: 98304 sectors (configurable)
  21. define Build/boot-scr
  22. rm -f [email protected]
  23. sed -e 's#@ROOT@#$(SIGNATURE)#g' \
  24. $(DEVICE_NAME).bootscript > [email protected]
  25. mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d [email protected] [email protected]
  26. endef
  27. define Build/boot-img
  28. rm -f [email protected]
  29. mkfs.fat -C [email protected] 16384
  30. $(foreach dts,$(DEVICE_DTS), mcopy -i [email protected] $(DTS_DIR)/$(dts).dtb ::$(dts).dtb;)
  31. mcopy -i [email protected] $(IMAGE_KERNEL) ::$(KERNEL_NAME)
  32. -mcopy -i [email protected] [email protected] ::boot.scr
  33. endef
  34. define Build/boot-img-ext4
  35. rm -fR [email protected]
  36. mkdir -p [email protected]
  37. $(foreach dts,$(DEVICE_DTS), $(CP) $(DTS_DIR)/$(dts).dtb [email protected];)
  38. $(CP) $(IMAGE_KERNEL) [email protected]/$(KERNEL_NAME)
  39. -$(CP) [email protected] [email protected]/boot.scr
  40. make_ext4fs -J -l 16384K [email protected] [email protected]
  41. endef
  42. define Build/sdcard-img
  43. if [ -n "$(UBOOT)" ]; then UBOOT="$(STAGING_DIR_IMAGE)/$(UBOOT)"; fi; \
  44. ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \
  45. SIGNATURE="$(SIGNATURE)" \
  46. ./gen_mvebu_sdcard_img.sh $@ \
  47. $$UBOOT \
  48. c 32768 [email protected] \
  49. 83 $$ROOTFS_SIZE $(IMAGE_ROOTFS)
  50. endef
  51. define Build/sdcard-img-ext4
  52. if [ -n "$(UBOOT)" ]; then UBOOT="$(STAGING_DIR_IMAGE)/$(UBOOT)"; fi; \
  53. ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \
  54. SIGNATURE="$(SIGNATURE)" \
  55. ./gen_mvebu_sdcard_img.sh $@ \
  56. $$UBOOT \
  57. 83 32768 [email protected] \
  58. 83 $$ROOTFS_SIZE $(IMAGE_ROOTFS)
  59. endef
  60. define Build/omnia-medkit-initramfs
  61. $(TAR) -c -T /dev/null -f $@
  62. rm -rf $(dir $(IMAGE_KERNEL))boot
  63. mkdir -p $(dir $(IMAGE_KERNEL))boot/boot/
  64. cp $(KDIR)/zImage-initramfs $(dir $(IMAGE_KERNEL))boot/boot/zImage
  65. cp $(DTS_DIR)/$(DEVICE_DTS).dtb $(dir $(IMAGE_KERNEL))boot/boot/dtb
  66. $(TAR) -rp --numeric-owner --owner=0 --group=0 --sort=name \
  67. $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
  68. --file=$@ -C $(dir $(IMAGE_KERNEL))boot/ .
  69. endef
  70. define Device/Default
  71. PROFILES := Default
  72. DEVICE_DTS := $(1)
  73. BOARD_NAME = $$(DEVICE_DTS)
  74. KERNEL_NAME := zImage
  75. KERNEL := kernel-bin | append-dtb | uImage none
  76. SUPPORTED_DEVICES = $$(DEVICE_DTS)
  77. UBOOT :=
  78. endef
  79. DEVICE_VARS += UBOOT
  80. define Device/UBI
  81. IMAGES := sysupgrade.bin
  82. IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
  83. endef
  84. define Device/UBI-factory
  85. $(Device/UBI)
  86. UBINIZE_OPTS := -E 5
  87. IMAGES += factory.img
  88. IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | pad-to $$$$(PAGESIZE)
  89. endef
  90. define Device/NAND-128K
  91. $(Device/UBI)
  92. BLOCKSIZE := 128k
  93. PAGESIZE := 2048
  94. SUBPAGESIZE := 512
  95. VID_HDR_OFFSET := 2048
  96. endef
  97. define Device/NAND-256K
  98. $(Device/UBI)
  99. BLOCKSIZE := 256k
  100. PAGESIZE := 4096
  101. endef
  102. define Device/NAND-512K
  103. $(Device/UBI)
  104. BLOCKSIZE := 512k
  105. PAGESIZE := 4096
  106. endef
  107. include cortex-a9.mk
  108. include cortex-a53.mk
  109. include cortex-a72.mk
  110. $(eval $(call BuildImage))