Skip to content

Instantly share code, notes, and snippets.

@xypron
Last active December 12, 2024 15:45
Show Gist options
  • Select an option

  • Save xypron/84d98ea915cd0af5e22d5d848899aff1 to your computer and use it in GitHub Desktop.

Select an option

Save xypron/84d98ea915cd0af5e22d5d848899aff1 to your computer and use it in GitHub Desktop.
Makefile to create SiFive HiFive Premier P550 firmware
#!/usr/bin/make -f
# SPDX-License-Identifier: MIT
UBOOT_VERSION=eab538b697011b866aba64938ef045e67fa08dc2
OPENSBI_VERSION=EIC7X-2024.11
NSIGN_VERSION=74e7c69b812923f68ef3eeb0c1cbbee90f80b566
all:
make uboot
make sbi
make firmware
make publish
u-boot:
git clone https://github.com/eswincomputing/u-boot.git
uboot: u-boot
cd u-boot && \
git fetch && \
git checkout $(UBOOT_VERSION) && \
make mrproper && \
make O=build_eswin/ hifive_premier_p550_defconfig && \
CROSS_COMPILE=riscv64-linux-gnu- \
make O=build_eswin/ -j$$(nproc)
opensbi:
git clone https://github.com/eswincomputing/opensbi.git
sbi: opensbi
cd opensbi && \
git fetch origin && \
git checkout $(OPENSBI_VERSION) && \
CROSS_COMPILE=riscv64-linux-gnu- make -j$$(nproc) \
FW_OPTIONS=0x0 \
PLATFORM=eswin/eic770x \
FW_PAYLOAD_PATH=../u-boot/build_eswin/u-boot.bin \
FW_FDT_PATH=../u-boot/build_eswin/u-boot.dtb \
CHIPLET="BR2_CHIPLET_1" \
CHIPLET_DIE_AVAILABLE="BR2_CHIPLET_1_DIE0_AVAILABLE" \
MEM_MODE="BR2_MEMMODE_FLAT" \
PLATFORM_CLUSTER_X_CORE="BR2_CLUSTER_4_CORE" \
PLATFORM_RISCV_ISA=rv64imafdc_zicsr_zifencei
Esbd-77serial-nsign:
git clone https://github.com/eswincomputing/Esbd-77serial-nsign
nsign: Esbd-77serial-nsign
cd Esbd-77serial-nsign && \
git checkout $(NSIGN_VERSION) && \
rm -rf build/ && \
mkdir build/ && \
cd build/ && \
cmake .. && \
make -j$$(nproc) && \
cp src/nsign ../..
hifive-premier-p550-tools:
git clone https://github.com/sifive/hifive-premier-p550-tools.git
meta-sifive:
git clone https://github.com/sifive/meta-sifive.git
firmware: hifive-premier-p550-tools nsign
cd meta-sifive && \
git checkout da24adbe3db628d0054a4e9ecb47f6b4b3b54894
cp opensbi/build/platform/eswin/eic770x/firmware/fw_payload.bin .
cp hifive-premier-p550-tools/ddr-fw/ddr_fw.bin .
cp hifive-premier-p550-tools/second_boot_fw/second_boot_fw.bin .
./nsign meta-sifive/recipes-bsp/bootchain/files/nsign.cfg
crc32 bootloader_ddr5_secboot.bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment