Makefile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. #
  3. # Copyright (C) 2013-2016 OpenWrt.org
  4. # Copyright (C) 2016 Yousong Zhou
  5. include $(TOPDIR)/rules.mk
  6. include $(INCLUDE_DIR)/image.mk
  7. FAT32_BLOCK_SIZE=1024
  8. FAT32_BLOCKS=$(shell echo $$(($(CONFIG_SUNXI_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
  9. DEVICE_VARS := SUNXI_DTS SUNXI_DTS_DIR
  10. define Build/sunxi-sdcard
  11. rm -f [email protected]
  12. mkfs.fat [email protected] -C $(FAT32_BLOCKS)
  13. mcopy -i [email protected] $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-boot.scr ::boot.scr
  14. mcopy -i [email protected] $(IMAGE_KERNEL) ::uImage
  15. ./gen_sunxi_sdcard_img.sh $@ \
  16. [email protected] \
  17. $(IMAGE_ROOTFS) \
  18. $(CONFIG_SUNXI_SD_BOOT_PARTSIZE) \
  19. $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
  20. $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-u-boot-with-spl.bin
  21. rm -f [email protected]
  22. endef
  23. # why \x00\x00\x00\x00 for zImage-initramfs
  24. define Device/Default
  25. PROFILES := Default
  26. KERNEL_NAME := zImage
  27. KERNEL := kernel-bin | uImage none
  28. IMAGES := sdcard.img.gz
  29. IMAGE/sdcard.img.gz := sunxi-sdcard | append-metadata | gzip
  30. SUNXI_DTS_DIR := allwinner/
  31. SUNXI_DTS = $$(SUNXI_DTS_DIR)$$(SOC)-$(lastword $(subst _, ,$(1)))
  32. endef
  33. define Device/FitImageLzma
  34. KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(SUNXI_DTS).dtb
  35. endef
  36. define Device/FitImageGzip
  37. KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(SUNXI_DTS).dtb
  38. endef
  39. include $(SUBTARGET).mk
  40. $(eval $(call BuildImage))