sipeed / LicheePi4A

LicheePi4A info&sdk
42 stars 5 forks source link

Hang start upstream kernel #14

Closed KwangSon closed 1 year ago

KwangSon commented 1 year ago

Hi, I'm stuck in boot with upstream u-boot, linux in licheepi4a.

I build U-boot with patch kernel with patch

and it's build. flow will be vendor uboot -> upsteram uboot(M-Mode) -> upstream kernel. it worked just before start kernel.

U-Boot 2023.07-rc2-00222-g1d571c3efe-dirty (Jun 05 2023 - 04:27:42 +0000)

CPU:   rv64imafdc
Model: Sipeed Lichee Pi 4A
DRAM:  8 GiB
Core:  9 devices, 6 uclasses, devicetree: separate
MMC:   sd@ffe7090000: 0
Loading Environment from <NULL>... OK
In:    serial@ffe7014000
Out:   serial@ffe7014000
Err:   serial@ffe7014000
Model: Sipeed Lichee Pi 4A
LPI4A=> setenv bootargs earlycon loglevel=7 init -s initcall_debug; setenv kernel_comp_addr_r 0x80200000; setenv kernel_comp_size 0x800000
LPI4A=> kernel_addr_r=0x20000000; fdt_addr_r=0x1d000000; ramdisk_addr_r=0x30000000
LPI4A=> load mmc 0:1 $ramdisk_addr_r initrd.img
1173867 bytes read in 72 ms (15.5 MiB/s)
LPI4A=> ext4load mmc 0:1 ${kernel_addr_r} Image.gz
6654311 bytes read in 358 ms (17.7 MiB/s)
LPI4A=> ext4load mmc 0:1 ${fdt_addr_r} th1520-lichee-pi-4a.dtb
8834 bytes read in 9 ms (958 KiB/s)
LPI4A=> booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
   Uncompressing Kernel Image
Moving Image from 0x20000000 to 0x200000, end=1776000
## Loading init Ramdisk from Legacy Image at 30000000 ...
   Image Name:   
   Created:      2023-06-05   4:18:12 UTC
   Image Type:   RISC-V Linux RAMDisk Image (gzip compressed)
   Data Size:    1173803 Bytes = 1.1 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 1d000000
   Booting using the fdt blob at 0x1d000000
Working FDT set to 1d000000
   Loading Ramdisk to ff666000, end ff78492b ... OK
   Loading Device Tree to 00000000ff660000, end 00000000ff665281 ... OK
Working FDT set to ff660000

Starting kernel ...

after it hanging. Any advises for help?

KwangSon commented 1 year ago

@orangecms sorry for tag if you don't want. But the last advice was very helpful, so I tag it just in case.

orangecms commented 1 year ago

Hi :)

Is there no SBI here? If U-Boot runs in M-mode, and so does the kernel, things may not work. AFAIUI, Linux is designed to run in S-Mode, so something like OpenSBI should be in the chain. Then you can run Linux with earlycon=sbi to get early debug output. You may need to activate it in the kernel config as well.

KwangSon commented 1 year ago

Hi :)

Is there no SBI here? If U-Boot runs in M-mode, and so does the kernel, things may not work. AFAIUI, Linux is designed to run in S-Mode, so something like OpenSBI should be in the chain. Then you can run Linux with earlycon=sbi to get early debug output. You may need to activate it in the kernel config as well.

Yes, I also doubted that part. But I thought why not in M-Mode? :) Always thanks! I'll try.

I tried, Yes it works!