For a official purpose, I had to build a basic application. But it was not a normal application, it had to be a BIOS app. I can code in C/C++ to some extent, but I don’t know how to do it in BIOS. So after many hours, I understood that the easiest way to run is below. Please note that some basics have been already configured as per found in the coreboot document. I have tested it in the below system.

$ cat /etc/lsb-release 

The directory was copied from: payloads/libpayload/sample and put into the below directory. I have use the following directory


And the directory listing has been provided below:

drwxrwxr-x  4 user1 user1   4096 Jan 11 11:57 ./
drwxrwxr-x 18 user1 user1   4096 Dec  7 11:11 ../
drwxrwxr-x  2 user1 user1   4096 Dec  7 11:11 arch_mock/
-rw-rw-r--  1 user1 user1    815 Jan 11 11:57 hello.c
-rwxrwxr-x  1 user1 user1 342192 Jan 11 11:57 hello.elf*
-rw-rw-r--  1 user1 user1   1540 Jan 11 11:57 hello.o
-rw-rw-r--  1 user1 user1   3374 Dec  7 16:13 hello_old.c
drwxrwxr-x 14 user1 user1   4096 Dec  7 14:47 libpayload/
-rw-rw-r--  1 user1 user1   2310 Dec  7 14:57 Makefile

After modification of the hello.c file, I was able to include it into the bios.

$ make
CC="/home/user1/coreboot/util/crossgcc/xgcc/bin/i386-elf-gcc" ../../libpayload/bin/lpgcc -fno-builtin -Wall -Werror -Os -c -o hello.o hello.c
CC="/home/user1/coreboot/util/crossgcc/xgcc/bin/i386-elf-gcc" ../../libpayload/bin/lpgcc -o hello.elf hello.o

For demonstration purpose, I have use the below code:

#include <libpayload-config.h>
#include <libpayload.h>

int main()
	printf("Hello from rezaur\n"); 	
	return 0;

Now come back to the original coreboot location and again run make and use the following command to run the bios rom.

$ qemu-system-i386 -bios build/coreboot.rom -boot menu=on