Updating the openSBI on R-01?

Actually i did and i can provide some tips.
Apparently you don’t need UART for this job, at least not in the best case scenario, but to the point.

Your idea with patch for C906’s fence issue was right way to go.
Also @ylyamin’s resource was a goldmine. Upgrading openSBI isn’t that scary :wink:

You indeed have to acquire u-boot’s sources as well as openSBI’s and do some mambo-jumbo, but it all works well, at least my µConsole R-01 is happy with this update. Well, sort of.

You need to obtain GitHub - tekkamanninja/u-boot: "Das U-Boot" Source Tree, build it with

git clone https://github.com/tekkamanninja/u-boot -b allwinner_d1
cd u-boot; make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv nezha_defconfig
echo "CONFIG_MMC_BROKEN_CD=y" >> .config
make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv oldconfig
make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv u-boot.bin u-boot.dtb

For some reason GitHub - smaeul/opensbi: RISC-V Open Source Supervisor Binary Interface will cause R01 to bootloop. I guess more details would come over UART but i can’t check it right now.
Instead, go with this approach

git clone https://github.com/tekkamanninja/opensbi -b allwinner_d1
cd opensbi/lib/sbi

Apply patch from [PATCH 2/2] lib: sbi_illegal_insn: Add emulation for fence.tso
this is - to add one include, one Errata workaround and supersede true_illegal_inst with misc_mem_opcode.
With these changes, openSBI compiles just fine.

CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=generic FW_PIC=y BUILD_INFO=y make

Then proceed with u-boot TOC1 creation, mkimage’s image generation and dd’ing resulting blob directly to µSD’s 32800 512-byte block.

This is, however, a partial win. I have to do more tests but my bootstraped Debian without openSBI’s patch( this is: regular one which comes with Ubuntu) raises a SIGILL when doing apt-get update. Probably the fence instruction.
After patching, no more illegal instructions, instead apt-get update waits for God knows what on 0% [Working] mark consuming 99% of cpu.

Would love to hear from you about your progress. I’ll try now to upgrade default ubuntu image with this new opensbi+uboot image but i guess ubuntu will work without any noticeable changes.

1 Like