Skip to content

Commit

Permalink
Documentation Update Mon Feb 5 04:15:49 UTC 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
jhkolb committed Feb 5, 2024
1 parent 30f4345 commit 41b4f83
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 32 deletions.
49 changes: 28 additions & 21 deletions docs/maize/vm-kernel-install.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ <h2>Tutorial Steps<a class="headerlink" href="#tutorial-steps" title="Permalink
<span class="c1"># If missing, ask an admin to run the command</span>
&gt;&gt;<span class="w"> </span>sudo<span class="w"> </span>usermod<span class="w"> </span>-a<span class="w"> </span>-G<span class="w"> </span>kvm,libvirt-qemu,libvirt<span class="w"> </span>myusername

<span class="c1"># Set environment variable, consider addin this line to ~/.profile so</span>
<span class="c1"># Set environment variable, consider adding this line to ~/.profile so</span>
<span class="c1"># it is set on each login</span>
&gt;&gt;<span class="w"> </span><span class="nb">export</span><span class="w"> </span><span class="nv">LIBVIRT_DEFAULT_URI</span><span class="o">=</span>qemu:///session

<span class="c1"># Copy Virtual Machine Image via kauffman&#39;s script; amounts to a</span>
<span class="c1"># virt-clone with some files / options</span>
<span class="c1"># Copy Virtual Machine Image via Kauffman&#39;s script; amounts to a</span>
<span class="c1"># virt-clone with some files and options</span>
&gt;&gt;<span class="w"> </span>~kauffman/vm-shares/clone-vm.sh

<span class="c1"># Log in to Guest VM and experiment</span>
Expand All @@ -132,7 +132,7 @@ <h2>Tutorial Steps<a class="headerlink" href="#tutorial-steps" title="Permalink
...
<span class="c1"># Check Guest VM kernel version</span>
user@kerneldev:~$<span class="w"> </span>uname<span class="w"> </span>-a
Linux<span class="w"> </span>kerneldev<span class="w"> </span><span class="m">5</span>.15.0-52-generic<span class="w"> </span><span class="c1">#58-Ubuntu SMP Thu Oct 13 08:03:55 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux</span>
Linux<span class="w"> </span>kerneldev<span class="w"> </span><span class="m">5</span>.15.0-92-generic<span class="w"> </span><span class="c1">#102-Ubuntu SMP Wed Jan 10 09:33:48 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux</span>

<span class="c1"># Escape from VM via Ctrl-]</span>
&gt;&gt;
Expand All @@ -143,17 +143,22 @@ <h2>Tutorial Steps<a class="headerlink" href="#tutorial-steps" title="Permalink
<span class="c1"># May need to press Enter to re-display prompt</span>
user@kerneldev:~$

<span class="c1"># Escape to VM or run `sudo shutdown now`</span>
<span class="c1"># Escape VM or run `sudo shutdown now`</span>

<span class="c1"># Ensure VM is shutdown before proceeding</span>
<span class="c1"># Ensure VM is shut down before proceeding</span>
&gt;&gt;<span class="w"> </span>virsh<span class="w"> </span>shutdown<span class="w"> </span>ubuntu22

<span class="c1"># Mount VM image on host via guestmount</span>
&gt;&gt;<span class="w"> </span>mkdir<span class="w"> </span><span class="nv">$HOME</span>/mnt
&gt;&gt;<span class="w"> </span>guestmount<span class="w"> </span>-a<span class="w"> </span><span class="nv">$HOME</span>/.local/share/libvirt/images/ubuntu22.qcow2<span class="w"> </span>-i<span class="w"> </span><span class="nv">$HOME</span>/mnt

<span class="c1"># Change to linux source tree (and build it if needed)</span>
<span class="c1"># Clone linux kernel source from local copy on `maize`</span>
&gt;&gt;<span class="w"> </span>git<span class="w"> </span>clone<span class="w"> </span>/srv/git/linux

<span class="c1"># Change to linux source tree and build it</span>
&gt;&gt;<span class="w"> </span><span class="nb">cd</span><span class="w"> </span><span class="nv">$HOME</span>/linux
&gt;&gt;<span class="w"> </span>make<span class="w"> </span>defconfig
&gt;&gt;<span class="w"> </span>make<span class="w"> </span>-j<span class="w"> </span><span class="m">20</span>

