Showing posts with label Boot. Show all posts
Showing posts with label Boot. Show all posts

Friday, June 19, 2015

What is the booting process for x86 machines

http://www.dewassoc.com/kbase/hard_drives/master_boot_record.htm

Friday, April 5, 2013

How does BIOS work


From: http://www.biosren.com/thread-3075-1-1.html
这个过程.....虽然我大体知道但是也说不清楚。还是帮你看了哈总结出来的贴给你看哈:
1.        当机器被打开时,等电源稳定之后,电源会发送一个“加电成功信号”给芯片,以启动时钟生成器(8284);
2.        然后,CPU重新自设定为初试状态,开始准备运行。当CPU最初被启动的时候,系统RAM中是空的,没有任何内容可供执行。当然CPU设计者也知道这一点,所以他们对CPU进行了预先编程,以让CPU在这个阶段总是去查找系统BIOSROM中的一个固定的位置,以启动BIOS BootProgram,这个位置为FFFF0h,这个位置是UMA临近结尾的位置。之所以选择这个位置是因为,这样就不会引起由于ROM的大小改变而造成的兼容性问题。既然FFFF0h到UMA结束的位置之后16个字节,所以这里只放置着一个Jump指令,以进一步跳转到真正的BIOSstartup program的位置。(不同的BIOS厂商可以将其放在不同的位置,只需要通过Jump指定就可以了)。
3.        然后BIOS开始实施Power-OnSelf Test(POST),在这个过程中,如果遇到任何错误,Booting处理就会结束,机器会被挂起。
4.        然后BIOS开始查找显示卡。精确的说,是查找被内建在BIOS内部的显示卡程序,并执行它,它通常被放在C0000h的内存位置,它的作用是初始化显示卡。绝大多数的现代显示卡都能够在显示器上显示它的相关信息。这就是为什么当我们开机的时候,首先会在显示器的顶端会出现关于显示卡的信息。
5.        然后BIOS会查看其它设备的ROM,看一看这些设备之中哪些存在着BIOS,通常能够在C8000h的位置找到IDE/ATA硬盘的BIOS,并执行它们。如果找到任何其它设备的BIOSes,它们也会被执行。
6.        然后BIOS显示它的启动屏幕。
7.        然后BIOS开始做进一步的检测,包括我们可以看到的内存容量检测。在这个阶段,如果BIOS遇到任何错误,BIOS将会在屏幕上显示它的错误信息。
8.        然后BIOS会根据自己的"系统资源列表“,来对系统资源进行进一步的检测以确定究竟那些系统资源(设备)被安装在机器上。有些计算机会逐步显示这些被检测到的设备。
9.        如果BIOS支持Plug&
play标准,它将会检测和配置Plug&play设备,并显示这些它找到的设备。
10.        等着一些检测结束之后,BIOS会在系统屏幕上列出一个检测总结。
11.        然后BIOS开始寻找一个启动设备,你可以通过配置BIOS来决定其搜索的顺序,这些设备包括FloppyDisk(A),或者Hard Disk(C),甚至还可以包括CD-ROM Driver或者其它设备。
12.        当找到响应的启动设备之后,BIOS将会查找Boot信息以开始OS的启动过程。如果它找到了一个HardDisk,它将会查找一个位于Cylinder 0, Head 0, Sector 1的Master BootRecord(硬盘的第一个扇区),如果它找到的是Floppy Disk,它也会读区软盘的第一个扇区。
13.        如果找不到任何启动设备,系统将会显示一条错误信息,然后冻结系统。如果找到了响应的启动设备,BIOS会将读到的扇区放在内存7C00h的位置,并跳转到那里执行它。从此以后,就有硬件启动阶段进入了OS启动阶段。
总之,这个阶段有大量的事情要做,比如自检,初始化各种芯片,控制器,与端口;包括显示器,内存,键盘,软驱,串口等等;在这个过程中BIOS将检测到的数据放置于1K到2K的RAM,这个区域因此也被称为BIOS Data Area;同时还将中断向量以及BIOS程序运行所需要的Stack设置置于0到1K的RAM。最终,POST执行INT 19h中断,找到可以启动的磁盘,并将boot程序装入内存7C00h,并将控制权交给OS的boot程序。
也不知是否正确。

Friday, June 8, 2012

How to Limit the Amount of Memory Available to OS

Linux:

set the mem=2000m as the boot arguments, then the Linux only use first 2000MB memory. If the total RAM is 2G, it reserves 48MB.
http://fengweizhang.blogspot.com/2012/06/boot-arguments-on-linux.html


Windows:

Add line
MaxPhyPage=0x7D000 
at [386enh] section of C:\WINDOWS\system.ini
0x7D000 * 4KB = 2000MB
http://support.microsoft.com/kb/181862



Boot Arguments on Linux

http://tldp.org/HOWTO/BootPrompt-HOWTO-3.html


The `mem=' Argument

This argument has several purposes: The original purpose was to specify the amount of installed memory (or a value less than that if you wanted to limit the amount of memory available to linux).
The next (and hardly used) purpose is to specify mem=nopentium which tells the Linux kernel to not use the 4MB page table performance feature. If you want to use it for both purposes, use a separate mem= for each one.
The original BIOS call defined in the PC specification that returns the amount of installed memory was only designed to be able to report up to 64MB. (Yes, another lack of foresight, just like the 1024 cylinder disks... sigh.) Linux uses this BIOS call at boot to determine how much memory is installed. A newer specification (e820) allows the BIOS to get this right on most machines nowadays. If you have more than 64MB of RAM installed on an older machine, you can use this boot argument to tell Linux how much memory you have. Here is a quote from Linus on the usage of the mem= parameter.
``The kernel will accept any `mem=xx' parameter you give it, and if it turns out that you lied to it, it will crash horribly sooner or later. The parameter indicates the highest addressable RAM address, so `mem=0x1000000' means you have 16MB of memory, for example. For a 96MB machine this would be `mem=0x6000000'. If you tell Linux that it has more memory than it actually does have, bad things will happen: maybe not at once, but surely eventually.''
Note that the argument does not have to be in hex, and the suffixes `k' and `M' (case insensitive) can be used to specify kilobytes and Megabytes, respectively. (A `k' will cause a 10 bit shift on your value, and a `M' will cause a 20 bit shift.) A typical example for a 128MB machine would be "mem=128m".
In some cases, the memory reported via e820 can also be wrong, and so the mem=exactmap was added. You use this in conjunction with specifying an exact memory map, such as:


        mem=exactmap mem=640K@0 mem=1023M@1M

for a 1GB machine with the usual 384k of ISA memory mapped I/O space excluded from use.