In this section, we will talk about file system and write a simple module to parse the structure of file system
.
In the end, we will see how to run the programs in the console with the help of the file system.
The file system we will use in the system is fat16.
You may use the file system in the operating systems like DOS or windows 95.
The reason we choose fat16 file system is that it’s easy to understand
and implementing read operation is simple as well.
Also, the operating system we use nowadays such as windows, linux and macos can recognize fat16 system
and read and write data into the system, which makes the interaction with it more easily.
For example, we build a program and drag and drop it to the fat16 image,
then we can boot the image, find the program and run the program in our system
.
If we want to read a text from the file, we can achieve it by defining a string
with the characters we want in the assembly code and assemble it to the binary file. Copy the file to the image
and read the data from the file.
The data we read from the file will be the characters we want.
In the following lectures, we will go into details about these operations. The main goal of this section is
to show you the process of parsing the file system structure and write a file module to add open, read operations
so that the user programs can access the file system. We will also focus on
how to combine the process module with file system to run the programs in the file image.
Therefore, I will add some restrictions on the file module in our system to simplify the building process
and direct your attention on the main goal of the section.
Before we build the file module, there is one problem, that is, where our files are stored
and how to access them.
Normally, the files are stored in the disk. The operating system reads and writes files data into the disk.
Unlike the data in the main memory,
the data in the disk stays unchanged after we shut down the computer.
But accessing the disk requires us to write a disk driver, which is not an easy task to do.
So writing a driver is not an option for the moment.
Instead, we will load all the data from disk into memory when we are in the boot process.
Remember when we are in the real mode, we load the loader file and kernel file using bios service,
and now we read the disk into memory using the same method, which means the entire file system is in the memory when our system runs.
Since we haven’t created a fat16 image, we will see how to create one
and inspect the fat16 image in the next video.
So let's get started.