7

From the past week I am puzzled with the question that how the grub first stage boot loader which is only 446 bytes is able to search for the second stage, when the second stage is in a complex file system! How does it locate the second stage?

When a complex partitioning scheme of windows and linux is in place, and the linux system is entirely in the extended partition, then how does the stage 1 finds the stage 2? Even stage 1.5?

All of the grub tutorials skim through this important part. I have searched though the internet but couldn't find anything that explains this. Sadly, I am not an assembly programmer.

I want to understand the boot process intricately in terms of which sectors of the hard disk are tickled (and roughly how) during bootup. *Please point me to a good resource or answer here. It will greatly help me to play with grub wisely.*

Some Resources Searched:

  1. How Linux Works : What every superuser should know by Brian Ward
  2. http://www.dedoimedo.com/computers/grub.html
  3. some past stackoverflow questions.
4

1 回答 1

4

阶段 1 通过嵌入其中的阻止列表加载表中的条目“知道”阶段 2 的位置。它从引导驱动器加载块列表,然后在 16 位实模式下跳转到指定的 CS:IP。这些在嵌入式数据页面中进行了描述。它在 BIOS 中查询磁盘几何结构,并将那里的线性块编号映射到 INT 13h BIOS 接口使用的 C:H:S 地址。

http://www.uruk.org/orig-grub/technical.html

新磁盘对齐也有很多时间,在 MBR 和第一个分区之间有不到 1-2 MB 的未分配空间,阶段 2 有时会卡在那里。

于 2013-05-11T18:22:38.707 回答