From a7633e5b663153b608c3ca1ae5e4413c52cbb5a2 Mon Sep 17 00:00:00 2001 From: Tulio A M Mendes Date: Fri, 13 Feb 2026 02:07:22 -0300 Subject: [PATCH] feat: mount FAT and ext2 filesystems from init.c - 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 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/kernel/init.c b/src/kernel/init.c index 4f34320..04954f4 100644 --- a/src/kernel/init.c +++ b/src/kernel/init.c @@ -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")) { -- 2.43.0