skiffos / SkiffOS

Any Linux distribution, anywhere.
https://skiffos.com
MIT License
685 stars 50 forks source link

VisionFive 2 uboot broken and kernel panic #291

Closed clayauld closed 1 year ago

clayauld commented 1 year ago

I have been able to manually trigger a boot of SkiffOS through some uboot commands that I referred back to when working on the Visionfive 1 board.

I used a workaround where I have a working Debian image on eMMC to trigger a successful launch of OpenSBI and U-Boot. I halt the autoboot process and manually enter these commands:

StarFive # mmc list                                                                                       │
sdio0@16010000: 0 (eMMC)                                                                                  │
sdio1@16020000: 1

StarFive # load mmc 1:1 $kernel_addr_r /boot/Image
22048768 bytes read in 926 ms (22.7 MiB/s)

StarFive #  load mmc 1:1 $fdt_addr_r /boot/jh7110-visionfive-v2.dtb
47809 bytes read in 9 ms (5.1 MiB/s)

StarFive # booti $kernel_addr_r - $fdt_addr_r

The kernel then boots, but ends in a kernel panic.

The full U-Boot log is here:

Main section boot fail,use backup section

U-Boot SPL 2021.10 (Feb 24 2023 - 03:37:30 -0500)
DDR version: dc2e84f0.
Trying to boot from MMC1

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 24 2023 - 03:37:30 -0500)

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

StarFive EEPROM format v2

--------EEPROM INFO--------
Vendor : StarFive Technology Co., Ltd.
Product full SN: VF7110B1-2253-D008E000-00007047
data version: 0x2
PCB revision: 0xb2
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:6a:0a
Ethernet MAC1 address: 6c:cf:39:00:6a:0d
--------EEPROM INFO--------

In:    serial@10000000
Out:   serial@10000000
Err:   serial@10000000
Model: StarFive VisionFive V2
Net:   eth0: ethernet@16030000, eth1: ethernet@16040000
bootmode emmc device 0
406 bytes read in 4 ms (98.6 KiB/s)
Importing environment from mmc0 ...
Can't set block device
Hit any key to stop autoboot:  0
StarFive # load mmc 1:1 $kernel_addr_r /boot/Image
22048768 bytes read in 927 ms (22.7 MiB/s)
StarFive # load mmc 1:1 $fdt_addr_r /boot/jh7110-visionfive-v2.dtb
47809 bytes read in 8 ms (5.7 MiB/s)
StarFive # booti $kernel_addr_r - $fdt_addr_r
Moving Image from 0x44000000 to 0x40200000, end=41772000
## Flattened Device Tree blob at 48000000
   Booting using the fdt blob at 0x48000000
   Using Device Tree in place at 0000000048000000, end 000000004800eac0

Starting kernel ...

clk u5_dw_i2c_clk_core already disabled
clk u5_dw_i2c_clk_apb already disabled
[    0.000000] Linux version 5.15.0 (clayauld@LT-U01215-pop-os) (riscv64-buildroot-linux-gnu-gcc.br_real 3
[    0.000000] OF: fdt: Ignoring memory range 0x40000000 - 0x40200000
[    0.000000] Machine model: StarFive VisionFive V2
[    0.000000] earlycon: sbi0 at I/O port 0x0 (options '')
[    0.000000] printk: bootconsole [sbi0] enabled
[    0.000000] efi: UEFI not found.
[    0.000000] Reserved memory: created CMA memory pool at 0x0000000080000000, size 512 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000040200000-0x00000000ffffffff]
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000023fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040200000-0x00000000c010ffff]
[    0.000000]   node   0: [mem 0x00000000c0110000-0x00000000c01fffff]
[    0.000000]   node   0: [mem 0x00000000c0200000-0x000000023fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040200000-0x000000023fffffff]
[    0.000000] SBI specification v1.0 detected
[    0.000000] SBI implementation ID=0x1 Version=0x10002
[    0.000000] SBI TIME extension detected
[    0.000000] SBI IPI extension detected
[    0.000000] SBI RFENCE extension detected
[    0.000000] SBI SRST extension detected
[    0.000000] SBI v0.2 HSM extension detected
[    0.000000] CPU with hartid=0 is not available
[    0.000000] CPU with hartid=0 is not available
[    0.000000] riscv: base ISA extensions acdfim
[    0.000000] riscv: ELF capabilities acdfim
[    0.000000] percpu: Embedded 18 pages/cpu s34984 r8192 d30552 u73728
[    0.000000] pcpu-alloc: s34984 r8192 d30552 u73728 alloc=18*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 2063880
[    0.000000] Kernel command line: console=ttyS0,115200  debug rootwait  earlycon=sbi
[    0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
[    0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] mem auto-init: stack:all(zero), heap alloc:off, heap free:off
[    0.000000] software IO TLB: mapped [mem 0x00000000fbfff000-0x00000000fffff000] (64MB)
[    0.000000] Memory: 7477996K/8386560K available (9596K kernel code, 4997K rwdata, 4096K rodata, 2198K )
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
[    0.000000] rcu:     RCU debug extended QS entry/exit.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] CPU with hartid=0 is not available
[    0.000000] riscv-intc: unable to find hart id for /cpus/cpu@0/interrupt-controller
[    0.000000] riscv-intc: 64 local interrupts mapped
[    0.000000] plic: plic@c000000: mapped 136 interrupts with 4 handlers for 9 contexts.
[    0.000000] random: get_random_bytes called from start_kernel+0x4cc/0x6d2 with crng_init=0
[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1]
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idles
[    0.000001] sched_clock: 64 bits at 4MHz, resolution 250ns, wraps every 2199023255500ns
[    0.008238] clocksource: timer@13050000.ch0: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 796s
[    0.018462] clocksource: timer@13050000.ch1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 796s
[    0.028775] clocksource: timer@13050000.ch2: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 796s
[    0.039089] clocksource: timer@13050000.ch3: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 796s
[    0.049610] Console: colour dummy device 80x25
[    0.054018] Calibrating delay loop (skipped), value calculated using timer frequency.. 8.00 BogoMIPS ()
[    0.064212] pid_max: default: 32768 minimum: 301
[    0.069156] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.076821] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.086482] ASID allocator disabled
[    0.090024] rcu: Hierarchical SRCU implementation.
[    0.094962] EFI services will not be available.
[    0.099835] smp: Bringing up secondary CPUs ...
[    0.106180] smp: Brought up 1 node, 4 CPUs
[    0.112230] devtmpfs: initialized
[    0.123604] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750s
[    0.133389] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.155226] pinctrl core: initialized pinctrl subsystem
[    0.161346] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.167825] cpuidle: using governor menu
[    0.193589] platform soc:dsi-output: Fixing up cyclic dependency with 29400000.dc8200
[    0.201886] platform 295d0000.mipi: Fixing up cyclic dependency with soc:dsi-output
[    0.209862] platform 29590000.hdmi: Fixing up cyclic dependency with 29400000.dc8200
[    0.227517] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.234166] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.244921] SCSI subsystem initialized
[    0.248747] libata version 3.00 loaded.
[    0.252719] usbcore: registered new interface driver usbfs
[    0.258170] usbcore: registered new interface driver hub
[    0.263603] usbcore: registered new device driver usb
[    0.269069] Advanced Linux Sound Architecture Driver Initialized.
[    0.275646] Bluetooth: Core ver 2.22
[    0.279162] NET: Registered PF_BLUETOOTH protocol family
[    0.284512] Bluetooth: HCI device and connection manager initialized
[    0.290945] Bluetooth: HCI socket layer initialized
[    0.295869] Bluetooth: L2CAP socket layer initialized
[    0.301005] Bluetooth: SCO socket layer initialized
[    0.306232] clocksource: Switched to clocksource riscv_clocksource
[    0.320409] NET: Registered PF_INET protocol family
[    0.326269] IP idents hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.341455] tcp_listen_portaddr_hash hash table entries: 4096 (order: 5, 163840 bytes, linear)
[    0.350250] TCP established hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.358935] TCP bind hash table entries: 65536 (order: 9, 2097152 bytes, linear)
[    0.368289] TCP: Hash tables configured (established 65536 bind 65536)
[    0.375747] MPTCP token hash table entries: 8192 (order: 6, 393216 bytes, linear)
[    0.383547] UDP hash table entries: 4096 (order: 6, 393216 bytes, linear)
[    0.390725] UDP-Lite hash table entries: 4096 (order: 6, 393216 bytes, linear)
[    0.398453] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.404774] RPC: Registered named UNIX socket transport module.
[    0.410638] RPC: Registered udp transport module.
[    0.415387] RPC: Registered tcp transport module.
[    0.420166] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.427854] Trying to unpack rootfs image as initramfs...
[    0.428368] Initialise system trusted keyrings
[    0.433256] rootfs image is not initramfs (invalid magic at start of compressed archive); looks like ad
[    0.437891] workingset: timestamp_bits=46 max_order=21 bucket_order=0
[    0.461969] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.468657] NFS: Registering the id_resolver key type
[    0.473672] Key type id_resolver registered
[    0.477970] Key type id_legacy registered
[    0.482112] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.488838] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.496313] ntfs: driver 2.1.32 [Flags: R/W].
[    0.500879] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    0.546629] NET: Registered PF_ALG protocol family
[    0.551382] Key type asymmetric registered
[    0.555529] Asymmetric key parser 'x509' registered
[    0.560655] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    0.568068] io scheduler mq-deadline registered
[    0.572589] io scheduler kyber registered
[    0.576942] io scheduler bfq registered
[    0.581338] start plist test
[    0.588666] end plist test
[    0.708460] clk-starfive-jh7110 13020000.clock-controller: starfive JH7110 clkgen init successfully.
[    0.798826] Freeing initrd memory: 97280K
[    0.825717] Serial: 8250/16550 driver, 6 ports, IRQ sharing disabled
[    0.834994] @@#########################@@
[    0.844637] L2CACHE: base addr invalid, skipping flush

