Operating system - the master boot program extension

A. The master boot program

From the previous chapters may know, the amount of code master boot program can not exceed 512 bytes, but in practice we need to break the 512-byte limit
ideas to break out - the master boot program
1. Complete the basic initialization
2. loaded from the storage medium into memory
3. handed over control of the newly loaded program execution Operating system - the master boot program extension
but this will be a problem - how to load the master boot program other program storage medium?
File system - a tissue file data on a storage medium - mainly contains a data area, a root directory, FAT2, FAT1, as shown in FIG boot sector
Operating system - the master boot program extension
(used when the virtual network disk F12) File System Example A.
1.FAT12 DOS file system is the early era of
2.FAT12 structure is very simple, has been in use for a floppy
basic organizational unit of 3.FAT12 - byte: the basic unit of data, sector: smallest unit of data disks in the cluster: one or more sectors region
introduced by the previous, solutions can be drawn
1. FAT12 floppy (data..img custom) format
2. writing executable program (Loader), floppy disk and copies it into
3 main guide program (Boot) look in the file system Loader
4. copy the Loader into memory and jumps to the entrance of the implementation of
the experiment - to write files to the virtual floppy disk, where we need some preparation of basic bochs, FreeDos, bximage, the main step is to create a virtual floppy disk format in FreeDos then, the finally mounted data.img Linux, and writes the file
Operating system - the master boot program extension
generated by bximage data.img command, and will be incorporated into the configuration freeDos.img
Operating system - the master boot program extension
After running through the generation and formatting, B is the virtual floppy disk by disk format B to B command to format a virtual floppy data.img have a file system that is Fata12 file system, and then generate the command through the terminal and the premise the raw material and copy it to a floppy disk
Operating system - the master boot program extension
finally see the files under virtual floppy disk, and content within the file command
Operating system - the master boot program extensionOperating system - the master boot program extensionOperating system - the master boot program extension
B.-depth understanding of FAT12
FAT12 file system from the boot sector, FAT tables, the root directory entry tables and files composition data area
Operating system - the master boot program extension
master boot FAT12 - the more important information is stored in the master boot type of file system, the file system total number of logical sectors, each cluster comprising a number of sectors and the like. Finally, the main guide 0x55AA bytes as the two ends, occupy a total of one sector
Operating system - the master boot program extensionOperating system - the master boot program extension
by comparison experiments found that one correspondence with the table

Two lower extensions of the master boot program

Q: How do I find in the root directory of FAT12 file exists in the target normal?
The size and location of the root directory area A. The formula has

Operating system - the master boot program extension
B.FAT12 file system root directory area - root directory area composed of directory entries, each entry represents a root directory of a root directory file index
Operating system - the master boot program extension
key member directory entry
DIR_Name-- file name (for determining whether the target file)
DIR_FstClus-- start file data storage location (used to determine the reading position)
DIR_FileSize-- file size (number of bytes used to determine the read)
we need to know there is a table FAT, FAT12 it is the core of the organization's data
relationship 1.FAT1 and FAT2 are backed up each other, exactly the same data content
2.FAT table is a diagram recorded data file has relations
3. each FAT table 12-bit temporary
first two entries without using a predetermined 4.FAT
Operating system - the master boot program extensionOperating system - the master boot program extension
Summary
1.FAT12 root directory area stores a start cluster number and length of the file
2 can determine whether the target file by searching the root directory area
3.FAT12 file organization of data using a single chain of thought - discrete distributed file data in a storage medium, the file data by associating FAT entry

Guess you like

Origin blog.51cto.com/13475106/2444790