Kernel: Add option to disable Serial output

This makes all debug output to appear on the TTY
This commit is contained in:
Bananymous 2023-01-25 21:44:09 +02:00
parent c0bc002ac6
commit 9c31790359
2 changed files with 15 additions and 4 deletions

6
iso.sh
View File

@ -11,8 +11,14 @@ cat > isodir/boot/grub/grub.cfg << EOF
menuentry "banan-os" {
multiboot /boot/banan-os.kernel
}
menuentry "banan-os (no serial)" {
multiboot /boot/banan-os.kernel noserial
}
menuentry "banan-os (no apic)" {
multiboot /boot/banan-os.kernel noapic
}
menuentry "banan-os (no apic, no serial)" {
multiboot /boot/banan-os.kernel noapic noserial
}
EOF
grub-mkrescue -o banan-os.iso isodir

View File

@ -23,6 +23,7 @@ using namespace BAN;
struct ParsedCommandLine
{
bool force_pic = false;
bool disable_serial = false;
};
ParsedCommandLine ParseCommandLine()
@ -41,6 +42,9 @@ ParsedCommandLine ParseCommandLine()
if (current - start == 6 && memcmp(start, "noapic", 6) == 0)
result.force_pic = true;
if (current - start == 8 && memcmp(start, "noserial", 8) == 0)
result.disable_serial = true;
if (!*current)
break;
start = current + 1;
@ -55,7 +59,10 @@ extern "C" void kernel_main()
{
DISABLE_INTERRUPTS();
Serial::initialize();
auto cmdline = ParseCommandLine();
if (!cmdline.disable_serial)
Serial::Initialize();
if (g_multiboot_magic != 0x2BADB002)
{
dprintln("Invalid multiboot magic number");
@ -63,8 +70,6 @@ extern "C" void kernel_main()
}
dprintln("Serial output initialized");
auto cmdline = ParseCommandLine();
kmalloc_initialize();
dprintln("kmalloc initialized");