In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
one。 On the main bootstrap
As you can see from the previous chapters, the amount of code of the master bootstrapper cannot exceed 512 bytes, but in practice we need to break the limit of 512 bytes.
The idea of breaking through the limit-the main bootstrap
1. Complete the most basic initialization work
two。 Load programs from storage media into memory
3. Transfer control to the Singapore program for execution
But there is a problem here-how does the master bootstrap load other programs in the storage media?
File system-- the method of organizing file data on storage media-mainly includes data area, root directory, FAT2, FAT1, and boot sector as shown in the figure.
a. File system example (F12 when using virtual network disk)
1.FAT12 is the early file system of the DOS era.
2.FAT12 has a very simple structure and has always been used in floppy disks
Basic organizational unit of 3.FAT12-byte: basic data unit, sector: the smallest data unit in a disk, cluster: one or more sectors
Through the previous introduction, we can come up with a solution
1. Use FAT12 to format floppy disks (customized by data..img)
two。 Write an executable program (Loader) and copy it to a floppy disk
3. The master bootstrapper (Boot) looks for Loader in the file system
4. Copy the Loader to memory and jump to the entrance for execution
Experiment-write a file to a virtual floppy disk. Here we need some basic bochs, FreeDos, and bximage to prepare. The main step is to create a virtual floppy disk and format it in FreeDos. Finally, mount the data.img to Linux and write to the file.
Generate data.img through the bximage command and incorporate it into freeDos.img in the configuration
It is generated after running, and then the B disk is formatted by the format B command. The B disk is the virtual floppy drive. By formatting the virtual floppy disk data.img, the file system is the Fata12 file system, and then the raw materials mentioned above are generated and copied to the floppy disk through the terminal and the command.
Finally, use the command to view the file under the virtual floppy disk and the contents of the file.
b. An in-depth understanding of FAT12
The FAT12 file system consists of a boot area, a FAT table, a root entry table and a file data area.
The important information stored in the master boot area of FAT12 is the type of file system, the total number of logical sectors of the file system, the number of sectors contained in each cluster, and so on. The main boot area ends with two bytes of 0x55AA, occupying a common sector.
Through the comparison of the experiment, it is found that it corresponds to the table one by one.
two。 Under the extension of the master bootstrapper
Q: how do I find the normal existence object file in the FAT12 root directory?
a. There is a formula for calculating the size and position of the root directory area.
The root area in the B.FAT12 file system-the root area consists of directory entries, each of which represents a file index in the root directory
Key members of directory items
DIR_Name-- file name (used to determine whether it is the target file)
DIR_FstClus-- file data starting storage location (used to determine the read location)
DIR_FileSize-- file size (used to determine the number of bytes read)
We need to know that there is also a FAT table, which is the core of FAT12's data organization.
1.FAT1 and FAT2 backup each other, and the data content is exactly the same.
The 2.FAT table is a diagram that records the sequence of file data.
3. Each FAT meter temporarily uses 12 bits.
The first two entries of 4.FAT stipulate that they are not used
Summary
The 1.FAT12 root area records the starting cluster number and length of the file.
two。 You can determine whether the target file exists by looking for the root directory area.
The organization of 3.FAT12 file data uses the idea of single linked list-- the file data is scattered in the storage medium, and the file data is associated through FAT items.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.