Skip to content

VisionFive boot fixes - #31

Merged
MichaelZhuxx merged 3 commits into
starfive-tech:JH7100_upstream_develfrom
zorun:visionfive_boot_fixes
Apr 9, 2023
Merged

MichaelZhuxx merged 3 commits into
starfive-tech:JH7100_upstream_develfrom
zorun:visionfive_boot_fixes

Conversation

@zorun

@zorun zorun commented May 30, 2022

Copy link
Copy Markdown
  • configs: starfive: define addresses according to Generic Distro spec
  • starfive: enable BOOTCOMMAND so that DISTRO_DEFAULTS becomes useful
  • configs: starfive: Change boot order to try DHCP last

See individual commit messages for details

Baptiste Jonglez added 3 commits May 28, 2022 17:06
According to https://u-boot.readthedocs.io/en/latest/develop/distro.html
the default u-boot configuration should define addresses such as
"kernel_addr_r", so that "users" (distro maintainers) don't have to guess
what are the right values.

The values in this patch are a mix of those from qemu-riscv config, and
those from the Fedora image provided by StarFive (which defines all
addresses in a uEnv.txt file).  These two sources mostly agree.

For reference, here are the addresses in the Fedora image (version
20211226-214100):

    fdt_high=0xffffffffffffffff
    initrd_high=0xffffffffffffffff

    scriptaddr=0x88100000
    script_offset_f=0x1fff000
    script_size_f=0x1000

    kernel_addr_r=0x84000000
    kernel_comp_addr_r=0x90000000
    kernel_comp_size=0x10000000

    fdt_addr_r=0x88000000
    ramdisk_addr_r=0x88300000

Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
Currently, the starfive configuration implements the distro spec:
https://u-boot.readthedocs.io/en/latest/develop/distro.html

However, BOOTCOMMAND is not enabled in the actual board config.  This
results in "bootcmd" not being defined, so u-boot does nothing by default.

The Fedora image provided by StarFive is still able to boot, but only
because u-boot has a preboot command that loads boot/uEnv.txt from the
third partition of the SD card.

To make use of the distro spec and allow generic booting of any OS image,
this patch enables BOOTCOMMAND.

Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
Currently, the boot order is DHCP, then MMC.

Trying DHCP boot first is not user-friendly, because it can take a long
time before falling back to MMC.  Also, network booting is usually not
wanted when a SD card is inserted.

Change order so that we first try MMC, and then fall back to DHCP if MMC
booting didn't work.

Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
@zorun zorun mentioned this pull request May 30, 2022
@zorun

zorun commented May 30, 2022

Copy link
Copy Markdown
Author

I have successfully tested these patches on a VisionFive V1 board, and I could boot Debian without needing any uEnv.txt file.

@zhaofengli zhaofengli mentioned this pull request Jun 10, 2022
2 of 14 tasks
@zorun

zorun commented Sep 4, 2022

Copy link
Copy Markdown
Author

Any update on this?

@zorun

zorun commented Sep 4, 2022

Copy link
Copy Markdown
Author

Just to clarify: the current u-boot on VisionFive v1 makes it hard for distros to support the board. And updating u-boot on a board is not something that most users will feel comfortable doing (btw, updating u-boot was well documented before, but I can't find the documentation on rvspace.org anymore :/).

So, it would be very helpful for the changes here to be integrated and shipped with the VisionFive V2 boards!

@orangecms

Copy link
Copy Markdown

For reference: The quick start guide has the instructions for upgrading U-Boot, recovery, etc..:
https://doc-en.rvspace.org/Doc_Center/quick_start_guide_visionfive.html

@orangecms

orangecms commented Dec 13, 2022 •

Copy link
Copy Markdown

I have an oreboot port in the makings instead, which would only need one single binary eventually for the whole procedure - clocks/GPIOs/DRAM init, SBI, loading a payload - plus your custom app, e.g., bare metal, LinuxBoot, hypervisor, whatever you like. :)

@MichaelZhuxx
MichaelZhuxx merged commit df3534e into starfive-tech:JH7100_upstream_devel Apr 9, 2023
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

Successfully merging this pull request may close these issues.

3 participants