KVM: Building the latest SeaBIOS firmware for virtual machines

By default, KVM will use the SeaBIOS x86 firmware for virtual machines.  This is typically installed as a dependent package which is years old.

In this article, I will show how to built the latest SeaBIOS image from source.

Prerequisites

I’m assuming you already have KVM and QEMU installed which would have installed the dependent “seabios” package.  This was covered in my article here.

If so, then check the current version of seaBIOS and location of its files.

$ sudo apt-cache policy seabios | grep Installed
$ sudo dpkg -L seabios

You will find your version of SeaBIOS at “/usr/share/seabios/bios.bin”.  The version coming from the Ubuntu repositories tends to be old.  You can verify by calling up a minimal VM using:

$ qemu-system-x86_64 -boot menu=on,splash-time=15000

You can see from this screenshot that out of the box, Ubuntu Xenial QEMU is packaged with SeaBIOS 1.7.4 which is from  December 2013.  Ubuntu 20 Focal comes with 1.13 from April 2019.

Get SeaBIOS source, make

The build instructions below are taken from this Ubuntu page. and this github page.

$ sudo apt-get install build-essential git -y
$ git clone https://github.com/coreboot/seabios.git
$ cd seabios
$ make

# show build result
$ ls -l out/bios.bin

# show version of new build
$ strings out/version.o | grep rel-

With the image now built, you can pull up a minimal VM using this new image.

$ qemu-system-x86_64 -boot menu=on,splash-time=15000 -bios out/bios.bin

 

If you are interested in using this image to boot a VM on KVM, read my article here.

 

REFERENCES

https://www.coreboot.org/SeaBIOS (instructions for manual build)

https://github.com/coreboot/seabios (source code)

https://www.seabios.org/Releases (features in each SeaBIOS versions)

https://help.ubuntu.com/community/Installation/QemuEmulator (brief explanation of QEMU)

https://www.collabora.com/news-and-blog/blog/2017/01/16/setting-up-qemu-kvm-for-kernel-development/

https://web.archive.org/web/20180104171638/http://nairobi-embedded.org/qemu_monitor_console.html (qemu control)

https://manpages.debian.org/stretch/qemu-system-x86/qemu-system-x86_64.1.en.html (parameters for qemu)