#VSCode

During kernel development, the process from build to test to debugging is quite cumbersome. For this reason, we saw that QEMU and gdb were linked to build a development environment. I don’t know if it’s comparable to that, but there were some difficulties in development related to the Linux graphics stack. It was only later that I realized it was good for my mental health that it was better to set up a development environment in the first place, even if it bothered me.

Usually, development using Linux is performed in a virtual machine. Even if a distribution such as Ubuntu is installed on a virtual machine, the resolution is automatically adjusted according to the size of the virtual machine window. However, it is very inconvenient to develop in an environment where a GUI desktop environment such as GNOME or KDE is not provided. This is because the resolution of 800x600 is fixed even if the size of the virtual machine window is increased.

Method 1. putty + VS Code

With putty, it is possible to develop by remotely connecting to the virtual machine from the host. You can even remotely test the Linux graphics stack by setting the value of the DISPLAY environment variable to “:0”! Of course, it is also a big advantage that messages output for debugging purposes can be checked separately through putty. On the other hand, I mainly use VS Code for code analysis, but I was very nervous as I performed development with putty, testing with a virtual machine, and analysis with VS Code. Of course, if you use vi + ctags, you can integrate development and analysis in putty, but VS Code is a very good tool, so I started looking for other ways.

Method 2. Remote VS Code

VS Code provides a plugin called Remote VS Code. This plugin is like this. First, install rmate binary and ssh in the virtual machine (ssh is also needed to use putty). Since ssh is installed, connect to the virtual machine by reverse tunneling on the shell provided by VS Code. After that, by entering “rmate [file path]” in the shell, you can edit the file in VS Code.