k230的详细启动过程是怎么样的?

Viewed 72

问题描述


5.4 HiFive Unleashed Boot
The Freedom U500 supports several boot methods. The general flow follows multiple stages:
1. ROM0 (0x1004): Decode MSEL and jump to the address found in 0x1100 + 8*MSEL. For
MSEL > 4, the process proceeds to the next step.
2. ROM1 (0x1_0000): Decode MSEL to determine which media contains the First Stage Boot
Loader (FSBL). The media is expected to be formatted with a GPT partition table (even on
SPI flash). The entire contents of the first partition with GUID type
5B193300-FC78-40CD-8002-E86C45580B47 are downloaded into the L2 sideband memory
and execution transfers there. ROM1 contains a hard-coded DTB block passed in a1 to the
FSBL, which ignores it.
3. FSBL (0x800_0000): Initialize core PPLs, DDR, and Ethernet PHY. Decode MSEL to deter-
mine which media contains the Berkeley Boot Loader (BBL). The media is expected to con-
tain a GPT-formatted partition table. The contents of the first partition with GUID type
2E54B353-1271-4842-806F-E436D6AF6985 are downloaded into DDR memory and exe-
cution transfers there. The FSBL contains an embedded DTB describing both the Freedom
U500 SoC and HiFive Unleashed board. The DTB is updated with the board MAC address
and DDR capacity and passed to BBL in a1.
4. BBL (0x8000_0000): Initialize the RISC-V supervisor binary interface (SBI). Jump to the
embedded linux kernel payload, passing a redacted DTB in a1.
5. Linux (0xffff_ffe0_0000_0000): Initializes all devices, starts DHCP + ssh.
    零阶段启动加载程序(ZSBL),它包含在片上掩码 ROM 中,并由 QEMU 提供。请注意,QEMU 实现的 ROM 代码与硬件中编程的代码并不相同。QEMU 的版本是一个简化版,但提供了与硬件相同的功能。

    一阶段启动加载程序(FSBL),它负责启动 PLL 和 DDR 内存。这是一部分 U-Boot SPL。

    二阶段启动加载程序(SSBL),它根据需要进一步初始化其他外设。这是一部分完整的 U-Boot,结合了一个 OpenSBI fw_dynamic 固件镜像。

这个是SiFive HiFive Unleashed (sifive_u)的启动过程,k230这边是怎么样的?
也是和sifive一样,要求BOOT0,BOOT1选中的目标设备上有gpt分区?
那他把目标分区的数据(FSBL)加载到了哪里?

1 Answers

BootROM -> SPL -> [Uboot] -> Linux/RTSmart

开机复位支持BootROM, BootROM 根据boot0&boot1的电平设置,选择对应的启动介质,从介质指定偏移加载SPL,然后SPL去启动UBOOT(可选),然后启动Linux或者RTSmart.

不够详细,这里BootROM里面的代码怎么加载BOOT0&BOOT1选中的目标设备?也是和sifive_u一样要求目标设备上有gpt分区?也是和sifive_u一样把目标gpt分区上的第0个分区的所有内容全部加载到地址0x800_0000这里?感觉不是吧,因为我要用qemu模拟k230,如果直接-kernel -initrd,这一点也不像真实硬件,我也想和sifive_u那边一样,qemu-system-riscv64 -M sifive_u,msel=11 -smp 5 -m 8G
-display none -serial stdio
-bios /path/to/u-boot-spl.bin
-drive file=/path/to/sdcard.img,if=sd
像这样整,因为我感觉这样用命令行更像真实硬件,这就需要知道k230这边具体是怎么做的,为了更好的模拟k230的硬件行为

BOOT0和BOOT1是2个GPIO,通过改变它们的电平决定启动介质,然后BOOTRom会从对应介质的对应偏移加载SPL.