forked from Bananymous/banan-os
Kernel: Add option to disable Serial output
This makes all debug output to appear on the TTY
This commit is contained in:
parent
c0bc002ac6
commit
9c31790359
6
iso.sh
6
iso.sh
|
@ -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
|
||||
|
|
|
@ -22,7 +22,8 @@ using namespace BAN;
|
|||
|
||||
struct ParsedCommandLine
|
||||
{
|
||||
bool force_pic = false;
|
||||
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");
|
||||
|
||||
|
|
Loading…
Reference in New Issue