]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commitdiff
feat: mount FAT and ext2 filesystems from init.c
authorTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 05:07:22 +0000 (02:07 -0300)
committerTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 05:07:22 +0000 (02:07 -0300)
- Probe IDE disk at LBA 0 for FAT and ext2 signatures during boot
- FAT mounts at /fat, ext2 mounts at /ext2
- Both fail gracefully on unformatted/zeroed disks (no panic)
- diskfs remains at /disk as primary RW filesystem

Build: clean, cppcheck: clean, smoke: 19/19 pass

src/kernel/init.c

index 4f34320ad094536e45120ec1feb9f378d8efb38e..04954f44ba54460100a0693b7506af65f4e3fb28 100644 (file)
@@ -12,6 +12,8 @@
 #include "persistfs.h"
 #include "diskfs.h"
 #include "procfs.h"
+#include "fat.h"
+#include "ext2.h"
 #include "pci.h"
 #include "e1000.h"
 #include "net.h"
@@ -104,6 +106,22 @@ int init_start(const struct boot_info* bi) {
         (void)vfs_mount("/proc", proc);
     }
 
+    /* Probe second IDE disk partition (LBA 0) for FAT or ext2.
+     * The primary disk is used by diskfs; a second partition could
+     * be formatted as FAT or ext2 and mounted at /mnt. */
+    {
+        fs_node_t* fatfs = fat_mount(0);
+        if (fatfs) {
+            (void)vfs_mount("/fat", fatfs);
+        }
+    }
+    {
+        fs_node_t* ext2fs = ext2_mount(0);
+        if (ext2fs) {
+            (void)vfs_mount("/ext2", ext2fs);
+        }
+    }
+
     int user_ret = arch_platform_start_userspace(bi);
 
     if (bi && cmdline_has_token(bi->cmdline, "ring3")) {