[...]

[   28.110312] L2CACHE: base addr invalid, skipping flush
[   28.115496] L2CACHE: base addr invalid, skipping flush
[   28.120712] L2CACHE: base addr invalid, skipping flush
[   28.125896] L2CACHE: base addr invalid, skipping flush
[   28.131112] L2CACHE: base addr invalid, skipping flush
[   28.136299] watchdog: BUG: soft lockup - CPU#0 stuck for 26s! [swapper/0:1]
[   28.136319] Modules linked in:
[   28.136329] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.0 #1
[   28.136339] Hardware name: StarFive VisionFive V2 (DT)
[   28.136345] epc : console_unlock+0x30c/0x410
[   28.136371]  ra : console_unlock+0x308/0x410
[   28.136387] epc : ffffffff800612f0 ra : ffffffff800612ec sp : ffffffd00400b500
[   28.136406]  gp : ffffffff815061f0 tp : ffffffe0bff40000 t0 : ffffffff815155af
[   28.136425]  t1 : ffffffff815155a0 t2 : 0000000000000000 s0 : ffffffd00400b600
[   28.136443]  s1 : ffffffff815075e8 a0 : ffffffff8141cff0 a1 : 0000000000000000
[   28.136461]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000000
[   28.136478]  a5 : ffffffe1f796c6ec a6 : 0000000000000000 a7 : 0000000000000001
[   28.136495]  s2 : ffffffff815075b8 s3 : 0000000000000000 s4 : 0000000000000002
[   28.136513]  s5 : 0000000000000000 s6 : 0000000000000000 s7 : ffffffff815075a8
[   28.136530]  s8 : ffffffff81507200 s9 : ffffffff81505be0 s10: ffffffff8141cee0
[   28.136548]  s11: 0000000000000000 t3 : 000000000000004c t4 : ffffffffffffffff
[   28.136566]  t5 : 0000000000000068 t6 : ffffffff815155af
[   28.136579] status: 0000000200000120 badaddr: 0000000000000000 cause: 8000000000000005
[   28.136600] [<ffffffff800612f0>] console_unlock+0x30c/0x410
[   28.136613] [<ffffffff80062350>] vprintk_emit+0x58/0x15a
[   28.136627] [<ffffffff80062468>] vprintk_default+0x16/0x1e
[   28.136640] [<ffffffff8006290a>] vprintk+0x72/0x80
[   28.136653] [<ffffffff8094fd54>] _printk+0x36/0x50
[   28.136670] [<ffffffff8040878e>] sifive_l2_flush64_range+0x88/0xa0
[   28.136685] [<ffffffff8053048a>] SysDevHost_Cache_Maintenance+0x92/0x9a
[   28.136704] [<ffffffff8050d2c2>] OSCPUCacheFlushRangeKM+0x2e/0x36
[   28.136722] [<ffffffff804c7970>] CacheOpExec+0x66/0x70
[   28.136738] [<ffffffff80498fbc>] _AllocOSPages+0x10d6/0x144c
[   28.136754] [<ffffffff8049a0dc>] PhysmemNewOSRamBackedPMR+0x518/0x58a
[   28.136768] [<ffffffff804ada96>] PhysHeapCreatePMR+0x30/0x3a
[   28.136785] [<ffffffff804ae67e>] PhysmemNewRamBackedPMR_direct+0x1f2/0x47c
[   28.136801] [<ffffffff8052f6b0>] BridgePhysmemNewRamBackedPMR+0x56/0x7e
[   28.136814] [<ffffffff8049c4de>] AllocateDeviceMemory+0xce/0x1b2
[   28.136829] [<ffffffff8049d6fc>] DevmemAllocateExportable+0xa2/0x146
[   28.136844] [<ffffffff804c5d28>] TLAllocSharedMemIfNull+0xbc/0x14c
[   28.136857] [<ffffffff804c5fa6>] TLStreamCreate+0x1be/0x2f2
[   28.136870] [<ffffffff8050228c>] PDumpInitCommon+0x1a6/0x77c
[   28.136881] [<ffffffff804bbe88>] PVRSRVCommonDriverInit+0x2da/0x654
[   28.136899] [<ffffffff80493d48>] PVRSRVDriverInit+0x16/0x66
[   28.136911] [<ffffffff80a1fcbe>] pvr_init+0x4e/0x6a
[   28.136924] [<ffffffff80002114>] do_one_initcall+0x58/0x182
[   28.136936] [<ffffffff80a00fa2>] kernel_init_freeable+0x1f6/0x258
[   28.136951] [<ffffffff8095991e>] kernel_init+0x1e/0x104
[   28.136966] [<ffffffff8000312c>] ret_from_exception+0x0/0xc
[   28.404748] L2CACHE: base addr invalid, skipping flush

[...]

