From c73de09c3820431e646ad663d5e700931b02a0c9 Mon Sep 17 00:00:00 2001 From: Sungjoon Moon Date: Sat, 27 Jun 2026 06:13:38 +0900 Subject: [PATCH] boards/premier-p550: add SiFive HiFive Premier P550 (ESWIN EIC7700X) Co-Authored-By: Claude Fable 5 --- README.md | 1 + boards/premier-p550/README.md | 106 +++++++++++++++++++++++++ boards/premier-p550/board.conf | 23 ++++++ boards/premier-p550/genimage.cfg | 55 +++++++++++++ boards/premier-p550/override-kernel.sh | 31 ++++++++ boards/premier-p550/post-assemble.sh | 24 ++++++ 6 files changed, 240 insertions(+) create mode 100644 boards/premier-p550/README.md create mode 100644 boards/premier-p550/board.conf create mode 100644 boards/premier-p550/genimage.cfg create mode 100755 boards/premier-p550/override-kernel.sh create mode 100755 boards/premier-p550/post-assemble.sh diff --git a/README.md b/README.md index 377fb8a..586ff77 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ Rootless cross-compilation of Gentoo stages using crossdev and hakoniwa | odroid-m1s | aarch64 | mainline v7.0 | TFA + U-Boot + rkbin | `-O3 -mcpu=cortex-a55` | testing | | odroid-m2 | aarch64 | mainline v7.0 | TFA + U-Boot + rkbin | `-O3 -mcpu=cortex-a76.cortex-a55` | testing | | pentium-mmx | i586 | mainline v6.12 | BIOS (no firmware) | `-O2 -march=pentium-mmx` | testing | +| premier-p550 | riscv64 | mainline v7.2-rc1 | vendor QSPI (OpenSBI + U-Boot) + extlinux | `-O3 -march=rv64gc_zba_zbb` | testing | ## CLI diff --git a/boards/premier-p550/README.md b/boards/premier-p550/README.md new file mode 100644 index 0000000..5d617f4 --- /dev/null +++ b/boards/premier-p550/README.md @@ -0,0 +1,106 @@ +# SiFive HiFive Premier P550 (ESWIN EIC7700X) + +Quad-core SiFive P550 (rv64gc + zba + zbb, **no V**) — `eic7700-hifive-premier-p550.dts` upstream since Linux 6.18; ethernet/MMC since 6.19. + +## Boot chain + +``` +Boot ROM (on-die) + -> reads bootchain from QSPI NOR (pre-flashed by vendor) + ddr_fw.bin + second_boot_fw.bin + OpenSBI v1.6 + u-boot 2024.01-EIC7X + -> u-boot `bootflow scan -b` over boot_targets=mmc1 usb nvme0 ahci mmc0 + 1. /extlinux/extlinux.conf ← we ship this; first match wins + 2. /boot.scr.uimg + 3. /EFI/BOOT/bootriscv64.efi +``` + +extlinux is the primary path: vendor u-boot's bootmeth order tries it +first, and its handler env-expands `${ram_size}` (set by the vendor +`dram_init()`) into the kernel cmdline. `mem=${ram_size}G` comes from +the vendor SDK's own extlinux.conf; mainline-DTB boots without it fault +in `paging_init` (`__memset`, cause=7 store access fault on +PMP-protected memory), so we keep it. The mainline +`eic7700-hifive-premier-p550.dts` skeleton has no `/memory` or +`/reserved-memory` nodes and relies on u-boot's fixups alone. + +**Our image does not touch QSPI.** The vendor bring-up chain in QSPI is +re-used as-is. We only supply the OS storage media — a single GPT image +with `bootfs` (`Image`, DTB, `extlinux/extlinux.conf`) and `rootfs`. + +If QSPI is damaged, see `boards/premier-p550-full/` (future) — that +variant rebuilds the QSPI chain from `eswincomputing/u-boot`, +`eswincomputing/opensbi`, and the two closed firmware blobs from +`sifiveinc/hifive-premier-p550-tools`. + +## Flash + +The single `gentoo-linux-premier-p550_dev-sdcard-.img.xz` +works on any medium u-boot's `boot_targets` covers. + +```sh +xzcat gentoo-linux-premier-p550_dev-sdcard-.img.xz \ + | sudo dd of=/dev/ bs=4M status=progress conv=fsync +``` + +`/dev/` examples: +- microSD on a host card reader: `/dev/sdX` (whichever your reader maps to) +- NVMe (after removing the M.2 and plugging into a USB-NVMe enclosure): `/dev/sdX` +- eMMC: not directly writable from host — `dd` from the booted board to + `/dev/mmcblk1` (or whichever sysfs reports), then reboot and remove SD. + +The image self-grows on first boot (`grow-rootfs` OpenRC oneshot fills +`rootfs` to the disk end + `resize2fs`). + +## Default credentials + +- root, empty password (development image — change on first login) +- sshd enabled, `PermitRootLogin yes`, `PermitEmptyPasswords yes` + +## Console + +`ttyS0 @ 115200 8N1`. Same UART vendor u-boot uses, no switch needed. + +## ISA / GCC + +`-march=rv64gc_zba_zbb -mabi=lp64d`. **Do not** use `-mcpu=sifive-p450` +— P450 is a superset (Zbs, Zicbom, Zihintpause, Zfhmin) and its codegen +will SIGILL on real P550 hardware. GCC mainline has no `sifive-p550` +entry yet; LLVM does (`SiFiveP500Model`). Track +`gcc/config/riscv/riscv-cores.def` for the eventual GCC counterpart. + +## Known mainline gaps (v7.2-rc1) + +`CONFIG_ARCH_ESWIN=y` landed in defconfig for v7.2-rc1 (commit by +A. Srinivasan, June 2026). Remaining gaps: + +- **GPU** (Imagination AXM-8-256) — no open Mesa; framebuffer console only +- **NPU** (19.95 TOPS) — vendor blob only +- **HDMI display** — vendor only; use serial console +- **Audio** — disabled in mainline +- **RTC** — time does not survive reboot (RHEL bug, likely same here) + +## Vendor firmware version + +Vendor QSPI bootchain matters. Reported by `u-boot version` at boot: + +- `2024.09.00-HFP550` — works +- `2024.11.00-HFP550` — NIC regression (downgrade if you hit it) +- `2025.04.00-HFP550` — Fedora minimum +- `2025.11.00-HFP550` — RHEL 10.2 minimum, current recommendation + +Update via SiFive's `EsBurn` (USB) or u-boot `es_burn write 0x90000000 flash`. + +## First-batch MAC-ID bug + +If your board's MAC reads `8c:1f:64:00:00:00`, the factory failed to +program it. Fix with `EsMacIdUpdateTool` from +`github.com/sifiveinc/hifive-premier-p550-tools`. + +## References + +- DTS in mainline: `arch/riscv/boot/dts/eswin/eic7700{,-hifive-premier-p550}.dts*` +- Vendor U-Boot fork (for the QSPI variant): https://github.com/eswincomputing/u-boot tag `u-boot-2024.01-EIC7X` +- Vendor OpenSBI fork: https://github.com/eswincomputing/opensbi tag `opensbi-1.3-EIC7X` +- QSPI firmware blobs: https://github.com/sifiveinc/hifive-premier-p550-tools +- EIC7700X TRM: https://github.com/eswincomputing/EIC7700X-SoC-Technical-Reference-Manual +- SiFive product page: https://www.sifive.com/boards/hifive-premier-p550 diff --git a/boards/premier-p550/board.conf b/boards/premier-p550/board.conf new file mode 100644 index 0000000..085b312 --- /dev/null +++ b/boards/premier-p550/board.conf @@ -0,0 +1,23 @@ +BOARD_NAME="premier-p550" +BOARD_ARCH="riscv64" +BOARD_CFLAGS="-O3 -march=rv64gc_zba_zbb -pipe" +BOARD_GCC_VERSION="16.1.0" +CROSS_COMPILE="riscv64-unknown-linux-gnu-" +KERNEL_ARCH="riscv" + +# TODO: back to the stable tree once v7.2 is released. +KERNEL_REPO="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git" +KERNEL_TAG="v7.2-rc1" +KERNEL_DEFCONFIG="defconfig" +BOARD_DTB_GLOB="arch/riscv/boot/dts/eswin/eic7700-hifive-premier-p550.dtb" + +BOOT_KERNEL_NAME="Image" +BOOT_CONSOLE="ttyS0,115200" +BOOT_HOSTNAME="gentoo" +BOOT_SERIAL_TTY="ttyS0" +BOOT_SERIAL_BAUD="115200" + +# Vendor QSPI already holds OpenSBI + u-boot — skip bootloader step. +BUILD_STEPS=(deps checkout kernel assemble pack) + +BOOT_SERVICES=("sshd:default" "dhcpcd:default") diff --git a/boards/premier-p550/genimage.cfg b/boards/premier-p550/genimage.cfg new file mode 100644 index 0000000..9058b25 --- /dev/null +++ b/boards/premier-p550/genimage.cfg @@ -0,0 +1,55 @@ +config { + outputpath = . + inputpath = . + rootpath = gen + tmppath = tmp +} + +image rootfs.ext4 { + ext4 { + use-mke2fs = "true" + label = "rootfs" + extraargs = "-i 4k" + } + + size = 5G + mountpoint = "/root" +} + +# Single FAT bootfs holds the kernel Image, DTB, and +# extlinux/extlinux.conf, found by vendor u-boot's `bootflow scan`. +# One FAT partition instead of a separate /boot ext4, matching what +# SiFive's own Ubuntu and RHEL 10 do on this board. +image bootfs.vfat { + vfat { + extraargs = "-F 32" + label = "BOOTFS" + } + + size = 256M + mountpoint = "/boot" +} + +# Single GPT image — dd to microSD / eMMC / NVMe / SATA / USB. +image gentoo-linux-premier-p550_dev-sdcard.img { + hdimage { + partition-table-type = gpt + } + + partition bootfs { + image = "bootfs.vfat" + offset = "1M" + size = "256M" + in-partition-table = "true" + partition-type-uuid = "U" + bootable = "true" + } + + partition rootfs { + image = "rootfs.ext4" + offset = "257M" + size = "" + in-partition-table = "true" + partition-type-uuid = "root-riscv64" + } +} diff --git a/boards/premier-p550/override-kernel.sh b/boards/premier-p550/override-kernel.sh new file mode 100755 index 0000000..5bb2ccf --- /dev/null +++ b/boards/premier-p550/override-kernel.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -e + +# v7.2-rc1 defconfig enables ARCH_ESWIN; the EIC7700 drivers still +# need turning on. + +make -C /build/linux ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}" + +cat >> /build/linux/.config <<'EOF' +CONFIG_ARCH_ESWIN=y +CONFIG_PINCTRL_EIC7700=y +CONFIG_DWMAC_EIC7700=y +CONFIG_RESET_EIC7700=y +CONFIG_COMMON_CLK_ESWIN=y +CONFIG_COMMON_CLK_EIC7700=y +CONFIG_PHY_EIC7700_SATA=y + +# P550 is RVA20U64 base (rv64imafdc + zba + zbb): no Vector, no +# T-Head/Andes/MIPS vendor extensions. Keep the boot-time alternatives +# patcher from rewriting for extensions this core lacks. +# CONFIG_RISCV_ISA_V is not set +# CONFIG_RISCV_ISA_V_DEFAULT_ENABLE is not set +# CONFIG_RISCV_ISA_XTHEADVECTOR is not set +# CONFIG_RISCV_ISA_VENDOR_EXT_THEAD is not set +# CONFIG_RISCV_ISA_VENDOR_EXT_ANDES is not set +# CONFIG_RISCV_ISA_VENDOR_EXT_MIPS is not set +# CONFIG_RISCV_ALTERNATIVE_EARLY is not set +EOF + +make -C /build/linux ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" olddefconfig +make -C /build/linux ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" WERROR=0 -j"$(nproc)" diff --git a/boards/premier-p550/post-assemble.sh b/boards/premier-p550/post-assemble.sh new file mode 100755 index 0000000..82031a0 --- /dev/null +++ b/boards/premier-p550/post-assemble.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -e + +# Vendor QSPI u-boot's bootflow scan picks up /extlinux/extlinux.conf +# first. Keep mem=${ram_size}G from the vendor SDK cmdline: u-boot's +# extlinux handler expands it (ram_size set by vendor dram_init), and +# mainline-DTB boots without it die in paging_init (PMP store fault). + +dtb_name=$(basename "$(ls /build/gen/boot/*.dtb | head -n1)") +[ -n "$dtb_name" ] || { echo "Error: no DTB in /build/gen/boot" >&2; exit 1; } + +rm -rf /build/gen/boot/extlinux /build/gen/boot/EFI /build/gen/boot/grub + +install -d /build/gen/boot/extlinux +cat > /build/gen/boot/extlinux/extlinux.conf <