From e8fd8303fba6bfee3b8abb5cdf08632227e09f1b Mon Sep 17 00:00:00 2001 From: Hoa Nguyen Date: Thu, 5 Oct 2023 23:15:27 -0700 Subject: [PATCH] stdlib: Add `chosen` node to the device tree of RISC-V board This enables two things, - /chosen/stdout-path is now default to uart@10000000, meaning the linux kernel's boot console will be redirected to uart. - /chosen/bootargs now contains the boot arguments obtained from gem5's library. This allows passing the boot arguments to the linux kernel via the device tree. Change-Id: I53821d85f619e6276da85f41c972c041eaaf3280 Signed-off-by: Hoa Nguyen --- src/python/gem5/components/boards/riscv_board.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/python/gem5/components/boards/riscv_board.py b/src/python/gem5/components/boards/riscv_board.py index 25f1fac562..93dae50244 100644 --- a/src/python/gem5/components/boards/riscv_board.py +++ b/src/python/gem5/components/boards/riscv_board.py @@ -259,6 +259,12 @@ class RiscvBoard(AbstractSystemBoard, KernelDiskWorkload): ) root.append(node) + node = FdtNode(f"chosen") + bootargs = " ".join(self.get_default_kernel_args()) + node.append(FdtPropertyStrings("bootargs", [bootargs])) + node.append(FdtPropertyStrings("stdout-path", ["/uart@10000000"])) + root.append(node) + # See Documentation/devicetree/bindings/riscv/cpus.txt for details. cpus_node = FdtNode("cpus") cpus_state = FdtState(addr_cells=1, size_cells=0)