<span class="c1"># Install kernel with adjusted root directory</span>
&gt;&gt;<span class="w"> </span>make<span class="w"> </span>install<span class="w"> </span><span class="nv">INSTALL_PATH</span><span class="o">=</span><span class="nv">$HOME</span>/mnt/boot
Expand All @@ -175,16 +180,16 @@ <h2>Tutorial Steps<a class="headerlink" href="#tutorial-steps" title="Permalink
<span class="c1"># Check that files are listed properly in the /boot directory</span>
user@kerneldev:~$<span class="w"> </span>ls<span class="w"> </span>/boot
...
vmlinuz-5.15.0-52-generic<span class="w"> </span><span class="c1"># old kernel</span>
vmlinuz-6.1.0-rc2-00189-g23758867219c<span class="w"> </span><span class="c1"># fresh kernel</span>
vmlinuz-5.15.0-92-generic<span class="w"> </span><span class="c1"># old kernel</span>
vmlinuz-6.8.0-rc3<span class="w"> </span><span class="c1"># fresh kernel</span>
...
System.map-5.15.0-52-generic<span class="w"> </span><span class="c1"># old kernel symbols</span>
System.map-6.1.0-rc2-00189-g23758867219c<span class="w"> </span><span class="c1"># fresh symbols</span>
System.map-5.15.0-59-generic<span class="w"> </span><span class="c1"># old kernel symbols</span>
System.map-6.8.0-rc3<span class="w"> </span><span class="c1"># fresh symbols</span>
...
config-5.15.0-52-generic<span class="w"> </span><span class="c1"># old config</span>
config-6.1.0-rc2-00189-g23758867219c<span class="w"> </span><span class="c1"># fresh config</span>
config-5.15.0-92-generic<span class="w"> </span><span class="c1"># old config</span>
config-6.8.0-rc3<span class="w"> </span><span class="c1"># fresh config</span>
...
initrd.img-5.15.0-52-generic<span class="w"> </span><span class="c1"># old initial ram disk</span>
initrd.img-5.15.0-92-generic<span class="w"> </span><span class="c1"># old initial ram disk</span>
<span class="c1"># need a fresh initial ramdisk</span>

user@kerneldev:~$
Expand Down Expand Up @@ -213,19 +218,21 @@ <h2>Tutorial Steps<a class="headerlink" href="#tutorial-steps" title="Permalink
W:<span class="w"> </span>Possible<span class="w"> </span>missing<span class="w"> </span>firmware<span class="w"> </span>/lib/firmware/i915/dg1_huc.bin<span class="w"> </span><span class="k">for</span><span class="w"> </span>built-in<span class="w"> </span>driver<span class="w"> </span>i915
...<span class="w"> </span><span class="c1"># various other warnings</span>

<span class="c1"># Update the boot loader (kernel selector)</span>
<span class="c1"># Update the boot loader (lets us select kernel at boot)</span>
user@kerneldev:~$<span class="w"> </span>sudo<span class="w"> </span>update-grub

<span class="c1"># Reboot the guest vm</span>
user@kerneldev:~$<span class="w"> </span>sudo<span class="w"> </span>reboot
....

<span class="c1"># Grub menu should appear, select new kernel 6.1</span>
<span class="c1"># Grub menu should appear, select new kernel 6.8</span>
<span class="w"> </span>GNU<span class="w"> </span>GRUB<span class="w"> </span>version<span class="w"> </span><span class="m">2</span>.06

