Linux MBR£ºÆô¶¯Ö¸µ¼³ÌÐòµÄ»ù±¾¹¦Ð§
Linux MBR£ºÆô¶¯Ö¸µ¼³ÌÐòµÄ»ù±¾×÷Óã¬ÐèÒªÏêϸ´úÂëʾÀý
ÔÚÅÌËã»úµÄÆô¶¯Àú³ÌÖУ¬Master Boot Record£¨MBR£¬Ö÷Ö¸µ¼¼Í¼£©ÊÎÑÝ×ÅÖÁ¹ØÖ÷ÒªµÄ½ÇÉ«¡£MBRÊÇ´æ´¢ÔÚÓ²Å̵ĵÚÒ»¸öÉÈÇøÖеÄһС¶Î³ÌÐò£¬Ëü°üÀ¨ÁËÖ¸µ¼¼ÓÔسÌÐòºÍ·ÖÇø±íµÈÐÅÏ¢¡£µ±ÅÌËã»úÆô¶¯Ê±£¬BIOS»áÊ×ÏȼÓÔØMBR£¬È»ºóÖ´ÐÐÆäÖеÄÖ¸µ¼¼ÓÔسÌÐò£¬´Ó¶øÖ¸µ¼²Ù×÷ϵͳµÄ¼ÓÔØ¡£
MBRµÄ»ù±¾×÷Óãº
Ö¸µ¼¼ÓÔسÌÐò£ºMBRÖаüÀ¨ÁËÖ¸µ¼¼ÓÔسÌÐò£¬¸Ã³ÌÐòÈÏÕæ¼ÓÔزÙ×÷ϵͳµÄÄںˡ£ÔÚLinuxϵͳÖУ¬Ö¸µ¼¼ÓÔسÌÐòͨ³£ÊÇGRUB£¨GRand Unified Bootloader£©¡£
·ÖÇø±íÐÅÏ¢£ºMBRÖл¹°üÀ¨ÁËÓ²Å̵ķÖÇø±íÐÅÏ¢£¬¼Í¼ÁËÓ²Å̵ķÖÇø½á¹¹ÇéÐΣ¬×ÊÖúÖ¸µ¼¼ÓÔسÌÐòÕÒµ½²Ù×÷ϵͳËùÔڵķÖÇø¡£
Æô¶¯²Ù×÷ϵͳ£ºÍ¨¹ýÖ¸µ¼¼ÓÔسÌÐò£¬MBRÄܹ»×¼È·µØÆô¶¯²Ù×÷ϵͳ£¬ÎªÓû§ÌṩÅÌËã»úµÄʹÓÃÇéÐΡ£
ÏÂÃæÎÒÃÇÀ´¿´Ò»¸ö¼òÆÓµÄLinux MBRµÄ´úÂëʾÀý£º
´úÂëʾÀý£º
section .text global _start _start: jmp main print_string: mov ah, 0x0E mov bh, 0x00 xor bl, bl print_loop: lodsb test al, al jz print_done int 0x10 jmp print_loop print_done: ret main: mov si, hello_message call print_string jmp $ hello_message db "Welcome to Linux MBR!", 0x0D, 0x0A, 0 times 510-($-$$) db 0 dw 0xAA55
µÇ¼ºó¸´ÖÆ
ÒÔÉÏÊÇÒ»¸ö¼òÆӵĻã±à´úÂëʾÀý£¬ÓÃÓÚÔÚÅÌËã»úÆô¶¯Ê±ÏÔʾһÌõ½Ó´ýÐÂÎÅ¡£¸ÃʾÀýʵÏÖÁË´ÓMBR¼ÓÔØ´úÂëµ½ÆÁÄ»´òÓ¡½Ó´ýÐÂÎŵĹ¦Ð§¡£
×ܽ᣺
LinuxµÄMBRÔÚÅÌËã»úÆô¶¯Àú³ÌÖÐÊÎÑÝ×Ų»¿É»òȱµÄ½ÇÉ«£¬ÈÏÕæÖ¸µ¼²Ù×÷ϵͳµÄ¼ÓÔØ¡£Í¨¹ýÒÔÉÏ´úÂëʾÀý£¬ÎÒÃÇ¿ÉÒÔÆðÔ´ÏàʶMBRµÄ»ù±¾×÷ÓúÍʵÏÖ·½·¨¡£ÉîÈëѧϰºÍÃ÷È·MBRµÄÔÀí£¬ÓÐÖúÓÚÎÒÃǸüºÃµØÃ÷È·ÅÌËã»úÆô¶¯Àú³ÌºÍ²Ù×÷ϵͳ¼ÓÔØÀú³Ì¡£
ÒÔÉϾÍÊÇLinux MBR£ºÆô¶¯Ö¸µ¼³ÌÐòµÄ»ù±¾¹¦Ð§µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