[   47.203368] L2CACHE: base addr invalid, skipping flush
[   47.209480] L2CACHE: base addr invalid, skipping flush
[   47.214658] L2CACHE: base addr invalid, skipping flush
[   47.229653] brd: module loaded
[   47.240915] loop: module loaded
[   47.245493] libphy: Fixed MDIO Bus: probed
[   47.251080] CAN device driver interface
[   47.256307] i2c_dev: i2c /dev entries driver
[   47.261197] Bluetooth: HCI UART driver ver 2.3
[   47.265571] Bluetooth: HCI UART protocol H4 registered
[   47.271517] sdhci: Secure Digital Host Controller Interface driver
[   47.277650] sdhci: Copyright(c) Pierre Ossman
[   47.282078] Synopsys Designware Multimedia Card Interface Driver
[   47.288440] sdhci-pltfm: SDHCI platform and OF driver helper
[   47.294851] riscv-pmu-sbi: SBI PMU extension is available
[   47.300217] riscv-pmu-sbi: 16 firmware and 4 hardware counters
[   47.306069] riscv-pmu-sbi: Perf sampling/filtering is not supported as sscof extension is not available
[   47.324147] NET: Registered PF_INET6 protocol family
[   47.332506] Segment Routing with IPv6
[   47.336127] In-situ OAM (IOAM) with IPv6
[   47.340254] NET: Registered PF_PACKET protocol family
[   47.345305] Bridge firewalling registered
[   47.349333] can: controller area network core
[   47.353907] NET: Registered PF_CAN protocol family
[   47.358650] can: raw protocol
[   47.361667] can: broadcast manager protocol
[   47.365916] can: netlink gateway - max_hops=1
[   47.370624] Bluetooth: RFCOMM TTY layer initialized
[   47.375442] Bluetooth: RFCOMM socket layer initialized
[   47.380679] Bluetooth: RFCOMM ver 1.11
[   47.384459] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   47.389842] Bluetooth: BNEP socket layer initialized
[   47.394849] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[   47.400845] Bluetooth: HIDP socket layer initialized
[   47.406061] lib80211: common routines for IEEE802.11 drivers
[   47.411671] lib80211_crypt: registered algorithm 'NULL'
[   47.416955] lib80211_crypt: registered algorithm 'WEP'
[   47.422134] lib80211_crypt: registered algorithm 'CCMP'
[   47.427436] lib80211_crypt: registered algorithm 'TKIP'
[   47.432727] Key type dns_resolver registered
[   47.437909] Loading compiled-in X.509 certificates
[   58.705159] Unable to handle kernel paging request at virtual address ffffffe07ff10000
[   58.713066] Oops [#1]
[   58.715376] Modules linked in:
[   58.718499] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G             L    5.15.0 #1
[   58.725863] Hardware name: StarFive VisionFive V2 (DT)
[   58.731063] epc : crc32_body+0x2c/0x132
[   58.734963]  ra : crc32_be+0x40/0x6a
[   58.738603] epc : ffffffff8036332c ra : ffffffff803634ae sp : ffffffd00400bd90
[   58.745883]  gp : ffffffff815061f0 tp : ffffffe0bff40000 t0 : ffffffffa0ce67de
[   58.753163]  t1 : 0000000000000004 t2 : ffffffff82457406 s0 : ffffffd00400bda0
[   58.760443]  s1 : 000000000000ff00 a0 : ffffffe07ff0fffc a1 : 0000000000001000
[   58.767723]  a2 : ffffffff80e438fc a3 : ffffffff80e43500 a4 : 0000000044c4da5d
[   58.775003]  a5 : ffffffffc924bf4e a6 : ffffffe0d4acccc4 a7 : 0000000000002000
[   58.782283]  s2 : 0000000000ff0000 s3 : 0000000000000007 s4 : ffffffff81507008
[   58.789563]  s5 : ffffffff80c1c038 s6 : ffffffff81507038 s7 : ffffffff80c00478
[   58.796843]  s8 : 0000000000000008 s9 : ffffffff80a000ac s10: 0000000000000000
[   58.804123]  s11: 0000000000000000 t3 : 000000007d192cb7 t4 : fffffffff76765b0
[   58.811403]  t5 : 000000007ba0608f t6 : ffffffffb440f7b1
[   58.816776] status: 0000000200000120 badaddr: ffffffe07ff10000 cause: 000000000000000d
[   58.824751] [<ffffffff8036332c>] crc32_body+0x2c/0x132
[   58.829982] ---[ end trace 365db12a39ca846f ]---
[   58.834636] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[   58.842344] SMP: stopping secondary CPUs
[   58.846347] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---
paralin commented 1 year ago

Unfortunately I don't have a visionfive2, @maxberger were you able to get it working with your board?

I'll take a pass at updating everything related to the config to match the reference buildroot the vendor publishes here shortly (in the next hour or so)

maxberger commented 1 year ago

I haven't tried with the latest version, will do that tomorrow. I've always used SD card only, so I have no experience with MMC.

clayauld commented 1 year ago

There are workarounds to getting boot from eMMC working, and the Starfive buildroot build works with that.

I'm not as concerned with making eMMC boot work until I get this to work on SD. Lots of the distros don't support it yet for this board. That's something for another day....

paralin commented 1 year ago

@clayauld I updated the kernel and u-boot on master, could you try these steps?

This is assuming you're using export SKIFF_WORKSPACE=visionfive2

  1. Clean with make clean (or delete workspaces/visionfive2)
  2. Enable bootlin toolchain with mkdir ./overrides/workspaces/visionfive2/buildroot && echo "BR2_TOOLCHAIN_EXTERNAL=y" > ./overrides/workspaces/visionfive2/buildroot/toolchain
  3. git pull master and git submodule update
  4. Compile the system & flash & test

They seem to have changed some things. The kernel errors you sent above seem to be related to the L2 cache being configured incorrectly. I think their newer versions might fix this. Using the bootlin toolchain is just for testing to speed up the build / remove potential variance in the toolchain.

paralin commented 1 year ago

Added +1 commit to rebase the kernel patches, changes:

maxberger commented 1 year ago

The previous version I checked and which worked was 2022.11.1-104-gc444c4f0 (the actual hash is without the g)

I have now done a clean checkout and build of the current version, 2023.02.1-25-gddb1a072 (hash: ddb1a072cd89c46bf70e84cd026b953d2ab3e7be). This one boots and starts fine on my visionfive2.

my buildscript (non-root):

export SKIFF_WORKSPACE=starfive
export SKIFF_CONFIG=starfive/visionfive2,apps/docker,apps/compose
make configure
make compile

then as root:

export SKIFF_WORKSPACE=starfive
export SKIFF_CONFIG=starfive/visionfive2,apps/docker,apps/compose
export STARFIVE_IMAGE=starfive.img
make cmd/starfive/common/buildimage
chmod 666 starfive.img

I then write the sd image to an sd card, the visionfive boots directly from there, no mmc. (bootswitches are at 3 and 4).

The relevant dmesg lines after your crash:

[    2.019094] lib80211_crypt: registered algorithm 'NULL'
[    2.019110] lib80211_crypt: registered algorithm 'WEP'
[    2.019124] lib80211_crypt: registered algorithm 'CCMP'
[    2.019138] lib80211_crypt: registered algorithm 'TKIP'
[    2.019174] Key type dns_resolver registered
[    2.024761] Loading compiled-in X.509 certificates
[    2.071100] starfive_jh7110-pinctrl 13040000.gpio: SiFive GPIO chip registered 64 GPIOs
[    2.080757] starfive_jh7110-pinctrl 17020000.gpio: SiFive GPIO chip registered 4 GPIOs
[    2.089720] pl08xdmac 16008000.sec_dma: initialized 8 virtual memcpy channels
[    2.097608] pl08xdmac 16008000.sec_dma: initialized 16 virtual slave channels
[    2.107282] debugfs: Directory '16008000.sec_dma' with parent 'dmaengine' already present!
[    2.116407] pl08xdmac 16008000.sec_dma: DMA: PL080 rev0 at 0x16008000 irq 23
[    2.124436] ssp-pl022 10060000.spi: ARM PL022 driver for StarFive SoC platform, device ID: 0x00041022
[    2.134621] ssp-pl022 10060000.spi: mapped registers from 0x0000000010060000 to (____ptrval____)
[    2.144739] ssp-pl022 10060000.spi: Requested frequency: 10000000 Hz is unsupported,select by default 8250000 Hz
[    2.156356] ssp-pl022 10060000.spi: will use autosuspend for runtime pm, delay 100ms
[    2.166289] i2c 2-0045: Fixing up cyclic dependency with 295d0000.mipi
[    2.173780] seeed_panel 2-0045: Unknown Atmel firmware revision: 0x00
[    2.181085] tinker_ft5406 2-0038: Address = 0x38
[    2.186163] tinker_ft5406 2-0038: width = 800, height = 480, reverse = 1
[    2.193687] tinker_ft5406 2-0038: i2c read error, -121
[    2.199361] tinker_ft5406 2-0038: Checking touch ic failed
[    2.205399] tinker_ft5406: probe of 2-0038 failed with error -121
[    2.212318] i2c 2-0019: Fixing up cyclic dependency with 295d0000.mipi
[    2.220436] Goodix-TS 2-0014: GTP Driver Version: V2.2<2014/01/14>
[    2.227280] Goodix-TS 2-0014: supply tp not found, using dummy regulator
[    2.437857] Goodix-TS 2-0014: I2C Read: 0x8000, 10 bytes failed, errcode: -121! Process reset.
[    2.607852] Goodix-TS 2-0014: I2C Read: 0x8000, 10 bytes failed, errcode: -121! Process reset.
[    2.777187] Goodix-TS 2-0014: Failed to get chip-type
[    2.782738] Goodix-TS 2-0014: Get chip type failed.
[    2.788254] Goodix-TS: probe of 2-0014 failed with error -22
[    2.795406] at24 5-0050: supply vcc not found, using dummy regulator
[    2.803276] at24 5-0050: 512 byte 24c04 EEPROM, writable, 16 bytes/write
[    2.812627] axp15060-regulator 5-0036: Register mipi_0p9 done! vol range:900 ~ 900 mV
[    2.822768] axp15060-regulator 5-0036: Register hdmi_1p8 done! vol range:1800 ~ 1800 mV
[    2.833131] axp15060-regulator 5-0036: Register hdmi_0p9 done! vol range:900 ~ 900 mV
[    2.843305] axp15060-regulator 5-0036: Register cpu_vdd done! vol range:500 ~ 1540 mV

-> I cannot replicate the error.

maxberger commented 1 year ago

Possible next steps:

I will be away from the machine for 2 weeks, and since I can't replicate the issue I will probably be of little help here. Once I am back I could try to work on the 6.2 kernel if you haven't done so yet.

paralin commented 1 year ago

@clayauld how much memory does your board have? I believe there's a patch that assumes 8GB

clayauld commented 1 year ago

My board is the 8GB version. I have built the new kernel successfully, just haven't had a chance to try booting the board yet. I may be able to get to that this afternoon.

clayauld commented 1 year ago

Again, I had to boot from eMMC with valid Debian image, interrupt the boot process, and manually enter the following:

load mmc 1:1 $kernel_addr_r /boot/Image
load mmc 1:1 $fdt_addr_r /boot/jh7110-visionfive-v2.dtb
booti $kernel_addr_r - $fdt_addr_r

Full boot log:

Main section boot fail,use backup section

U-Boot SPL 2021.10 (Feb 24 2023 - 03:37:30 -0500)
DDR version: dc2e84f0.
Trying to boot from MMC1

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 24 2023 - 03:37:30 -0500)

CPU:   rv64imacu
Model: StarFive VisionFive V2
DRAM:  8 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-2253-D008E000-00007047
data version: 0x2
PCB revision: 0xb2
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:6a:0a
Ethernet MAC1 address: 6c:cf:39:00:6a:0d
--------EEPROM INFO--------

In:    serial@10000000
Out:   serial@10000000
Err:   serial@10000000
Model: StarFive VisionFive V2
Net:   eth0: ethernet@16030000, eth1: ethernet@16040000
bootmode emmc device 0
406 bytes read in 3 ms (131.8 KiB/s)
Importing environment from mmc0 ...
Can't set block device
Hit any key to stop autoboot:  2  0 
StarFive # load mmc 1:1 $kernel_addr_r /boot/Image
22045184 bytes read in 927 ms (22.7 MiB/s)
StarFive # load mmc 1:1 $fdt_addr_r /boot/jh7110-visionfive-v2.dtb
48366 bytes read in 8 ms (5.8 MiB/s)
StarFive # booti $kernel_addr_r - $fdt_addr_r
Moving Image from 0x44000000 to 0x40200000, end=41772000
## Flattened Device Tree blob at 48000000
   Booting using the fdt blob at 0x48000000
   Using Device Tree in place at 0000000048000000, end 000000004800eced

Starting kernel ...