<span class="w"> </span>+----------------------------------------------------------------------------+
<span class="w"> </span><span class="p">|</span>*Ubuntu,<span class="w"> </span>with<span class="w"> </span>Linux<span class="w"> </span><span class="m">6</span>.1.0-rc2-00189-g23758867219c<span class="w"> </span><span class="p">|</span>
<span class="w"> </span><span class="p">|</span><span class="w"> </span>Ubuntu,<span class="w"> </span>with<span class="w"> </span>Linux<span class="w"> </span><span class="m">6</span>.1.0-rc2-00189-g23758867219c<span class="w"> </span><span class="o">(</span>recovery<span class="w"> </span>mode<span class="o">)</span><span class="w"> </span><span class="p">|</span>
<span class="w"> </span><span class="p">|</span>*Ubuntu,<span class="w"> </span>with<span class="w"> </span>Linux<span class="w"> </span><span class="m">6</span>.8.0-rc3<span class="w"> </span><span class="p">|</span>
<span class="w"> </span><span class="p">|</span><span class="w"> </span>Ubuntu,<span class="w"> </span>with<span class="w"> </span>Linux<span class="w"> </span><span class="m">6</span>.8.0-rc3<span class="w"> </span><span class="o">(</span>recovery<span class="w"> </span>mode<span class="o">)</span><span class="w"> </span><span class="p">|</span>
<span class="w"> </span><span class="p">|</span><span class="w"> </span>Ubuntu,<span class="w"> </span>with<span class="w"> </span>Linux<span class="w"> </span><span class="m">5</span>.15.0-92-generic<span class="w"> </span><span class="p">|</span>
<span class="w"> </span><span class="p">|</span><span class="w"> </span>Ubuntu,<span class="w"> </span>with<span class="w"> </span>Linux<span class="w"> </span><span class="m">5</span>.15.0-92-generic<span class="w"> </span><span class="o">(</span>recovery<span class="w"> </span>mode<span class="o">)</span><span class="w"> </span><span class="p">|</span>
<span class="w"> </span><span class="p">|</span><span class="w"> </span>Ubuntu,<span class="w"> </span>with<span class="w"> </span>Linux<span class="w"> </span><span class="m">5</span>.15.0-52-generic<span class="w"> </span><span class="p">|</span>
<span class="w"> </span><span class="p">|</span><span class="w"> </span>Ubuntu,<span class="w"> </span>with<span class="w"> </span>Linux<span class="w"> </span><span class="m">5</span>.15.0-52-generic<span class="w"> </span><span class="o">(</span>recovery<span class="w"> </span>mode<span class="o">)</span><span class="w"> </span><span class="p">|</span>
<span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="p">|</span>
Expand All @@ -247,14 +254,14 @@ <h2>Tutorial Steps<a class="headerlink" href="#tutorial-steps" title="Permalink

<span class="c1"># Check that the new kernel is running</span>
user@kerneldev:~$<span class="w"> </span>uname<span class="w"> </span>-a
Linux<span class="w"> </span>kerneldev<span class="w"> </span><span class="m">6</span>.1.0-rc2-00189-g23758867219c<span class="w"> </span><span class="c1">#1 SMP PREEMPT_DYNAMIC Sat Oct 29 21:27:42 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux</span>
Linux<span class="w"> </span>kerneldev<span class="w"> </span><span class="m">6</span>.8.0-rc3<span class="w"> </span><span class="c1">#1 SMP PREEMPT_DYNAMIC Sun Feb 4 20:59:48 CST 2024 x86_64 x86_64 x86_64 GNU/Linux</span>

<span class="c1"># Press Ctrl-] to escape to host shell</span>
&gt;&gt;

<span class="c1"># Take a snapshot of the install</span>
&gt;&gt;<span class="w"> </span>virsh<span class="w"> </span>snapshot-create-as<span class="w"> </span>ubuntu22<span class="w"> </span>kernel-61-installed
Domain<span class="w"> </span>snapshot<span class="w"> </span>kernel-61-installed<span class="w"> </span>created
&gt;&gt;<span class="w"> </span>virsh<span class="w"> </span>snapshot-create-as<span class="w"> </span>ubuntu22<span class="w"> </span>kernel-68-installed
Domain<span class="w"> </span>snapshot<span class="w"> </span>kernel-68-installed<span class="w"> </span>created

