BIOS如何知道存在哪种类型的BPB? [英] How does the bios know what type of BPB is present?

查看:81
本文介绍了BIOS如何知道存在哪种类型的BPB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想让引导程序从USB记忆棒引导,则必须包含BPB. USB记忆棒正在软盘仿真模式下运行.如此处所示,有许多不同的BPB版本. BIOS如何知道存在哪种类型的BPB? GRUB 0.97似乎还使用了另一种 BPB 格式?

If I want my bootloader to boot from a usb stick, I have to include a BPB. The usb stick is running in floppy emulation mode. As seen here, there are many different BPB versions. How does the bios know what type of BPB is present? GRUB 0.97 seem to be using yet another BPB format ?

我可以将Bootloader从偏移量0xb稍微填充一下,然后它也将起作用. 是否有标准尺寸/通用尺寸?我没有在USB上使用任何文件系统,只是原始文件.

I can pad my bootloader from offset 0xb a little, and then it will also work. Is there a standard/common size to use? I am not using any filesystem on my USB, just raw.

我想我需要BPB,因为BIOS试图更新一些值,这会覆盖一些代码.由于每个BPB似乎都有些不同,所以BIOS如何知道在哪里更新什么值?

I guess I need the BPB because the bios tries to update some on the values, which overwrite some of the code. Since every BPB seems a little different, how can the bios know where to update what value?

推荐答案

并非所有的BIOS实现都关心您是否拥有BPB.以MBR引导扇区开头的BPB的常规格式如下:

Not all BIOS implementations care if you have a BPB. The general format for the BPB with the beginning of an MBR boot sector is below:

bits 16
org 0                   ; BIOS will load the MBR to this location.

    bootStart:
            jmp     _start
            nop
            osType      db  'MSDOS6.0'
            bpb
            bps         dw  512
            spc         db  8
            rs          dw  1
            fats        db  2
            re          dw  512
            ss          dw  0
            media       db  0xf8
            spfat       dw  0xc900
            spt         dw  0x3f00
            heads       dw  0x1000
            hidden      dw  0x3f00, 0
            ls          dw  0x5142,0x0600
            pdn         db  0x80
            cheads          db  0
            sig         db  0x29
            serialno    dw  0xce13, 0x4630
            label       db  'NO NAME'
            fattype     db  "FAT32"

    _start:
                                ; set up the registers
            mov     ax, 0x07c0
            mov     ds, ax
            mov     fs, ax
            mov     gs, ax
            mov     ax, 0x0700
            mov     es, ax

这些字段始终位于同一位置..如果系统关心BPB,则只需解析即可验证它.

The fields are always in the same place.. The way that the system, if it cares about the BPB, verifies it is simply by parsing it.

这篇关于BIOS如何知道存在哪种类型的BPB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