Makefile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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/boot-scr
  14. rm -f $@-boot.scr
  15. sed \
  16. -e 's#@ROOT@#$(SIGNATURE)#g' \
  17. -e 's#@DTB@#$(firstword $(DEVICE_DTS))#g' \
  18. $(BOOT_SCRIPT).bootscript > $@-new.bootscript
  19. mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d $@-new.bootscript $@-boot.scr
  20. endef
  21. define Build/boot-img
  22. rm -f $@.boot
  23. mkfs.fat -C $@.boot $$(( $(CONFIG_TARGET_KERNEL_PARTSIZE) * 1024 ))
  24. $(foreach dts,$(DEVICE_DTS), mcopy -i $@.boot $(KDIR)/image-$(dts).dtb ::$(dts).dtb;)
  25. mcopy -i $@.boot $(IMAGE_KERNEL) ::$(KERNEL_NAME)
  26. -mcopy -i $@.boot $@-boot.scr ::boot.scr
  27. endef
  28. define Build/boot-img-ext4
  29. rm -fR $@.boot
  30. mkdir -p $@.boot
  31. $(foreach dts,$(DEVICE_DTS), $(CP) $(KDIR)/image-$(dts).dtb $@.boot/$(dts).dtb;)
  32. $(CP) $(IMAGE_KERNEL) $@.boot/$(KERNEL_NAME)
  33. -$(CP) $@-boot.scr $@.boot/boot.scr
  34. make_ext4fs -J -l $(CONFIG_TARGET_KERNEL_PARTSIZE)M $@.bootimg $@.boot
  35. endef
  36. define Build/sdcard-img
  37. SIGNATURE="$(SIGNATURE)" \
  38. ./gen_mvebu_sdcard_img.sh $@ \
  39. $(if $(UBOOT),$(STAGING_DIR_IMAGE)/$(UBOOT)) \
  40. c $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
  41. 83 $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS)
  42. endef
  43. define Build/sdcard-img-ext4
  44. SIGNATURE="$(SIGNATURE)" \
  45. ./gen_mvebu_sdcard_img.sh $@ \
  46. $(if $(UBOOT),$(STAGING_DIR_IMAGE)/$(UBOOT)) \
  47. 83 $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.bootimg \
  48. 83 $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS)
  49. endef
  50. define Build/omnia-medkit-initramfs
  51. $(TAR) -c -T /dev/null -f $@
  52. rm -rf $(dir $(IMAGE_KERNEL))boot
  53. mkdir -p $(dir $(IMAGE_KERNEL))boot/boot/
  54. cp $(KDIR)/zImage-initramfs $(dir $(IMAGE_KERNEL))boot/boot/zImage
  55. cp $(KDIR)/image-$(DEVICE_DTS).dtb $(dir $(IMAGE_KERNEL))boot/boot/dtb
  56. $(TAR) -rp --numeric-owner --owner=0 --group=0 --sort=name \
  57. $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
  58. --file=$@ -C $(dir $(IMAGE_KERNEL))boot/ .
  59. endef
  60. define Device/Default
  61. PROFILES := Default
  62. BOARD_NAME = $$(DEVICE_DTS)
  63. KERNEL_NAME := zImage
  64. KERNEL := kernel-bin | append-dtb | uImage none
  65. IMAGES := sysupgrade.bin
  66. IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | pad-to $$$$(PAGESIZE)
  67. IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
  68. SUPPORTED_DEVICES = $(subst _,$(comma),$(1))
  69. UBINIZE_OPTS := -E 5
  70. UBOOT :=
  71. BOOT_SCRIPT :=
  72. endef
  73. DEVICE_VARS += BOOT_SCRIPT UBOOT
  74. define Device/Default-arm64
  75. BOOT_SCRIPT := generic-arm64
  76. DTS_DIR := $(DTS_DIR)/marvell
  77. IMAGES := sdcard.img.gz
  78. IMAGE/sdcard.img.gz := boot-scr | boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata
  79. KERNEL_NAME := Image
  80. KERNEL := kernel-bin
  81. endef
  82. define Device/NAND-128K
  83. BLOCKSIZE := 128k
  84. PAGESIZE := 2048
  85. SUBPAGESIZE := 512
  86. VID_HDR_OFFSET := 2048
  87. endef
  88. define Device/NAND-256K
  89. BLOCKSIZE := 256k
  90. PAGESIZE := 4096
  91. endef
  92. define Device/NAND-512K
  93. BLOCKSIZE := 512k
  94. PAGESIZE := 4096
  95. endef
  96. include cortex-a9.mk
  97. $(eval $(call BuildImage))