Google Pixel 6 Pro: Limiting the battery’s charge level

Introduction This post is a spin-off from another post of mine. It’s the result of my wish to limit the battery’s charge level, so it doesn’t turn into a balloon again. I’ve written this post in chronological order (i.e. in the order that I found out things). If you’re here for the “what do I [...]

dmesg output of a Google Pixel 6 Pro

Just in case this helps anyone, this is the output of the dmesg command. The phone was rooted with Magisk, or else how would I get this? But at this stage, I hadn’t install Zygisk or any other module to hide the fact that the phone is rooted. Note that there’s also logcat for the [...]

Setting up a small Sphinx project for validating Linux kernel documentation RST markup

Introduction Since I maintain a module in the Linux kernel, I also need to maintain its documentation. Sometime in the past, the rst format was adopted for files under Documentation/ in the kernel tree, with Sphinx chosen as the tool for making formatted documents. Which is pretty nice, as rst human readable and can also [...]

Linux kernel: Dumping a module’s content for regression check

After making a lot of whitespace reorganization in a kernel module (indentation, line breaks, fixing things reported by sparse and checkpatch), I wanted to make sure I didn’t really change anything. All edits were of the type that the compiler should be indifferent about, but how can I be sure I didn’t change anything accidentally? [...]

Root over NFS remains read only with Linux v5.7

Upgrading the kernel should be quick and painless… After upgrading the kernel from v5.3 to 5.7, a lot of systemd services failed (Debian 8), in particular systemd-remount-fs: ● systemd-remount-fs.service – Remount Root and Kernel File Systems Loaded: loaded (/lib/systemd/system/systemd-remount-fs.service; static) Active: failed (Result: exit-code) since Sun 2020-07-26 15:28:15 IDT; 17min ago Docs: man:systemd-remount-fs.service(8) http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems Process: [...]

Linux kernel OOPS dissection notes

What’s this Every now and then I find myself looking at an Oops or kernel panic, reminding myself how to approach this. So this is where I write down the jots as I go. This isn’t very organized. Disassembly First thing first: Disassemble the relevant parts: $ objdump -DS driver.ko > ~/Desktop/driver.asm Doing this on [...]

Ftrace: The Linux kernel hacker’s swiss knife

Introduction I ran into ftrace completely by chance, while trying to figure out why the call to usb_submit_urb() took so long time. In fact, it wasn’t. It was pr_info() that delayed the output. And it was ftrace that got me to realize that. Whether you’re into dissecting existing kernel code, and want to know which [...]

Linux driver: Creating device files for a hotpluggable device

Introduction Most device drivers hook onto an already existing subsystem: Audio, networking, I2C, whatever. If it’s a specialized piece of hardware, a single device file is typically enough, and you get away with a misc device or, as shown in the kernel’s USB example (drivers/usb/usb-skeleton.c), with the USB framework’s usb_register_dev() call. However in some cases, [...]

Linux kernel programming: Do I need a lock?

Introduction Writing a device driver for Linux (or other kernel programming) always requires keeping parallel execution in mind. It’s often enough to follow common programming patterns, using spinlocks and mutexes in the same way that everyone else does. But somehow, I always find myself looking at my own code, and ask myself: Am I absolutely [...]

Jots on named pipes (FIFOs in Linuxish)

Major disclaimer These are pretty random jots that I made while evaluating named pipes as a solution for project. I eventually went for a driver in the kernel for various reasons, so I never got to verify that anything written below is actually correct. I’ve also written a small post on epoll with named pipes [...]