0

I want to do some interaction with bios of a embedded linux on an AMD Ryzen embedded platform.

The main tool I think is flashrom which can read/write flash chips.

It should also be possible to write data to flash rom using something like dd if the address of the chip in memory is known?

Is this the correct way to look for system bios:

root@device:~/bios# grep ROM /proc/iomem
    000c0000-000cd3ff : Video ROM
  000f0000-000fffff : System ROM

If I look for the rom using flashrom tool I get the following:

root@device:~/bios# flashrom -p internal --flash-name
flashrom v1.2 on Linux 5.4.199 (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found chipset "AMD FP4".
Enabling flash write... OK.
Found Winbond flash chip "W25Q64.W" (8192 kB, SPI) mapped at physical address 0x00000000ff800000.
vendor="Winbond" name="W25Q64.W"

So the iomem says the chip is at 000f0000-000fffff and flashrom is saying he chip is at 0x00000000ff800000

Which one is correct, or better yet, why these are not identical?

DEKKER
  • 834
  • 8
  • 18

1 Answers1

1

Which one is correct, or better yet, why these are not identical?

They are different, because they are different things. Neither are "correct".

What flashrom outputs is an address of a physical flash IC.

What iomem reports where some part of memory is mapped to in memory space; this might be some memory that itself is somewhere on a flash IC (maybe even the one you queried via flashrom -p internal, but more likely something that got copied or mapped to some part of RAM during early hardware initialization.

You have to realize that "BIOS", "Video ROM", … are IBM PC concepts that essentially do not at all apply to how hardware works nowadays. They are hence, if present, completely emulated.

So, when you say "interaction with bios of a embedded linux on an AMD Ryzen", you are actually saying "I want to talk to a 38 year old API that gets somehow emulated by the firmware running on the processor I'm using"; it's not so easy to pinpoint who emulates what in that case, and superficially simple things like "there's the video ROM, which is a chip contains a font, and programs for the video BIOS", that's plain really not how the graphics hardware works. Same for the BIOS – what initializes the board and CPU is not some IBM PC-BIOS-derived software, but the firmware of your board and your CPU, including UEFI programs and Linux. The BIOS interface is really just some additional API offered optionally by the firmware.

Marcus Müller
  • 21,602
  • 2
  • 39
  • 54