RSoC: Implementing a FAT32 Filesystem in Redox

By Deepak Sirone on

This is a blog post about the work which I have done so far in implementing a FAT32 filesystem in Redox. Currently the Redox bootloader as well as the userspace filesystem daemon supports only RedoxFS.

Goals identified

Currently the Redox bootloader is purely written in assembly. The bootloader can either be assembled along with the filesystem image or a standalone kernel image. The -D FILESYSTEM and -D KERNEL options during assembly time take care of this. Extending the bootloader to read a filesystem is rather tedious using assembly and so it was decided that Rust is the way to go.

The first week was mainly spent in exploring the bootloader code.

Roughly the bootloader boots as follows:

The RedoxFS filesystem is an extent based filesystem and the bootloader parses the root inode to figure out where the kernel lives on the disk. It then loads each extent in succession.

The following workflow was decided to modify the bootloader:

Currently I am using the -D KERNEL to insert the stub into the bootloader image. It is based on an old version of Philip Opperman’s blog OS which has been hacked to mimic the Redox kernel’s linker addresses as well as page size. The stub repo which I am currently using can be found here. qemu does not boot the disk when using the -machine q35 flag if the size of the disk image is too small. So the image is padded with about 8MB worth of zeroes, aligned to 512 bytes. Currently the stub does not support printing functions and hence the only was to verify that it is running is by using qemu’s gdb debug target.

Future Work