<?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>Kernel on sysarcher/@ich_code</title><link>https://sysarcher.github.io/categories/kernel/</link><description>Recent content in Kernel on sysarcher/@ich_code</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sun, 28 Apr 2019 21:22:37 +0200</lastBuildDate><atom:link href="https://sysarcher.github.io/categories/kernel/index.xml" rel="self" type="application/rss+xml"/><item><title>Taking Kata Steps</title><link>https://sysarcher.github.io/posts/kata-steps/</link><pubDate>Sun, 28 Apr 2019 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/kata-steps/</guid><description>&lt;p&gt;So I thought that it might be a great idea to run an RT kernel inside Kata containers. This is a usecase because I soon hope to see Kata containers running on real-time capable hypervisors and also being used in scenarios where real-time is a thing. Soon!&lt;/p&gt;
&lt;p&gt;For now, let&amp;rsquo;s look at how I went about doing what I did..&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;You need to &lt;code&gt;go get github.com/kata-containers/packaging&lt;/code&gt; repository. (or, git clone if you so prefer.) Be sure to have your &lt;code&gt;$GOPATH&lt;/code&gt; properly set!!&lt;/li&gt;
&lt;li&gt;cd into &lt;code&gt;packaging/kernel&lt;/code&gt; directory.&lt;/li&gt;
&lt;li&gt;I chose the &lt;code&gt;4.19.31&lt;/code&gt; version of the kernel. Primarily because it was a newer kernel (not too different from the kernel version that comes with the current kata release.) and because it had the &lt;a href="https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.19/patch-4.19.31-rt18.patch.xz"&gt;RT patches available&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;I changed &lt;a href="https://github.com/kata-containers/packaging/blob/dce0558ec6d8329e81fa59c809351170f6741a7a/kernel/build-kernel.sh#L25"&gt;the &lt;code&gt;kernel_version=&amp;quot;&amp;quot;&lt;/code&gt; line&lt;/a&gt; to &lt;code&gt;kernel_version=&amp;quot;4.19.31&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That&amp;rsquo;s it. We are ready to (1) apply the necessary patches from Kata maintainers to our Kernel of choosing and (2) apply the RT patches:&lt;/p&gt;</description><content:encoded><![CDATA[<p>So I thought that it might be a great idea to run an RT kernel inside Kata containers. This is a usecase because I soon hope to see Kata containers running on real-time capable hypervisors and also being used in scenarios where real-time is a thing. Soon!</p>
<p>For now, let&rsquo;s look at how I went about doing what I did..</p>
<ol>
<li>You need to <code>go get github.com/kata-containers/packaging</code> repository. (or, git clone if you so prefer.) Be sure to have your <code>$GOPATH</code> properly set!!</li>
<li>cd into <code>packaging/kernel</code> directory.</li>
<li>I chose the <code>4.19.31</code> version of the kernel. Primarily because it was a newer kernel (not too different from the kernel version that comes with the current kata release.) and because it had the <a href="https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.19/patch-4.19.31-rt18.patch.xz">RT patches available</a></li>
<li>I changed <a href="https://github.com/kata-containers/packaging/blob/dce0558ec6d8329e81fa59c809351170f6741a7a/kernel/build-kernel.sh#L25">the <code>kernel_version=&quot;&quot;</code> line</a> to <code>kernel_version=&quot;4.19.31&quot;</code></li>
</ol>
<p>That&rsquo;s it. We are ready to (1) apply the necessary patches from Kata maintainers to our Kernel of choosing and (2) apply the RT patches:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># download and apply the kata patches to the kernel</span>
</span></span><span style="display:flex;"><span>./build-kernel.sh setup
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>cd kata-linux-4.19.31-36
</span></span><span style="display:flex;"><span>patch -p1&lt;../path-to-extracted-patch/patch-4.19.31-rt18.patch
</span></span></code></pre></div><p>Wait&hellip; we need to first, <code>make menuconfig</code> and enable <code>RT</code> capabilities</p>
<pre tabindex="0"><code>General Setup 
  --&gt; Preemption Model
    --&gt; Fully Preemptible Kernel (RT)
</code></pre><p>Now, we&rsquo;re ready to build the Kernel and install it*:</p>
<pre tabindex="0"><code>./build-kernel.sh setup
sudo ./build-kernel.sh install
</code></pre><h3 id="drum-roll-please">Drum Roll please</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ docker run -it --runtime kata-runtime ubuntu bash
</span></span><span style="display:flex;"><span>root@77cf04fd8290:/# uname -r
</span></span><span style="display:flex;"><span>4.19.31-rt18
</span></span><span style="display:flex;"><span>root@77cf04fd8290:/# uname -a
</span></span><span style="display:flex;"><span>Linux 77cf04fd8290 4.19.31-rt18 #2 SMP PREEMPT RT Mon Apr 29 09:06:08 CEST 2019 x86_64 x86_64 x86_64 GNU/Linux
</span></span><span style="display:flex;"><span>root@77cf04fd8290:/# 
</span></span></code></pre></div><p>So proud!!!</p>
<p>Happy Building!!</p>
<h3 id="note-on-kernel-files">Note on Kernel Files</h3>
<p><code>vmlinux</code>: uncompressed kernel. |
<code>vmlinuz</code>: compressed kernel. |
<code>bzImage</code>: located under <code>arch/x86_64/boot/bzImage</code>. Big Zimage. Compressed kernel image.</p>
<p>More info: <a href="https://stackoverflow.com/a/22338835/3760442">https://stackoverflow.com/a/22338835/3760442</a></p>
<h3 id="acknowledgements">Acknowledgements</h3>
<p>Special thanks to @egernst, @rico and the great team on Slack!! Though this was my first foray into Kata Containers, I must say the folks were very welcoming. Thank you all!!</p>
<p><em>* I built the kernel (as of the time of writing) using <code>make build -j4</code> instead of using the <code>build-kernel.sh</code> script but it shouldn&rsquo;t matter. Just FYI.</em></p>
]]></content:encoded></item></channel></rss>