summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2021-10-23 17:18:57 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-25 23:38:28 +0200
commit542a88a7be9fbdbc2ff3eadc38cdcaa33292fb97 (patch)
tree07f15023e4b8546c809f677a8b01b3006e7ea22b
parent314b8a374ba82152bb092d9c6ff0c2b5d5c21005 (diff)
downloadserenity-542a88a7be9fbdbc2ff3eadc38cdcaa33292fb97.zip
Kernel: Separate framebuffers from bootmode
Bootmode used to control framebuffers, panic behavior, and SystemServer. This patch factors framebuffer control into a separate flag. Note that the combination 'bootmode=self-test fbdev=on' leads to unexpected behavior, which can only be fixed in a later commit.
-rw-r--r--.github/workflows/cmake.yml2
-rw-r--r--Base/usr/share/man/man7/boot_parameters.md6
-rw-r--r--Documentation/BareMetalInstallation.md2
-rw-r--r--Documentation/NetworkBoot.md4
-rw-r--r--Documentation/RunningTests.md2
-rw-r--r--Kernel/CommandLine.cpp5
-rw-r--r--Kernel/CommandLine.h2
-rw-r--r--Kernel/Graphics/GraphicsManagement.cpp13
-rw-r--r--Kernel/Graphics/GraphicsManagement.h3
-rw-r--r--Meta/Azure/Serenity.yml2
-rw-r--r--Meta/extlinux.conf2
-rw-r--r--Meta/grub-ebr.cfg2
-rw-r--r--Meta/grub-gpt.cfg2
-rw-r--r--Meta/grub-mbr.cfg2
-rwxr-xr-xMeta/run.sh1
-rwxr-xr-xMeta/serenity.sh2
16 files changed, 26 insertions, 26 deletions
diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
index 68e1d84823..c7f898170c 100644
--- a/.github/workflows/cmake.yml
+++ b/.github/workflows/cmake.yml
@@ -183,7 +183,7 @@ jobs:
working-directory: ${{ github.workspace }}/Build/${{ matrix.arch }}
env:
SERENITY_QEMU_CPU: "max,vmx=off"
- SERENITY_KERNEL_CMDLINE: "boot_mode=self-test"
+ SERENITY_KERNEL_CMDLINE: "fbdev=off boot_mode=self-test"
SERENITY_RUN: "ci"
run: |
echo "::group::ninja run # Qemu output"
diff --git a/Base/usr/share/man/man7/boot_parameters.md b/Base/usr/share/man/man7/boot_parameters.md
index cec7d2e44d..74fb849084 100644
--- a/Base/usr/share/man/man7/boot_parameters.md
+++ b/Base/usr/share/man/man7/boot_parameters.md
@@ -38,6 +38,8 @@ List of options:
* **`disable_virtio`** - If present on the command line, virtio devices will not be detected, and initialized on boot.
+* **`fbdev`** - This parameter expects **`on`** or **`off`**.
+
* **`force_pio`** - If present on the command line, the IDE controllers will be force into PIO mode when initialized IDE Channels on boot.
* **`hpet`** - This parameter expects one of the following values. **`periodic`** - The High Precision Event Timer should
@@ -68,7 +70,3 @@ List of options:
## See also
* [`SystemServer`(7)](../man7/SystemServer.md).
-
-
-
-
diff --git a/Documentation/BareMetalInstallation.md b/Documentation/BareMetalInstallation.md
index f662bcf803..9ca9ff7a58 100644
--- a/Documentation/BareMetalInstallation.md
+++ b/Documentation/BareMetalInstallation.md
@@ -56,5 +56,5 @@ framebuffer with 8x8 font glyphs.
You can force capable multiboot bootloaders to boot Serenity into high resolution mode by editing **Kernel/Arch/i386/Boot/boot.S** and
adding **| MULTIBOOT_VIDEO_MODE** to the end of the **multiboot_flags** before building Serenity.
-Setting a boot argument of `boot_mode=no-fbdev` will force the kernel to not initialize any framebuffer devices, hence allowing the system
+Setting a boot argument of `fbdev=off` will force the kernel to not initialize any framebuffer devices, hence allowing the system
to boot into console-only mode as `SystemServer` will detect this condition and will not initialize `WindowServer`.
diff --git a/Documentation/NetworkBoot.md b/Documentation/NetworkBoot.md
index a2776f36ea..f8506adcf4 100644
--- a/Documentation/NetworkBoot.md
+++ b/Documentation/NetworkBoot.md
@@ -87,7 +87,7 @@ menuentry 'SerenityOS - netboot diskless text mode' {
set gfxkeep=text
terminal_output console
echo 'Loading prekernel...'
- multiboot (tftp)/serenity/prekernel root=/dev/ramdisk0 boot_mode=text
+ multiboot (tftp)/serenity/prekernel root=/dev/ramdisk0 fbdev=off
echo 'Loading kernel...'
module (tftp)/serenity/kernel
echo 'Loading ramdisk...'
@@ -179,7 +179,7 @@ For troubleshooting purposes, you can add the following command line arguments i
- `disable_uhci_controller`
Because iPXE (unlike GRUB) doesn't support VESA VBE modesetting when booting a multiboot kernel,
-you might not see any output, so add the `boot_mode=text` argument as well to boot into VGA text mode.
+you might not see any output, so add the `fbdev=off` argument as well to boot into VGA text mode.
Afterwards you will need to enable the `console` iPXE command by uncommenting the following line in `src/config/general.h`:
```c
diff --git a/Documentation/RunningTests.md b/Documentation/RunningTests.md
index 9aeea0529c..01d7aa058e 100644
--- a/Documentation/RunningTests.md
+++ b/Documentation/RunningTests.md
@@ -114,6 +114,6 @@ lines will boot SerenityOS in self-test mode, run tests, and exit.
```sh
export SERENITY_RUN=ci
-export SERENITY_KERNEL_CMDLINE="boot_mode=self-test"
+export SERENITY_KERNEL_CMDLINE="fbdev=off boot_mode=self-test"
ninja run
```
diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp
index c661a9dd77..369ffd9027 100644
--- a/Kernel/CommandLine.cpp
+++ b/Kernel/CommandLine.cpp
@@ -214,10 +214,9 @@ BootMode CommandLine::boot_mode(Validate should_validate) const
return BootMode::Unknown;
}
-UNMAP_AFTER_INIT bool CommandLine::is_no_framebuffer_devices_mode() const
+UNMAP_AFTER_INIT bool CommandLine::are_framebuffer_devices_enabled() const
{
- const auto mode = boot_mode();
- return mode == BootMode::NoFramebufferDevices || mode == BootMode::SelfTest;
+ return lookup("fbdev"sv).value_or("on"sv) == "on"sv;
}
StringView CommandLine::userspace_init() const
diff --git a/Kernel/CommandLine.h b/Kernel/CommandLine.h
index 5e3b6b7a6e..27afe79588 100644
--- a/Kernel/CommandLine.h
+++ b/Kernel/CommandLine.h
@@ -66,7 +66,7 @@ public:
[[nodiscard]] bool is_vmmouse_enabled() const;
[[nodiscard]] PCIAccessLevel pci_access_level() const;
[[nodiscard]] bool is_legacy_time_enabled() const;
- [[nodiscard]] bool is_no_framebuffer_devices_mode() const;
+ [[nodiscard]] bool are_framebuffer_devices_enabled() const;
[[nodiscard]] bool is_force_pio() const;
[[nodiscard]] AcpiFeatureLevel acpi_feature_level() const;
[[nodiscard]] BootMode boot_mode(Validate should_validate = Validate::No) const;
diff --git a/Kernel/Graphics/GraphicsManagement.cpp b/Kernel/Graphics/GraphicsManagement.cpp
index a8602d74e0..55f7cbca54 100644
--- a/Kernel/Graphics/GraphicsManagement.cpp
+++ b/Kernel/Graphics/GraphicsManagement.cpp
@@ -33,10 +33,14 @@ bool GraphicsManagement::is_initialized()
}
UNMAP_AFTER_INIT GraphicsManagement::GraphicsManagement()
- : m_framebuffer_devices_allowed(!kernel_command_line().is_no_framebuffer_devices_mode())
{
}
+bool GraphicsManagement::framebuffer_devices_allowed() const
+{
+ return kernel_command_line().are_framebuffer_devices_enabled();
+}
+
void GraphicsManagement::deactivate_graphical_mode()
{
for (auto& graphics_device : m_graphics_devices) {
@@ -69,7 +73,7 @@ UNMAP_AFTER_INIT bool GraphicsManagement::determine_and_initialize_graphics_devi
VERIFY(is_vga_compatible_pci_device(device_identifier) || is_display_controller_pci_device(device_identifier));
auto add_and_configure_adapter = [&](GraphicsDevice& graphics_device) {
m_graphics_devices.append(graphics_device);
- if (!m_framebuffer_devices_allowed) {
+ if (!framebuffer_devices_allowed()) {
graphics_device.enable_consoles();
return;
}
@@ -175,9 +179,8 @@ UNMAP_AFTER_INIT bool GraphicsManagement::initialize()
* be created, so SystemServer will not try to initialize WindowServer.
*/
- if (kernel_command_line().is_no_framebuffer_devices_mode()) {
- dbgln("Forcing no initialization of framebuffer devices");
- }
+ if (!framebuffer_devices_allowed())
+ dbgln("Forcing non-initialization of framebuffer devices");
PCI::enumerate([&](PCI::DeviceIdentifier const& device_identifier) {
// Note: Each graphics controller will try to set its native screen resolution
diff --git a/Kernel/Graphics/GraphicsManagement.h b/Kernel/Graphics/GraphicsManagement.h
index 5c58926d03..d21cee52f8 100644
--- a/Kernel/Graphics/GraphicsManagement.h
+++ b/Kernel/Graphics/GraphicsManagement.h
@@ -37,7 +37,7 @@ public:
unsigned allocate_minor_device_number() { return m_current_minor_number++; };
GraphicsManagement();
- bool framebuffer_devices_allowed() const { return m_framebuffer_devices_allowed; }
+ bool framebuffer_devices_allowed() const;
bool framebuffer_devices_exist() const;
Spinlock& main_vga_lock() { return m_main_vga_lock; }
@@ -54,7 +54,6 @@ private:
// Note: there could be multiple VGA adapters, but only one can operate in VGA mode
RefPtr<VGACompatibleAdapter> m_vga_adapter;
unsigned m_current_minor_number { 0 };
- const bool m_framebuffer_devices_allowed;
Spinlock m_main_vga_lock;
};
diff --git a/Meta/Azure/Serenity.yml b/Meta/Azure/Serenity.yml
index ddd715729e..a115f3e3dc 100644
--- a/Meta/Azure/Serenity.yml
+++ b/Meta/Azure/Serenity.yml
@@ -80,7 +80,7 @@ jobs:
timeoutInMinutes: 60
env:
SERENITY_QEMU_CPU: 'max,vmx=off'
- SERENITY_KERNEL_CMDLINE: 'boot_mode=self-test'
+ SERENITY_KERNEL_CMDLINE: 'fbdev=off boot_mode=self-test'
SERENITY_RUN: 'ci'
- script: |
diff --git a/Meta/extlinux.conf b/Meta/extlinux.conf
index 4a99448488..3a2ed93ce7 100644
--- a/Meta/extlinux.conf
+++ b/Meta/extlinux.conf
@@ -13,7 +13,7 @@ LABEL SerenityOS
LABEL SerenityOSText
MENU LABEL SerenityOS (text mode)
KERNEL mboot.c32
- APPEND ../Prekernel root=/dev/hda1 boot_mode=text --- ../Kernel
+ APPEND ../Prekernel root=/dev/hda1 fbdev=off --- ../Kernel
LABEL SerenityOSNoACPI
MENU LABEL SerenityOS (No ACPI)
diff --git a/Meta/grub-ebr.cfg b/Meta/grub-ebr.cfg
index 0ee30831fa..d70e838c15 100644
--- a/Meta/grub-ebr.cfg
+++ b/Meta/grub-ebr.cfg
@@ -8,7 +8,7 @@ menuentry 'SerenityOS (normal)' {
menuentry 'SerenityOS (text mode)' {
root=hd0,5
- multiboot /boot/Prekernel boot_mode=no-fbdev root=/dev/hda4
+ multiboot /boot/Prekernel fbdev=off root=/dev/hda4
module /boot/Kernel
}
diff --git a/Meta/grub-gpt.cfg b/Meta/grub-gpt.cfg
index 91e6f6b110..c46256a85f 100644
--- a/Meta/grub-gpt.cfg
+++ b/Meta/grub-gpt.cfg
@@ -8,7 +8,7 @@ menuentry 'SerenityOS (normal)' {
menuentry 'SerenityOS (text mode)' {
root=hd0,2
- multiboot /boot/Prekernel boot_mode=no-fbdev root=/dev/hda2
+ multiboot /boot/Prekernel fbdev=off root=/dev/hda2
module /boot/Kernel
}
diff --git a/Meta/grub-mbr.cfg b/Meta/grub-mbr.cfg
index 20e8ef83df..05e8359879 100644
--- a/Meta/grub-mbr.cfg
+++ b/Meta/grub-mbr.cfg
@@ -8,7 +8,7 @@ menuentry 'SerenityOS (normal)' {
menuentry 'SerenityOS (text mode)' {
root=hd0,1
- multiboot /boot/Prekernel boot_mode=no-fbdev root=/dev/hda1
+ multiboot /boot/Prekernel fbdev=off root=/dev/hda1
module /boot/Kernel
}
diff --git a/Meta/run.sh b/Meta/run.sh
index bf33a14c30..8aa424a110 100755
--- a/Meta/run.sh
+++ b/Meta/run.sh
@@ -69,6 +69,7 @@ fi
[ "$KVM_SUPPORT" -eq "1" ] && SERENITY_VIRT_TECH_ARG="-enable-kvm"
+# For default values, see Kernel/CommandLine.cpp
[ -z "$SERENITY_KERNEL_CMDLINE" ] && SERENITY_KERNEL_CMDLINE="hello"
[ -z "$SERENITY_RAM_SIZE" ] && SERENITY_RAM_SIZE=1G
diff --git a/Meta/serenity.sh b/Meta/serenity.sh
index 6e70ec78b0..46bd9f54d9 100755
--- a/Meta/serenity.sh
+++ b/Meta/serenity.sh
@@ -358,7 +358,7 @@ if [[ "$CMD" =~ ^(build|install|image|copy-src|run|gdb|test|rebuild|recreate|kad
else
build_target install
build_target image
- export SERENITY_KERNEL_CMDLINE="boot_mode=self-test"
+ export SERENITY_KERNEL_CMDLINE="fbdev=off boot_mode=self-test"
export SERENITY_RUN="ci"
build_target run
fi