Error about the HiFive Unleashed boot from flash

as under root directory said, i flash the hifive-unleashed-a00-YYYY-MM-DD.gpt image into the QSPI flash, and then put the MODESEL pin to 0110(which is said will resuce image from flash), but i got error:

MMC_SPI: 0 at 0:1 hz 20000000 mode 0

Warning: Input data exceeds 1048576 bytes - truncated

Info: input data size = 1048578 = 0x100002

Error: Environment import failed: errno = 12

running boot2…

Error: “boot2” not defined

i have no ideal what happened, please help me.

The boot2 message sounds like a uboot error. It is probably looking for a rule in the uEnv.txt file which is missing. You can find the uEnv.txt file in the conf dir of the freedom-u-sdk source tree.

I would not recommend writing to flash on the board. That is dangerous. You might break something. The two useful choices here are

  1. use the original flash zsbl/fsbl to boot into bbl using default modesel setting
  2. put u-boot in a partition on the sdcard, along with a partition for the uEnv.txt file, and a partition for the kernel, and a partition for the root file system, and set the modesel switches as mentioned in readme.txt

If you look at the freedom-u-sdk Makefile, there are makefile commands to create a properly formatted sdcard that will boot using u-boot.

Or there is a third option, which is to switch from freedom-u-sdk to openembedded, which is better maintained, which is what we are planning to do.

Thanks for your answer. But, for some reason, I must do a experiment about booting kernel from flash on HiFive Unleashed board, is there any possible way to do that? Or, is there any possible way put the kernel image in flash on board and boot the kernel from flash? (I don’t care if other images are in flash or not)

In addition:
<1>any suggestion, if i want to fix the error mentioned before.

<2>what is the meaning of ‘openembedded’? Is it a git project or branch?

I’m not a boot loader or linux kernel expert, so can’t really help you with any of the details. I’ve never written to flash. I just use the makefile to build images and boot them as intended. I’m doubtful that you can put anything other than a boot loader in flash.

OpenEmbedded/Yocto are embedded linux distros that you can build from scratch. There is RISC-V support.

And there is also HiFive Unleashed support in there, but this will just build an image you can write to the sdcard. This doesn’t have anything to do with writing flash.

If you have questions about freedom-u-sdk, you should try filing an issue in the github project.

Thanks for your help. I will try to file an issue in the github project.

I boot linux from QSPI flash successfully.

  1. You should boot linux from sdcard at first.
  2. Copy the file “hifive-unleashed-a00-YYYY-MM-DD.gpt” into directory of linux on sdcard.
  3. Use command “flashcp -v hifive-unleashed-a00-YYYY-MM-DD.gpt /dev/mtd0” to flash image into QSPI flash.
  4. Poweroff and put MODSEL pin to 0110.

Good luck to you! :grinning: