mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
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.
This commit is contained in:
parent
314b8a374b
commit
542a88a7be
Notes:
sideshowbarker
2024-07-18 01:52:36 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/542a88a7be9 Pull-request: https://github.com/SerenityOS/serenity/pull/10607 Reviewed-by: https://github.com/ADKaster ✅
2
.github/workflows/cmake.yml
vendored
2
.github/workflows/cmake.yml
vendored
@ -183,7 +183,7 @@ jobs:
|
|||||||
working-directory: ${{ github.workspace }}/Build/${{ matrix.arch }}
|
working-directory: ${{ github.workspace }}/Build/${{ matrix.arch }}
|
||||||
env:
|
env:
|
||||||
SERENITY_QEMU_CPU: "max,vmx=off"
|
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"
|
SERENITY_RUN: "ci"
|
||||||
run: |
|
run: |
|
||||||
echo "::group::ninja run # Qemu output"
|
echo "::group::ninja run # Qemu output"
|
||||||
|
@ -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.
|
* **`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.
|
* **`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
|
* **`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
|
## See also
|
||||||
|
|
||||||
* [`SystemServer`(7)](../man7/SystemServer.md).
|
* [`SystemServer`(7)](../man7/SystemServer.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
|
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.
|
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`.
|
to boot into console-only mode as `SystemServer` will detect this condition and will not initialize `WindowServer`.
|
||||||
|
@ -87,7 +87,7 @@ menuentry 'SerenityOS - netboot diskless text mode' {
|
|||||||
set gfxkeep=text
|
set gfxkeep=text
|
||||||
terminal_output console
|
terminal_output console
|
||||||
echo 'Loading prekernel...'
|
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...'
|
echo 'Loading kernel...'
|
||||||
module (tftp)/serenity/kernel
|
module (tftp)/serenity/kernel
|
||||||
echo 'Loading ramdisk...'
|
echo 'Loading ramdisk...'
|
||||||
@ -179,7 +179,7 @@ For troubleshooting purposes, you can add the following command line arguments i
|
|||||||
- `disable_uhci_controller`
|
- `disable_uhci_controller`
|
||||||
|
|
||||||
Because iPXE (unlike GRUB) doesn't support VESA VBE modesetting when booting a multiboot kernel,
|
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`:
|
Afterwards you will need to enable the `console` iPXE command by uncommenting the following line in `src/config/general.h`:
|
||||||
```c
|
```c
|
||||||
|
@ -114,6 +114,6 @@ lines will boot SerenityOS in self-test mode, run tests, and exit.
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
export SERENITY_RUN=ci
|
export SERENITY_RUN=ci
|
||||||
export SERENITY_KERNEL_CMDLINE="boot_mode=self-test"
|
export SERENITY_KERNEL_CMDLINE="fbdev=off boot_mode=self-test"
|
||||||
ninja run
|
ninja run
|
||||||
```
|
```
|
||||||
|
@ -214,10 +214,9 @@ BootMode CommandLine::boot_mode(Validate should_validate) const
|
|||||||
return BootMode::Unknown;
|
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 lookup("fbdev"sv).value_or("on"sv) == "on"sv;
|
||||||
return mode == BootMode::NoFramebufferDevices || mode == BootMode::SelfTest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StringView CommandLine::userspace_init() const
|
StringView CommandLine::userspace_init() const
|
||||||
|
@ -66,7 +66,7 @@ public:
|
|||||||
[[nodiscard]] bool is_vmmouse_enabled() const;
|
[[nodiscard]] bool is_vmmouse_enabled() const;
|
||||||
[[nodiscard]] PCIAccessLevel pci_access_level() const;
|
[[nodiscard]] PCIAccessLevel pci_access_level() const;
|
||||||
[[nodiscard]] bool is_legacy_time_enabled() 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]] bool is_force_pio() const;
|
||||||
[[nodiscard]] AcpiFeatureLevel acpi_feature_level() const;
|
[[nodiscard]] AcpiFeatureLevel acpi_feature_level() const;
|
||||||
[[nodiscard]] BootMode boot_mode(Validate should_validate = Validate::No) const;
|
[[nodiscard]] BootMode boot_mode(Validate should_validate = Validate::No) const;
|
||||||
|
@ -33,10 +33,14 @@ bool GraphicsManagement::is_initialized()
|
|||||||
}
|
}
|
||||||
|
|
||||||
UNMAP_AFTER_INIT GraphicsManagement::GraphicsManagement()
|
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()
|
void GraphicsManagement::deactivate_graphical_mode()
|
||||||
{
|
{
|
||||||
for (auto& graphics_device : m_graphics_devices) {
|
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));
|
VERIFY(is_vga_compatible_pci_device(device_identifier) || is_display_controller_pci_device(device_identifier));
|
||||||
auto add_and_configure_adapter = [&](GraphicsDevice& graphics_device) {
|
auto add_and_configure_adapter = [&](GraphicsDevice& graphics_device) {
|
||||||
m_graphics_devices.append(graphics_device);
|
m_graphics_devices.append(graphics_device);
|
||||||
if (!m_framebuffer_devices_allowed) {
|
if (!framebuffer_devices_allowed()) {
|
||||||
graphics_device.enable_consoles();
|
graphics_device.enable_consoles();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -175,9 +179,8 @@ UNMAP_AFTER_INIT bool GraphicsManagement::initialize()
|
|||||||
* be created, so SystemServer will not try to initialize WindowServer.
|
* be created, so SystemServer will not try to initialize WindowServer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (kernel_command_line().is_no_framebuffer_devices_mode()) {
|
if (!framebuffer_devices_allowed())
|
||||||
dbgln("Forcing no initialization of framebuffer devices");
|
dbgln("Forcing non-initialization of framebuffer devices");
|
||||||
}
|
|
||||||
|
|
||||||
PCI::enumerate([&](PCI::DeviceIdentifier const& device_identifier) {
|
PCI::enumerate([&](PCI::DeviceIdentifier const& device_identifier) {
|
||||||
// Note: Each graphics controller will try to set its native screen resolution
|
// Note: Each graphics controller will try to set its native screen resolution
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
unsigned allocate_minor_device_number() { return m_current_minor_number++; };
|
unsigned allocate_minor_device_number() { return m_current_minor_number++; };
|
||||||
GraphicsManagement();
|
GraphicsManagement();
|
||||||
|
|
||||||
bool framebuffer_devices_allowed() const { return m_framebuffer_devices_allowed; }
|
bool framebuffer_devices_allowed() const;
|
||||||
bool framebuffer_devices_exist() const;
|
bool framebuffer_devices_exist() const;
|
||||||
|
|
||||||
Spinlock& main_vga_lock() { return m_main_vga_lock; }
|
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
|
// Note: there could be multiple VGA adapters, but only one can operate in VGA mode
|
||||||
RefPtr<VGACompatibleAdapter> m_vga_adapter;
|
RefPtr<VGACompatibleAdapter> m_vga_adapter;
|
||||||
unsigned m_current_minor_number { 0 };
|
unsigned m_current_minor_number { 0 };
|
||||||
const bool m_framebuffer_devices_allowed;
|
|
||||||
|
|
||||||
Spinlock m_main_vga_lock;
|
Spinlock m_main_vga_lock;
|
||||||
};
|
};
|
||||||
|
@ -80,7 +80,7 @@ jobs:
|
|||||||
timeoutInMinutes: 60
|
timeoutInMinutes: 60
|
||||||
env:
|
env:
|
||||||
SERENITY_QEMU_CPU: 'max,vmx=off'
|
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'
|
SERENITY_RUN: 'ci'
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
|
@ -13,7 +13,7 @@ LABEL SerenityOS
|
|||||||
LABEL SerenityOSText
|
LABEL SerenityOSText
|
||||||
MENU LABEL SerenityOS (text mode)
|
MENU LABEL SerenityOS (text mode)
|
||||||
KERNEL mboot.c32
|
KERNEL mboot.c32
|
||||||
APPEND ../Prekernel root=/dev/hda1 boot_mode=text --- ../Kernel
|
APPEND ../Prekernel root=/dev/hda1 fbdev=off --- ../Kernel
|
||||||
|
|
||||||
LABEL SerenityOSNoACPI
|
LABEL SerenityOSNoACPI
|
||||||
MENU LABEL SerenityOS (No ACPI)
|
MENU LABEL SerenityOS (No ACPI)
|
||||||
|
@ -8,7 +8,7 @@ menuentry 'SerenityOS (normal)' {
|
|||||||
|
|
||||||
menuentry 'SerenityOS (text mode)' {
|
menuentry 'SerenityOS (text mode)' {
|
||||||
root=hd0,5
|
root=hd0,5
|
||||||
multiboot /boot/Prekernel boot_mode=no-fbdev root=/dev/hda4
|
multiboot /boot/Prekernel fbdev=off root=/dev/hda4
|
||||||
module /boot/Kernel
|
module /boot/Kernel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ menuentry 'SerenityOS (normal)' {
|
|||||||
|
|
||||||
menuentry 'SerenityOS (text mode)' {
|
menuentry 'SerenityOS (text mode)' {
|
||||||
root=hd0,2
|
root=hd0,2
|
||||||
multiboot /boot/Prekernel boot_mode=no-fbdev root=/dev/hda2
|
multiboot /boot/Prekernel fbdev=off root=/dev/hda2
|
||||||
module /boot/Kernel
|
module /boot/Kernel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ menuentry 'SerenityOS (normal)' {
|
|||||||
|
|
||||||
menuentry 'SerenityOS (text mode)' {
|
menuentry 'SerenityOS (text mode)' {
|
||||||
root=hd0,1
|
root=hd0,1
|
||||||
multiboot /boot/Prekernel boot_mode=no-fbdev root=/dev/hda1
|
multiboot /boot/Prekernel fbdev=off root=/dev/hda1
|
||||||
module /boot/Kernel
|
module /boot/Kernel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@ fi
|
|||||||
|
|
||||||
[ "$KVM_SUPPORT" -eq "1" ] && SERENITY_VIRT_TECH_ARG="-enable-kvm"
|
[ "$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_KERNEL_CMDLINE" ] && SERENITY_KERNEL_CMDLINE="hello"
|
||||||
|
|
||||||
[ -z "$SERENITY_RAM_SIZE" ] && SERENITY_RAM_SIZE=1G
|
[ -z "$SERENITY_RAM_SIZE" ] && SERENITY_RAM_SIZE=1G
|
||||||
|
@ -358,7 +358,7 @@ if [[ "$CMD" =~ ^(build|install|image|copy-src|run|gdb|test|rebuild|recreate|kad
|
|||||||
else
|
else
|
||||||
build_target install
|
build_target install
|
||||||
build_target image
|
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"
|
export SERENITY_RUN="ci"
|
||||||
build_target run
|
build_target run
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user