Makefile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. #
  3. # Copyright (C) 2022 Toco Technologies <[email protected]>
  4. #
  5. include $(TOPDIR)/rules.mk
  6. include $(INCLUDE_DIR)/image.mk
  7. FAT32_BLOCK_SIZE=1024
  8. FAT32_BLOCKS=$(shell echo $$(($(CONFIG_SIFIVEU_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
  9. KERNEL_LOADADDR:=0x80200000
  10. define Build/riscv-sdcard
  11. rm -f [email protected] #$(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img
  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] $(DTS_DIR)/$(DEVICE_DTS).dtb ::dtb
  15. mcopy -i [email protected] $(IMAGE_KERNEL) ::Image
  16. ./gen_sifiveu_sdcard_img.sh \
  17. $@ \
  18. [email protected] \
  19. $(IMAGE_ROOTFS) \
  20. $(CONFIG_SIFIVEU_SD_BOOT_PARTSIZE) \
  21. $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
  22. $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-u-boot.itb \
  23. $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-u-boot.itb-spl
  24. endef
  25. define Device/Default
  26. PROFILES := Default
  27. KERNEL_NAME := Image
  28. KERNEL := kernel-bin | libdeflate-gzip
  29. IMAGES := sdcard.img.gz
  30. IMAGE/sdcard.img.gz := riscv-sdcard | append-metadata | gzip
  31. endef
  32. define Device/sifive_unleashed
  33. DEVICE_VENDOR := SiFive
  34. DEVICE_MODEL := Unleashed (FU540)
  35. DEVICE_DTS := sifive/hifive-unleashed-a00
  36. UBOOT := sifive_unleashed
  37. endef
  38. TARGET_DEVICES += sifive_unleashed
  39. define Device/sifive_unmatched
  40. DEVICE_VENDOR := SiFive
  41. DEVICE_MODEL := Unmatched (FU740)
  42. DEVICE_DTS := sifive/hifive-unmatched-a00
  43. DEVICE_PACKAGES += kmod-eeprom-at24 kmod-hwmon-lm90
  44. UBOOT := sifive_unmatched
  45. endef
  46. TARGET_DEVICES += sifive_unmatched
  47. $(eval $(call BuildImage))