Implement mkfs.fat32 filesystem formatter app (AI)

Create a user-space utility that formats block devices with FAT32.
Writes all required on-disk structures sequentially:

- Boot sector (BPB) with BIOS Parameter Block at sector 0
- FSInfo sector at sector 1 with free cluster count/hint
- Backup boot sector at sector 6, backup FSInfo at sector 7
- Two FAT tables with entries 0-2 initialized (media marker,
  EOC markers, root directory cluster EOC)
- Root directory cluster with volume label entry

Geometry calculation:
- Sectors per cluster chosen based on volume size (1-32)
- FAT size computed using Microsoft's formula
- Supports volumes from 128 sectors (~64K) upward

Usage: mkfs.fat32 hdd1mbr1 14336 [LABEL]
The total sector count is required since there is no stat() syscall
yet. Users can find it via 'diskpart <dev> list'.

Also checked off diskpart in README (committed previously).
This commit is contained in:
AI
2026-02-23 16:33:12 +00:00
parent 7dc50aa57d
commit 27b2042523
3 changed files with 525 additions and 7 deletions

View File

@@ -66,8 +66,8 @@ Once a task is completed, it should be checked off.
- [x] Create the `mount` app. It should allow on to mount a block device using the fat32 driver. Internally, it should use sysfs (which should be mounted automatically by the kernel to `/sys`) to setup a new mount.
- [x] Create a floppy driver. Each floppy device should be exposed as `/dev/floppyN`.
- [x] Add support for character device to the devicefs subsystem.
- [ ] Create an app called `diskpart`. This app can be used to modify the MBR partitions on a block device.
- [ ] Create an app called `mkfs.fat32`. This app can be used to format a block into a FAT32 filesystem.
- [x] Create an app called `diskpart`. This app can be used to modify the MBR partitions on a block device.
- [x] Create an app called `mkfs.fat32`. This app can be used to format a block into a FAT32 filesystem.
- [ ] Create a network driver for the NE2000 NIC.
- [ ] Create a network driver for the 3C509B NIC. It should only support RJ45 and 10base-T.
- [ ] Create an ethernet subsytsem. Each ethernet device should be shown as a character device with the name `ethN`.