Monthly Archives: August 2013

You are browsing the site archives by month.

Today I learned how to use sparse. It is a great tool that picks up warnings that aren’t caught by the compiler.

Getting Sparse on Ubuntu:

sudo apt-get install sparse

How to use sparse:

make M=drivers/staging/dgnc/ C=1

The types of warnings that I got from sparse for this driver were about adding markers and changing the types of variables. For example, some variables need the “marker” __iomem (it is used by the kernel to keep track of how memory is being used). No warning would pop up when compiling the code like normal. Sparse catches these problems.

Sparse is like the grammar police. =]

I UNDERSTAND THE CODE~! Whoot! I’m really proud of myself. I printed all the *.c files and was reading them a lot and looking for the corresponding functions in the linux API to wrap my head around the code and see where the API has changed. Its very time consuming. All the code I printed is about 100 pages. And that’s just the *.c files. I’ve learned a lot about how driver code latches onto the kernel and gets off it too. Its pretty awesome. Lots of abstractions are involved, but everything is properly named and well documented (at least in the code =]).

I’ve been reading and re-reading sections of Linux Device Drivers and Linux Kernel Development to understand the code. These two books have been very helpful.

I’ve also been spending tons of time debugging. I knew a little, but not much about how to debug.

All in all, its been great. I’m halfway thru the internship, and very proud of myself. =]