Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where to add/fix boot targets? #51

Open
MichaIng opened this issue Jun 8, 2023 · 2 comments
Open

Where to add/fix boot targets? #51

MichaIng opened this issue Jun 8, 2023 · 2 comments

Comments

@MichaIng
Copy link
Contributor

MichaIng commented Jun 8, 2023

Generic boot, i.e. scanning through all defined boot targets for bootable partitions, is currently broken. The relevant part of the default/embedded U-Boot environment looks like this:

bootcmd=run load_vf2_env;run importbootenv;run boot2; run scan_boot_dev; run load_distro_uenv;run distro_bootcmd
distro_bootcmd=setenv nvme_need_init; for target in ${boot_targets}; do run bootcmd_${target}; done
boot_targets=mmc0 dhcp
devnum=1
bootcmd_mmc0=devnum=0; run mmc_boot

So as long as there is not uEnv.txt on a 3rd partition with a FAT filesystem, it tries the mmc0 target. It looks like it would set devnum to 0, but actually it doesn't, as the syntax is wrong. So it remains at default value 1, which is the SD card.

Since last U-Boot update, with NVMe support added, as fast as any NVMe card is attached, it sets devnum to 0 correctly, aiming to boot from NVMe device 0. However, there is no nvme0 boot target, so it again tries to boot from mmc0. As now devnum is 0, which is the eMMC slot, it does not boot from SD card anymore as it used to prior to the U-Boot update.

Basically what we want, for generic boot support, is this:

boot_targets=mmc1 mmc0 nvme0 dhcp
bootcmd_mmc0=setenv devnum 0; run mmc_boot
bootcmd_mmc1=setenv devnum 1; run mmc_boot
bootcmd_nvme0=setenv devnum 0; run nvme_boot
  • All boot targets added, in the order SD card > eMMC > NVMe > DHCP
  • The mmc0 boot command now does really set devnum to 0 with the correct setenv command (devnum=0 is incorrect syntax).
  • mmc1 SD card boot command added.
  • nvme0 NVMe boot command added.

I wanted to fix/add those environment variables, but I cannot find them. Neither boot_targets, nor bootcmd_mmc0 is defined here: https://github.com/MichaIng/u-boot/blob/JH7110_VisionFive2_devel/include/configs/starfive-visionfive2.h

Would if work if we add them here to the end of the CONFIG_EXTRA_ENV_SETTINGS variable, just in case BOOTENV or BOOTENV_SF sets them, where ever those are defined?

@JamiKettunen
Copy link

@MichaelZhuxx Any ideas? I'd love to be able to use the board without a uEnv.txt on a 3rd partition with FAT filesystem

@MichaIng
Copy link
Contributor Author

Cross-linking a similar report on the other repo: starfive-tech/VisionFive2#67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants