{"id":63055,"date":"2025-04-29T16:44:14","date_gmt":"2025-04-29T08:44:14","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63055\/"},"modified":"2025-04-29T16:44:14","modified_gmt":"2025-04-29T08:44:14","slug":"linux-mbr%ef%bc%9a%e5%90%af%e5%8a%a8%e5%bc%95%e5%af%bc%e7%a8%8b%e5%ba%8f%e7%9a%84%e5%9f%ba%e6%9c%ac%e5%8a%9f%e8%83%bd-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63055\/","title":{"rendered":"Linux MBR\uff1a\u542f\u52a8\u5f15\u5bfc\u7a0b\u5e8f\u7684\u57fa\u672c\u529f\u80fd"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/465\/014\/170895871366789.jpg\" class=\"aligncenter\" title=\"Linux MBR\uff1a\u542f\u52a8\u5f15\u5bfc\u7a0b\u5e8f\u7684\u57fa\u672c\u529f\u80fd\u63d2\u56fe\" alt=\"Linux MBR\uff1a\u542f\u52a8\u5f15\u5bfc\u7a0b\u5e8f\u7684\u57fa\u672c\u529f\u80fd\u63d2\u56fe\" \/><\/p>\n<h3>Linux MBR\uff1a\u542f\u52a8\u5f15\u5bfc\u7a0b\u5e8f\u7684\u57fa\u672c\u4f5c\u7528\uff0c\u9700\u8981\u5177\u4f53\u4ee3\u7801\u793a\u4f8b<\/h3>\n<p>\u5728\u8ba1\u7b97\u673a\u7684\u542f\u52a8\u8fc7\u7a0b\u4e2d\uff0cMaster Boot Record\uff08MBR\uff0c\u4e3b\u5f15\u5bfc\u8bb0\u5f55\uff09\u626e\u6f14\u7740\u81f3\u5173\u91cd\u8981\u7684\u89d2\u8272\u3002MBR\u662f\u5b58\u50a8\u5728\u786c\u76d8\u7684\u7b2c\u4e00\u4e2a\u6247\u533a\u4e2d\u7684\u4e00\u5c0f\u6bb5\u7a0b\u5e8f\uff0c\u5b83\u5305\u542b\u4e86\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\u548c\u5206\u533a\u8868\u7b49\u4fe1\u606f\u3002\u5f53\u8ba1\u7b97\u673a\u542f\u52a8\u65f6\uff0cBIOS\u4f1a\u9996\u5148\u52a0\u8f7dMBR\uff0c\u7136\u540e\u6267\u884c\u5176\u4e2d\u7684\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\uff0c\u4ece\u800c\u5f15\u5bfc\u64cd\u4f5c\u7cfb\u7edf\u7684\u52a0\u8f7d\u3002<\/p>\n<h4>MBR\u7684\u57fa\u672c\u4f5c\u7528\uff1a<\/h4>\n<ol>\n<li> <strong>\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f<\/strong>\uff1aMBR\u4e2d\u5305\u542b\u4e86\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\uff0c\u8be5\u7a0b\u5e8f\u8d1f\u8d23\u52a0\u8f7d\u64cd\u4f5c\u7cfb\u7edf\u7684\u5185\u6838\u3002\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\u901a\u5e38\u662fGRUB\uff08GRand Unified Bootloader\uff09\u3002<\/li>\n<li> <strong>\u5206\u533a\u8868\u4fe1\u606f<\/strong>\uff1aMBR\u4e2d\u8fd8\u5305\u542b\u4e86\u786c\u76d8\u7684\u5206\u533a\u8868\u4fe1\u606f\uff0c\u8bb0\u5f55\u4e86\u786c\u76d8\u7684\u5206\u533a\u5e03\u5c40\u60c5\u51b5\uff0c\u5e2e\u52a9\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\u627e\u5230\u64cd\u4f5c\u7cfb\u7edf\u6240\u5728\u7684\u5206\u533a\u3002<\/li>\n<li> <strong>\u542f\u52a8\u64cd\u4f5c\u7cfb\u7edf<\/strong>\uff1a\u901a\u8fc7\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\uff0cMBR\u80fd\u591f\u6b63\u786e\u5730\u542f\u52a8\u64cd\u4f5c\u7cfb\u7edf\uff0c\u4e3a\u7528\u6237\u63d0\u4f9b\u8ba1\u7b97\u673a\u7684\u4f7f\u7528\u73af\u5883\u3002<\/li>\n<\/ol>\n<p>\u4e0b\u9762\u6211\u4eec\u6765\u770b\u4e00\u4e2a\u7b80\u5355\u7684Linux MBR\u7684\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<h4>\u4ee3\u7801\u793a\u4f8b\uff1a<\/h4>\n<pre>section .text\n    global _start\n\n_start:\n    jmp main\n\nprint_string:\n    mov ah, 0x0E\n    mov bh, 0x00\n    xor bl, bl\n\nprint_loop:\n    lodsb\n    test al, al\n    jz print_done\n\n    int 0x10\n    jmp print_loop\n\nprint_done:\n    ret\n\nmain:\n    mov si, hello_message\n    call print_string\n\n    jmp $\n\nhello_message db \"Welcome to Linux MBR!\", 0x0D, 0x0A, 0\n\ntimes 510-($-$$) db 0\ndw 0xAA55<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4ee5\u4e0a\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u6c47\u7f16\u4ee3\u7801\u793a\u4f8b\uff0c\u7528\u4e8e\u5728\u8ba1\u7b97\u673a\u542f\u52a8\u65f6\u663e\u793a\u4e00\u6761\u6b22\u8fce\u6d88\u606f\u3002\u8be5\u793a\u4f8b\u5b9e\u73b0\u4e86\u4eceMBR\u52a0\u8f7d\u4ee3\u7801\u5230\u5c4f\u5e55\u6253\u5370\u6b22\u8fce\u6d88\u606f\u7684\u529f\u80fd\u3002<\/p>\n<h4>\u603b\u7ed3\uff1a<\/h4>\n<p>Linux\u7684MBR\u5728\u8ba1\u7b97\u673a\u542f\u52a8\u8fc7\u7a0b\u4e2d\u626e\u6f14\u7740\u4e0d\u53ef\u6216\u7f3a\u7684\u89d2\u8272\uff0c\u8d1f\u8d23\u5f15\u5bfc\u64cd\u4f5c\u7cfb\u7edf\u7684\u52a0\u8f7d\u3002\u901a\u8fc7\u4ee5\u4e0a\u4ee3\u7801\u793a\u4f8b\uff0c\u6211\u4eec\u53ef\u4ee5\u521d\u6b65\u4e86\u89e3MBR\u7684\u57fa\u672c\u4f5c\u7528\u548c\u5b9e\u73b0\u65b9\u5f0f\u3002\u6df1\u5165\u5b66\u4e60\u548c\u7406\u89e3MBR\u7684\u539f\u7406\uff0c\u6709\u52a9\u4e8e\u6211\u4eec\u66f4\u597d\u5730\u7406\u89e3\u8ba1\u7b97\u673a\u542f\u52a8\u8fc7\u7a0b\u548c\u64cd\u4f5c\u7cfb\u7edf\u52a0\u8f7d\u8fc7\u7a0b\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fLinux MBR\uff1a\u542f\u52a8\u5f15\u5bfc\u7a0b\u5e8f\u7684\u57fa\u672c\u529f\u80fd\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux MBR\uff1a\u542f\u52a8\u5f15\u5bfc\u7a0b\u5e8f\u7684\u57fa\u672c\u4f5c\u7528\uff0c\u9700\u8981\u5177\u4f53\u4ee3\u7801\u793a\u4f8b \u5728\u8ba1\u7b97\u673a\u7684\u542f\u52a8\u8fc7\u7a0b\u4e2d\uff0cMaster Boot Record\uff08MBR\uff0c\u4e3b\u5f15\u5bfc\u8bb0\u5f55\uff09\u626e\u6f14\u7740\u81f3\u5173\u91cd\u8981\u7684\u89d2\u8272\u3002MBR\u662f\u5b58\u50a8\u5728\u786c\u76d8\u7684\u7b2c\u4e00\u4e2a\u6247\u533a\u4e2d\u7684\u4e00\u5c0f\u6bb5\u7a0b\u5e8f\uff0c\u5b83\u5305\u542b\u4e86\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\u548c\u5206\u533a\u8868\u7b49\u4fe1\u606f\u3002\u5f53\u8ba1\u7b97\u673a\u542f\u52a8\u65f6\uff0cBIOS\u4f1a\u9996\u5148\u52a0\u8f7dMBR\uff0c\u7136\u540e\u6267\u884c\u5176\u4e2d\u7684\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\uff0c\u4ece\u800c\u5f15\u5bfc\u64cd\u4f5c\u7cfb\u7edf\u7684\u52a0\u8f7d\u3002 MBR\u7684\u57fa\u672c\u4f5c\u7528\uff1a \u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\uff1aMBR\u4e2d\u5305\u542b\u4e86\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\uff0c\u8be5\u7a0b\u5e8f\u8d1f\u8d23\u52a0\u8f7d\u64cd\u4f5c\u7cfb\u7edf\u7684\u5185\u6838\u3002\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\u901a\u5e38\u662fGRUB\uff08GRand Unified Bootloader\uff09\u3002 \u5206\u533a\u8868\u4fe1\u606f\uff1aMBR\u4e2d\u8fd8\u5305\u542b\u4e86\u786c\u76d8\u7684\u5206\u533a\u8868\u4fe1\u606f\uff0c\u8bb0\u5f55\u4e86\u786c\u76d8\u7684\u5206\u533a\u5e03\u5c40\u60c5\u51b5\uff0c\u5e2e\u52a9\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\u627e\u5230\u64cd\u4f5c\u7cfb\u7edf\u6240\u5728\u7684\u5206\u533a\u3002 \u542f\u52a8\u64cd\u4f5c\u7cfb\u7edf\uff1a\u901a\u8fc7\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\uff0cMBR\u80fd\u591f\u6b63\u786e\u5730\u542f\u52a8\u64cd\u4f5c\u7cfb\u7edf\uff0c\u4e3a\u7528\u6237\u63d0\u4f9b\u8ba1\u7b97\u673a\u7684\u4f7f\u7528\u73af\u5883\u3002 \u4e0b\u9762\u6211\u4eec\u6765\u770b\u4e00\u4e2a\u7b80\u5355\u7684Linux MBR\u7684\u4ee3\u7801\u793a\u4f8b\uff1a \u4ee3\u7801\u793a\u4f8b\uff1a 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 &#8220;Welcome [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63055","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63055","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=63055"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63055\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63055"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63055"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63055"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}