clk u5_dw_i2c_clk_core already disabled
clk u5_dw_i2c_clk_apb already disabled
[    0.000000] Linux version 5.15.0 (clayauld@LT-U01215-pop-os) (riscv64-linux-gcc.br_real (Buildroot 2021.11-4428-g6b6741b) 12.2.0, GNU ld (GNU Binutils) 2.39) #1 SMP Fri May 26 17:47:03 AKDT 2023
[    0.000000] OF: fdt: Ignoring memory range 0x40000000 - 0x40200000
[    0.000000] Machine model: StarFive VisionFive V2
[    0.000000] earlycon: sbi0 at I/O port 0x0 (options '')
[    0.000000] printk: bootconsole [sbi0] enabled
[    0.000000] efi: UEFI not found.
[    0.000000] Reserved memory: created CMA memory pool at 0x0000000080000000, size 512 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000040200000-0x00000000ffffffff]
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000023fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040200000-0x00000000c010ffff]
[    0.000000]   node   0: [mem 0x00000000c0110000-0x00000000c01fffff]
[    0.000000]   node   0: [mem 0x00000000c0200000-0x000000023fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040200000-0x000000023fffffff]
[    0.000000] SBI specification v1.0 detected
[    0.000000] SBI implementation ID=0x1 Version=0x10002
[    0.000000] SBI TIME extension detected
[    0.000000] SBI IPI extension detected
[    0.000000] SBI RFENCE extension detected
[    0.000000] SBI SRST extension detected
[    0.000000] SBI v0.2 HSM extension detected
[    0.000000] CPU with hartid=0 is not available
[    0.000000] CPU with hartid=0 is not available
[    0.000000] riscv: base ISA extensions acdfim
[    0.000000] riscv: ELF capabilities acdfim
[    0.000000] percpu: Embedded 18 pages/cpu s34984 r8192 d30552 u73728
[    0.000000] pcpu-alloc: s34984 r8192 d30552 u73728 alloc=18*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 2063880
[    0.000000] Kernel command line: console=ttyS0,115200  debug rootwait  earlycon=sbi
[    0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
[    0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] mem auto-init: stack:all(zero), heap alloc:off, heap free:off
[    0.000000] software IO TLB: mapped [mem 0x00000000fbfff000-0x00000000fffff000] (64MB)
[    0.000000] Memory: 7477996K/8386560K available (9540K kernel code, 4993K rwdata, 4096K rodata, 2198K init, 425K bss, 384276K reserved, 524288K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
[    0.000000] rcu:     RCU debug extended QS entry/exit.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] CPU with hartid=0 is not available
[    0.000000] riscv-intc: unable to find hart id for /cpus/cpu@0/interrupt-controller
[    0.000000] riscv-intc: 64 local interrupts mapped
[    0.000000] plic: plic@c000000: mapped 136 interrupts with 4 handlers for 9 contexts.
[    0.000000] random: get_random_bytes called from start_kernel+0x4cc/0x6d2 with crng_init=0
[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1]
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 881590404240 ns
[    0.000000] sched_clock: 64 bits at 4MHz, resolution 250ns, wraps every 2199023255500ns
[    0.008239] clocksource: timer@13050000.ch0: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.018464] clocksource: timer@13050000.ch1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.028777] clocksource: timer@13050000.ch2: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.039091] clocksource: timer@13050000.ch3: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.049609] Console: colour dummy device 80x25
[    0.054018] Calibrating delay loop (skipped), value calculated using timer frequency.. 8.00 BogoMIPS (lpj=40000)
[    0.064213] pid_max: default: 32768 minimum: 301
[    0.069157] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.076825] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.086482] ASID allocator disabled
[    0.090025] rcu: Hierarchical SRCU implementation.
[    0.094964] EFI services will not be available.
[    0.099843] smp: Bringing up secondary CPUs ...
[    0.106183] smp: Brought up 1 node, 4 CPUs
[    0.112236] devtmpfs: initialized
[    0.123669] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.133456] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.155338] pinctrl core: initialized pinctrl subsystem
[    0.161416] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.167844] thermal_sys: Registered thermal governor 'step_wise'
[    0.168192] cpuidle: using governor menu
[    0.200137] platform soc:dsi-output: Fixing up cyclic dependency with 29400000.dc8200
[    0.208411] platform 295d0000.mipi: Fixing up cyclic dependency with soc:dsi-output
[    0.216419] platform 29590000.hdmi: Fixing up cyclic dependency with 29400000.dc8200
[    0.233924] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.240574] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.251274] SCSI subsystem initialized
[    0.255106] libata version 3.00 loaded.
[    0.259048] usbcore: registered new interface driver usbfs
[    0.264510] usbcore: registered new interface driver hub
[    0.269855] usbcore: registered new device driver usb
[    0.275464] Advanced Linux Sound Architecture Driver Initialized.
[    0.282040] Bluetooth: Core ver 2.22
[    0.285570] NET: Registered PF_BLUETOOTH protocol family
[    0.290907] Bluetooth: HCI device and connection manager initialized
[    0.297338] Bluetooth: HCI socket layer initialized
[    0.302263] Bluetooth: L2CAP socket layer initialized
[    0.307400] Bluetooth: SCO socket layer initialized
[    0.312620] clocksource: Switched to clocksource riscv_clocksource
[    0.326761] NET: Registered PF_INET protocol family
[    0.332500] IP idents hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.347693] tcp_listen_portaddr_hash hash table entries: 4096 (order: 5, 163840 bytes, linear)
[    0.356494] TCP established hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.365186] TCP bind hash table entries: 65536 (order: 9, 2097152 bytes, linear)
[    0.375040] TCP: Hash tables configured (established 65536 bind 65536)
[    0.382364] MPTCP token hash table entries: 8192 (order: 6, 393216 bytes, linear)
[    0.390165] UDP hash table entries: 4096 (order: 6, 393216 bytes, linear)
[    0.397393] UDP-Lite hash table entries: 4096 (order: 6, 393216 bytes, linear)
[    0.405151] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.411318] RPC: Registered named UNIX socket transport module.
[    0.417190] RPC: Registered udp transport module.
[    0.421931] RPC: Registered tcp transport module.
[    0.426711] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.434923] Initialise system trusted keyrings
[    0.439501] Trying to unpack rootfs image as initramfs...
[    0.444929] rootfs image is not initramfs (invalid magic at start of compressed archive); looks like an initrd
[    0.444952] workingset: timestamp_bits=46 max_order=21 bucket_order=0
[    0.452120] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.468203] NFS: Registering the id_resolver key type
[    0.473271] Key type id_resolver registered
[    0.477440] Key type id_legacy registered
[    0.481665] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.488358] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.495844] ntfs: driver 2.1.32 [Flags: R/W].
[    0.500429] jffs2: version 2.2. (NAND) \C2 2001-2006 Red Hat, Inc.
[    0.546864] NET: Registered PF_ALG protocol family
[    0.551617] Key type asymmetric registered
[    0.555817] Asymmetric key parser 'x509' registered
[    0.560851] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    0.568230] io scheduler mq-deadline registered
[    0.572800] io scheduler kyber registered
[    0.577100] io scheduler bfq registered
[    0.581467] start plist test
[    0.588649] end plist test
[    0.696492] clk-starfive-jh7110 13020000.clock-controller: starfive JH7110 clkgen init successfully.
[    0.707991] L2CACHE: DataError @ 0x00000000.08040140
[    0.708082] L2CACHE: No. of Banks in the cache: 8
[    0.712897] L2CACHE: DataFail @ 0x00000000.0804005B
[    0.722652] L2CACHE: No. of ways per bank: 16
[    0.727032] L2CACHE: Sets per bank: 256
[    0.730925] L2CACHE: Bytes per cache block: 64
[    0.735510] L2CACHE: Index of the largest way enabled: 15
[    0.809216] Freeing initrd memory: 97280K
[    0.839939] Serial: 8250/16550 driver, 6 ports, IRQ sharing disabled
[    0.849374] @@#########################@@
[    0.868867] brd: module loaded
[    0.880350] loop: module loaded
[    0.884972] libphy: Fixed MDIO Bus: probed
[    0.890473] CAN device driver interface
[    0.895471] i2c_dev: i2c /dev entries driver
[    0.900362] Bluetooth: HCI UART driver ver 2.3
[    0.904759] Bluetooth: HCI UART protocol H4 registered
[    0.910052] cpu cpu0: OPP table can't be empty
[    0.915089] sdhci: Secure Digital Host Controller Interface driver
[    0.921203] sdhci: Copyright(c) Pierre Ossman
[    0.925670] Synopsys Designware Multimedia Card Interface Driver
[    0.931992] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.938405] riscv-pmu-sbi: SBI PMU extension is available
[    0.943770] riscv-pmu-sbi: 16 firmware and 4 hardware counters
[    0.949622] riscv-pmu-sbi: Perf sampling/filtering is not supported as sscof extension is not available
[    0.967843] NET: Registered PF_INET6 protocol family
[    0.976400] Segment Routing with IPv6
[    0.980018] In-situ OAM (IOAM) with IPv6
[    0.984153] NET: Registered PF_PACKET protocol family
[    0.989198] Bridge firewalling registered
[    0.993230] can: controller area network core
[    0.997804] NET: Registered PF_CAN protocol family
[    1.002527] can: raw protocol
[    1.005585] can: broadcast manager protocol
[    1.009812] can: netlink gateway - max_hops=1
[    1.014531] Bluetooth: RFCOMM TTY layer initialized
[    1.019348] Bluetooth: RFCOMM socket layer initialized
[    1.024588] Bluetooth: RFCOMM ver 1.11
[    1.028365] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    1.033752] Bluetooth: BNEP socket layer initialized
[    1.038754] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[    1.044758] Bluetooth: HIDP socket layer initialized
[    1.049961] lib80211: common routines for IEEE802.11 drivers
[    1.055574] lib80211_crypt: registered algorithm 'NULL'
[    1.060832] lib80211_crypt: registered algorithm 'WEP'
[    1.066057] lib80211_crypt: registered algorithm 'CCMP'
[    1.071319] lib80211_crypt: registered algorithm 'TKIP'
[    1.076643] Key type dns_resolver registered
[    1.081763] Loading compiled-in X.509 certificates
[   12.351698] Unable to handle kernel paging request at virtual address ffffffe07ff10000
[   12.359604] Oops [#1]
[   12.361913] Modules linked in:
[   12.365035] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.15.0 #1
[   12.371013] Hardware name: StarFive VisionFive V2 (DT)
[   12.376214] epc : crc32_body+0x2c/0x132
[   12.380113]  ra : crc32_be+0x40/0x6a
[   12.383753] epc : ffffffff8036332c ra : ffffffff803634ae sp : ffffffd00400bd90
[   12.391033]  gp : ffffffff815053c0 tp : ffffffe0bff40000 t0 : ffffffffb123bd3a
[   12.398313]  t1 : 0000000000000004 t2 : 000000006bbcfc92 s0 : ffffffd00400bda0
[   12.405593]  s1 : 000000000000ff00 a0 : ffffffe07ff0fffc a1 : 0000000000001000
[   12.412873]  a2 : ffffffff80e4393c a3 : ffffffff80e43540 a4 : ffffffffbe608cbc
[   12.420153]  a5 : ffffffffc924bf4e a6 : ffffffe0d4acccc4 a7 : 0000000000002000
[   12.427434]  s2 : 0000000000ff0000 s3 : 0000000000000007 s4 : ffffffff81507008
[   12.434713]  s5 : ffffffff80c1c048 s6 : ffffffff81507038 s7 : ffffffff80c00478
[   12.441993]  s8 : 0000000000000008 s9 : ffffffff80a000ac s10: 0000000000000000
[   12.449273]  s11: 0000000000000000 t3 : 000000007d192cb7 t4 : 000000004209d5e6
[   12.456553]  t5 : 000000007ba0608f t6 : ffffffffb440f7b1
[   12.461927] status: 0000000200000120 badaddr: ffffffe07ff10000 cause: 000000000000000d
[   12.469901] [<ffffffff8036332c>] crc32_body+0x2c/0x132
[   12.475132] ---[ end trace 8f58925ba5d14c4a ]---
[   12.479786] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[   12.487494] SMP: stopping secondary CPUs
[   12.491498] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---
Main section boot fail,use backup section
Main section boot fail,use backup section

U-Boot SPL 2021.10 (Feb 24 2023 - 03:37:30 -0500)
DDR version: dc2e84f0.
Trying to boot from MMC1

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 24 2023 - 03:37:30 -0500)

