My Workflow

Recently, some of the Outreachy interns were discussing our workflows. So, I thought that a short description of what I do might be useful!

Where I work

I do all of my work in an Ubuntu VM running in the Hyper-V hypervisor. I start up a VM and make some code changes. Then I compile and install the changes and finally shutdown and restart the VM to test them.

How I compile and install changes

After making some code changes, I compile and install them using the following steps. I run all of the these commands from the root directory of the kernel source tree that I’m working on.

1. Run a make command on the directory that contains the module that I’m working on to check for compilation errors. For example, if I’m working on a module in the drivers/hv directory, I would run the following command, which will make the .o files for the files in the drivers/hv directory:

make drivers/hv/

Note the forward slash at the end of the directory path – that’s necessary. If you leave it off, nothing will be built. This command just makes the .o files, but it doesn’t link the modules. I just like to use it for quick check to make sure that I don’t have any compilation errors.

2. Compile the kernel the make command. This command takes care of compiling and linking everything:

make -jX

where X is the number of threads that you want to use for the compilation. The kernelnewbies tutorial suggests setting this equal to the number of CPUs that your machine has.

4. Reload the modules and install the kernel with:

sudo make modules_install install

How I test my changes

I shut down the Linux VM and restart it to test the code changes. Since I’m currently working on a Hyper-V module in a Linux VM running in Hyper-V, I can’t unload and reload the module. The module is in use. If you’re working on a module that you can unload and reload, it’s much faster to do that.

That’s it! For more information, check out the first patch tutorial at kernelnewbies.org.

Advertisements