开发者

What kind of knowledge is required to program a simple safe working boot sector?

I know knowledge of 开发者_JAVA技巧assembly is the very first thing needed (which I have), and I also know that Boot Sector code tells the processor to boot/execute a program (or OS), but what I don't is the HOW of it. I've seen disassembled bootsector code, but I don't know how to write that code. If I write a malfunctioning bootsector code to my USB flash drive, it will never work again.

I can always get tidbits of programming boot sectors from the internet but I'm looking for an organized tutorial or something like that, where they teach how to program a boot sector and other boot programs from beginning to end. Please point me in the right direction...


There is two MBR actually. First is master boot record (MBR) and second is volume boot record (VBR). Both participate in the bootstrapping of operating system. MBR structure differs from VBR in this way - MBR basically starts with your assembly code and ends with patrition table information, VBR starts with jump to your assembly code which is placed after some volume information. When system starts it reads MBR into memory at physical address 0x7c00 and jumps to that address. It is supposed MBR's responsibility to read partition table (loaded together with MBR as it's part) and to find actual volume (disk drive such as C,D,E,... in terms of Windows), where an operatig system is expected to be. After MBR has found OS volume it loads it's VBR again at the address 0x7c00 and then jumps to the mentioned address. Now VBR reads it's volume information (loaded with it as it's part) and decides where to find operating system bootstrap code. After decision is made - VBR loads OS bootstrap code and jumps to it's starting address.

Having this information you can see the required boot record writer knowledge. At least - you should know wich boot record you are writing (MBR or VBR). Then you can read about it's data structures and write code capable of reading them and loading next chunk of bootstrap code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