如何将 BIOS 数据转储到文件

Omi*_*mid 29 linux bios

我想将笔记本电脑的 BIOS 数据转储到一个文件中。我找到的唯一解决方案是以下命令:

dd if=/dev/mem bs=X skip=Y count=1
Run Code Online (Sandbox Code Playgroud)

X并且Y不同的人建议的解决方案不同,因为有不同的 BIOS 类型。

有没有办法找到 BIOS 数据的确切地址/dev/mem?我可以用它dmidecode来查找内存中 BIOS 的地址范围吗?Linux 是将所有 BIOS 数据转储到 RAM 中还是仅转储其中的一个特殊部分?

如果 Linux 可以将 BIOS 数据转储到 RAM,那么 root 用户是否也可以直接访问 BIOS?

小智 22

您可以尝试使用biosdecode.

它是一个命令行实用程序,用于解析 BIOS 内存并打印有关它知道的所有结构(或入口点)的信息。它找出有关硬件的信息,例如:

  • IPMI 设备
  • 内存类型和速度
  • 底盘信息
  • 温度探头
  • 冷却装置
  • 电流探头
  • 处理器和内存信息
  • 序列号
  • BIOS版本
  • PCI / PCIe 插槽和速度

等等。

需要考虑的事项:

  • biosdecode解析BIOS内存并打印有关所有结构的信息。
  • 解码BIOS数据与转储计算机的DMI 相同。该DMI表主要描述了该系统目前由。
  • 提供的数据biosdecode不是人类可读的格式。

查看屏幕上的内容

您将需要使用dmidecode命令在屏幕上转储计算机的 DMI (SMBIOS) 表内容。

$ sudo dmidecode --type 0 
Run Code Online (Sandbox Code Playgroud)

搜索手册页以获取更多信息:

$ man dmidecode
Run Code Online (Sandbox Code Playgroud)

是的,内核只在 RAM 中保存它需要的来自 BIOS 的信息。但是,您可以使用包含嵌入式 ASM(汇编代码)等的 C 应用程序从 root 用户进行实时 BIOS 调用。

您可以在 Linuxmagazine 的这篇文章中阅读有关 Linux 内核和系统 BIOS 的更多信息:Linux and the BIOS


And*_*ese 14

我想你要找的是flashrom. 如果您的系统受支持,您可以通过发出以下命令来读取您的 BIOS 内容

# flashrom -r <outputfile>
Run Code Online (Sandbox Code Playgroud)

如果您只想保存所谓的CMOS RAM(您将配置保存到的那些额外字节,例如 RTC 上的警报等),内核的nvram驱动程序和设备可能会帮助您:

config NVRAM
     tristate "/dev/nvram support"
     depends on ATARI || X86 || (ARM && RTC_DRV_CMOS) || GENERIC_NVRAM
     ---help---
       If you say Y here and create a character special file /dev/nvram
       with major number 10 and minor number 144 using mknod ("man mknod"),
       you get read and write access to the extra bytes of non-volatile
       memory in the real time clock (RTC), which is contained in every PC
       and most Ataris.  The actual number of bytes varies, depending on the
       nvram in the system, but is usually 114 (128-14 for the RTC).

       This memory is conventionally called "CMOS RAM" on PCs and "NVRAM"
       on Ataris. /dev/nvram may be used to view settings there, or to
       change them (with some utility). It could also be used to frequently
       save a few bits of very important data that may not be lost over
       power-off and for which writing to disk is too insecure. Note
       however that most NVRAM space in a PC belongs to the BIOS and you
       should NEVER idly tamper with it. See Ralf Brown's interrupt list
       for a guide to the use of CMOS bytes by your BIOS.

       On Atari machines, /dev/nvram is always configured and does not need
       to be selected.

       To compile this driver as a module, choose M here: the
       module will be called nvram.
Run Code Online (Sandbox Code Playgroud)


ack*_*ack 11

如果其他工具不可用或无法使用,这里有一种方法可以对要转储的内存区域进行有根据的猜测。

例如,在 VirtualBox VM 中,我通过执行以下操作成功转储了其 BIOS:

$ grep ROM /proc/iomem # https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-firmware-memmap
000c0000-000c7fff : Video ROM
000e2000-000e2fff : Adapter ROM
  000f0000-000fffff : System ROM
# dd if=/dev/mem of=pcbios.rom bs=64k skip=15 count=1 # 15*64k + 64k
Run Code Online (Sandbox Code Playgroud)

  • 您如何根据内存地址知道要使用的大小? (2认同)

tot*_*tti 8

选项bios dmidecode

dmidecode -t bios
Run Code Online (Sandbox Code Playgroud)

从存储器读取C:0000F:FFFF不需要的dmidecode

dd if=/dev/mem bs=1k skip=768  count=256 2>/dev/null | strings -n 8
Run Code Online (Sandbox Code Playgroud)