Skip to content

Instantly share code, notes, and snippets.

@yaneti
Last active August 25, 2025 06:13
Show Gist options
  • Save yaneti/653c880ef732ab04bc65ee1fc6bfaa9f to your computer and use it in GitHub Desktop.
Save yaneti/653c880ef732ab04bc65ee1fc6bfaa9f to your computer and use it in GitHub Desktop.
Milk-V Megrez bootchain build steps
# build u-boot
git clone -b rockos-dev https://github.com/rockos-riscv/rockos-u-boot
pushd rockos-u-boot
make eic7700_milkv_megrez_defconfig
make
popd
# produce a combined opensbi+u-boot payload
git clone -b rockos-dev https://github.com/rockos-riscv/rockos-opensbi
cd rockos-opensbi
# with recent gcc you'll need patching for bool
# http://declera.com/~yaneti/eswin-nsign/rockos-opensbi-gcc.patch
make PLATFORM=generic FW_PAYLOAD=y FW_PAYLOAD_PATH=../rockos-u-boot/u-boot.bin FW_FDT_PATH=../rockos-u-boot/u-boot.dtb
# copy the payload to the diretory for all other binaries that are combined later
cp -av ./build/platform/generic/firmware/fw_payload.bin sign/preload/
# this is for building a recent nsign from source and not depending on the old rockos x86_64 binary
# you'll need cmake
git clone -b dev https://github.com/eswincomputing/Esbd-77serial-nsign
cd Esbd-77serial-nsign
./build.sh
cp -av nsign ../sign/preload/
cd ../sign/preload
# this nsign is newer and slightly incompatible with the bootchain.cfg that rockos uses with the old nsign, so get a patched bootchain.cfg that works for me
wget http://declera.com/~yaneti/eswin-nsign/megrez-nsign2.cfg
./nsign megrez-nsign2.cfg
and you have a megrez-nsign2-test.bin thats is suitable for loading via the recovery boot method and flashed to SPI
@mischief
Copy link

@yaneti
Copy link
Author

yaneti commented Aug 25, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment