`
simohayha
  • 浏览: 1387389 次
  • 性别: Icon_minigender_1
  • 来自: 火星
社区版块
存档分类
最新评论

boot sequence overview

阅读更多
原文在这里:
http://www.os-forum.com/minix/boot/bootsequence.php

当pc启动的时候,pc将会搜索磁盘(其实也就是你bois设置的启动顺序)上的一个magic number(0xAA55),这个number是在磁盘第一个扇区的起始510字节位移处。

当magic number被发现,磁盘的第一个扇区将会被装载进地址为LOAD0FF(0x7C00)的内存然后执行它,这一切都是pc的ROM bios所实现的,不依赖于具体的操作系统。如果操作系统是minix,则被装载执行的代码要么是master bootblock code(masterboot.s)要么是bootstrap code(bootblock.s).其他的操作系统提供了他们自己的等效于 masterboot或者bootblock的代码。下面我们描述的就是minix boot system.

如果在第一个扇区的代码是master bootblock,这个代码将会复制他自己到 BUFFER(0x0600)然后跳转到BUFFER处。用户能够通过按alt键选择哪一个分区用来引导(可以看masterboot.s).如果用户没有按住alt键,这段代码要么load fix变量指定的分区,要么搜索分区表来查找激活的分区。如果没有

激活的分区,下一个磁盘的第一块引导区将会被load。

如果代码是bootstrap code(bootblock.s)。the bootstrap也会被装载进LOAD0FF(0x7C00),可是他并不会复制自己.the bootstrap将会自动加载boot镜像。the bootstrap装载boot monitor代码到BOOTSEG(0x1000 )然后跳转到BOOTSEG:BOOTOFF(0x0030)--也就是跳过了镜像的头部。

boot monitor 文件包含4个文件(boothead.s, boot.c, bootimage.c, and rawfs.c).boot monitor 的主函数就是用来装载minix操作系统,或者其他的操作系统.(更详细的boot monitor 的描述可以看这里http://www.os-forum.com/minix/boot/monitor.8.html)

正如在boothead.s的注释中所描述的,boothead.s包含了启动和低级别的支持(主要是执行BIOS的系统调用).一旦当bootstrap跳到boot monitor ,boothead.s中的代码将会立即执行,它决定了内存布局,处理器,当前的视频模式,被引导的设备,然后最终将会调用boot()(在boot.c中).此外,boothead.s还有一个退出boot  monitor 的函数,这个函数定义设备参数,读写数据到磁盘,从/到键盘或者屏幕读/写字符.退出boot  monitor 并跳转到minx os内核的函数(如果合适将会跳到保护模式)在boothead.s中。

boot.c包含了在 monitor 中高级的函数。其中最高等级的函数是boot().这个函数调用initialize(). initialize()移动boot monitor ,并且从
传递给内核的内存映射中删除boot monitor 。然后他将会调用下面的函数:

get_parameters()设置了几个环境变量和函数从bootparams扇区(激活分区的第二个扇区)得到几个参数.环境变量比如"processor", "bus", and "video" 都会被设置.

r_super()(在rawfs.c)检测系统是否是minix文件系统,并且决定文件系统的参数.

当着两个函数返回后,boot monitor将会执行用户键入的命令,比如boot(直接引导系统).

boot.image.c主函数是bootminix().她被boot monitor的boot(也就是上面所说的)命令所调用.这个函数将会调用下面的几个函数:

select_image()查找磁盘上正确的os镜像。

exec_image()装载os镜像到内存。

minix()(boothead.s)转换到保护模式,并且跳转到内核。

bootminix()当os从boot monitor返回时也会返回(比如用户关机(shutdown))

rawfs.c顾名思义,执行一个文件系统的操作的子集。例如能从磁盘读的块,能够从一个文件得到的信息,能够读取的目录的内容,能转换为inode number的一个路径。但是很多一般的文件系统的操作不能用在boot monistor的文件系统,比如创建文件.
4
0
分享到:
评论
3 楼 simohayha 2009-02-16  
Spike 写道

simohayha 写道当pc启动的时候,pc将会搜索磁盘(其实也就是你bois设置的启动顺序)上的一个magic number(0xAA55),这个number是在磁盘第一个扇区的前510字节里面。 我想这里你应该是笔误了吧?magic number(0xAA55)是在boot sector的511-512处,也即boot sector是以0xAA55结尾的;而不是在前510字节里。



,恩,谢谢指正。。

2 楼 Spike 2009-02-16  
simohayha 写道
当pc启动的时候,pc将会搜索磁盘(其实也就是你bois设置的启动顺序)上的一个magic number(0xAA55),这个number是在磁盘第一个扇区的前510字节里面。


我想这里你应该是笔误了吧?

magic number(0xAA55)是在boot sector的511-512处,也即boot sector是以0xAA55结尾的;而不是在前510字节里。
1 楼 笨笨狗 2008-11-17  
嗯,学到新东西了,支持!

相关推荐

    BIOS Boot Specification

    2.0 OVERVIEW 9 2.1 DESCRIPTION 9 3.0 IPL DEVICES 10 3.1 REQUIREMENTS FOR IPL DEVICES 10 3.1.1 IPL TABLE 10 3.1.2 PRODUCT NAME STRING 10 3.2 BAIDS 11 3.3 DEVICES WITH PNP EXPANSION HEADERS 11 3.4 ...

    AIX入门与提高PDF

    2.3 Power on sequence, LEDs, and audio signals . . . . . . . . 14 2.4 Useful commands. . . . . . . . . . 14 2.4.1 Using the alog command . . . 14 2.4.2 Using the cfgmgr command . 18 2.4.3 Using the ...

    DLPC34xx Software Programmer’s Guide.pdf

    2.1 Software Programmer’s Guide Overview 3 Interface Specification 3.1 I 2C Interface and Ports for DLPC343x 4 System Initialization 4.1 Boot ROM Concept 4.2 Resident Boot Software 4.3 HOST_IRQ ...

    TMS320C6678 Multicore Fixed and Floating-Point Digital Signal Processor

    2.4 Boot Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

    The Indispensable PC Hardware Book - rar - part1. (1/7)

    Overview of 386 and 486 CPUs. 486 Processor derivatives and clones. i486SX and i487SX. i486SX upgrade: the i487SX. i486DX2 processors with internal frequency doubling. The i486DX4. Other 486 ...

    squashfs2.2-r2.tar.gz

    1. SQUASHFS OVERVIEW -------------------- 1. Data, inodes and directories are compressed. 2. Squashfs stores full uid/gids (32 bits), and file creation time. 3. Files up to 2^32 bytes are supported...

    squashfs1.3r3.tar.gz

    being written to a block device, or is to be stored in a bootimage, the extra pad bytes are not needed. 2.1 appending to squashfs filesystems ------------------------------------- Beginning with ...

    vxbus_device_driver_developers_guide_6.9

    PART I: VXBUS FUNDAMENTALS 1 Getting Started with Device Driver Development .................................... 3 1.1 About Device Drivers ...............................................................

    CIS_Solaris_10_Benchmark_v5.0.0

    Overview ................................................................................................................................................................. 8 Consensus Guidance ...........

    Accelerated Graphics Port Interface Specification

    Operation.........................................................................................40 3.2 Operation Overview............................................................................

Global site tag (gtag.js) - Google Analytics