页次: 1
xfel 可以启动内核,晕哥的xfel 在D1上通过直接加载可以启动SPL 和 opensbi;同样的,根据道理,我把需要的文件按照地址全部加载到对应的位置,那不是可以直接启动内核,按照这个思路,我就一步一步加载;
(1)首先,根据理解,SPL用于初始化时钟,DDR和搬运数据,但是XFEL已经实现了,所以,我直接用xfel加载opensbi后的代码:
.\xfel.exe write 0x41fc0000 fw_jump.bin
.\xfel.exe write 0x42000000 u-boot.fex
.\xfel.exe write 0x45000000 boot.img
结果会卡在start kernel,后面五打印,因此我在内核启动前加了一段汇编的电灯代码,结果发现内核确实运行了,灯点亮了。因此我怀疑后面的解析出错,我往后翻了以下,出错的地方只可能是设备树解析,因此我怀疑设备树有问题,但是bootm中的设备树确实传参正确。
(2)后面我翻了SPL的代码,又找到了一段设备树的读取加载,所以更新了以下命令】
.\xfel.exe write 0x41fc0000 fw_jump.bin
.\xfel.exe write 0x42000000 u-boot.fex
.\xfel.exe write 0x45000000 boot.img
.\xfel.exe write 0x20000 boot0_nand_sun20iw1p1.bin
.\xfel.exe write 0x42200000 sunxi.dtb
最终实现的效果,正常启动内核;
Starting kernel ...
[ 0.000000] Linux version 5.4.61 (ubuntu@ubuntu1804) (riscv64-unknown-linux-gnu-gcc (C-SKY RISCV Tools V1.8.4 B20200702) 8.1.0, GNU ld (GNU Binutils) 2.32) #1 PREEMPT Mon Sep 11 09:21:39 UTC 2023
[ 0.000000] cma: Reserved 16 MiB at 0x000000005f000000
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000040000000-0x000000005fffffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000040000000-0x000000005fffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000005fffffff]
[ 0.000000] elf_hwcap is 0x20112d
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 129280
[ 0.000000] Kernel command l
正常编译出来的文件就是boot0, opensbi,uboot,以及uImage,那自己一步一步那我直接去掉boot0,按照opensbi uboot kernel直接下载到ddr上指定的地址中,为啥不能正常启动内核,只会卡在start kernel这边,那我和直接pack打包成对应的tina_d1-h-nezha_uart0.img有什么大的区别吗,导致连内核都启动不起来,求大佬解惑。可以有偿
[27.769]
relocate *********************
[27.773]
relocate *********************
[27.777]android.hardware = sun20iw1p1
Android's image name: d1-h-nezha
[27.785]
relocate *********************
[27.789]
relocate *********************
[27.793]
relocate *********************
[27.797]
relocate *********************
Detect comp gzip+++++++++++++
Uncompressing Kernel Image ... GGGGGGGGGGGGGGGZIP
## Transferring control to kernel (at address 40000000) ...
[33.544]
Starting kernel ...zzzzzzzzzzzz
## Linux machid: 00000000, FDT addr: 5ea83da0
那还有一个问题,就是xfel 启动了opensbi,我把opensbi的跳转地址设为了0x4200000,然后把uboot下载到0x4200000上,但是启动opensbi后,无法正常驱动uboot,跳到0x42000000地址后好像会出错
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : T-HEAD Xuantie Platform
Platform HART Features : RV64ACDFIMSUVX
Platform Max HARTs : 1
Current Hart : 0
Firmware Base : 0x40000400
Firmware Size : 99 KB
Runtime SBI Version : 0.2
MIDELEG : 0x0000000000000222
MEDELEG : 0x000000000000b1ff
PMP0 : 0x0000000040000000-0x000000004001ffff (A)
PMP1 : 0x0000000040000000-0x000000007fffffff (A,R,W,X)
PMP2 : 0x0000000080000000-0x00000000bfffffff (A,R,W,X)
PMP3 : 0x0000000000020000-0x0000000000027fff (A,R,W,X)
PMP4 : 0x0000000000000000-0x000000003fffffff (A,R,W)
===========scratch->next_addr : 0x42000000
[/data1/work/risc/c906/opensbi/lib/sbi/sbi_hart.c]: next_addr:42000000 sbi_hart_switch_mode: 303
[/data1/work/risc/c906/op
U-Boot 2018.05-g24521d6-dirty (Aug 22 2023 - 04:28:12 -0400) Allwinner Technology
[23.172]DRAM: Unhandled exception: Load access fault
EPC: 000000004201318c TVAL: 0000000040010000
### ERROR ### Please RESET the board ###
页次: 1