In previous post coreboot was configured and installed. Here we try to establish good debugging environment for it. To create a good emulated environment to debug, research and learn coreboot few tricks are required. First of all we need to know how to run our emulated environment (qemu). What I mean by that ?

  • load coreboot image (-bios option),
    • freeze CPU at startup (-S),
  • get appropriate feedback about virtual machine state (-d in_asm,cpu),
  • set up remote gdb server to run qemu step by step (-s).

So finally we get:

We don’t need graphics so it also could be disable (-nographic). Run above command and prepare debugging environment as described below.

  • load bootblock file in gdb:

  • use objdump to find out at what address .text, .bss and .data sections are:

my output looks like that:

  • use above addresses to load symbols from coreboot_ram file in gdb:

  • In another terminal or screen window

(use :e to reload qemu.log file after every instruction), in this file we will get information about all registers of virtual machine * target remote :1234 * Run next instruction (ni command in gdb) and refresh qemu.log, if you get something like:

it means that your debugging enviroment was set correctly.