- Configure and build SeaBIOS.
- Run make menuconfig in SeaBIOS root source directory. If you’re downloading SeaBIOS as Coreboot payload, it’s located at <coreboot_source_path>/payloads/external/SeaBIOS/seabios.
- Enable CONFIG_OPTIONROMS, CONFIG_PMM, CONFIG_COREBOOT_FLASH when you run make menuconfig.
- Configure debug level to 8 (CONFIG_DEBUG_LEVEL)
- Save your changes and quit from the configuration menu (make menuconfig).
- Build SeaBIOS by invoking make.
- Configure and build Coreboot.
- Run make menuconfig in Coreboot root source directory.
- Disable both CONFIG_VGA_ROM_RUN and CONFIG_PCI_ROM_RUN as either of these options will confuse the virtual machine (Qemu) and possibly modify the contents of the PCI option ROM at runtime (debugging). Producing unwanted side effects.
- Configure SeaBIOS binary not as ordinary payload, but as an ELF payload. Configure CONFIG_PAYLOAD_FILE to point to the SeaBIOS ELF file, i.e.
<seabios_source_path>/out/bios.bin.elf . - Save your changes and quit from configuration menu (make menuconfig).
- Build Coreboot by invoking make.
- Insert TEST.ROM as CBFS component to Coreboot ROM file. The following are the steps to insert the PCI option ROM (the steps could be scripted):
- Combine TEST.ROM as CBFS component to Coreboot ROM with this command (invoked from Coreboot source code root directory):
./build/cbfstool build/coreboot.rom add <path_to_TEST_ROM> genroms/test.rom raw
- Check whether everything is OK with this command:
./build/cbfstool build/coreboot.rom print
- Combine TEST.ROM as CBFS component to Coreboot ROM with this command (invoked from Coreboot source code root directory):
- Run Qemu utilizing the newly built Coreboot ROM file as its BIOS (configured to stop and wait for the GDB connection).
qemu –m 128 –bios <path_to_coreboot_rom> -hda linux.img –net none –nographic –s –S
The –net none option disables gPXE option ROM from Qemu to load. The gPXE option ROM complicates the analysis a bit. Therefore, it’s better to get rid of it.
NOTE: If Qemu gPXE option ROM is enabled (default), the TEST.ROM option ROM would always be loaded at C980h segment. If Qemu gPXE option ROM is disabled, the TEST.ROM option ROM would always be loaded at C900h segment. - Run IDA Pro and connect via GDB remote debugging.
- Configure IDA Pro debugger to run in x86 16-bit mode.
- Attach to the qemu machine via Debugger|Attach|Remote GDB Debugger menu. Configure the IP address of your virtual or physical target machine there (which runs Qemu) and set the debugger specific option to run 16-bit code.
- When stopped at reset vector (FFFF:FFF0), create your required memory regions (Debugger|Debugger Options…|Set Specific Options|Memory Map)
- Configure breakpoints as needed.
- Run (press F9) and debug.
Post a Comment
2 comments:
Hi,How to anti-compile the VGA pci option rom ?I want to realize and modify the code in it ?
Like anti compile it:http://www.badongo.com/file/26075914
It is legacy rom +efi rom ,how to anticompile it to modify ?
Thank you for reply.
Best regards,
Chung
Start by reading this: https://sites.google.com/site/pinczakko/low-cost-embedded-x86-teaching-tool-2
As long as you could isolate the PCI ROM. You should be fine (mostly) only by reading the article above.
Post a Comment