<span class="c1"># Congratulations!</span>
</pre></div>
Expand Down
21 changes: 11 additions & 10 deletions docs/rust/hello_world_module.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,23 +244,24 @@ <h2>Booting the New Kernel<a class="headerlink" href="#booting-the-new-kernel" t
GRUB menu when your VM starts up. They likely look something like the following:</p>
<ol class="arabic simple">
<li><p><code class="docutils literal notranslate"><span class="pre">5.15.0-52-generic</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">6.1.0-rc7-00101-g01f85...</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">6.1.0-rc7-00102-gabe44...</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">5.15.0-92-generic</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">6.8.0-rc3</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">6.8.0-rc3-00001-gc4cbdfd00f16</span></code></p></li>
</ol>
<p>The first version came with the base Ubuntu 22.04 installation and the second
version was installed in our previous VM and kernel boot tutorial. You should
boot the <cite>last</cite>, most recent version as it will contain our new module.</p>
<p>The first two versions came with the base Ubuntu 22.04 installation and the
third version was installed in our previous VM and kernel boot tutorial. You
should boot the <cite>last</cite>, most recent version as it will contain our new module.</p>
<p>The kernel module should have printed out a message to the cosole when your VM
booted up, but it probably went by too quickly for you to notice. We’ll use the
<code class="docutils literal notranslate"><span class="pre">journalctl</span></code> tool to review the logs from our most recent kernel boot.</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="w"> </span>&gt;&gt;<span class="w"> </span>uname<span class="w"> </span>-a
<span class="w"> </span>Linux<span class="w"> </span>kerneldev<span class="w"> </span><span class="m">6</span>.1.0-rc7-00102-gabe44...
<span class="w"> </span>Linux<span class="w"> </span>kerneldev<span class="w"> </span><span class="m">6</span>.8.0-rc3-00001-gc4cbdfd00f16
&gt;&gt;<span class="w"> </span>journalctl<span class="w"> </span>-b
<span class="c1"># Boot Log Messages Appear on Screen</span>
</pre></div>
</div>
<p>If you search this output, you should find the following line:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>Nov<span class="w"> </span><span class="m">29</span><span class="w"> </span><span class="m">22</span>:23:38<span class="w"> </span>kerneldev<span class="w"> </span>kernel:<span class="w"> </span>Hello,<span class="w"> </span>World!
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>Feb<span class="w"> </span><span class="m">04</span><span class="w"> </span><span class="m">22</span>:23:38<span class="w"> </span>kerneldev<span class="w"> </span>kernel:<span class="w"> </span>Hello,<span class="w"> </span>World!
</pre></div>
</div>
<p>Where the date at the left will likely be different for you. Congratulations,
Expand Down Expand Up @@ -302,7 +303,7 @@ <h2>Recovering from a Broken Kernel<a class="headerlink" href="#recovering-from-
pointer.</p>
<p><cite>Note</cite>: If you’re following along and make this change, then compile and
install your kernel, you’ll end up with a new set of files in <code class="docutils literal notranslate"><span class="pre">/boot</span></code> and a
new GRUB menu entry called something like <code class="docutils literal notranslate"><span class="pre">6.1.0-rc7-0102-...-dirty</span></code>, since
new GRUB menu entry called something like <code class="docutils literal notranslate"><span class="pre">6.8.0-rc3-0001-...-dirty</span></code>, since
you are creating a kernel based changes that are uncommitted to git.</p>
<p>Booting this kernel should produce a message indicating that a panic has
occurred and including a bunch of diagnostic information. At this point, you
Expand Down Expand Up @@ -339,7 +340,7 @@ <h2>Loading a Buggy Kernel Module<a class="headerlink" href="#loading-a-buggy-ke
but it will not incorporate it directly into the kernel as it did before.</p>
<p>Now, we reconfigure our kernel with <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">oldconfig</span></code>, then recompile and
reinstall the new kernel into our virtual machine. Reboot your virtual machine,
making sure to select the <code class="docutils literal notranslate"><span class="pre">6.1.0-rc7-00102-...-dirty</span></code> kernel version.</p>
making sure to select the <code class="docutils literal notranslate"><span class="pre">6.8.0-rcc-00001-...-dirty</span></code> kernel version.</p>
<p>You should now see your VM boot successfully. Since our module was not
automatically loaded, its bug has not (yet) affected our system. Let’s now
instruct the kernel to load our module:</p>
Expand All @@ -359,7 +360,7 @@ <h2>Future Goal: Kernel Build Script<a class="headerlink" href="#future-goal-ker
to.</p>
<p>The current issue preventing our developing such a script is identifying a
method to run commands <cite>in the VM</cite> from a script executed on the host. This will
be necessary for the <cite>update-initramfs</cite> and <cite>update-grub</cite> commands.</p>
be necessary for the <code class="docutils literal notranslate"><span class="pre">update-initramfs</span></code> and <code class="docutils literal notranslate"><span class="pre">update-grub</span></code> commands.</p>
<p>If anyone would like to investigate this or knows of a solution, it would be a
valuable contribution to the group!</p>
</section>
Expand Down
Loading

0 comments on commit 41b4f83

Please sign in to comment.