openwrt/target/linux/sifiveu/image/Makefile
Zoltan HERPAI a3469a90c4 sifiveu: add new target for SiFive U-based boards
RISC-V is a new CPU architecture aimed to be fully free and open. This
target will add support for it, based on 5.15.

Supports running on:
 - HiFive Unleashed - FU540, first generation
 - HiFive Unmatched - FU740, current latest generation, PCIe

SD-card images are generated, where the partitions are required to have
specific type codes. As it is commonplace nowadays, OpenSBI is used as the
first stage, with U-boot following as the proper bootloader.

Specifications:

HiFive Unleashed:
 - CPU: SiFive FU540 quad-core RISC-V (U54, RV64IMAFDC or RV64GC)
 - Memory: 8Gb
 - Ethernet: 1x 10/100/1000
 - Console: via microUSB

HiFive Unmatched:
 - CPU: SiFive FU740 quad-core RISC-V (U74, RV64IMAFDCB or RV64GCB)
 - Memory: 16Gb
 - Ethernet: 1x 10/100/1000
 - USB: 4x USB 3.2
 - PCIe:  - 1x PCIe Gen3 x8
          - 1x M.2 key M (PCIe x4)
          - 1x M.2 Key E (PCIe x1 / USB2.0)
 - Console: via microUSB

Installation:
Standard SD-card installation via dd-ing the generated image to
an SD-card of at least 256Mb.

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
2023-05-28 13:19:11 +02:00

57 lines
1.5 KiB
Makefile

# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2022 Toco Technologies <info@toco.ae>
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
FAT32_BLOCK_SIZE=1024
FAT32_BLOCKS=$(shell echo $$(($(CONFIG_SIFIVEU_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
KERNEL_LOADADDR:=0x80200000
define Build/riscv-sdcard
rm -f $@.boot #$(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img
mkfs.fat $@.boot -C $(FAT32_BLOCKS)
mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-boot.scr ::boot.scr
mcopy -i $@.boot $(DTS_DIR)/$(DEVICE_DTS).dtb ::dtb
mcopy -i $@.boot $(IMAGE_KERNEL) ::Image
./gen_sifiveu_sdcard_img.sh \
$@ \
$@.boot \
$(IMAGE_ROOTFS) \
$(CONFIG_SIFIVEU_SD_BOOT_PARTSIZE) \
$(CONFIG_TARGET_ROOTFS_PARTSIZE) \
$(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-u-boot.itb \
$(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-u-boot.itb-spl
endef
define Device/Default
PROFILES := Default
KERNEL_NAME := Image
KERNEL := kernel-bin | libdeflate-gzip
IMAGES := sdcard.img.gz
IMAGE/sdcard.img.gz := riscv-sdcard | append-metadata | gzip
endef
define Device/sifive_unleashed
DEVICE_VENDOR := SiFive
DEVICE_MODEL := Unleashed (FU540)
DEVICE_DTS := sifive/hifive-unleashed-a00
UBOOT := sifive_unleashed
endef
TARGET_DEVICES += sifive_unleashed
define Device/sifive_unmatched
DEVICE_VENDOR := SiFive
DEVICE_MODEL := Unmatched (FU740)
DEVICE_DTS := sifive/hifive-unmatched-a00
DEVICE_PACKAGES += kmod-eeprom-at24 kmod-hwmon-lm90
UBOOT := sifive_unmatched
endef
TARGET_DEVICES += sifive_unmatched
$(eval $(call BuildImage))