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

Specific image does not boot after SPL and U-Boot update to v3.8.2 #87

Open
vpx23 opened this issue Nov 28, 2023 · 3 comments
Open

Specific image does not boot after SPL and U-Boot update to v3.8.2 #87

vpx23 opened this issue Nov 28, 2023 · 3 comments

Comments

@vpx23
Copy link

vpx23 commented Nov 28, 2023

Hello everybody!

I updated the VisionFive2 Software from v2.10.4 to v3.8.2.

As OS I used an SD card with this image: https://nightly.ipfire.org/next/latest/riscv64/

Bootlog of v2.10.4:


U-Boot SPL 2021.10 (Feb 28 2023 - 21:44:53 +0800)
DDR version: dc2e84f0.
Trying to boot from SPI

OpenSBI v1.2
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name             : StarFive VisionFive V2
Platform Features         : medeleg
Platform HART Count       : 5
Platform IPI Device       : aclint-mswi
Platform Timer Device     : aclint-mtimer @ 4000000Hz
Platform Console Device   : uart8250
Platform HSM Device       : jh7110-hsm
Platform PMU Device       : ---
Platform Reboot Device    : pm-reset
Platform Shutdown Device  : pm-reset
Firmware Base             : 0x40000000
Firmware Size             : 292 KB
Runtime SBI Version       : 1.0

Domain0 Name              : root
Domain0 Boot HART         : 1
Domain0 HARTs             : 0*,1*,2*,3*,4*
Domain0 Region00          : 0x0000000002000000-0x000000000200ffff (I)
Domain0 Region01          : 0x0000000040000000-0x000000004007ffff ()
Domain0 Region02          : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address      : 0x0000000040200000
Domain0 Next Arg1         : 0x0000000042200000
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes

Boot HART ID              : 1
Boot HART Domain          : root
Boot HART Priv Version    : v1.11
Boot HART Base ISA        : rv64imafdcbx
Boot HART ISA Extensions  : none
Boot HART PMP Count       : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 34
Boot HART MHPM Count      : 2
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109


U-Boot 2021.10 (Feb 28 2023 - 21:44:53 +0800), Build: jenkins-VF2_515_Branch_SDK_Release-31

CPU:   rv64imacu
Model: StarFive VisionFive V2
DRAM:  4 GiB
MMC:   sdio0@16010000: 0, sdio1@16020000: 1
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

StarFive EEPROM format v2

--------EEPROM INFO--------
Vendor : StarFive Technology Co., Ltd.
Product full SN: VF7110B1-2310-D004E000-00001493
data version: 0x2
PCB revision: 0xb2
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:50:18
Ethernet MAC1 address: 6c:cf:39:00:50:19
--------EEPROM INFO--------

