Makefile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #
  2. # Copyright (C) 2016 Jiang Yutang <[email protected]>
  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. LS_SD_KERNELPART_SIZE = 40
  10. LS_SD_KERNELPART_OFFSET = 16
  11. LS_SD_ROOTFSPART_OFFSET = 64
  12. LS_SD_IMAGE_SIZE = $(shell echo $$((($(LS_SD_ROOTFSPART_OFFSET) + \
  13. $(CONFIG_TARGET_ROOTFS_PARTSIZE)))))
  14. # The limitation of flash sysupgrade.bin is 1MB dtb + 16MB kernel + 32MB rootfs
  15. LS_SYSUPGRADE_IMAGE_SIZE = 49m
  16. define Image/Prepare
  17. # Build .dtb for all boards we may run on
  18. $(foreach dts,$(DEVICE_DTS_LIST),
  19. $(call Image/BuildDTB,$(DTS_DIR)/$(dts).dts,$(DTS_DIR)/$(dts).dtb)
  20. )
  21. endef
  22. define Build/ls-clean
  23. rm -f $@
  24. endef
  25. define Build/ls-append
  26. dd if=$(STAGING_DIR_IMAGE)/$(1) >> $@
  27. endef
  28. define Build/ls-append-dtb
  29. dd if=$(DTS_DIR)/$(1).dtb >> $@
  30. endef
  31. define Build/ls-append-kernel
  32. mkdir -p [email protected] && \
  33. cp $(IMAGE_KERNEL) [email protected]/fitImage && \
  34. make_ext4fs -J -L kernel -l "$(LS_SD_KERNELPART_SIZE)M" "[email protected]" "[email protected]" && \
  35. dd [email protected] >> $@ && \
  36. rm -rf [email protected] && \
  37. rm -f [email protected]
  38. endef
  39. define Build/ls-append-sdhead
  40. ./gen_sdcard_head_img.sh $(STAGING_DIR_IMAGE)/$(1)-sdcard-head.img \
  41. $(LS_SD_KERNELPART_OFFSET) $(LS_SD_KERNELPART_SIZE) \
  42. $(LS_SD_ROOTFSPART_OFFSET) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
  43. dd if=$(STAGING_DIR_IMAGE)/$(1)-sdcard-head.img >> $@
  44. endef
  45. define Build/traverse-fit
  46. ./mkits-multiple-config.sh -o [email protected] -A $(LINUX_KARCH) \
  47. -v $(LINUX_VERSION) -k $@ -a $(KERNEL_LOADADDR) \
  48. -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
  49. -C gzip -c 1 -c 2 \
  50. -d $(DEVICE_DTS_DIR)/freescale/traverse-ls1043s.dtb \
  51. -D "Traverse_LS1043S" -n "ls1043s" -a $(FDT_LOADADDR) -c 1 \
  52. -d $(DEVICE_DTS_DIR)/freescale/traverse-ls1043v.dtb \
  53. -D "Traverse_LS1043V" -n "ls1043v" -a $(FDT_LOADADDR) -c 2
  54. PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f [email protected] [email protected]
  55. @mv -f [email protected] $@
  56. endef
  57. define Device/fix-sysupgrade
  58. DEVICE_COMPAT_VERSION := 2.0
  59. DEVICE_COMPAT_MESSAGE := DTB was added to sysupgrade. Image format is different. \
  60. To use sysupgrade You need to change firmware partition in bootargs to "49m@0xf00000(firmware)" and saveenv. \
  61. After that, You can use "sysupgrade -F".
  62. endef
  63. define Device/rework-sdcard-images
  64. DEVICE_COMPAT_VERSION := 2.0
  65. DEVICE_COMPAT_MESSAGE := SD-card images were changed to squashfs + ext4 overlay combined images. \
  66. It is required to flash the entire sd-card again and manually copy config.
  67. endef
  68. include $(SUBTARGET).mk
  69. $(eval $(call BuildImage))