引导加载程序帮助...为什么 USB 驱动器即使没有引导签名也能引导?

发布于 2024-10-31 09:38:14 字数 1539 浏览 1 评论 0原文

我正在阅读这篇关于如何从软盘启动的文章: http:// /www.cs.umbc.edu/portal/help/nasm/boot.shtml

我将在这里给出代码:

; boot1.asm   stand alone program for floppy boot sector
; Compiled using            nasm -f bin boot1.asm
; Written to floppy with    dd if=boot1 of=/dev/fd0

; Boot record is loaded at 0000:7C00,
    ORG 7C00h
; load message address into SI register:
    LEA SI,[msg]
; screen function:
    MOV AH,0Eh
print:  MOV AL,[SI]         
    CMP AL,0         
    JZ done     ; zero byte at end of string
    INT 10h     ; write character to screen.    
        INC SI         
    JMP print

; wait for 'any key':
done:   MOV AH,0       
        INT 16h     ; waits for key press
            ; AL is ASCII code or zero
            ; AH is keyboard code

; store magic value at 0040h:0072h to reboot:
;       0000h - cold boot.
;       1234h - warm boot.
    MOV  AX,0040h
    MOV  DS,AX
    MOV  word[0072h],0000h   ; cold boot.
    JMP  0FFFFh:0000h    ; reboot!

msg     DB  'Welcome, I have control of the computer.',13,10
    DB  'Press any key to reboot.',13,10
    DB  '(after removing the floppy)',13,10,0
; end boot1

我使用 nasm 组装它,然后使用 dd 将其复制到 USB 驱动器。然后我重新启动系统,一切正常。我的问题是,为什么即使我们没有在第 511 个字节定义 0xaa55,它仍然有效?请向我解释一下。另外,什么是冷重启和热重启?请给我一个很好的链接,我可以在其中详细了解启动过程...


编辑: 感谢您的回复!但我发现了为什么在这种情况下会发生这种情况。我之前曾将这个驱动器设置为可启动,之后又对其进行了多次格式化。事实证明,该格式不会影响 MBR。因此,当我使用 lde 打印驱动器内容的十六进制转储时,我发现签名仍然存在。现在我将其删除,从驱动器启动时显示错误“找不到操作系统”。

I was reading this article about how to boot from a floppy disk: http://www.cs.umbc.edu/portal/help/nasm/boot.shtml

I will give the code here:

; boot1.asm   stand alone program for floppy boot sector
; Compiled using            nasm -f bin boot1.asm
; Written to floppy with    dd if=boot1 of=/dev/fd0

; Boot record is loaded at 0000:7C00,
    ORG 7C00h
; load message address into SI register:
    LEA SI,[msg]
; screen function:
    MOV AH,0Eh
print:  MOV AL,[SI]         
    CMP AL,0         
    JZ done     ; zero byte at end of string
    INT 10h     ; write character to screen.    
        INC SI         
    JMP print

; wait for 'any key':
done:   MOV AH,0       
        INT 16h     ; waits for key press
            ; AL is ASCII code or zero
            ; AH is keyboard code

; store magic value at 0040h:0072h to reboot:
;       0000h - cold boot.
;       1234h - warm boot.
    MOV  AX,0040h
    MOV  DS,AX
    MOV  word[0072h],0000h   ; cold boot.
    JMP  0FFFFh:0000h    ; reboot!

msg     DB  'Welcome, I have control of the computer.',13,10
    DB  'Press any key to reboot.',13,10
    DB  '(after removing the floppy)',13,10,0
; end boot1

I assembled it using nasm and then copied it to a USB drive using dd. Then I restarted the system and it worked just fine. My problem is that why is this working even when we have not defined 0xaa55 at 511th byte? Please explain this to me. And also, what is cold reboot and warm reboot? Kindly give me a good link where I can learn in detail about the booting process...


EDITED:
Thanks for you responses! but I found why this was happening in this case. It was that I had made this drive bootable sometime ago and the formatted it many times after that. Turns out that the format does not affect the MBR. So, when I printed the hex dump of the contents of the drive using lde, I found out the signature was still there. Now that I removed it, booting from the drive is showing the error "Operating System not found".

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

韬韬不绝 2024-11-07 09:38:14

这取决于您计算机的 BIOS。许多 BIOS 实现不需要 AA55 签名来启动软盘,并且由于 USB 驱动器既不是软盘也不是硬盘驱动器,因此由 BIOS 决定应将其视为哪一个。我猜测您的 BIOS 不需要软盘签名,并将 USB 驱动器视为软盘驱动器,这意味着它也不需要 USB 驱动器签名。

有关冷启动和热启动之间的区别,请参阅吉姆的评论。

It depends on your computer's BIOS. A lot of BIOS implementations do not require the AA55 signature to boot floppy disks, and since a USB drive is neither a floppy disk or hard drive, it is up to the BIOS to decide which it should be treated as. I would guess that your BIOS does not require the signature for floppy disks and treats USB drives as floppy drives, which would mean it also does not require the signature for USB drives.

See Jim's comment for the difference between cold and warm boot.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文