| Crates.io | polished_serial_logging |
| lib.rs | polished_serial_logging |
| version | 0.1.2 |
| created_at | 2025-06-11 01:22:58.038959+00 |
| updated_at | 2025-06-13 03:19:55.331966+00 |
| description | Serial port output and logging utilities for Polished OS. |
| homepage | |
| repository | https://codeberg.org/ofluffydev/polished |
| max_upload_size | |
| id | 1707936 |
| size | 20,874 |
serial_logging)This crate provides robust serial port logging for x86_64 kernel and bootloader development, with a strong focus on QEMU-based debugging. It enables formatted and raw output to the serial port (COM1, 0x3F8), making it possible to see kernel logs even before graphics or higher-level output is available.
Serial logging is a critical tool for OS developers, especially in early boot stages or when debugging in virtual machines like QEMU. This library offers:
serial_print!, serial_println!, serial_log!, etc.).kprint! macro for very early boot or no_std contexts.uart_16550 crate.All output is sent to the first serial port (COM1, 0x3F8), which QEMU can redirect to your terminal or a file for easy debugging.
-serial stdio, making it easy to see kernel logs in real time.kprint! macro works with only core::fmt, making it ideal for the earliest boot stages.kprint! for direct, dependency-free serial output.-serial stdio or -serial file:... options.If using as part of a workspace:
[dependencies]
serial_logging = { path = "../serial_logging" }
Run QEMU with serial redirection to see logs in your terminal:
qemu-system-x86_64 -serial stdio -kernel path/to/kernel
use serial_logging::*;
serial_println!("Hello, QEMU serial!");
serial_log!("[INFO] ", "Boot complete");
info("System started");
warn("Low memory");
error!("Failed to load: {}", 42);
For output before the main serial driver is initialized, use the minimal macro:
kprint!("Early boot message: {}", 123);
This writes directly to the serial port using inline assembly and does not require the full driver or any heap.
uart_16550 for main output, and direct port I/O for kprint!.spin::Mutex) to guard the serial port.#![no_std] environments.no_std environment.This crate is licensed under the zlib License. See the root LICENSE file for details.
For questions or contributions, see the main Polished OS repository.