As I wrote in the previous blog post, my first objective is to make Unikraft boot on QEMU using the Linux x86 boot protocol. Here I will present my progress so far and different challenges I faced while working towards my goal.
By using the git grep
command, I found that QEMU 9.0.1
handles the Linux x86 boot protocol in the x86.c file.
Everything happens in the x86_load_linux
function.
These are as follows:
As you can see, only 13 out of 39 fields are used. Out of these, 6 are read by QEMU:
And 7 are written by QEMU:
The application I am using to test the mklinux_x86.py
file is app-helloworld.
By using multiple printf
and exit
calls inside the x86_load_linux
function, I was able to determine the way QEMU uses the header.
Another useful tool was hexdump
,that was used to look at how my script builds the header.
For starters, I could not figure out why the header created by the script did not align to what QEMU expected.
The problem was that the header, as presented in the documentation, starts at offset 0x1f1
, not 0x0
.
To fix it I had to add 0x1f1 zeros.
Another issue was with integrating it in Unikraft. Eventually I figured it out, with help from my mentors.
Although debugging could be done only by running the mklinux_x86.py
script and looking at the header, I wanted to test by integrating everything in Unikraft.
For doing this I had to modify the following files: Linker.uk, Config.uk and Makefile.rules.
At the moment, when I try to run, it loops indefinitely. I have to debug and find out what does not work.
Additionally I am going to look into SeaBIOS/qboot/GRUB2 to see how the jumping to the kernel happens and I will write the needed 16-bit and 32-bit assembly stubs.
Feel free to ask questions, report issues, and meet new people.