bobuhiro11/gokvm - GitHub

Introduction

Continuation of gokvm development 1 2 3 4 5 6.

As introduced up to last time, by supporting virtio-blk and virtio-net, the virtual machine can now communicate with the outside through IO. This time, I changed the initrd from busybox-based to u-root-based, so I’ll talk about that.

0d89a47f Introduction of u-root-based initrd

I received a Pull Request suggesting that a VMM written in Go language should have an initrd also written in Go. It can generate artifacts with one command, and compared to busybox, it seemed simpler with fewer steps.

cb504d85 Make u-root-based initrd the default

After working with u-root initrd for a while, I felt it could handle what I wanted to do, so I made it the default. However, some things that could be done naturally with busybox couldn’t be done with u-root. For example:

  • To move the cursor within the shell with ctrl-l and ctrl-e, terminfo files were needed in addition to clear and tic commands.
  • When starting the guest, I placed a script file in /bin/uinit to initialize the NIC, file system, and start the HTTP server, but daemons were getting killed midway. I think my understanding of init-related behavior is insufficient. So as a workaround, I wrote it in .bashrc.

Conclusion

I also performed several refactorings besides this. This time there were no VMM-like changes. In the future, I want to work on migration.