<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>ankit_kdev</title><link>https://ankitkdev.com/</link><description>Recent content on ankit_kdev</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 11 Jun 2026 17:26:20 +0530</lastBuildDate><atom:link href="https://ankitkdev.com/index.xml" rel="self" type="application/rss+xml"/><item><title>Linux Device Driver Hacks</title><link>https://ankitkdev.com/blog/linux-device-driver-hacks/</link><pubDate>Thu, 11 Jun 2026 17:26:20 +0530</pubDate><guid>https://ankitkdev.com/blog/linux-device-driver-hacks/</guid><description>&lt;blockquote>
&lt;p>This blog will contain the code snippets that are needed to implement particular feature in kernel.
I&amp;rsquo;ll mainly focus on code snippet rather than the explanation.
Again! this blog may not be fully correct. You&amp;rsquo;re expected to &amp;ldquo;check the facts/code&amp;rdquo; before applying.
Please correct me, if i&amp;rsquo;m wrong. I&amp;rsquo;ll be more happy to accept the changes.
This Blog is not beginner friendly.&lt;/p>&lt;/blockquote>
&lt;h2 id="kernel-module-macro">Kernel MODULE MACRO&lt;/h2>
&lt;h3 id="handling-module-parameters">Handling module parameters&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c" data-lang="c">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;linux/moduleparam.h&amp;gt; // No need to include this. &amp;#39;linux/module.h&amp;#39; included it.&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">module_param&lt;/span>(name, type, perm);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">MODULE_PARM_DESC&lt;/span>(myarr,&lt;span style="color:#e6db74">&amp;#34;this is my array of int&amp;#34;&lt;/span>);
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;pre tabindex="0">&lt;code>inmod module.ko param=value
&lt;/code>&lt;/pre>&lt;hr>
&lt;h2 id="char-device">Char Device&lt;/h2>
&lt;blockquote>
&lt;p>There are 2 way to create char device.
Creating the device node through &amp;lsquo;kernel module&amp;rsquo; or using &lt;code>mknod&lt;/code>&lt;/p></description></item><item><title>Understanding Forward Declarations in C</title><link>https://ankitkdev.com/blog/forward-declaration-in-c/</link><pubDate>Sun, 17 May 2026 17:00:31 +0530</pubDate><guid>https://ankitkdev.com/blog/forward-declaration-in-c/</guid><description>&lt;p>One of the best ways to learn systems programming is by reading real-world code. Recently, while reading the Linux kernel source, I noticed something interesting inside &lt;code>drivers/pinctrl/core.h&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c" data-lang="c">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;linux/kref.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;linux/list.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;linux/mutex.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;linux/radix-tree.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;linux/types.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;linux/pinctrl/machine.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">struct&lt;/span> dentry;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">struct&lt;/span> device;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">struct&lt;/span> device_node;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">struct&lt;/span> module;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>At first glance, these lines seem incomplete. We see declarations like &lt;code>struct device;&lt;/code> but no actual definition. Where is the complete structure with all its members? Why didn&amp;rsquo;t file defining this structure isn&amp;rsquo;t included?&lt;/p></description></item><item><title>Legal Notice</title><link>https://ankitkdev.com/legal-notice/</link><pubDate>Thu, 14 May 2026 00:00:00 +0000</pubDate><guid>https://ankitkdev.com/legal-notice/</guid><description>&lt;h3 id="disclaimer">Disclaimer&lt;/h3>
&lt;p>This website is provided for educational and informational purposes only. While efforts are made to keep content accurate and up to date, no guarantees are made regarding completeness, accuracy, or reliability.&lt;/p>
&lt;h3 id="technical-content">Technical Content&lt;/h3>
&lt;p>Articles related to Linux, kernel development, embedded systems, C programming, and debugging reflect personal experience and research. Readers should independently verify technical instructions before applying them in production or critical environments.&lt;/p>
&lt;h3 id="external-links">External Links&lt;/h3>
&lt;p>This website may contain links to third-party websites. I am not responsible for the content, privacy practices, or availability of those external sites.&lt;/p></description></item><item><title>Privacy Policy</title><link>https://ankitkdev.com/privacy-policy/</link><pubDate>Thu, 14 May 2026 00:00:00 +0000</pubDate><guid>https://ankitkdev.com/privacy-policy/</guid><description>&lt;p>This website is a personal blog and portfolio.&lt;/p>
&lt;h3 id="information-collection">Information Collection&lt;/h3>
&lt;p>When you visit this website, basic technical information such as IP address, browser type, device information, and pages visited may be logged automatically by hosting providers or analytics services.&lt;/p>
&lt;h3 id="analytics">Analytics&lt;/h3>
&lt;p>This website may use analytics tools to understand traffic and improve content. These tools may collect anonymized usage information.&lt;/p>
&lt;h3 id="cookies">Cookies&lt;/h3>
&lt;p>This website itself does not intentionally use cookies for tracking, though third-party embedded services or external links may use cookies according to their own policies.&lt;/p></description></item><item><title>C Memory Layout: Structs, Unions, and a Linux Kernel Patch</title><link>https://ankitkdev.com/blog/c-memory-layout/</link><pubDate>Mon, 04 May 2026 13:30:05 +0530</pubDate><guid>https://ankitkdev.com/blog/c-memory-layout/</guid><description>&lt;h1 id="overview">Overview&lt;/h1>
&lt;p>C memory layout looks simple in isolation: structs store fields sequentially, unions overlap memory, and flexible array members allow variable-sized trailing storage. But combining these features can create subtle layout issues.&lt;/p>
&lt;p>While working on a Linux kernel selftest, I encountered a case where a union contained multiple structures, each ending with a flexible array member at different offsets. Although the code was functionally correct, this confused the compiler into treating the union as effectively variable-sized, triggering a layout warning.&lt;/p></description></item><item><title>Configure U-boot For Beaglebone Black</title><link>https://ankitkdev.com/blog/configure-uboot-bbb/</link><pubDate>Wed, 22 Apr 2026 15:02:44 +0530</pubDate><guid>https://ankitkdev.com/blog/configure-uboot-bbb/</guid><description>&lt;h1 id="overview">Overview&lt;/h1>
&lt;p>U-Boot (Universal Boot Loader) is the go-to bootloader for embedded Linux systems. If you&amp;rsquo;re working with the BeagleBone Black (BBB), building U-Boot from source gives you full control over the boot process, from initializing hardware to loading your kernel. This guide walks you through cross-compiling and installing U-Boot on the BBB from scratch.&lt;/p>
&lt;p>This blog will explain how to compile and install U-Boot, and then either manually boot from the U-Boot prompt or use &lt;strong>&lt;code>uEnv.txt&lt;/code>&lt;/strong> to autoboot the kernel.
You can also use &lt;code>extlinux/extlinux.conf&lt;/code> to boot the kernel.&lt;/p></description></item><item><title>Build and Install Linux Kernel For Beaglebone Black</title><link>https://ankitkdev.com/blog/build-linux-kernel-bbb/</link><pubDate>Wed, 08 Apr 2026 22:31:16 +0530</pubDate><guid>https://ankitkdev.com/blog/build-linux-kernel-bbb/</guid><description>&lt;h1 id="overview">Overview&lt;/h1>
&lt;p>The BeagleBone Black (BBB) uses an ARM Cortex-A8 32 bit processor, so the kernel must be cross-compiled on an x86 machine and then deployed to the board. This blog will assume that you already have a os[debian/ubuntu] installed on your sd card.&lt;/p>
&lt;p>We’ll:&lt;/p>
&lt;ul>
&lt;li>set up toolchain&lt;/li>
&lt;li>fetch kernel source&lt;/li>
&lt;li>configure for BBB&lt;/li>
&lt;li>build kernel + modules&lt;/li>
&lt;li>deploy to SD card / board&lt;/li>
&lt;/ul>
&lt;h2 id="1-prerequisites">1. Prerequisites&lt;/h2>
&lt;p>Make sure you have:&lt;/p>
&lt;ul>
&lt;li>Ubuntu (or any Linux host)&lt;/li>
&lt;li>Cross compiler for ARM (arm)&lt;/li>
&lt;/ul>
&lt;p>Install required tools:&lt;/p></description></item><item><title>Basics of debugging slab memory corruption via SLUB debug</title><link>https://ankitkdev.com/blog/debug-slub-memory/</link><pubDate>Wed, 04 Feb 2026 16:45:19 +0530</pubDate><guid>https://ankitkdev.com/blog/debug-slub-memory/</guid><description>&lt;h1 id="introduction">Introduction&lt;/h1>
&lt;p>Memory corruption can occur due to various bugs or defects: Uninitialized Memory
Reads (UMR), Use After Free (UAF), Use After Return (UAR), double-free, memory
leakage, or illegal Out Of Bounds (OOB) accesses that attempt to work upon (read/write/
execute) illegal memory regions.&lt;/p>
&lt;p>Since memory is dynamically allocated and freed via the kernel&amp;rsquo;s engine – the
page allocator. This can lead to serious wastage (internal fragmentation) of memory.
To mitigate this, the slab allocator (or slab cache) is layered upon it, serving two
primary tasks – providing fragments of pages efficiently (within the kernel, allocation
requests for small pieces of memory, from a few bytes to a couple of kilobytes), and serving as a cache for commonly used data structures.&lt;/p></description></item><item><title>Linux Kernel Mentorship Program</title><link>https://ankitkdev.com/blog/linux-kernel-mentorship-program/</link><pubDate>Mon, 08 Dec 2025 10:35:09 +0530</pubDate><guid>https://ankitkdev.com/blog/linux-kernel-mentorship-program/</guid><description>&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>I have been using Linux for the last two years and gradually developed an interest in systems programming and C. The mentorship prerequisites includes tasks like building and booting the Linux kernel, writing a basic kernel module, decoding stack traces, and modifying and booting a custom kernel build.&lt;/p>
&lt;p>Somehow, my application was accepted ;-).
&lt;img alt="alt text" loading="lazy" src="https://ankitkdev.com/lfx-acceptance.png">&lt;/p>
&lt;p>At first, the Linux Kernel seemed quite difficult to understand what was going on. We were initially told to choose two subsystems to work on.&lt;/p></description></item><item><title>Linux Kernel Mentorship Program</title><link>https://ankitkdev.com/linux/linux-kernel-mentorship-program/</link><pubDate>Mon, 08 Dec 2025 10:35:09 +0530</pubDate><guid>https://ankitkdev.com/linux/linux-kernel-mentorship-program/</guid><description>&lt;h3 id="introduction">Introduction&lt;/h3>
&lt;p>I have been using Linux for the last two years and gradually developed an interest in systems programming and C. The mentorship prerequisites includes tasks like building and booting the Linux kernel, writing a basic kernel module, decoding stack traces, and modifying and booting a custom kernel build.&lt;/p>
&lt;p>Somehow, my application was accepted ;-).
&lt;img alt="alt text" loading="lazy" src="https://ankitkdev.com/lfx-acceptance.png">&lt;/p>
&lt;p>At first, the Linux Kernel seemed quite difficult to understand what was going on. We were initially told to choose two subsystems to work on.&lt;/p></description></item><item><title>Install Ubuntu Server on Qemu</title><link>https://ankitkdev.com/blog/install-ubuntu-server-on-qemu/</link><pubDate>Sat, 16 Aug 2025 14:30:04 +0530</pubDate><guid>https://ankitkdev.com/blog/install-ubuntu-server-on-qemu/</guid><description>&lt;h1 id="installation-of-ubuntu-server-on-qemu-x86_64">Installation of ubuntu server on qemu-x86_64&lt;/h1>
&lt;p>At First I want to run the custom modules on linux. But this is something that is not good to do on host machine. So i searched a lot of stuff. Tinkering with buildroot, after some days i was able to run the build on qemu.&lt;/p>
&lt;p>But i found out build actually didn’t have my basic tool like &lt;code>gnu make&lt;/code>. Everytime i try to do something i need to find particular tool on &lt;code>menuconfig&lt;/code> then make the build again. Learning was so slow.&lt;/p></description></item><item><title>klog | grep -i me</title><link>https://ankitkdev.com/klog/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://ankitkdev.com/klog/</guid><description>Here I usually write about my work. What i broke, How i detected it &amp;amp; How i Fixed it(Most Imp)</description></item></channel></rss>