Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
106 changes: 106 additions & 0 deletions boards/premier-p550/README.md
Original file line number Diff line number Diff line change
@@ -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.

Check failure on line 3 in boards/premier-p550/README.md

View workflow job for this annotation

GitHub Actions / markdownlint (advisory)

Line length

boards/premier-p550/README.md:3:81 MD013/line-length Line length [Expected: 80; Actual: 140] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md013.md

## Boot chain

```

Check failure on line 7 in boards/premier-p550/README.md

View workflow job for this annotation

GitHub Actions / markdownlint (advisory)

Fenced code blocks should have a language specified

boards/premier-p550/README.md:7 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md040.md
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-<timestamp>.img.xz`
works on any medium u-boot's `boot_targets` covers.

```sh
xzcat gentoo-linux-premier-p550_dev-sdcard-<timestamp>.img.xz \
| sudo dd of=/dev/<target> bs=4M status=progress conv=fsync
```

`/dev/<target>` examples:
- microSD on a host card reader: `/dev/sdX` (whichever your reader maps to)

Check failure on line 46 in boards/premier-p550/README.md

View workflow job for this annotation

GitHub Actions / markdownlint (advisory)

Lists should be surrounded by blank lines

boards/premier-p550/README.md:46 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- microSD on a host card reade..."] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md032.md
- 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
23 changes: 23 additions & 0 deletions boards/premier-p550/board.conf
Original file line number Diff line number Diff line change
@@ -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")
55 changes: 55 additions & 0 deletions boards/premier-p550/genimage.cfg
Original file line number Diff line number Diff line change
@@ -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"
}
}
31 changes: 31 additions & 0 deletions boards/premier-p550/override-kernel.sh
Original file line number Diff line number Diff line change
@@ -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)"
24 changes: 24 additions & 0 deletions boards/premier-p550/post-assemble.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF
default gentoo
timeout 30

label gentoo
menu label Gentoo Linux (HiFive Premier P550)
kernel /${BOOT_KERNEL_NAME}
fdt /${dtb_name}
append root=PARTLABEL=rootfs rootfstype=ext4 rootwait earlycon=sbi console=${BOOT_CONSOLE}n8 mem=\${ram_size}G
EOF
Loading