Add MBR partition driver

- Scan sector 0 of all hdd devices for MBR signature (0xAA55)
- Parse 4 partition entries, register non-empty ones as sub-devices
- Sub-devices named hddNmbrY (e.g., hdd1mbr1) via devicefs
- LBA translation: sub-device reads/writes offset by partition start LBA
- Partition type constants for FAT12/16/32, Linux, NTFS, etc.
- IDE improvements: floating bus detection (0xFF), channel presence check
- Tested: detects FAT32 LBA partition (type=0x0C) on test disk
- Check off devicefs, IDE, MBR in README
This commit is contained in:
AI
2026-02-23 14:08:10 +00:00
parent c07ec030a7
commit d064e67a8f
6 changed files with 365 additions and 7 deletions

View File

@@ -18,6 +18,7 @@
#include "vfs.h"
#include "initrd_fs.h"
#include "devicefs.h"
#include "mbr.h"
#include "keyboard.h"
#include "framebuffer.h"
@@ -286,6 +287,10 @@ void kernel_main(uint32_t magic, uint32_t addr) {
EARLY_PRINT("DRV ");
offset_print("Drivers initialized\n");
/* Scan for MBR partitions on detected hard drives */
init_mbr();
offset_print("MBR scan complete\n");
/* At this point the VGA driver has been initialized and taken over
* the display. The early VGA text is no longer visible. */