CPU:   rv64imacu
Model: StarFive VisionFive V2
DRAM:  8 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-2253-D008E000-00007047
data version: 0x2
PCB revision: 0xb2
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:6a:0a
Ethernet MAC1 address: 6c:cf:39:00:6a:0d
--------EEPROM INFO--------

In:    serial@10000000
Out:   serial@10000000
Err:   serial@10000000
Model: StarFive VisionFive V2
Net:   eth0: ethernet@16030000, eth1: ethernet@16040000
bootmode emmc device 0
406 bytes read in 4 ms (98.6 KiB/s)
Importing environment from mmc0 ...
Can't set block device
Hit any key to stop autoboot:  2  0 
StarFive # load mmc 1:1 $kernel_addr_r /boot/Image
22045184 bytes read in 927 ms (22.7 MiB/s)
StarFive # load mmc 1:1 $fdt_addr_r /boot/jh7110-visionfive-v2.dtb
48366 bytes read in 8 ms (5.8 MiB/s)
StarFive # booti $kernel_addr_r - $fdt_addr_r
Moving Image from 0x44000000 to 0x40200000, end=41772000
## Flattened Device Tree blob at 48000000
   Booting using the fdt blob at 0x48000000
   Using Device Tree in place at 0000000048000000, end 000000004800eced

Starting kernel ...

