更改BIOS代码/刷新BIOS
我花了很多时间开发操作系统并开发低级引导加载程序。但现在我想离开我的操作系统一段时间,同时不离开底层环境并做一些涉及安全的事情。
因此,我选择按照预启动身份验证方案构建自己的标准密码实用程序。由于我希望该软件至少具有一定的便携性,因此我希望它使用尽可能少的外部支持。我想,如果我能以某种方式设法在自检和正在运行的实模式操作系统中的 int 19 引导程序之间的某个位置“挂钩”到 BIOS,那就最好了。
然而,事实证明找到有关如何修改 BIOS 代码的信息是不可能的。我没有发现任何关于如何实现前面提到的目标的信息。我只找到了描述如何刷新 BIOS 的页面。
有谁知道我如何读取/写入BIOS代码?或者有人可以提供描述此内容的页面链接?
我知道这不仅有可能使我的设备变砖,而且也有可能,我意识到了风险并愿意承担它。
I've spent a lot of time developing an operating system and working on my low level boot loader. But now I want to take some time off my operating system while not leaving the low-level environment and doing something involving security.
So I chose to build my own standard password utility following the pre-boot authentication scheme. Since I want the software to be at least a little portable I want it to use as little external support as is possible. I figured that I'd be best if I somehow managed to 'hook' into the bios somewhere between the self checks and the int 19 bootstrap from within a running real mode OS.
However finding information on how to modify the bios code proved to be impossible. I've found nothing on how to achieve the before mentioned. I have only found pages describing how to flash your bios.
Does anyone know how I can read/write bios code? Or can someone provide links to pages that describe this?
I know that it's not only possible to brick my device but it is also likely, I'm aware of the risk and willing to take it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Pinczakko 的关于 BIOS 逆向工程的文章是了解这一点的好地方。还有一本由同一作者出版的书,但现在已经绝版了打印。
我不确定这种方法是否是实现安全启动的最佳方法,但该网站上的文章非常详细,应该会向您指出修改 BIOS 固件的方法。
Pinczakko's articles on BIOS reverse engineering are a great place to start looking at this. There was also a book published by the same author but it is now out of print.
I'm not sure if this approach is the best approach towards a secure boot, but the articles on this site are very detailed and should point you towards a method for modifying your BIOS firmware.
我不太确定你想要实现什么,但是:
BIOS 完全是特定于硬件的 - 每个制造商都有自己的更新/刷新 BIOS 的机制,因此尝试提出一种用于更新 BIOS 的便携式机制是注定的为了失败。例如,当使用 Bochs 时,您可以通过指定不同的 BIOS ROM 映像来“更新”BIOS。
如果您想修改/编写自己的 BIOS,那么它将完全特定于该硬件。您最好的选择是从像 Bochs 这样的开源软件开始 - 因为您可以查看 BIOS 的源代码(并轻松测试/调试它),您有合理的机会理解 BIOS 代码并修改它进入一些有用的东西,但我怀疑这不是你想要做的。
为什么不在操作系统启动时执行此身份验证?如果您想保护数据,那么您应该对其进行加密,并要求用户在启动时提供登录/提供解密密钥。
I'm not really sure what you are trying to achieve, but:
The BIOS is completely hardware specific - each manufacturer will have their own mechanism for updating / flashing BIOS and so trying to come up with a portable mechanism for updating a BIOS is destined for failure. For example when using Bochs you "update" the BIOS by specifying a different BIOS ROM image.
If you want to modifty / write your own BIOS then its going to be completely specific to that hardware. Your best bet would be to start with something like Bochs as its open source - as you can take a look at the source code for the BIOS (and easily test / debug it) you stand a reasonable chance of understanding the BIOS code and modifying it into something that works, however I suspect this isn't what you are trying to do.
Why not just perform this authentication as your OS boots? If you want to protect the data then you should encrypt it and require that the user supply log in / supply the decryption key on startup.
如果您正在考虑使用“传统”PC BIOS,我会劝阻您不要尝试,原因有 Justin 提到的许多原因:1) 传统 BIOS 是 PC 供应商特定的; 2)它是闭源且专有的; 3) 没有行业标准定义传统 BIOS 接口来扩展您正在尝试的系统。
另一方面,如果您可以访问基于 UEFI 的 BIOS PC,您可能会能够编写自己的 PEI/DXE 驱动程序来实现此类功能。这至少会为您指明正确的方向:
http://sourceforge .net/apps/mediawiki/tianocore/index.php?title=欢迎
英特尔出版社关于该主题的书籍:超越 BIOS
关于读/写 BIOS 的实用性,您需要确定SPI 部分包含 BIOS 并获取 ROM燃烧器。 SPI部分可以有插座也可以没有;如果它没有插座,您将需要一个烙铁并能够为该部件创建插座/接头。您显然不想用您的主计算机系统开始这个项目。也许您可以找到较旧的系统或参考板。
If you were thinking of working with "legacy" PC BIOS, I would dissuade you from trying for many of the reasons Justin mentioned: 1) legacy BIOS is PC vendor-specific; 2) it is closed source and proprietary; 3) there are no industry standards defining legacy BIOS interfaces for extending the system as you are trying to do.
On the other hand, if you have access to a UEFI-based BIOS PC, you may be able to write your own PEI/DXE driver(s) to implement such a feature. This will at least point you in the right direction:
http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Welcome
Intel Press book on the topic: Beyond BIOS
Regarding the practicality of read/writing the BIOS, you'll need to identify the SPI part containg the BIOS and get a ROM burner. The SPI part may or may not be socketed; if it is not socketed, you'll need a soldering iron and be able to create a socket/header for the part. You obviously do not want to embark on this project with your primary computer system. Perhaps you could find an older system or a reference board.