I am reading the linux-on-litex-vexriscv code to investigate how to boot Linux.
- linux-on-litex-vexriscv/sim.py
class SoCLinux(SoCCore): def __init__(self, init_memories = False, sdram_module = "MT48LC16M16", sdram_data_width = 32, sdram_verbosity = 0): ... # RAM Initialization. ram_init = [] if init_memories: ram_init = get_mem_data("images/boot.json", endianness="little", offset=0x40000000)
In other words, the information needed to boot Linux is supplied through RAM initialization.
boot.json
{ "Image": "0x40000000", "rv32.dtb": "0x40ef0000", "rootfs.cpio": "0x41000000", "opensbi.bin": "0x40f00000" }
This apparently initializes the SDRAM and gets everything ready for booting Linux. Let's try bringing this into my own environment as is.
That said, it seems all I need to do is specify boot.json in the simulation options.
litex_sim --cpu-type=scariv --sdram-init=./images/boot.json
Let's compile with this and check the behavior.
This is an English translation of the original Japanese post: LiteXによるSoC環境構築を試行する (7. Linuxをブートするためのコマンドラインオプションの調査)