clk u5_dw_i2c_clk_core already disabled
clk u5_dw_i2c_clk_apb already disabled
[    0.000000] Linux version 5.15.0 (clayauld@LT-U01215-pop-os) (riscv64-linux-gcc.br_real (Buildroot 2021.11-4428-g6b6741b) 12.2.0, GNU ld (GNU Binutils) 2.39) #1 SMP Fri May 26 17:47:03 AKDT 2023
[    0.000000] OF: fdt: Ignoring memory range 0x40000000 - 0x40200000
[    0.000000] Machine model: StarFive VisionFive V2
[    0.000000] earlycon: sbi0 at I/O port 0x0 (options '')
[    0.000000] printk: bootconsole [sbi0] enabled
[    0.000000] efi: UEFI not found.
[    0.000000] Reserved memory: created CMA memory pool at 0x0000000080000000, size 512 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000040200000-0x00000000ffffffff]
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000023fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040200000-0x00000000c010ffff]
[    0.000000]   node   0: [mem 0x00000000c0110000-0x00000000c01fffff]
[    0.000000]   node   0: [mem 0x00000000c0200000-0x000000023fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040200000-0x000000023fffffff]
[    0.000000] SBI specification v1.0 detected
[    0.000000] SBI implementation ID=0x1 Version=0x10002
[    0.000000] SBI TIME extension detected
[    0.000000] SBI IPI extension detected
[    0.000000] SBI RFENCE extension detected
[    0.000000] SBI SRST extension detected
[    0.000000] SBI v0.2 HSM extension detected
[    0.000000] CPU with hartid=0 is not available
[    0.000000] CPU with hartid=0 is not available
[    0.000000] riscv: base ISA extensions acdfim
[    0.000000] riscv: ELF capabilities acdfim
[    0.000000] percpu: Embedded 18 pages/cpu s34984 r8192 d30552 u73728
[    0.000000] pcpu-alloc: s34984 r8192 d30552 u73728 alloc=18*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 2063880
[    0.000000] Kernel command line: console=ttyS0,115200  debug rootwait  earlycon=sbi
[    0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
[    0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] mem auto-init: stack:all(zero), heap alloc:off, heap free:off
[    0.000000] software IO TLB: mapped [mem 0x00000000fbfff000-0x00000000fffff000] (64MB)
[    0.000000] Memory: 7477996K/8386560K available (9540K kernel code, 4993K rwdata, 4096K rodata, 2198K init, 425K bss, 384276K reserved, 524288K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
[    0.000000] rcu:     RCU debug extended QS entry/exit.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] CPU with hartid=0 is not available
[    0.000000] riscv-intc: unable to find hart id for /cpus/cpu@0/interrupt-controller
[    0.000000] riscv-intc: 64 local interrupts mapped
[    0.000000] plic: plic@c000000: mapped 136 interrupts with 4 handlers for 9 contexts.
[    0.000000] random: get_random_bytes called from start_kernel+0x4cc/0x6d2 with crng_init=0
[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1]
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 881590404240 ns
[    0.000001] sched_clock: 64 bits at 4MHz, resolution 250ns, wraps every 2199023255500ns
[    0.008240] clocksource: timer@13050000.ch0: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.018465] clocksource: timer@13050000.ch1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.028778] clocksource: timer@13050000.ch2: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.039092] clocksource: timer@13050000.ch3: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.049611] Console: colour dummy device 80x25
[    0.054021] Calibrating delay loop (skipped), value calculated using timer frequency.. 8.00 BogoMIPS (lpj=40000)
[    0.064214] pid_max: default: 32768 minimum: 301
[    0.069141] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.076807] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.086465] ASID allocator disabled
[    0.090007] rcu: Hierarchical SRCU implementation.
[    0.094944] EFI services will not be available.
[    0.099818] smp: Bringing up secondary CPUs ...
[    0.106168] smp: Brought up 1 node, 4 CPUs
[    0.112231] devtmpfs: initialized
[    0.123662] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.133448] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.155303] pinctrl core: initialized pinctrl subsystem
[    0.161383] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.167815] thermal_sys: Registered thermal governor 'step_wise'
[    0.168165] cpuidle: using governor menu
[    0.200094] platform soc:dsi-output: Fixing up cyclic dependency with 29400000.dc8200
[    0.208369] platform 295d0000.mipi: Fixing up cyclic dependency with soc:dsi-output
[    0.216373] platform 29590000.hdmi: Fixing up cyclic dependency with 29400000.dc8200
[    0.233885] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.240534] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.251270] SCSI subsystem initialized
[    0.255106] libata version 3.00 loaded.
[    0.259050] usbcore: registered new interface driver usbfs
[    0.264513] usbcore: registered new interface driver hub
[    0.269860] usbcore: registered new device driver usb
[    0.275463] Advanced Linux Sound Architecture Driver Initialized.
[    0.282040] Bluetooth: Core ver 2.22
[    0.285570] NET: Registered PF_BLUETOOTH protocol family
[    0.290906] Bluetooth: HCI device and connection manager initialized
[    0.297337] Bluetooth: HCI socket layer initialized
[    0.302262] Bluetooth: L2CAP socket layer initialized
[    0.307399] Bluetooth: SCO socket layer initialized
[    0.312623] clocksource: Switched to clocksource riscv_clocksource
[    0.326762] NET: Registered PF_INET protocol family
[    0.332495] IP idents hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.347704] tcp_listen_portaddr_hash hash table entries: 4096 (order: 5, 163840 bytes, linear)
[    0.356498] TCP established hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.365178] TCP bind hash table entries: 65536 (order: 9, 2097152 bytes, linear)
[    0.375026] TCP: Hash tables configured (established 65536 bind 65536)
[    0.382482] MPTCP token hash table entries: 8192 (order: 6, 393216 bytes, linear)
[    0.390280] UDP hash table entries: 4096 (order: 6, 393216 bytes, linear)
[    0.397521] UDP-Lite hash table entries: 4096 (order: 6, 393216 bytes, linear)
[    0.405280] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.411597] RPC: Registered named UNIX socket transport module.
[    0.417467] RPC: Registered udp transport module.
[    0.422210] RPC: Registered tcp transport module.
[    0.426991] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.434686] Trying to unpack rootfs image as initramfs...
[    0.435206] Initialise system trusted keyrings
[    0.440088] rootfs image is not initramfs (invalid magic at start of compressed archive); looks like an initrd
[    0.444743] workingset: timestamp_bits=46 max_order=21 bucket_order=0
[    0.468840] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.475571] NFS: Registering the id_resolver key type
[    0.480583] Key type id_resolver registered
[    0.484877] Key type id_legacy registered
[    0.489030] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.495750] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.503216] ntfs: driver 2.1.32 [Flags: R/W].
[    0.507804] jffs2: version 2.2. (NAND) \C2 2001-2006 Red Hat, Inc.
[    0.553226] NET: Registered PF_ALG protocol family
[    0.557978] Key type asymmetric registered
[    0.562127] Asymmetric key parser 'x509' registered
[    0.567253] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    0.574653] io scheduler mq-deadline registered
[    0.579188] io scheduler kyber registered
[    0.583549] io scheduler bfq registered
[    0.587951] start plist test
[    0.596695] end plist test
[    0.704695] clk-starfive-jh7110 13020000.clock-controller: starfive JH7110 clkgen init successfully.
[    0.716325] L2CACHE: DataError @ 0x00000000.08040110
[    0.721468] L2CACHE: DataFail @ 0x00000000.0804005B
[    0.726569] L2CACHE: Could not request IRQ 0
[    0.808230] Freeing initrd memory: 97280K
[    0.836948] Serial: 8250/16550 driver, 6 ports, IRQ sharing disabled
[    0.846378] @@#########################@@
[    0.865902] brd: module loaded
[    0.877191] loop: module loaded
[    0.881762] libphy: Fixed MDIO Bus: probed
[    0.887271] CAN device driver interface
[    0.892233] i2c_dev: i2c /dev entries driver
[    0.897152] Bluetooth: HCI UART driver ver 2.3
[    0.901526] Bluetooth: HCI UART protocol H4 registered
[    0.906853] cpu cpu0: OPP table can't be empty
[    0.911840] sdhci: Secure Digital Host Controller Interface driver
[    0.917988] sdhci: Copyright(c) Pierre Ossman
[    0.922406] Synopsys Designware Multimedia Card Interface Driver
[    0.928761] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.935178] riscv-pmu-sbi: SBI PMU extension is available
[    0.940524] riscv-pmu-sbi: 16 firmware and 4 hardware counters
[    0.946423] riscv-pmu-sbi: Perf sampling/filtering is not supported as sscof extension is not available
[    0.964746] NET: Registered PF_INET6 protocol family
[    0.973384] Segment Routing with IPv6
[    0.977003] In-situ OAM (IOAM) with IPv6
[    0.981111] NET: Registered PF_PACKET protocol family
[    0.986185] Bridge firewalling registered
[    0.990160] can: controller area network core
[    0.994777] NET: Registered PF_CAN protocol family
[    0.999500] can: raw protocol
[    1.002535] can: broadcast manager protocol
[    1.006804] can: netlink gateway - max_hops=1
[    1.011480] Bluetooth: RFCOMM TTY layer initialized
[    1.016323] Bluetooth: RFCOMM socket layer initialized
[    1.021506] Bluetooth: RFCOMM ver 1.11
[    1.025328] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    1.030682] Bluetooth: BNEP socket layer initialized
[    1.035714] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[    1.041687] Bluetooth: HIDP socket layer initialized
[    1.046923] lib80211: common routines for IEEE802.11 drivers
[    1.052509] lib80211_crypt: registered algorithm 'NULL'
[    1.057823] lib80211_crypt: registered algorithm 'WEP'
[    1.063014] lib80211_crypt: registered algorithm 'CCMP'
[    1.068282] lib80211_crypt: registered algorithm 'TKIP'
[    1.073604] Key type dns_resolver registered
[    1.078737] Loading compiled-in X.509 certificates
[   12.360281] Unable to handle kernel paging request at virtual address ffffffe07ff10000
[   12.368186] Oops [#1]
[   12.370496] Modules linked in:
[   12.373618] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.0 #1
[   12.379596] Hardware name: StarFive VisionFive V2 (DT)
[   12.384796] epc : crc32_body+0x2c/0x132
[   12.388696]  ra : crc32_be+0x40/0x6a
[   12.392336] epc : ffffffff8036332c ra : ffffffff803634ae sp : ffffffd00400bd90
[   12.399616]  gp : ffffffff815053c0 tp : ffffffe0bff40000 t0 : 0000000018253178
[   12.406896]  t1 : 0000000000000004 t2 : 000000006db23526 s0 : ffffffd00400bda0
[   12.414176]  s1 : 000000000000ff00 a0 : ffffffe07ff0fffc a1 : 0000000000001000
[   12.421456]  a2 : ffffffff80e4393c a3 : ffffffff80e43540 a4 : fffffffffb9a448a
[   12.428736]  a5 : ffffffffc924bf4e a6 : ffffffe0d4acccc4 a7 : 0000000000002000
[   12.436016]  s2 : 0000000000ff0000 s3 : 0000000000000007 s4 : ffffffff81507008
[   12.443296]  s5 : ffffffff80c1c048 s6 : ffffffff81507038 s7 : ffffffff80c00478
[   12.450576]  s8 : 0000000000000008 s9 : ffffffff80a000ac s10: 0000000000000000
[   12.457856]  s11: 0000000000000000 t3 : 000000007d192cb7 t4 : ffffffffe0f3c4b3
[   12.465136]  t5 : 000000007ba0608f t6 : ffffffffb440f7b1
[   12.470509] status: 0000000200000120 badaddr: ffffffe07ff10000 cause: 000000000000000d
[   12.478483] [<ffffffff8036332c>] crc32_body+0x2c/0x132
[   12.483719] ---[ end trace 6305806158a030ea ]---
[   12.488369] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[   12.496076] SMP: stopping secondary CPUs
[   12.500080] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---
paralin commented 1 year ago

@clayauld Since U-Boot is stored inside the SPI flash on board, and opensbi as well,

Could you try updating to the versions that the vendor provides: https://github.com/starfive-tech/VisionFive2#appendix-iii-updating-spl-and-u-boot-binaries-under-u-boot

@maxberger I noticed that the visionfive2 config does not build opensbi, isn't it needed? Seems so from the visionfive2 repo linked above.

clayauld commented 1 year ago

I have updated U-Boot and OpenSBI to the latest version already based on the repo you linked here. That was part of my original setup before trying to install SkiffOS.

paralin commented 1 year ago

@maxberger maybe the patch to change the dts to 8gb is not needed with the newer opensbi?

@clayauld You could try to build the kernel without that patch:

rm configs/starfive/visionfive2/kernel_patches/0002-Enable-8gb-of-memory.patch 
make configure br/linux-dirclean compile

The kernel oops is saying that it's a page fault error, so I think it's trying to access a memory address out-of-bounds.

paralin commented 1 year ago

I think u-boot might be responsible for setting some memory related values.

Looking at the u-boot source I see:

CONFIG_BOOTCOMMAND="run load_vf2_env;run importbootenv;run boot2; run load_distro_uenv;run distro_bootcmd"

Extra env: https://github.com/starfive-tech/u-boot/blob/ac0ac696256abf412826d74ee918dd417e207d7b/include/configs/starfive-visionfive2.h#L242

Possibly running the boot script manually instead of running with the default run distro_bootcmd might miss setting these?

paralin commented 1 year ago

@clayauld Is my understanding correct that you need to run u-boot manually since the SkiffOS u-boot is not booting correctly?

Could you try flashing the working u-boot to the skiffos sd card?

I'll have a look at synchronizing the u-boot build config to the one in the visionfive2 repo as well.

This is a bit hard for me to fix because I don't have a visionfive2 board on hand at the moment.

clayauld commented 1 year ago

@maxberger maybe the patch to change the dts to 8gb is not needed with the newer opensbi?

@clayauld You could try to build the kernel without that patch:

rm configs/starfive/visionfive2/kernel_patches/0002-Enable-8gb-of-memory.patch 
make configure br/linux-dirclean compile

The kernel oops is saying that it's a page fault error, so I think it's trying to access a memory address out-of-bounds.

I'm running the build now after doing completing the above commands....

@clayauld Is my understanding correct that you need to run u-boot manually since the SkiffOS u-boot is not booting correctly?

Could you try flashing the working u-boot to the skiffos sd card?

I'll have a look at synchronizing the u-boot build config to the one in the visionfive2 repo as well.

This is a bit hard for me to fix because I don't have a visionfive2 board on hand at the moment.

Yes, I am running the u-boot commands manually to attempt the boot. I'll work on getting u-boot flashed to the sd card. It's possible that the u-boot environments are not being set up properly with my manual commands. I was also thinking of attempting to pull in the u-boot build config from the visionfive2 repo myself and testing that out. I can report tomorrow on my progress.

clayauld commented 1 year ago

Pulling from the Starfive buildroot repo I tried booting with the following commands:

setenv fileaddr 0xa0000000
setenv fdtaddr 0x46000000
setenv kernel_addr_r 0x40200000
setenv irdaddr 0x46100000
setenv irdsize 0x5f00000

load mmc 1:1 $kernel_addr_r /boot/Image
load mmc 1:1 $fdt_addr_r /boot/u-boot.dtb
booti $kernel_addr_r - $fdt_addr_r

I was able to keep from getting a kernel panic, but I do have a system halt at the last line. Here are the logs:

Main section boot fail,use backup section
Main section boot fail,use backup section

U-Boot SPL 2021.10 (Feb 24 2023 - 03:37:30 -0500)
DDR version: dc2e84f0.
Trying to boot from MMC1

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 24 2023 - 03:37:30 -0500)

