See the [[Build HOWTO]] for information on how to build coreboot for this board.

−

+

−

Change to directory targets/emulation/qemu-x86 and modify Config.lb:

+

−

* change payload to point to your payload (filo.elf or linux.elf)

+

−

* if you are using a Linux payload, increase the value of option ROM_SIZE to 2048*1024 (2 MB)

+

−

+

−

Return to targets directory and execute:

+

−

$ ./buildtarget emulation/qemu-x86

+

−

+

−

Go to targets/emulation/qemu-x86/qemu-x86 and execute:

+

−

$ make

+

−

This creates the coreboot image (qemu-bios.rom). Copy and rename this file to bios.bin in your home directory.

+

This creates the coreboot image (build/coreboot.rom).

=== Building Qemu ===

=== Building Qemu ===

+

Qemu used to require patches to work with coreboot, but any current standard build (as packaged by distributions) should be good enough.

−

If you plan to run Qemu version 0.9.0, you will have to build QEMU from source after applying a couple of patches. (Later versions of QEMU might incorporate these patches, allowing you to run them unmodified; hopefully someone will be kind enough to update this tutorial if this happens.)

Configure and make QEMU (use the --cc option if your default gcc is newer than version 3.4):

+

−

$ ./configure --cc=gcc-3.4 --target-list=i386-softmmu && make

+

−

+

−

The QEMU binary is stored in the i386-softmmu directory.

+

−

+

==== Building Qemu on FreeBSD ====

==== Building Qemu on FreeBSD ====

Qemu can easily be installed using FreeBSD's Ports tree. The Qemu port lives in emulators/qemu. However, as of version 0.9.1 the FreeBSD port can unfortunately no longer be used with coreboot. The latest working version is 0.9.0 which can be retrieved from the FreeBSD CVS repository. For your convenience, an archive of the last working port version has been uploaded to this wiki. You can download the archive from [http://www.coreboot.org/Image:FreeBSD-Qemu-0.9.0.tgz here]. For some reason, the downloaded archive cannot be extracted with tar only, so use these steps to extract the archive:

Qemu can easily be installed using FreeBSD's Ports tree. The Qemu port lives in emulators/qemu. However, as of version 0.9.1 the FreeBSD port can unfortunately no longer be used with coreboot. The latest working version is 0.9.0 which can be retrieved from the FreeBSD CVS repository. For your convenience, an archive of the last working port version has been uploaded to this wiki. You can download the archive from [http://www.coreboot.org/Image:FreeBSD-Qemu-0.9.0.tgz here]. For some reason, the downloaded archive cannot be extracted with tar only, so use these steps to extract the archive:

The -bios option tells QEMU to use path/to/coreboot.rom as its BIOS. The -nographic option suppresses the graphical VGA display and connects the virtual machine's serial port to your console. If you want to keep VGA display, you can use "-serial stdio" instead, which only redirects serial to the console.

You should now see all sorts of interesting coreboot messages, followed by Linux kernel boot messages or a FILO prompt.

You should now see all sorts of interesting coreboot messages, followed by Linux kernel boot messages or a FILO prompt.

Introduction

If you don't have a mainboard supported by coreboot don't worry: QEMU can help you to emulate one. Using coreboot with QEMU may serve the purpose to familiarize you as a developer with coreboot and may be a reference system during development.

While there are many ways to use coreboot to load and run a Linux kernel, this tutorial covers two of the most common:

coreboot with FILO as payload, using FILO to load a Linux kernel (and optional initramfs) from a hard disk image. This approach involves a bit more mechanism (it relies on FILO's built-in disk and filesystem drivers) but it produces a tiny coreboot image.

coreboot with a Linux kernel (and optional initramfs) as payload. This cuts FILO out of the picture, but the main challenge with this approach is squeezing the resulting coreboot image into QEMU's BIOS ROM area (currently 2 MB, but easy to extend by patching QEMU).

Requirements

plus a Linux kernel and root filesystem and a working development environment (make, gcc, etc.).

Building or finding a Linux kernel

If you are using FILO, you can simply grab a Linux kernel and initramfs from your favorite distribution.

Otherwise, you will probably need to build a kernel and initramfs from scratch, ensuring that the final coreboot image does not exceed QEMU's BIOS size limit (2MB if qemu-bios-size patch applied, 256KB otherwise). Building the kernel and initramfs is beyond the scope of this tutorial; how you configure them depends on your application.

If you plan to use kexec to chain-boot another Linux kernel, tools from these projects can help automate the process of generating a kernel and initramfs:

If you are using a debootstrap filesystem, open the file /mnt/rootfs/etc/inittab and change runlevel to level 1:

id:1:initdefault:

cd out of /mnt/rootfs and umount it:

# umount /mnt/rootfs

Exit from the root account:

# exit

Starting coreboot in QEMU

Execute QEMU using the following parameters:

$ qemu -bios path/to/coreboot.rom -hda disk.img -nographic

The -bios option tells QEMU to use path/to/coreboot.rom as its BIOS. The -nographic option suppresses the graphical VGA display and connects the virtual machine's serial port to your console. If you want to keep VGA display, you can use "-serial stdio" instead, which only redirects serial to the console.

You should now see all sorts of interesting coreboot messages, followed by Linux kernel boot messages or a FILO prompt.