mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-25 03:01:36 +01:00
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="generator" content="Asciidoctor 2.0.11">
|
||||
<meta name="description" content="The perfect emulation setup to study and develop the <<linux-kernel>> v5.9.2, kernel modules, <<qemu-buildroot-setup,QEMU>>, <<gem5-buildroot-setup,gem5>> and x86_64, ARMv7 and ARMv8 <<userland-assembly,userland>> and <<baremetal-setup,baremetal>> assembly, <<c,ANSI C>>, <<cpp,C++>> and <<posix,POSIX>>. <<gdb>> and <<kgdb>> just work. Powered by <<about-the-qemu-buildroot-setup,Buildroot>> and <<about-the-baremetal-setup,crosstool-NG>>. Highly automated. Thoroughly documented. Automated <<test-this-repo,tests>>. "Tested" in an Ubuntu 20.04 host.">
|
||||
<meta name="description" content="The perfect emulation setup to study and develop the <<linux-kernel>> v5.9.2, kernel modules, <<qemu-buildroot-setup,QEMU>>, <<gem5-buildroot-setup,gem5>> and x86_64, ARMv7 and ARMv8 <<userland-assembly,userland>> and <<baremetal-setup,baremetal>> assembly, <<c,ANSI C>>, <<cpp,C++>> and <<posix,POSIX>>. EVERYTHING is built from source. <<gdb>> and <<kgdb>> just work. Powered by <<about-the-qemu-buildroot-setup,Buildroot>> and <<about-the-baremetal-setup,crosstool-NG>>. Highly automated. Thoroughly documented. Automated <<test-this-repo,tests>>. "Tested" in an Ubuntu 20.04 host.">
|
||||
<title>Linux Kernel Module Cheat</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
|
||||
<style>
|
||||
@@ -489,6 +489,17 @@ pre{ white-space:pre }
|
||||
<p>and the new <code>pr_info</code> message should now show on the terminal at the end of the boot.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>If you are simultaneously developing the test script and the kernel module, some smart test scripts should take the kernel module as first argument so you can directly run:</p>
|
||||
</div>
|
||||
<div class="literalblock">
|
||||
<div class="content">
|
||||
<pre>/mnt/9p/rootfs_overlay/lkmc/scull.sh /mnt/9p/out_rootfs_overlay/lkmc/scull.ko</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>and it will pick up both the test script and the kernel module from host.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>This works because we have a <a href="9p.html">9P</a> mount there setup by default, which mounts the host directory that contains the build outputs on the guest:</p>
|
||||
</div>
|
||||
<div class="literalblock">
|
||||
@@ -503,7 +514,7 @@ pre{ white-space:pre }
|
||||
<p>Such failures are however unlikely, and you should be fine if you don’t see anything weird happening.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>The safe way, is to fist <a href="rebuild-buildroot-while-running.html">quit QEMU</a>, rebuild the modules, put them in the root filesystem, and then reboot:</p>
|
||||
<p>The safe way is to fist <a href="rebuild-buildroot-while-running.html">quit QEMU</a>, rebuild the modules put them somewhere QEMU can see and then reboot. So you could either place it in the root filesystem:</p>
|
||||
</div>
|
||||
<div class="literalblock">
|
||||
<div class="content">
|
||||
@@ -513,7 +524,16 @@ pre{ white-space:pre }
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p><code>./build-buildroot</code> is required after <code>./build-modules</code> because it re-generates the root filesystem with the modules that we compiled at <code>./build-modules</code>.</p>
|
||||
<p>where <code>./build-buildroot</code> is required after <code>./build-modules</code> because it re-generates the root filesystem with the modules that we compiled at <code>./build-modules</code>.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Alternatively, for a slightly faster turnaround just leave it on 9p and use it from there:</p>
|
||||
</div>
|
||||
<div class="literalblock">
|
||||
<div class="content">
|
||||
<pre>./build-modules
|
||||
./run --eval-after 'insmod /mnt/9p/out_rootfs_overlay/lkmc/hello.ko'</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>You can see that <code>./build</code> does that as well, by running:</p>
|
||||
@@ -553,7 +573,6 @@ pre{ white-space:pre }
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
<!-- Google Analytics, AKA selling my soul to Google for some backlinks. -->
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
@@ -561,5 +580,12 @@ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
ga('create', 'UA-47867706-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-DEE2HEJW9X"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', 'G-DEE2HEJW9X');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user