diff --git a/init.d/00_logging_ramfs.service b/init.d/00_logging_ramfs.service new file mode 100644 index 0000000000..d46cea9f8f --- /dev/null +++ b/init.d/00_logging_ramfs.service @@ -0,0 +1,13 @@ +{ + "unit": { + "default_dependencies": false, + "requires_weak": ["00_randd.service"] + }, + "service": { + "cmd": "ramfs", + "args": ["logging"], + "type": { + "scheme": "logging" + } + } +} diff --git a/init.d/00_runtime.target b/init.d/00_runtime.target index 82d1dd7d30..45549c1ab2 100644 --- a/init.d/00_runtime.target +++ b/init.d/00_runtime.target @@ -6,7 +6,8 @@ "00_nulld.service", "00_randd.service", "00_rtcd.service", - "00_zerod.service" + "00_zerod.service", + "00_logging_ramfs.service" ] } } diff --git a/init.d/10_logging b/init.d/10_logging deleted file mode 100644 index 1908fe00b1..0000000000 --- a/init.d/10_logging +++ /dev/null @@ -1,4 +0,0 @@ -requires_weak 00_runtime.target -scheme log logd -stdio /scheme/log -scheme logging ramfs logging diff --git a/init.d/20_graphics b/init.d/20_graphics index 45930814cf..ecfd423b4c 100644 --- a/init.d/20_graphics +++ b/init.d/20_graphics @@ -1,4 +1,3 @@ -requires_weak 10_logging scheme input inputd notify FRAMEBUFFER_ADDR=$ FRAMEBUFFER_VIRT=$ FRAMEBUFFER_WIDTH=$ FRAMEBUFFER_HEIGHT=$ FRAMEBUFFER_STRIDE=$ vesad scheme fbbootlog fbbootlogd diff --git a/init/src/main.rs b/init/src/main.rs index 4acad75895..37b164e68e 100644 --- a/init/src/main.rs +++ b/init/src/main.rs @@ -135,11 +135,6 @@ fn run_command(cmd: Command, config: &mut InitConfig) { Command::RequiresWeak(_) => {} // handled by unit parsing code Command::Nothing => {} Command::Echo(text) => println!("{text}"), - Command::Stdio(stdio) => { - if let Err(err) = switch_stdio(&stdio) { - eprintln!("init: failed to switch stdio to '{}': {}", stdio, err); - } - } Command::Service(service) => { if config.skip_cmd.contains(&service.cmd) { eprintln!( @@ -166,6 +161,13 @@ fn main() { } .apply(&mut pending_units, &mut unit_store, &mut init_config); + let mut command = std::process::Command::new("logd"); + command.env_clear().envs(&init_config.envs); + daemon::SchemeDaemon::spawn(command, "log"); + if let Err(err) = switch_stdio("/scheme/log") { + eprintln!("init: failed to switch stdio to '/scheme/log': {err}"); + } + let runtime_target = UnitId("00_runtime.target".to_owned()); 'a: while let Some(unit) = pending_units.pop_front() { diff --git a/init/src/script.rs b/init/src/script.rs index 08298f14cc..888db7ddd3 100644 --- a/init/src/script.rs +++ b/init/src/script.rs @@ -45,9 +45,6 @@ pub enum Command { // Service Service(Service), - // Modify env - Stdio(String), - // Misc Echo(String), Nothing, @@ -62,12 +59,6 @@ impl Command { match cmd.as_str() { "requires_weak" => Ok(Command::RequiresWeak(args.map(UnitId).collect::>())), "echo" => Ok(Command::Echo(args.collect::>().join(" "))), - "stdio" => { - let Some(stdio) = args.next() else { - return Err("init: failed to set stdio: no argument".to_owned()); - }; - Ok(Command::Stdio(stdio)) - } "notify" => { let process = Process::parse(args)?;