Setting up the kernel development environment - Shell Aliases
This article describes how to define useful shell aliases for your kernel development environment.
Shell aliases can make the life of a developer easier. In kernel development this is even more important as a lot of the workflows are driven by the command line.
Generally aliases make the life easier when navigating the source tree.
I generally define aliases for the important directories. This makes navigating pretty quick. I work mostly on three repositories: linux upstream repo, linux company repo and io-uring. For each of them I have an alias defined. In addition I have an alias to switch to the parent directory.
Some git commands are repeated pretty reguarly. I have defined aliases for some of them. I often need to see the current list of branches, create a patch for for the last commit, get a list of current commits and get the status of the current transaction.
I also defined a few aliases to invoke emacs faster. One is for text mode emacs, the other is to open emacs in graphics mode. In addition there are shortcuts to update the doom emacs configuration and to invoke neovim.
To quickly fetch new emails, I have defined the
For kernel development I have defined a few additional aliases.
mc invokes make clean and
m starts a new parallel build. It takes into accout how many processors are available on the
In case you decided to use LSP (Language server protocol), the
gen alias updates the LSP
server. Especially after swithing branches this is necessary. If you use cscope instead,
cs alias invokes cscope.
To make virtualization easier to use, a couple of aliases have been defined. The standard
vt starts a virtual kernel with 4 processors and 16MB of memory.
vio starts a
kernel that also makes a local liburing and fio directory available. This is very useful for
running io-uring tests.
vdbg is an alias that allows to attach a gdb session to the kernel
during startup (I will write an additional post that describes how to do this). The last
vnvme attaches a nvme device to the virtual machine.