Setting the clock to 1.2 GHz for Ubuntu 21.04

The processor clock can be increased to 1.2 GHz for Ubuntu 21.04 by building and flashing an updated U-Boot. The recipe was mostly taken from:

These commands are run on the Unmatched.

git clone https://github.com/sifive/meta-sifive.git

git clone https://github.com/riscv/opensbi.git
cd opensbi
git checkout v0.9 -b tmp
for f in ../meta-sifive/recipes-bsp/opensbi/files/*.patch; do echo $f;patch -p1 < $f;done
for f in ../meta-sifive/recipes-bsp/opensbi/files/unmatched/*.patch; do echo $f;patch -p1 < $f;done
make PLATFORM=generic
export OPENSBI=`realpath build/platform/generic/firmware/fw_dynamic.bin`
cd ..

git clone https://github.com/u-boot/u-boot.git
cd u-boot
git checkout v2021.01 -b tmp
for f in ../meta-sifive/recipes-bsp/u-boot/files/unmatched/*.patch; do echo $f;patch -p1 < $f;done
***********************************************************************
manually edit the file include/configs/sifive-hifive-unmatched-fu740.h
add the line:
"fdtfile=sifive/hifive-unmatched-a00.dtb\0" \
to the CONFIG_EXTRA_ENV_SETTINGS #define
***********************************************************************
make sifive_hifive_unmatched_fu740_defconfig
make -j4
sudo dd if=u-boot.itb of=/dev/mmcblk0p14 bs=4k oflag=direct
cd spl
sudo dd if=u-boot-spl.bin of=/dev/mmcblk0p13 bs=4k oflag=direct

reboot

The board will now be running at 1.2 GHz. As an added bonus, a bright blue LED is lit to help you find your way in the night.

5 Likes

For the adventurous, you can try other CPU clock rates by changing the line:

assigned-clock-rates = <1200000000>;

in the file u-boot/arch/riscv/dts/fu740-c000-u-boot.dtsi

1 Like

These instructions are immensely helpful — thanks!

Do the dd of= partitions remain the same if you are running from SSD? (because bootstrap is still from SD)

Yes.