CPU:   rv64imacu
Model: StarFive VisionFive V2
DRAM:  8 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-2253-D008E000-00007047
data version: 0x2
PCB revision: 0xb2
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:6a:0a
Ethernet MAC1 address: 6c:cf:39:00:6a:0d
--------EEPROM INFO--------

In:    serial@10000000
Out:   serial@10000000
Err:   serial@10000000
Model: StarFive VisionFive V2
Net:   eth0: ethernet@16030000, eth1: ethernet@16040000
bootmode emmc device 0
406 bytes read in 4 ms (98.6 KiB/s)
Importing environment from mmc0 ...
Can't set block device
Hit any key to stop autoboot:  2  0 
StarFive # 
StarFive # setenv fileaddr 0xa0000000
StarFive # setenv fdtaddr 0x46000000
StarFive # setenv kernel_addr_r 0x40200000
StarFive # setenv irdaddr 0setenv irdsize 0x5f00000
StarFive # load mmc 1:1 $kernel_addr_r /boot/Image
22045184 bytes read in 927 ms (22.7 MiB/s)
StarFive # load mmc 1:1 $fdt_addr_r /boot/u-boot.dtb
46222 bytes read in 8 ms (5.5 MiB/s)
StarFive # booti $kernel_addr_r - $fdt_addr_r
## Flattened Device Tree blob at 48000000
   Booting using the fdt blob at 0x48000000
   Using Device Tree in place at 0000000048000000, end 000000004800e48d

Starting kernel ...

clk u5_dw_i2c_clk_core already disabled
clk u5_dw_i2c_clk_apb already disabled
[    0.000000] Linux version 5.15.0 (clayauld@LT-U01215-pop-os) (riscv64-linux-gcc.br_real (Buildroot 2021.11-4428-g6b6741b) 12.2.0, GNU ld (GNU Binutils) 2.39) #1 SMP Mon May 29 23:10:26 AKDT 2023
[    0.000000] OF: fdt: Ignoring memory range 0x40000000 - 0x40200000
[    0.000000] Machine model: StarFive VisionFive V2
[    0.000000] earlycon: sbi0 at I/O port 0x0 (options '')
[    0.000000] printk: bootconsole [sbi0] enabled
[    0.000000] efi: UEFI not found.
[    0.000000] cma: Reserved 16 MiB at 0x00000000bf000000
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000040200000-0x00000000ffffffff]
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000013fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040200000-0x000000013fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040200000-0x000000013fffffff]
[    0.000000] SBI specification v1.0 detected
[    0.000000] SBI implementation ID=0x1 Version=0x10002
[    0.000000] SBI TIME extension detected
[    0.000000] SBI IPI extension detected
[    0.000000] SBI RFENCE extension detected
[    0.000000] SBI SRST extension detected
[    0.000000] SBI v0.2 HSM extension detected
[    0.000000] riscv: base ISA extensions acimu
[    0.000000] riscv: ELF capabilities acim
[    0.000000] percpu: Embedded 18 pages/cpu s34984 r8192 d30552 u73728
[    0.000000] pcpu-alloc: s34984 r8192 d30552 u73728 alloc=18*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [0] 4 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 1031688
[    0.000000] Kernel command line: console=ttyS0,115200  debug rootwait  earlycon=sbi
[    0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.000000] mem auto-init: stack:all(zero), heap alloc:off, heap free:off
[    0.000000] software IO TLB: mapped [mem 0x00000000fb000000-0x00000000ff000000] (64MB)
[    0.000000] Memory: 3998348K/4192256K available (9540K kernel code, 4993K rwdata, 4096K rodata, 2198K init, 425K bss, 177524K reserved, 16384K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=5, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=5.
[    0.000000] rcu:     RCU debug extended QS entry/exit.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=5
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] riscv-intc: 64 local interrupts mapped
[    0.000000] plic: plic@c000000: mapped 136 interrupts with 4 handlers for 9 contexts.
[    0.000000] random: get_random_bytes called from start_kernel+0x4cc/0x6d2 with crng_init=0
[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1]
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 881590404240 ns
[    0.000001] sched_clock: 64 bits at 4MHz, resolution 250ns, wraps every 2199023255500ns
[    0.008282] Console: colour dummy device 80x25
[    0.012693] Calibrating delay loop (skipped), value calculated using timer frequency.. 8.00 BogoMIPS (lpj=40000)
[    0.022897] pid_max: default: 32768 minimum: 301
[    0.027754] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.035162] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.044681] ASID allocator disabled
[    0.048223] rcu: Hierarchical SRCU implementation.
[    0.053161] EFI services will not be available.
[    0.058092] smp: Bringing up secondary CPUs ...
sbi_trap_error: hart0: trap handler failed (error -2)
sbi_trap_error: hart0: mcause=0x0000000000000005 mtval=0x0000000040048060
sbi_trap_error: hart0: mepc=0x0000000040004cac mstatus=0x0000000200001800
sbi_trap_error: hart0: ra=0x0000000040009ee2 sp=0x0000000040047f10
sbi_trap_error: hart0: gp=0x0000000000000000 tp=0x0000000040048000
sbi_trap_error: hart0: s0=0x0000000040047f20 s1=0x0000000040048000
sbi_trap_error: hart0: a0=0x0000000040048060 a1=0x0000000000000002
sbi_trap_error: hart0: a2=0x0000000000000000 a3=0x0000000000000019
sbi_trap_error: hart0: a4=0x0000000000000001 a5=0x0000000040048060
sbi_trap_error: hart0: a6=0x00000000400480a8 a7=0x0000000000000004
sbi_trap_error: hart0: s2=0x00000000400241a8 s3=0x0000000000000000
sbi_trap_error: hart0: s4=0x0000000000000000 s5=0x0000000040029000
sbi_trap_error: hart0: s6=0x0000000040029020 s7=0x0000000000000000
sbi_trap_error: hart0: s8=0x000000000000001c s9=0x0000000040035ab0
sbi_trap_error: hart0: s10=0x0000000000000000 s11=0x0000000000000000
sbi_trap_error: hart0: t0=0x0000000000000000 t1=0x0000000000000000
sbi_trap_error: hart0: t2=0x0000000000000000 t3=0x0000000000002000
sbi_trap_error: hart0: t4=0x0000000000000000 t5=0x0000000000000000
sbi_trap_error: hart0: t6=0x0000000000000000
[    1.138570] CPU1: failed to come online
[    1.144241] smp: Brought up 1 node, 4 CPUs
[    1.149559] devtmpfs: initialized
[    1.159226] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    1.169013] futex hash table entries: 2048 (order: 5, 131072 bytes, linear)
[    1.176685] pinctrl core: initialized pinctrl subsystem
[    1.182703] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    1.189011] thermal_sys: Registered thermal governor 'step_wise'
[    1.189164] cpuidle: using governor menu
[    1.205459] starfive_jh7110-pinctrl 13040000.gpio: error -ENOENT: could not get reset
[    1.213207] starfive_jh7110-pinctrl: probe of 13040000.gpio failed with error -2
[    1.223788] platform 29590000.hdmi: Fixing up cyclic dependency with 29400000.dc8200
[    1.231863] platform 295d0000.mipi: Fixing up cyclic dependency with 29400000.dc8200
[    1.248142] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    1.254790] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    1.265475] SCSI subsystem initialized
[    1.269308] libata version 3.00 loaded.
[    1.273228] usbcore: registered new interface driver usbfs
[    1.278687] usbcore: registered new interface driver hub
[    1.284037] usbcore: registered new device driver usb
[    1.289595] Advanced Linux Sound Architecture Driver Initialized.
[    1.296157] Bluetooth: Core ver 2.22
[    1.299690] NET: Registered PF_BLUETOOTH protocol family
[    1.305023] Bluetooth: HCI device and connection manager initialized
[    1.311451] Bluetooth: HCI socket layer initialized
[    1.316380] Bluetooth: L2CAP socket layer initialized
[    1.321516] Bluetooth: SCO socket layer initialized
[    1.326718] clocksource: Switched to clocksource riscv_clocksource
[    1.341160] NET: Registered PF_INET protocol family
[    1.346600] IP idents hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    1.357998] tcp_listen_portaddr_hash hash table entries: 2048 (order: 4, 81920 bytes, linear)
[    1.366568] TCP established hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    1.374848] TCP bind hash table entries: 32768 (order: 8, 1048576 bytes, linear)
[    1.383219] TCP: Hash tables configured (established 32768 bind 32768)
[    1.390252] MPTCP token hash table entries: 4096 (order: 5, 196608 bytes, linear)
[    1.397877] UDP hash table entries: 2048 (order: 5, 196608 bytes, linear)
[    1.404778] UDP-Lite hash table entries: 2048 (order: 5, 196608 bytes, linear)
[    1.412346] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    1.418638] RPC: Registered named UNIX socket transport module.
[    1.424484] RPC: Registered udp transport module.
[    1.429276] RPC: Registered tcp transport module.
[    1.434017] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    1.442239] Initialise system trusted keyrings
[    1.446793] workingset: timestamp_bits=46 max_order=20 bucket_order=0
[    1.460283] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    1.466628] NFS: Registering the id_resolver key type
[    1.471646] Key type id_resolver registered
[    1.475845] Key type id_legacy registered
[    1.480009] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    1.486678] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    1.494156] ntfs: driver 2.1.32 [Flags: R/W].
[    1.498715] jffs2: version 2.2. (NAND) \C2 2001-2006 Red Hat, Inc.
[    1.543749] NET: Registered PF_ALG protocol family
[    1.548485] Key type asymmetric registered
[    1.552625] Asymmetric key parser 'x509' registered
[    1.557634] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    1.565019] io scheduler mq-deadline registered
[    1.569625] io scheduler kyber registered
[    1.573834] io scheduler bfq registered
[    1.578003] start plist test
[    1.585500] end plist test
[    1.588835] clk-starfive-jh7110 13020000.clock-controller: Failed to parse starfive,sys-syscon
[    1.597382] clk-starfive-jh7110: probe of 13020000.clock-controller failed with error -2
[    1.605648] clk-starfive-jh7110-vout 295c0000.clock-controller: rst get failed
[    1.612809] clk-starfive-jh7110-vout: probe of 295c0000.clock-controller failed with error -2
[    1.621795] L2CACHE: DataError @ 0x00000000.08040110
[    1.626727] L2CACHE: DataFail @ 0x00000000.0804005B
[    1.631666] L2CACHE: No. of Banks in the cache: 8
[    1.636386] L2CACHE: No. of ways per bank: 16
[    1.640817] L2CACHE: Sets per bank: 256
[    1.644706] L2CACHE: Bytes per cache block: 64
[    1.649223] L2CACHE: Index of the largest way enabled: 15
[    1.654832] jh7110-pmu 17030000.pmu: registered 8 power domains
[    1.712738] Serial: 8250/16550 driver, 6 ports, IRQ sharing disabled
[    1.720960] @@#########################@@
[    1.738352] brd: module loaded
[    1.748370] loop: module loaded
[    1.752413] libphy: Fixed MDIO Bus: probed
[    1.757609] CAN device driver interface
[    1.761943] i2c_dev: i2c /dev entries driver
[    1.766441] Bluetooth: HCI UART driver ver 2.3
[    1.770818] Bluetooth: HCI UART protocol H4 registered
[    1.776117] cpu cpu0: OPP table can't be empty
[    1.780888] sdhci: Secure Digital Host Controller Interface driver
[    1.787008] sdhci: Copyright(c) Pierre Ossman
[    1.791432] Synopsys Designware Multimedia Card Interface Driver
[    1.797631] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.803675] riscv-pmu-sbi: SBI PMU extension is available
[    1.809024] riscv-pmu-sbi: 16 firmware and 4 hardware counters
[    1.814884] riscv-pmu-sbi: Perf sampling/filtering is not supported as sscof extension is not available
[    1.827484] NET: Registered PF_INET6 protocol family
[    1.835265] Segment Routing with IPv6
[    1.838901] In-situ OAM (IOAM) with IPv6
[    1.842954] NET: Registered PF_PACKET protocol family
[    1.848020] Bridge firewalling registered
[    1.852022] can: controller area network core
[    1.856585] NET: Registered PF_CAN protocol family
[    1.861319] can: raw protocol
[    1.864332] can: broadcast manager protocol
[    1.868596] can: netlink gateway - max_hops=1
[    1.873237] Bluetooth: RFCOMM TTY layer initialized
[    1.878063] Bluetooth: RFCOMM socket layer initialized
[    1.883252] Bluetooth: RFCOMM ver 1.11
[    1.887072] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    1.892429] Bluetooth: BNEP socket layer initialized
[    1.897463] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[    1.903436] Bluetooth: HIDP socket layer initialized
[    1.908631] lib80211: common routines for IEEE802.11 drivers
[    1.914210] lib80211_crypt: registered algorithm 'NULL'
[    1.919514] lib80211_crypt: registered algorithm 'WEP'
[    1.924697] lib80211_crypt: registered algorithm 'CCMP'
[    1.929994] lib80211_crypt: registered algorithm 'TKIP'
[    1.935288] Key type dns_resolver registered
[    1.940257] Loading compiled-in X.509 certificates
[    1.948432] of_cfs_init
[    1.950873] of_cfs_init: OK
[    1.953912] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.963263] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.970130] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    1.978689] cfg80211: failed to load regulatory.db
[    4.046737] ALSA device list:
[    4.049627]   No soundcards found.
[    4.053121] Warning: unable to open an initial console.
[    4.058497] Waiting for root device ...
maxberger commented 1 year ago