In:    serial@10000000
Out:   serial@10000000
Err:   serial@10000000
Model: StarFive VisionFive V2
Net:   eth0: ethernet@16030000, eth1: ethernet@16040000
switch to partitions #0, OK
mmc1 is current device
found device 1
bootmode flash device 1
Can't set block device
Failed to load '/boot/uEnv.txt'
Hit any key to stop autoboot:  0
Can't set block device
Importing environment from mmc1 ...
## Info: input data size = 790 = 0x316
Can't set block device
## Warning: defaulting to text format
## Error: "boot2" not defined
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Card did not respond to voltage select! : -110
** Unable to read file ubootefi.var **
Failed to load EFI variables
Scanning mmc 1:2...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Found EFI removable media binary efi/boot/bootriscv64.efi
151552 bytes read in 13 ms (11.1 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
error: failed to retrieve the structure field.
error: serial port `com0' isn't found.
error: terminal `serial' isn't found.
error: terminal `serial' isn't found.
error: unable to determine partition UUID of boot device.


                           GNU GRUB  version 2.12~rc1

 ┌────────────────────────────────────────────────────────────────────────────┐
 │*IPFire 2.27 (riscv64) - core182 Development Build: next/ff12bfda GNU/Linux │
 │ Advanced options for IPFire 2.27 (riscv64) - core182 Development Build: ne►│
 │ Serial Console: IPFire 2.27 (riscv64) - core182 Development Build: next/ff►│
 │                                                                            │
 │                                                                            │
 │                                                                            │
 │                                                                            │
 │                                                                            │
 │                                                                            │
 │                                                                            │
 │                                                                            │
 │                                                                            │
 └────────────────────────────────────────────────────────────────────────────┘

      Use the ▲ and ▼ keys to select which entry is highlighted.
      Press enter to boot the selected OS, `e' to edit the commands
      before booting or `c' for a command-line.
   The highlighted entry will be executed automatically in 0s.

Bootlog of v3.8.2:


U-Boot SPL 2021.10 (Oct 31 2023 - 19:41:27 +0800)
LPDDR4: 4G version: g8ad50857.
Trying to boot from SPI

OpenSBI v1.2
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|___/_____|
        | |
        |_|

Platform Name             : StarFive VisionFive V2
Platform Features         : medeleg
Platform HART Count       : 5
Platform IPI Device       : aclint-mswi
Platform Timer Device     : aclint-mtimer @ 4000000Hz
Platform Console Device   : uart8250
Platform HSM Device       : ---
Platform PMU Device       : ---
Platform Reboot Device    : pm-reset
Platform Shutdown Device  : pm-reset
Platform Suspend Device   : ---
Firmware Base             : 0x40000000
Firmware Size             : 392 KB
Firmware RW Offset        : 0x40000
Runtime SBI Version       : 1.0

Domain0 Name              : root
Domain0 Boot HART         : 1
Domain0 HARTs             : 0*,1*,2*,3*,4*
Domain0 Region00          : 0x0000000002000000-0x000000000200ffff M: (I,R,W) S/U: ()
Domain0 Region01          : 0x0000000040000000-0x000000004003ffff M: (R,X) S/U: ()
Domain0 Region02          : 0x0000000040040000-0x000000004007ffff M: (R,W) S/U: ()
Domain0 Region03          : 0x0000000000000000-0xffffffffffffffff M: (R,W,X) S/U: (R,W,X)
Domain0 Next Address      : 0x0000000040200000
Domain0 Next Arg1         : 0x0000000042200000
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes
Domain0 SysSuspend        : yes

Boot HART ID              : 1
Boot HART Domain          : root
Boot HART Priv Version    : v1.11
Boot HART Base ISA        : rv64imafdcbx
Boot HART ISA Extensions  : none
Boot HART PMP Count       : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 34
Boot HART MHPM Count      : 2
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109


U-Boot 2021.10 (Oct 31 2023 - 19:41:27 +0800), Build: jenkins-github_visionfive2-19

CPU:   rv64imacu_zba_zbb
Model: StarFive VisionFive V2
DRAM:  4 GiB
MMC:   sdio0@16010000: 0, sdio1@16020000: 1
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

StarFive EEPROM format v2

--------EEPROM INFO--------
Vendor : StarFive Technology Co., Ltd.
Product full SN: VF7110B1-2310-D004E000-00001493
data version: 0x2
PCB revision: 0xb2
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:50:18
Ethernet MAC1 address: 6c:cf:39:00:50:19
--------EEPROM INFO--------

In:    serial
Out:   serial
Err:   serial
Model: StarFive VisionFive V2
Net:   eth0: ethernet@16030000, eth1: ethernet@16040000
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc1 is current device
Try booting from MMC1 ...
Can't set block device
## Warning: Input data exceeds 1048576 bytes - truncated
## Info: input data size = 1048578 = 0x100002
## Error: "boot2" not defined
Card did not respond to voltage select! : -110
starfive_pcie pcie@2B000000: Port link up.
starfive_pcie pcie@2B000000: Starfive PCIe bus probed.
PCI: Failed autoconfig bar 10
starfive_pcie pcie@2C000000: Port link down.
starfive_pcie pcie@2C000000: Starfive PCIe bus probed.
PCI: Failed autoconfig bar 10

Device 0: unknown device

Device 0: unknown device
Tring booting distro ...
switch to partitions #0, OK
mmc1 is current device
Try booting from MMC1 ...
Can't set block device
## Warning: defaulting to text format
## Warning: Input data exceeds 1048576 bytes - truncated
## Info: input data size = 1048578 = 0x100002
Can't set block device
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
fatwrite - write file into a dos filesystem

Usage:
fatwrite <interface> <dev[:part]> <addr> <filename> [<bytes> [<offset>]]
    - write file 'filename' from the address 'addr' in RAM
      to 'dev' on 'interface'
Retrieving file: /extlinux/extlinux.conf
Can't set block device
Error reading config file
Card did not respond to voltage select! : -110

Device 0: unknown device

Device 0: unknown device
StarFive #
StarFive # version
U-Boot 2021.10 (Oct 31 2023 - 19:41:27 +0800), Build: jenkins-github_visionfive2-19

riscv64-buildroot-linux-gnu-gcc.br_real (Buildroot VF2_v3.8.2) 12.2.0
GNU ld (GNU Binutils) 2.39
StarFive #

SD card and image are the same in the two boots so they can't be the issue.

The IPFire image has its own bugs in the kernel but the latest VisionFive doesn't even boot into GRUB.

@MichaIng
Copy link

MichaIng commented Nov 28, 2023

This is likely because of the broken default U-Boot environment with the new version, which strictly requires boot configs/scripts and kernel image on a 3rd partition with FAT filesystem. Previously there was a moreless generic fallback, looping through all partitions, but that is gone.

So you must overwrite the U-Boot environment to again support the EFI partition provided by your IPFire image. Here is an example of a generic environment which supports all types of boot scripts/methods from all filesystems on all partitions from all boot media (SD card, eMMC, NVMe, USB, DHCP/TFTP), and at least tries to still support the StarFive DTB load+edit+write and SDK images: https://github.com/MichaIng/linux/blob/6.1-visionfive2/linux-image-visionfive2/etc/u-boot-initial-env

@vpx23
Copy link
Author

vpx23 commented Nov 29, 2023

Thanks for the insight, could you please tell me the source where I can find this information? Bugtracker, mailing list, release notes, version history, changelog etc., thanks.

@MichaIng
Copy link

MichaIng commented Nov 29, 2023

This commit broke it: starfive-tech/u-boot@1f26242

distro_bootcmd loops through all boot targets and checks all partitions for boot scripts/methods, so it was a generic fallback if the prior StarFive specific commands did not succeed. Now this has gone and only two StarFive-specific commands run, which hardcode a dedicated boot partition 3 with FAT filesystem, extlinux, and root partition 4, without any fallback. You can see both functions/methods added here: starfive-tech/u-boot@af8ba43

This is not a bug, but a totally unnecessary and complex hardcoding of needs for the image this U-Boot is able to boot. The upstream defaults do everything pretty well in a generic way, so there is actually no point to interfere. The only reasons for a custom environment are the in-memory U-Boot DTB rewrites for A revision Ethernet and different RAM sizes, and the (IMO problematic) on-disk DTB file rewrite done on every reboot with StarFive images to achieve the same for the Linux distribution. However, this can be done without breaking generic boot support, which is what we do with the bottom part of the environment I linked.

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