mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
Kernel/riscv64: Get the kernel command line from the device tree
This also hides the fdt dump by default now, it can be activated by adding `dump_fdt` to the kernel command line
This commit is contained in:
parent
51b841b4b2
commit
3941277940
3 changed files with 15 additions and 3 deletions
|
@ -218,8 +218,11 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT void init([[maybe_unused]] BootInfo con
|
||||||
// FIXME: Read the /chosen/bootargs property.
|
// FIXME: Read the /chosen/bootargs property.
|
||||||
kernel_cmdline = RPi::Mailbox::the().query_kernel_command_line(s_command_line_buffer);
|
kernel_cmdline = RPi::Mailbox::the().query_kernel_command_line(s_command_line_buffer);
|
||||||
#elif ARCH(RISCV64)
|
#elif ARCH(RISCV64)
|
||||||
// FIXME: Take this from the flattened device tree (/chosen/bootargs)
|
auto maybe_command_line = get_command_line_from_fdt();
|
||||||
kernel_cmdline = "serial_debug"sv;
|
if (maybe_command_line.is_error())
|
||||||
|
kernel_cmdline = "serial_debug"sv;
|
||||||
|
else
|
||||||
|
kernel_cmdline = maybe_command_line.value();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setup_serial_debug();
|
setup_serial_debug();
|
||||||
|
@ -290,7 +293,8 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT void init([[maybe_unused]] BootInfo con
|
||||||
#if ARCH(RISCV64)
|
#if ARCH(RISCV64)
|
||||||
MUST(unflatten_fdt());
|
MUST(unflatten_fdt());
|
||||||
|
|
||||||
dump_fdt();
|
if (kernel_command_line().contains("dump_fdt"sv))
|
||||||
|
dump_fdt();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initialize TimeManagement before using randomness!
|
// Initialize TimeManagement before using randomness!
|
||||||
|
|
|
@ -32,6 +32,13 @@ void dump_fdt()
|
||||||
MUST(DeviceTree::dump(header, fdt));
|
MUST(DeviceTree::dump(header, fdt));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ErrorOr<StringView> get_command_line_from_fdt()
|
||||||
|
{
|
||||||
|
auto& header = *bit_cast<DeviceTree::FlattenedDeviceTreeHeader*>(&s_fdt_storage[0]);
|
||||||
|
auto fdt = ReadonlyBytes(s_fdt_storage, header.totalsize);
|
||||||
|
return TRY(DeviceTree::slow_get_property("/chosen/bootargs"sv, header, fdt)).as_string();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceTree::DeviceTree const& DeviceTree::get()
|
DeviceTree::DeviceTree const& DeviceTree::get()
|
||||||
|
|
|
@ -24,6 +24,7 @@ extern BootInfo s_boot_info;
|
||||||
|
|
||||||
ErrorOr<void> unflatten_fdt();
|
ErrorOr<void> unflatten_fdt();
|
||||||
void dump_fdt();
|
void dump_fdt();
|
||||||
|
ErrorOr<StringView> get_command_line_from_fdt();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace DeviceTree {
|
namespace DeviceTree {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue