I saw in a Discord server that list that someone decided to replace the default logo that is included with OVMF (also known as EDK2/Tianocore) – the EFI wrapper used on QEMU and other KVM software to boot from UEFI images. While they only did it as a funny side-gag, since they were recompiling the source for a secureboot compatible image, I thought it would’ve been quite a challenge to change them out, considering the restrictions that you’d typically be working with in an EFI file, such as needing the file in specific formats, editing files, etc. Turns out however, it’s relatively straightfoward and easy to setup. Therefore in this short guide, i’ll be showing you how you’re able to replace the Tianocore logo present in the default OVMF files with your own, to give your virtual machines a bit more of a “personal” touch :p

Before you begin and preparing the environment

The steps you need to take in order to compile the images for OVMF may differ depending on your Linux distribution. If you’re unable to find the same or suitable replacements for the packages listed for your distro, you should first try checking the EDK2 Git Repository first. I’ll be building the images on a Ubuntu 21.04 installation.

We’ll be using the terminal to download required packages as well as the source code itself before compiling. Before we can get to downloading anything though, we should firstly consider running sudo apt update to ensure we have the most up-to-date packages available for download, before installing the required packages with sudo apt install -y git nasm iasl build-essential uuid-dev. Afterwards, we can clone the full repository to our directory of choice with git clone https://github.com/tianocore/edk2, and wait for that to finish cloning to your directory of choice.

Preparing your new image

There’s a couple of requirements that you’ll need to satisfy for the image to display, and not look incredibly weird when you build the image. Firstly, your image needs to be a 256-colour bitmap image, and secondly no greater than 200px in width and/or height. While the second requirement isn’t exactly nessacary, it’ll help make your image not look too big or mess with other elements that may render at boot time, like the Windows spinning circle. Now I made my image through GIMP, however unfortunately it doesn’t include the ability to export as 256 colour meaning I had to resort to using the Wine version of MSPaint to export the final image. There’s likely a better way to do this process through alternative image editors, and i’ll update this with a better method when I’m aware of one.

Make sure to fill in any background left over in your graphic with pure black

For my OwO image, I chose to keep the same dimensions as the original Tianocore image, which is 193x58px. You don’t have to stick to this resolution, however i’ve chosen it for the sake of simplicity. After designing your graphic in your favourite editor, you’ll need to fill in any empty space that isn’t taken up by part of the graphic with complete black (0,0,0) otherwise the final result might not render like you want, considering bitmap has no transparent layer support. After you have finished designing your bitmap, you’ll need to export your image as a 256-colour bitmap. You should be able to do this easily in your software’s export options, either while saving the file or on a seperate dropdown for bitmap images. Name the resulting file “Logo” (exactly identical, case sensetive) then proceed to save it.

Importing your graphic

Before we’re able to import the graphic, there’s a couple extra steps we need to undertake in the respository folder relating to certain files that’ll assist in the build process. In your edk2 root folder, run git submodule update --init. Once that’s finished downloading, we’ll need to compile the tools by running make -C BaseTools. If compiled successfully, make should tell you “OK” and that it’s left the directories.

I’ve seen some writeups and tutorials require you to check edk2/Conf/target.txt and ensure certain parameters are there, however if the file doesn’t exist don’t worry as the compiler should fill in the parameters for you.

Head over to the directory <edk2_root>/MdeModulePkg/Logo. You should see the Tianocore logo already there in the directory, along with a bunch of other files. All we need to focus on is the .bmp file that’s already there, as the other files only deal with referencing and defining the logo file. Drag your new logo into the directory, where you should be asked if you want to replace the existing file there. Click replace as we’ll no longer be needing the Tianocore Logo if we want our own to be shown instead. You should then see your graphic in the folder where the Tianocore graphic was. You can now close the directory as no more modification is required.

Building and running OVMF

Now that we’ve made all the changes that were needed, we’re able to begin compiling the OVMF binaries for use on virtual machines. Go back to the terminal window and cd to the OvmfPkg folder with cd <edk2-root>/OvmfPkg. Afterwards, you’ll be able to run ./build.sh and begin the compilation process, which this script will take care of for you. If you get an error regarding python missing, this is because by default it’s looking for python2 instead of python3. You can fix this by either installing the python2 packages with sudo apt install python, or you can run ln -s /usr/bin/python3 /usr/bin/python in the terminal instead which will use your existing python3 installation. You should then be able to rerun ./build.sh and compile successfully. If the process finishes successfully, you should be greeted at the end of the text vomit with a simple “Done”, and how long it took to build.

You’re now able to put the files to use! I use virt-manager to manage my KVM instances, which means these settings may differ depending on how your KVM setup is. Firstly, make sure that XML editing is turned on in the virt-manager settings (this can be found by going to Edit > Prefrences and checking “Enable XML Editing”). Then you can open your virtual machine(s) and replace the default OVMF files with your own in the XML tab on the VM overview panel. Look for <loader> and <nvram> under the <os> tag. You’ll need to replace both as your existing nvram will not match your new OVMF build. The files can be found under <edk2_root>/Build/OvmfX64/DEBUG_GCC5/FV/OVMF_{CODE/VARS}.fd. OVMF_CODE is placed inbetween the <loader> tags, while OVMF_VARS is placed between the <nvram> tags. After you’ve added your new files to their respective locations, you can click “Apply” and then start the VM.

If all went well, you should see your own graphic instead of the Tianocore one! Now of course, this isn’t the only thing you could potentially configure with OVMF/EDK2, considering it’s an open source project that’s constantly being maintained, you’re free to customise other parts of the wrapper too as you see fit – however this might require some knowledge in C prior :v