Notes, musings and what not
Using static checkers on Linux Kernel
One of the hurdles in contributing to Linux kernel as a beginner is to find something to work on. If you are working as a kernel developer or are a part of a kernel mentorship program, this shouldn’t be a problem. But for others, the first step is to send a bunch of coding style fixes for warnings reported by checkpatch.
In addition to checkpatch, there are many other static analysis tools like sparse, coccinelle and smatch, used to analyse source code and find possible bugs. In this post, I’ll show how to use some of these tools to find issues to fix.
…Hardware compression algorithms
Compression is a common technique that allows us to reduce the size of data. We use it when we store or send files as zip, 7z or rar archives. It helps reduce the space occupied by files in the filesystem and also to save bandwidth while transferring over a network.
In general, compression algorithms try to encode redundancy or regularity in data with lesser bits.
There are many different software compression algorithms available. Lempel-Ziv family of algorithms, used in tools like zip and 7z, works by replacing repeated chunks of data with a pointer to an earlier occurrence. This avoids repeating the same chunks of data over and over again.
…FOSSHack 2021
FOSSHack 2021
FOSSHack 2021 is a remote hackathon, organized by FOSSUnited, that happened on 13-14 November. FOSSUnited is a non-profit foundation that seeks to foster more FOSS projects and contributors from India and this hackathon is one such initiative.
The rules were simple: Build a FOSS project or Work on existing FOSS project during the weekend. The projects would be judged based on factors like technical complexity, completeness and utility.
I came to know about FOSSHack from the ILUGC mailing list.
…Publishing packages to PyPI
The usability of a programming language depends on many factors and one of them is the availability of good libraries to build on. When libraries are available, we also need a way to search and download libraries with ease. Most modern langauges maintain some form of index to make dependency management easier. Examples include Crates.io for Rust and PyPI for Python.
Python Package Index (PyPI) is an index and repository of Python packages. Publishing your Python library or tool on PyPI allows any user to download it with pip.
…Creating sysfs files
The kernel provides a few ways in which userspace programs can get information from the kernel space.
- procfs: Used to get information about running processes
- debugfs: Used by kernel developers for debugging
- sysfs
Sysfs is used for data that is not related to a particular process. It has information about hardware devices attached to the system and about drivers handling those devices.
Any file added to the sysfs becomes a part of the Linux Application Binary Interface (ABI). This means that applications might start using this file and now it has to be supported (like) forever, because kernel developers care about not breaking userspace.
…