2022-11-19 21:56:05 +00:00
|
|
|
---
|
|
|
|
title: Building Libreboot for Emulation
|
|
|
|
x-toc-enable: true
|
|
|
|
...
|
|
|
|
|
|
|
|
Introduction
|
|
|
|
============
|
|
|
|
|
|
|
|
Libreboot supports building for qemu as a target board.
|
|
|
|
The resulting rom can then be tested using qemu.
|
|
|
|
|
|
|
|
The qemu board is mostly intended to speed up development by removing the need to flash to bare metal during initial tests.
|
|
|
|
Qemu may also be useful for end users who intend to make changes to their libreboot rom without having to flash and reboot their machine.
|
|
|
|
|
|
|
|
Building and Testing
|
|
|
|
====================
|
|
|
|
|
|
|
|
Libreboot can be built for qemu just like any other board.
|
|
|
|
|
2023-10-10 16:58:18 +00:00
|
|
|
./build fw coreboot qemu_x86_12mb
|
2022-11-19 21:56:05 +00:00
|
|
|
|
|
|
|
In order to test the resulting roms, you must have qemu installed on the host machine.
|
|
|
|
Test the roms by pointing qemu to the rom in bios mode.
|
|
|
|
For example:
|
|
|
|
|
2023-09-11 16:20:57 +00:00
|
|
|
`qemu-system-x86_64 -bios bin/qemu_x86_12mb/grub_qemu_x86_12mb_libgfxinit_corebootfb_usqwerty_noblobs.rom`
|
2022-11-19 21:56:05 +00:00
|
|
|
|
2023-09-11 16:20:57 +00:00
|
|
|
`qemu-system-x86_64 -bios bin/qemu_x86_12mb/uboot_payload_qemu_x86_12mb_libgfxinit_corebootfb_noblobs.rom -serial stdio`
|
2022-12-17 21:36:25 +00:00
|
|
|
|
|
|
|
There is basic support for an arm64 virtual machine as well, although the payloads are not as developed as the x86 one:
|
|
|
|
|
2023-10-10 16:58:18 +00:00
|
|
|
./build fw coreboot qemu_arm64_12mb
|
2022-12-17 21:36:25 +00:00
|
|
|
|
2023-01-08 01:22:04 +00:00
|
|
|
```
|
2023-09-11 16:20:57 +00:00
|
|
|
qemu-system-aarch64 -bios bin/qemu_arm64_12mb/uboot_payload_qemu_arm64_12mb_libgfxinit_corebootfb_noblobs.rom \
|
2023-01-08 01:22:04 +00:00
|
|
|
-M virt,secure=on,virtualization=on,acpi=on -cpu cortex-a53 -m 768M -serial stdio -vga none -display none
|
|
|
|
```
|
2022-12-17 21:36:25 +00:00
|
|
|
|
2023-09-11 16:20:57 +00:00
|
|
|
NOTE: After the 20230625 release, U-Boot support was removed from x86 Qemu; it's
|
|
|
|
also problematic on ARM-based Qemu. Only x86 qemu, with other payloads, is to
|
|
|
|
be considered reliable for now.
|
|
|
|
|
2022-11-19 21:56:05 +00:00
|
|
|
Use Cases
|
|
|
|
=========
|
|
|
|
|
|
|
|
While development is the primary motivation for qemu support, the board makes it easy to test minor changes to release roms.
|
|
|
|
For example one can use *cbfstool* from coreboot to edit the background image in a libreboot rom as follows:
|
|
|
|
|
2023-01-08 01:22:04 +00:00
|
|
|
```
|
|
|
|
cbfstool /path/to/rom remove -n background.png
|
2022-11-19 21:56:05 +00:00
|
|
|
cbfstool /path/to/rom add -f mynewbackground.png -n background.png -t raw
|
|
|
|
```
|
|
|
|
|
|
|
|
Using qemu allows the user to verify that the background image renders properly before performing the same operation on their release rom.
|