]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commitdiff
init: integrate partition scanning after blockdev registration (Etapa 6)
authorTulio A M Mendes <[email protected]>
Tue, 26 May 2026 04:08:52 +0000 (01:08 -0300)
committerTulio A M Mendes <[email protected]>
Wed, 3 Jun 2026 04:02:35 +0000 (01:02 -0300)
- Added partition_scan_mbr() call for each ATA drive present
- Scans hda, hdb, hdc, hdd for MBR partitions
- Partitions are automatically registered during scan
- Tests: 124/124 PASS

src/kernel/init.c

index 2591986bf5c9980c058eeade0b4cace0af442018..a6bbec65ed4e13ef239cb5580a73c6f48a862905 100644 (file)
@@ -291,8 +291,16 @@ int init_start(const struct boot_info* bi) {
     blockdev_init_lock();
     blockdev_register_ata();
 
-    /* Initialize partition subsystem (scan will be done later) */
+    /* Initialize partition subsystem and scan for partitions */
     partition_init_lock();
+    for (int i = 0; i < ATA_MAX_DRIVES; i++) {
+        if (!ata_pio_drive_present(i)) continue;
+        const char* names[ATA_MAX_DRIVES] = { "hda", "hdb", "hdc", "hdd" };
+        block_device_t* bdev = blockdev_find(names[i]);
+        if (bdev) {
+            partition_scan_mbr(bdev);
+        }
+    }
 
     /* If root= is specified on the kernel command line, mount that device
      * as the disk root filesystem.  The filesystem type is auto-detected