Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled

This commit is contained in:
domenico
2025-06-24 14:35:53 +02:00
commit c06fb25d1f
9263 changed files with 1750214 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
config SIFIVEU_SD_BOOT_PARTSIZE
int "Boot (SD Card) filesystem partition size (in MB)"
depends on TARGET_sifiveu
default 32

View File

@@ -0,0 +1,56 @@
# 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))

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2022 OpenWrt.org
#
set -ex
[ $# -eq 7 ] || {
echo "SYNTAX: $0 <file> <bootfs image> <rootfs image> <bootfs size> <rootfs size> <u-boot ITB image> <u-boot SPL>"
exit 1
}
OUTPUT="$1"
BOOTFS="$2"
ROOTFS="$3"
BOOTFSSIZE="$4"
ROOTFSSIZE="$5"
UBOOT="$6"
UBOOT_SPL="$7"
set $(ptgen -o $OUTPUT -v -g -T sifiveu_spl -N loader1 -p 1024 -T sifiveu_uboot -N loader2 -p 4096 -t ef -N boot -p ${BOOTFSSIZE}M -N rootfs -p ${ROOTFSSIZE}M)
ROOTFSOFFSET=$(($7 / 512))
dd bs=512 if="$UBOOT_SPL" of="$OUTPUT" seek=34 conv=notrunc
dd bs=512 if="$UBOOT" of="$OUTPUT" seek=2082 conv=notrunc
dd bs=512 if="$BOOTFS" of="$OUTPUT" seek=10274 conv=notrunc
dd bs=512 if="$ROOTFS" of="$OUTPUT" seek=${ROOTFSOFFSET} conv=notrunc