initramfs name as param
This commit is contained in:
parent
a2540962da
commit
16d05011ca
51
Cargo.lock
generated
51
Cargo.lock
generated
@ -27,9 +27,39 @@ checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "2.9.0"
|
version = "2.9.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
|
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "build_const"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b4ae4235e6dac0694637c763029ecea1a2ec9e4e06ec2729bd21ba4d9c863eb7"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "byteorder"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core2"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "239fa3ae9b63c2dc74bd3fa852d4792b8b305ae64eeede946265b6af62f1fff3"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crc"
|
||||||
|
version = "1.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb"
|
||||||
|
dependencies = [
|
||||||
|
"build_const",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "critical-section"
|
name = "critical-section"
|
||||||
@ -71,6 +101,7 @@ dependencies = [
|
|||||||
"enumflags2",
|
"enumflags2",
|
||||||
"flagset",
|
"flagset",
|
||||||
"limine",
|
"limine",
|
||||||
|
"lzma-rs",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"spin",
|
"spin",
|
||||||
"talc",
|
"talc",
|
||||||
@ -101,6 +132,22 @@ version = "0.4.27"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lzma-rs"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "git+https://github.com/glaeqen/lzma-no-std-rs/#5635feaf5923f54161e9582dddb80cd457c07223"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
"core2",
|
||||||
|
"crc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.7.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.21.3"
|
version = "1.21.3"
|
||||||
|
@ -8,6 +8,7 @@ acpi = "5.1.0"
|
|||||||
enumflags2 = "0.7.11"
|
enumflags2 = "0.7.11"
|
||||||
flagset = "0.4.7"
|
flagset = "0.4.7"
|
||||||
limine = "0.4.0"
|
limine = "0.4.0"
|
||||||
|
lzma-rs = { git = "https://github.com/glaeqen/lzma-no-std-rs/", version = "0.2.0", default-features = false }
|
||||||
once_cell = { version = "1.20.3", default-features = false, features = ["alloc", "critical-section"] }
|
once_cell = { version = "1.20.3", default-features = false, features = ["alloc", "critical-section"] }
|
||||||
spin = "0.10.0"
|
spin = "0.10.0"
|
||||||
talc = "4.4.2"
|
talc = "4.4.2"
|
||||||
|
@ -144,4 +144,4 @@ script = '''
|
|||||||
[tasks.run]
|
[tasks.run]
|
||||||
dependencies = ["iso"]
|
dependencies = ["iso"]
|
||||||
command = "${QEMUCOMMAND}"
|
command = "${QEMUCOMMAND}"
|
||||||
args = ["-drive", "file=build/gila.iso,format=raw,index=0,media=disk", "-serial", "stdio"]
|
args = ["-display", "none", "-drive", "file=build/gila.iso,format=raw,index=0,media=disk", "-serial", "stdio"]
|
@ -1,7 +1,7 @@
|
|||||||
timeout: 5
|
timeout: 2
|
||||||
|
|
||||||
/Gila
|
/Gila
|
||||||
protocol: limine
|
protocol: limine
|
||||||
kernel_path: boot():/boot/kernel
|
kernel_path: boot():/boot/kernel
|
||||||
cmdline: -loglevel=Trace -logdev=display,serial
|
cmdline: -loglevel=Trace -logdev=display,serial -initramfs=/boot/initramfs.tar.lzma
|
||||||
module_path: boot():/boot/initramfs.tar.lzma
|
module_path: boot():/boot/initramfs.tar.lzma
|
||||||
|
@ -17,11 +17,14 @@ mod syscall_runner;
|
|||||||
|
|
||||||
use arch::current::*;
|
use arch::current::*;
|
||||||
use arch::x86_64::serial::Serialport;
|
use arch::x86_64::serial::Serialport;
|
||||||
|
use limine::file::File;
|
||||||
use spin::mutex::Mutex;
|
use spin::mutex::Mutex;
|
||||||
|
#[allow(unused_imports)]
|
||||||
|
use lzma_rs::lzma_decompress;
|
||||||
|
|
||||||
use crate::boot::*;
|
use crate::boot::*;
|
||||||
use crate::log::*;
|
use crate::log::*;
|
||||||
use crate::memory::alloc::{boxed, format, string::*, vec};
|
use crate::memory::alloc::{boxed, format, string::*, vec, collections::BTreeMap};
|
||||||
use crate::params::*;
|
use crate::params::*;
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
@ -37,20 +40,22 @@ unsafe extern "C" fn main() -> ! {
|
|||||||
LOGGER.lock().log(level, msg);
|
LOGGER.lock().log(level, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut params: BTreeMap<String, String> = BTreeMap::new();
|
||||||
|
|
||||||
// Set up some stuff based on kernel params if we get any
|
// Set up some stuff based on kernel params if we get any
|
||||||
if let Some(executable_file_response) = FILE_REQUEST.get_response() {
|
if let Some(executable_file_response) = FILE_REQUEST.get_response() {
|
||||||
let kernel_parameters = get_kernel_params(
|
params = get_kernel_params(
|
||||||
limine::file::File::string(executable_file_response.file()).to_bytes(),
|
limine::file::File::string(executable_file_response.file()).to_bytes(),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set up logging level from params
|
// Set up logging level from params
|
||||||
if let Some(level) = kernel_parameters.get("-loglevel") {
|
if let Some(level) = params.get("-loglevel") {
|
||||||
if let Ok(parsed_level) = LogLevel::try_from(level.as_str()) {
|
if let Ok(parsed_level) = LogLevel::try_from(level.as_str()) {
|
||||||
LOGGER.lock().level = parsed_level;
|
LOGGER.lock().level = parsed_level;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add subscribers to logger
|
// Add subscribers to logger
|
||||||
if let Some(device) = kernel_parameters.get("-logdev") {
|
if let Some(device) = params.get("-logdev") {
|
||||||
let log_device_list: vec::Vec<&str> = device.split(',').collect();
|
let log_device_list: vec::Vec<&str> = device.split(',').collect();
|
||||||
if log_device_list.contains(&"display") {
|
if log_device_list.contains(&"display") {
|
||||||
// Append display console to log subs
|
// Append display console to log subs
|
||||||
@ -80,6 +85,7 @@ unsafe extern "C" fn main() -> ! {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(address_response) = ADDRESS_REQUEST.get_response() {
|
if let Some(address_response) = ADDRESS_REQUEST.get_response() {
|
||||||
log(
|
log(
|
||||||
LogLevel::Trace,
|
LogLevel::Trace,
|
||||||
@ -89,28 +95,12 @@ unsafe extern "C" fn main() -> ! {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if let Some(module_response) = MODULE_REQUEST.get_response() {
|
|
||||||
log(
|
|
||||||
LogLevel::Info,
|
|
||||||
&format!(
|
|
||||||
"Boot: Kernel modules count: {}",
|
|
||||||
module_response.modules().len()
|
|
||||||
),
|
|
||||||
);
|
|
||||||
if !module_response.modules().is_empty() {
|
|
||||||
log(LogLevel::Info, "Boot: Kernel modules list:");
|
|
||||||
for module in module_response.modules() {
|
|
||||||
log(
|
|
||||||
LogLevel::Info,
|
|
||||||
&format!("\t{}", String::from_utf8_lossy(module.path().to_bytes())),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log(
|
log(
|
||||||
LogLevel::Info,
|
LogLevel::Info,
|
||||||
"Boot: Log devices configured. Booting `gila`.",
|
"Boot: Log devices configured. Booting `gila`.",
|
||||||
);
|
);
|
||||||
|
|
||||||
log(LogLevel::Info, "Boot: Trans Rights!");
|
log(LogLevel::Info, "Boot: Trans Rights!");
|
||||||
|
|
||||||
if let Some(framebuffer_response) = FRAMEBUFFER_REQUEST.get_response() {
|
if let Some(framebuffer_response) = FRAMEBUFFER_REQUEST.get_response() {
|
||||||
@ -145,6 +135,47 @@ unsafe extern "C" fn main() -> ! {
|
|||||||
|
|
||||||
let _rsdp_response = RSDP_REQUEST.get_response();
|
let _rsdp_response = RSDP_REQUEST.get_response();
|
||||||
|
|
||||||
|
// TODO: Get the initramfs
|
||||||
|
if let Some(module_response) = MODULE_REQUEST.get_response() {
|
||||||
|
log(
|
||||||
|
LogLevel::Info,
|
||||||
|
&format!(
|
||||||
|
"Boot: Kernel modules count: {}",
|
||||||
|
module_response.modules().len()
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if !module_response.modules().is_empty() {
|
||||||
|
log(LogLevel::Info, "Boot: Kernel modules list:");
|
||||||
|
for module in module_response.modules() {
|
||||||
|
log(
|
||||||
|
LogLevel::Info,
|
||||||
|
&format!("\t{}", String::from_utf8_lossy(module.path().to_bytes())),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Some(irfs_path) = params.get("-initramfs") {
|
||||||
|
log(
|
||||||
|
LogLevel::Info,
|
||||||
|
&format!("Boot: initramfs path requested: {}", irfs_path)
|
||||||
|
);
|
||||||
|
let initramfs_option: Option<&File> = {
|
||||||
|
let mut result: Option<&File> = None;
|
||||||
|
for file in module_response.modules() {
|
||||||
|
if &file.path().to_string_lossy().to_string() == irfs_path {
|
||||||
|
result = Some(file);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result
|
||||||
|
};
|
||||||
|
if let Some(_initramfs_file) = initramfs_option {
|
||||||
|
log(
|
||||||
|
LogLevel::Info,
|
||||||
|
"Boot: Found initramfs at supplied path"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
for _i in 0..100000000 {
|
for _i in 0..100000000 {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
Loading…
Reference in New Issue
Block a user