Bootloader
The Echo Kernel bootloader is responsible for initializing essential system components and transitioning from the boot process to the kernel's execution. It serves as the critical bridge between hardware initialization and the kernel's main execution phase.
Features
- System component initialization
- Interrupt handling setup
- Display system initialization
- Kernel launch sequence
Boot Process
1. Early Initialization
void boot(void)
The main boot function performs the following sequence:
-
IDT Initialization
- Calls
keyboard::idt_init()
- Sets up interrupt handling infrastructure
- Configures keyboard interrupt handler
- Calls
-
Display Setup
- Initializes video memory
- Clears the screen
- Prepares display for kernel output
-
Kernel Launch
- Transfers control to kernel main function
- Initiates system main loop
Implementation Details
Component Initialization
The bootloader ensures proper initialization of core system components:
-
Interrupt System
- Configures Interrupt Descriptor Table (IDT)
- Sets up keyboard interrupt handler
- Enables necessary interrupt lines
-
Display System
- Configures video memory access
- Sets up text mode display
- Prepares screen for output
-
Kernel Handoff
- Prepares environment for kernel execution
- Transfers control to kernel main function
Error Handling
The bootloader implements basic error detection:
- Checks IDT initialization success
- Verifies display system availability
- Reports critical errors before halting
Dependencies
The bootloader relies on several system components:
display
namespace for screen outputkeyboard
namespace for input handling and IDT setupkernel
namespace for main kernel functionality
Usage
The bootloader is typically invoked by the system's initial boot code:
bootloader::boot();
System Requirements
Hardware
- x86 compatible processor
- Standard keyboard controller
- VGA-compatible display adapter
Memory
- Minimum memory requirements determined by kernel
- Video memory at 0xb8000
- IDT space requirements
Limitations
Current implementation has several limitations:
-
Boot Options
- No configuration parameters
- Single boot path only
- No alternative boot modes
-
Hardware Support
- Basic hardware initialization only
- Limited device support
- No advanced boot features
-
Error Recovery
- Basic error detection only
- No recovery mechanisms
- Halts on critical errors
Future Enhancements
Potential areas for improvement:
-
Configuration
- Boot parameters support
- Multiple boot modes
- Configuration file support
-
Hardware Support
- Additional device initialization
- Extended hardware detection
- More robust error handling
-
Boot Features
- Memory management initialization
- Advanced boot options
- Recovery mechanisms
Technical Notes
Memory Layout
The bootloader assumes a specific memory layout:
- IDT location
- Video memory at 0xb8000
- Kernel load address
Hardware Interaction
Direct hardware interaction through:
- I/O ports
- Memory-mapped I/O
- Interrupt vectors
Control Flow
- BIOS → Bootloader
- Bootloader initialization
- System component setup
- Kernel handoff