starfive-tech / VisionFive2

438 stars 78 forks source link

Version 3.4.5 visionfive2_fw_payload.img too large? #73

Open rgadsdon opened 11 months ago

rgadsdon commented 11 months ago

Kernel 6.4.0-46, Fedora 38, boot from sdcard.

u-boot-spl.bin.normal.out loads OK, but then:

# flashcp -v visionfive2_fw_payload.img /dev/mtd1 visionfive2_fw_payload.img won't fit into /dev/mtd1!

ThomasKorimort commented 11 months ago

The official boot procedure flow is listed in https://doc-en.rvspace.org/VisionFive2/Boot_UG/JH7110_SDK/boot_flow.html . Maybe it is possible to build a custom OpenSBI and U-Boot bootloader independent of the official StarFive sources. There are also ongoing discussions on the official discussion forum at RVspace, that the JH7110 has a secure boot mode, which is not usable on the Vision Five 2, because its ZSBL BootROM might be compromised for letting the custom kernel believe falsely to run in supervisor mode, whilst it is controlled by a shadow operating system actually using the JH7110's secure boot features (https://forum.rvspace.org/t/is-the-source-code-for-the-boot-rom-for-the-visionfive-2-available/1918/46). Whereas this might be conspiracy stuff and troll activity to be left aside, it might impact the possibility to write a custom open-source and free version of the OpenSBI and U-Boot bootloader software for the Starfive Vision Five 2. On the other side, in the current struggles of the world it seems also quite plausible, that free and open-source computing is sabotaged, restricted and counteracted wherever possible, the world being out for a ramble of self-destruction.

misuzu commented 11 months ago

It's a kernel bug, there're no issues when flashing via UART

ThomasKorimort commented 11 months ago

The memory reserved for the SPL on /dev/mtd0 and payload on /dev/mtd1 is quite small. I remember having seen a post, that said, that the payload file was just a KB or so too big to be fitted to its destined partition. Such mishaps do not appear at random. Even if they might not be completely intentional either, they are the result of the hard court battles over copyrights, brand wars and DRM issues currently going on between the major and some minor players in the business, not to speak of the economic war between the USA and China. -> The devil hides in the detail.

MichaIng commented 11 months ago

Linking the related issue at the kernel repo: https://github.com/starfive-tech/linux/issues/81

misuzu commented 11 months ago

On the "upstream" kernel the layout looks like this:

% cat /proc/mtd                            
dev:    size   erasesize  name
mtd0: 00080000 00001000 "spl"
mtd1: 00010000 00001000 "uboot-env"
mtd2: 00400000 00001000 "uboot"
mtd3: 00a00000 00001000 "reserved-data"

So the visionfive2_fw_payload.img should be flashed to /dev/mtd2 instead of /dev/mtd1

grisu48 commented 6 months ago

I had the same issue on Debian Sid, and https://github.com/starfive-tech/VisionFive2/issues/73#issuecomment-1683560369 resolved it for me.

You likely also need to use /dev/mtd2 instead of /dev/mtd1. I also needed to update the openSUSE documentation - could this be a issue with one of the Fedora guides?