garage44.eu/jeroen/pinnacle

logclone: git clone https://garage44.eu/jeroen/pinnacle.git

cartopolis-agent · 2026-11-30T14:03:08Z

fix(kernel): a laptop starts silent; the tone only when a test asks

The self-check's 440 Hz tone played at every start on a PC, through a
real laptop's speakers since HDA. It now plays only with `selfcheck` or
`tone` on the command line; `cargo xtask laptop` puts `tone` on its
stick's, which the installed disk keeps.
kernel/src/selfcheck.rs | 5 +++++
 xtask/src/install.rs    | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/kernel/src/selfcheck.rs b/kernel/src/selfcheck.rs
index 95cf9e6..6d73b75 100644
--- a/kernel/src/selfcheck.rs
+++ b/kernel/src/selfcheck.rs
@@ -635,12 +635,17 @@ pub fn io() {
 /// Sound, when there is a device: a program plays 300 ms of a 440 Hz tone
 /// through the kernel's mixer, whose periods complete by interrupt. What
 /// came out of the device, `cargo xtask test` hears in QEMU's WAV file.
+/// Only when a test asks (`selfcheck` or `tone` on the command line): a
+/// laptop starts silent.
 pub fn audio() {
     use crate::drivers::sound;
     if !sound::present() {
         println!("audio: no sound device");
         return;
     }
+    if !crate::args::has("selfcheck") && !crate::args::has("tone") {
+        return;
+    }
     let before = sound::stats();
     let program = crate::programs::find(b"hello").expect("built without programs");
     let id = sched::spawn_program(program, arg::AUDIO, Vec::new(), false, true, None)
diff --git a/xtask/src/install.rs b/xtask/src/install.rs
index 23ca54e..ef1cf15 100644
--- a/xtask/src/install.rs
+++ b/xtask/src/install.rs
@@ -449,8 +449,9 @@ fn check_installed(arch: Arch, target: &Path) -> Result {
         return Err("the boot partition's kernel is not this checkout's".into());
     }
     let line = fat::read_file(&mut disk, boot_at, "PINNACLE/CMDLINE").ok_or("no command line")?;
+    // The new system named first; the stick's other words (`tone`) kept.
     let expected = format!("root={}", table.partitions[1].id.text());
-    if String::from_utf8_lossy(&line) != expected {
+    if String::from_utf8_lossy(&line).split(' ').next() != Some(expected.as_str()) {
         return Err(format!(
             "the command line is {:?}",
             String::from_utf8_lossy(&line)
@@ -717,7 +718,7 @@ const LAPTOP_LINES: &[&str] = &[
 /// boot log on the screen), into `target/demo-laptop/`.
 pub fn laptop() -> Result {
     let dir = demo_dir("demo-laptop")?;
-    let medium = medium(Arch::Pc, "install-to=nvme0n1")?;
+    let medium = medium(Arch::Pc, "install-to=nvme0n1 tone")?;
     let target = root().join("target/installed-laptop.img");
     blank(&target, TARGET_MIB)?;
     // Not ended when "install ok" is said: the machine must turn itself off.