Since it says waiting for root device: I had to adapt exlinux.conf to get the root device correct, before that I also had the kernel stop at the same Point: https://github.com/skiffos/SkiffOS/blob/master/configs/starfive/visionfive2/resources/boot-scripts/extlinux.conf#L4

No idea if this helps, but it could give you additional parameters to try

clayauld commented 1 year ago

Hmmm... my extlinux.conf file has the same parameters as the linked version above.

I still can't figure out why uboot doesn't like the sd card. And no matter what I seem to do it doesn't want to work with the built image. I tried to build the VisionFive2 image right from the upstream buildroot source (https://github.com/buildroot/buildroot) and I'm getting the same issues with the SD card not being recognized with this board. So it seems like the upstream buildroot source is broken for whatever version of the board I have.

clayauld commented 1 year ago

I think I found the reason for uboot not liking the SD card image:

From buildroot source genimage.cfg.... https://github.com/buildroot/buildroot/blob/master/board/visionfive2/genimage.cfg

image

U-boot is hardcoded in this board to look for 3 partitions on the drive. It is coded to boot from the 3rd partition /boot directory.

paralin commented 1 year ago

@clayauld okay I see the comment now saying it's hard coded. Makes sense.

We can use a 3 partition layout as well, are you able to test it once to see if it works?

clayauld commented 1 year ago

Absolutely. If you have a quick patch to the install script or image gen script I can test it quickly. I was going to work on a patch myself but you can probably push it quicker than I can.

I was looking at the uboot code last night and had my suspicions that it was looking for the 3rd partition. Every sd image I've seen work on my board had 3+ partitions, and had the boot dir or boot code in the 3rd partition. That caused me to look a little deeper at the other source code to validate and verify that it was looking for a partition layout like this.

paralin commented 1 year ago

@clayauld I'm just confused because @maxberger confirmed that the current configuration works fine with his visionfive2, and the distro_bootcmd seems to scan for a boot.scr.

What exactly is it searching for? /boot/extlinux.conf I guess.

paralin commented 1 year ago

@clayauld if that is indeed the issue you would see uboot logs looking for files and not finding them and then falling back to network boot. If uboot doesn't start at all it's a different issue.

paralin commented 1 year ago

@clayauld According to @maxberger the current version boots & starts fine on his visionfive2.

Given that combined with the fact that your u-boot logs do not show u-boot searching for the third partition, I have to think that the issue is not related to the partition layout after all.

If you still want to test this, I pushed the starfive-partitions branch.

clayauld commented 1 year ago

@paralin Thanks, I'll test it out.

After finding more documentation online about different builds for this I'm suspecting something else is going on here too. I can't get to a U-Boot prompt unless I have a TF card inserted with a working image and interrupt the boot process. Something definitely seems to be broken with my board since all documents state I should be able to load U-Boot from SPI flash even with no card or eMMC. Makes me think that the SPI flash is not working properly or the ROM on board is doing some sort of check before it starts the boot process.

clayauld commented 1 year ago

Turns out this is an issue with my board. The board could not load anything from SPI flash and after following a different set of instructions on flashing uboot and SPL binary to the board I was able to get the system to work as expected.

I followed the flashing instructions here: https://wiki.gentoo.org/wiki/Embedded_Handbook/Boards/StarFive_VisionFive_2

Screenshot from 2023-05-30 14-50-21

Talk about frustrating....

I now have a successful boot using the SkiffOS master branch and no issues. This whole problem came down to the fact that uboot and the SBL binary were not properly flashed to the board's SPI onboard flash, and the UART bootloader recovery process did not fix the issue no matter how many times I completed it.

One thing we could do is add these notes to the VisionFive2 README to note what works in getting the board's onboard uboot and SBL updated properly.

I'm going to also document this elsewhere and provide ANOTHER resource to help people solve this same issue.

paralin commented 1 year ago

@clayauld thanks for figuring it out. If you want to send a PR with more documentation for the readme ill merge it right away!

clayauld commented 1 year ago

Perfect! I'll work up some documentation to help and request a PR with the changes. Thanks for your support! It's always great working on this project.