For some reason I will debug bios to see how it works.


Get&Build BIOS

  1. git clone https://github.com/coreboot/seabios.git
  2. make

Debug BIOS

Do not try x/i command in gdb when debugging bios, because gdb does not support 16 bit segmentation memory management You must provide the correct address, do not simply use x/10i, it will not work in real mode because 8086 doesn’t support flat memory model(google it) , you must provide the segment seletor and the offset, such x/10i 0xffffabcd, or 0x000fabcd, see https://stackoverflow.com/questions/62513643/qemu-gdb-does-not-show-instructions-of-firmware.

Way 1

  1. qemu-system-i386 -bios out/bios.bin -S -s
  1. ╭─ ~/Learning/System/Linux/Kernel/seabios on master ?2 ········ ─╮
  2. ╰─ ls ─╯
  3. COPYING docs out rom16offset.o src
  4. COPYING.LESSER Makefile README scripts vgasrc
  5. ╭─ ~/Learning/System/Linux/Kernel/seabios on master ?2 ········ ─╮
  6. ╰─ gdb ./out/rom.o ─╯

in gdb

  1. target remote :1234

Way 2

See, https://stackoverflow.com/questions/49405417/how-to-launch-openbios-from-qemu.

  1. qemu-system-i386 -L . -vga cirrus -serial stdio -S -s
  1. # In gdb
  2. target remote :1234