diff --git a/scripts/qemu-runner.sh b/scripts/qemu-runner.sh index 72b14bb..48aa45f 100755 --- a/scripts/qemu-runner.sh +++ b/scripts/qemu-runner.sh @@ -8,4 +8,4 @@ bin="${elf%.elf}.bin" # Convert to binary format aarch64-none-elf-objcopy -O binary "$elf" "$bin" -qemu-system-aarch64 -M virt,gic-version=3 -initrd moss.img -cpu cortex-a72 -m 2G -smp 4 -nographic -s -kernel "$bin" +qemu-system-aarch64 -M virt,gic-version=3 -initrd moss.img -cpu cortex-a72 -m 2G -smp 4 -nographic -s -kernel "$bin" -append "--init=/bin/bash --rootfs=fat32fs --automount=/dev,devfs" diff --git a/src/arch/arm64/boot/mod.rs b/src/arch/arm64/boot/mod.rs index 362a1d7..73afff3 100644 --- a/src/arch/arm64/boot/mod.rs +++ b/src/arch/arm64/boot/mod.rs @@ -21,7 +21,6 @@ use aarch64_cpu::{ asm::{self, barrier}, registers::{ReadWriteable, SCTLR_EL1, TCR_EL1, TTBR0_EL1}, }; -use alloc::string::ToString; use core::arch::global_asm; use libkernel::{ CpuOps, @@ -125,10 +124,9 @@ fn arch_init_stage2(frame: *mut ExceptionState) -> *mut ExceptionState { cpu_messenger_init(cpu_count()); - kmain( - "--init=/bin/bash --rootfs=fat32fs --automount=/dev,devfs".to_string(), - frame, - ); + let cmdline = super::fdt::get_cmdline(); + + kmain(cmdline.unwrap_or_default(), frame); boot_secondaries(); diff --git a/src/arch/arm64/fdt.rs b/src/arch/arm64/fdt.rs index 1f1e46f..c0c1337 100644 --- a/src/arch/arm64/fdt.rs +++ b/src/arch/arm64/fdt.rs @@ -1 +1,10 @@ +use crate::drivers::fdt_prober::get_fdt; +use alloc::string::{String, ToString}; + pub const MAX_FDT_SZ: usize = 2 * 1024 * 1024; + +pub fn get_cmdline() -> Option { + let fdt = get_fdt(); + + Some(fdt.chosen()?.bootargs()?.to_string()) +}