<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Kernel on iMil.net</title>
    <link>http://imil.net/blog/tags/kernel/</link>
    <description>Recent content in Kernel on iMil.net</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 21 Aug 2022 20:43:27 +0200</lastBuildDate>
    <atom:link href="http://imil.net/blog/tags/kernel/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Build a Single in Tree Linux Kernel Module (Debian &amp; Clones)</title>
      <link>http://imil.net/blog/posts/2022/build-a-single-in-tree-linux-kernel-module-debian--clones/</link>
      <pubDate>Sun, 21 Aug 2022 20:43:27 +0200</pubDate>
      <guid>http://imil.net/blog/posts/2022/build-a-single-in-tree-linux-kernel-module-debian--clones/</guid>
      <description>&lt;p&gt;How misleading and complicated this task should be that I&amp;rsquo;m writing such an article in 2022?&lt;br&gt;&#xA;Anyway, if you struggle compiling a simple, standalone Linux kernel module on Debian, Ubuntu, Mint and the like, here&amp;rsquo;s the recipe:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Fetch &lt;code&gt;linux-source-&amp;lt;version&amp;gt;&lt;/code&gt; and &lt;code&gt;linux-headers-&amp;lt;version&amp;gt;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sudo apt install linux-source-5.4.0 linux-headers-&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;uname -r&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Do &lt;strong&gt;not&lt;/strong&gt; use &lt;code&gt;apt-get source linux-source-&amp;lt;version&amp;gt;&lt;/code&gt;, &lt;em&gt;only pain will you find&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Untar the fetched archive where you&amp;rsquo;d like&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ tar jxvf /usr/src/linux-source-5.4.0.tar.bz2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Copy your current kernel configuration&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cd linux-source-5.4.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cp /boot/config-&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;uname -r&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt; .config&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Prepare the build environment&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ make oldconfig scripts prepare modules_prepare&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Copy current kernel exported symbols file&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cp /usr/src/linux-headers-&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;uname -r&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;/Module.symvers .&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Build the module you need&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ make -C . M&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;arch/x86/kvm&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Test it&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sudo insmod arch/x86/kvm/kvm-intel.ko&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Eventually backup the current loaded module (&lt;code&gt;modinfo &amp;lt;module&amp;gt;&lt;/code&gt;), replace it with your freshly built one and don&amp;rsquo;t forget to &lt;code&gt;depmod -a&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>An Innocent Mount Issue</title>
      <link>http://imil.net/blog/posts/2022/an-innocent-mount-issue/</link>
      <pubDate>Mon, 14 Mar 2022 08:54:50 +0100</pubDate>
      <guid>http://imil.net/blog/posts/2022/an-innocent-mount-issue/</guid>
      <description>&lt;p&gt;I work as a freelance contractor for about a year now, I quit a 10+ years regular &lt;a href=&#34;https://web.archive.org/web/20210121194911/https://www.nbs-system.com/publications/interview-collaborateur/emile-heitor-interview-d-un-directeur-technique/&#34;&gt;CTO job&lt;/a&gt; to give into more technical subjects, troubleshoot, code, build infrastructures, &lt;a href=&#34;https://www.imdb.com/title/tt0084967/&#34;&gt;A-Team style&lt;/a&gt;, I help companies with complex matters that might require experience and rigorousness.&lt;/p&gt;&#xA;&lt;p&gt;One of my last missions was really, really fun to deal with. A rather big company handling scientific, secret-level data, had an issue with their storage system.&lt;br&gt;&#xA;They use &lt;a href=&#34;https://en.wikipedia.org/wiki/InfiniBand&#34;&gt;Infiniband&lt;/a&gt; as their communication layer on an &lt;a href=&#34;https://en.wikipedia.org/wiki/High-performance_computing&#34;&gt;HPC&lt;/a&gt; environment, it was not a problem while the underlying operating system was &lt;em&gt;CentOS&lt;/em&gt; 7.1 with kernel 3.10.0-1160, but since new machines were installed with &lt;em&gt;CentOS&lt;/em&gt; 7.7 and up, with kernels 3.10.0-1062 and up, whenever they wrote a file less than 701 bytes long, the file would be corrupted.&lt;br&gt;&#xA;For the record and understanding of the following debugging session, the company uses &lt;a href=&#34;https://en.wikipedia.org/wiki/Network_File_System&#34;&gt;NFS&lt;/a&gt; over &lt;a href=&#34;https://en.wikipedia.org/wiki/Remote_direct_memory_access&#34;&gt;RDMA&lt;/a&gt;, the latter being the technique used by &lt;em&gt;Infiniband&lt;/em&gt; to achieve low latency and great throughput.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
