<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Linux Kernel on losgobbi</title><link>https://losgobbi.github.io/categories/linux-kernel/</link><description>Recent content in Linux Kernel on losgobbi</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><copyright>personal blog :)</copyright><lastBuildDate>Sun, 08 Feb 2026 17:52:00 -0300</lastBuildDate><atom:link href="https://losgobbi.github.io/categories/linux-kernel/index.xml" rel="self" type="application/rss+xml"/><item><title>My contributions at 2025</title><link>https://losgobbi.github.io/posts/contributions-2025/</link><pubDate>Sun, 08 Feb 2026 17:52:00 -0300</pubDate><guid>https://losgobbi.github.io/posts/contributions-2025/</guid><description>&lt;h4 id="my-contributions-at-2025">My contributions at 2025&lt;/h4>
&lt;p>Number of patches: 14&lt;/p>
&lt;p>&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=54cec13d5726a88919b5bf3f47491b6c3fe67598">dt-bindings: trivial-devices: Add Maxim max30208&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=294d4a1c79c1e83adf283cb164488cf7d9e2a257">dt-bindings: trivial-devices: Add VZ89TE to trivial&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b0d226a60856a1b765bb9a3848c7b2322fd08c47">wifi: ath11k: validate ath11k_crypto_mode on top of ath11k_core_qmi_firmware_&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dc0756de69dc398faa4472eafb72563672cc5981">dt-bindings: iio: adc: st,spear600-adc: txt to yaml format conversion.&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a238572b90876c9030655b7fb062b79b5972034f">dt-bindings: iio: gyroscope: invensense,itg3200: add binding&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=06f77ff9d852c9f2764659ea81489364d8a69a9c">soundwire: debugfs: move debug statement outside of error handling&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fd8e6f8729629407d2d932116d83b9cd71c17d80">dt-bindings: iio: gyro: invensense,mpu3050: change irq maxItems&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d75c7021c08e8ae3f311ef2464dca0eaf75fab9f">iio: adc: spear_adc: mask SPEAR_ADC_STATUS channel and avg&amp;hellip;&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=73c8b83b4aedae07b3c45379fe14be5a2734cbca">dt-bindings: iio: pressure: add invensense,icp10100&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b3c253cda6eefcf317cb81afadb2f49d8a2620d5">staging: rtl8723bs: Remove commented ifdef CONFIG_WAPI_SUPPORT&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5cfa43ae133856c8afb4f0177dde782b68005d2c">staging: rtl8723bs: Remove unsupported PALTFORM_OS_WINCE ifdef&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=de4cbbdf2d98a6f94dfc116247798d6600936335">staging: rtl8723bs: remove todo/note and duplicated EFUSE_CTRL macro&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=02f86101e430cce9a99a044b483c4ed5b91bb3b8">iio: imu: bmi270: fix dev_err_probe error msg&lt;/a>&lt;br/>&lt;/p></description></item><item><title>My contributions at 2024</title><link>https://losgobbi.github.io/posts/contributions-2024/</link><pubDate>Mon, 26 May 2025 21:00:00 -0300</pubDate><guid>https://losgobbi.github.io/posts/contributions-2024/</guid><description>&lt;h4 id="my-contributions-at-2024">My contributions at 2024&lt;/h4>
&lt;p>TL;DR; patches over staging area&lt;br>
Number of patches: 5&lt;/p>
&lt;p>&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=00ea2b0dc6ff47e3d3d976fd788aa22373d042b8">staging: gdm724x: fix returning -1 with return equivalent errors&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ea5e911e14cebfc9832728c27f05e43b086fec0c">staging: rtl8723bs: remove unused debug statements&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e139445ccbe4d902fce1dce517cd3b63f5b68eb8">staging: rtl8723bs: change remaining printk to proper api&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2bc2c3640039520d7cc0ea1e4c91fb0a8126fdda">staging: rtl8723bs: delete DBG_RX_SIGNAL_DISPLAY_RAW_DATA ifdef code&lt;/a>&lt;br/>
&lt;a href="https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=716eefc88c2f784ef16395d6a3eea8670847bba4">staging: rtl8723bs: delete HAL_DEF_DBG_RX_INFO_DUMP enum and caller&lt;/a>&lt;br/>&lt;/p></description></item><item><title>Using QEMU to run Kernel Selftests (x86)</title><link>https://losgobbi.github.io/posts/self-test-x86/</link><pubDate>Tue, 05 Mar 2024 17:53:15 -0300</pubDate><guid>https://losgobbi.github.io/posts/self-test-x86/</guid><description>&lt;img style="display: block; margin: auto;" src="https://losgobbi.github.io/qemu_logo.webp"/>
&lt;p>Last month I read something about Kernel Selftests, a subject I had never heard of. Those tests were created to exercise some code paths inside the Kernel and they can also be used to detect regression during future versions. I was curious about it and initially I was intending to run that at my personal machine but tests could generate instabilities or side effects during the system usage, so I’ve changed my mind and I was looking for a VM for that purpose.&lt;/p>
&lt;p>Instead using the VirtualBox, I remember about QEMU, a versatile emulator and virtual machine for many architectures and since I’ve never played with that before directly, I’ve decided to use it.&lt;/p>
&lt;h4 id="environment">Environment:&lt;/h4>
&lt;p>The selftests are located at the Kernel source tree, at &lt;em>tools/testing/selftests/&lt;/em> folder. You need to clone that and ideally, be running the same kernel version in your system. I’ve used a release candidate version (kernel_source/Makefile):&lt;/p>
&lt;p>&lt;img style="display: block; margin: auto;" src="https://losgobbi.github.io/kernel_version.webp"/>&lt;br/>&lt;/p>
&lt;p>After building the Kernel, we could use the bzImage (Kernel compressed image binary) through QEMU CLI but we don’t have a file system available to interact with the system (actually, Kernel won’t boot without it…). So, I’ve used the &lt;a href="https://buildroot.org/">Buildroot&lt;/a> platform to create a FS with utilities and dependencies plus the Kernel image. In that way, we could interact with the system and achieve our goal, run the Kernel Selftests. I’ve used some pieces of a nice instructions file at &lt;a href="https://gist.github.com/chrisdone/02e165a0004be33734ac2334f215380e">here&lt;/a> (very straightforward if you are not used to Buildroot).&lt;/p>
&lt;p>After making everything, we’ll have the artifacts at &lt;em>images/&lt;/em> path of Buildroot, just need to use them:&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"># mount the rootfs created by buildroot, we&amp;#39;ll install the selftests there
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>sudo mount &lt;span style="color:#f92672">-&lt;/span>o loop &lt;span style="color:#f92672">/&lt;/span>opt&lt;span style="color:#f92672">/&lt;/span>buildroot_topdir&lt;span style="color:#f92672">/&lt;/span>build_cfg_files&lt;span style="color:#f92672">/&lt;/span>buildroot&lt;span style="color:#f92672">/&lt;/span>images&lt;span style="color:#f92672">/&lt;/span>rootfs.ext2 &lt;span style="color:#f92672">/&lt;/span>opt&lt;span style="color:#f92672">/&lt;/span>buildroot_topdir&lt;span style="color:#f92672">/&lt;/span>build_cfg_files&lt;span style="color:#f92672">/&lt;/span>buildroot&lt;span style="color:#f92672">/&lt;/span>root_loop
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&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"># install selftests but a disclaimer: this is not very correct because
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># I didn&amp;#39;t use the kernel folder at buildroot for building the test binaries.
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Also, the tools to build them (gcc, etc) would not be the same.
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>cd &lt;span style="color:#f92672">&amp;lt;&lt;/span>linux_repo_outside_of_buildroot&lt;span style="color:#f92672">&amp;gt;/&lt;/span>tools&lt;span style="color:#f92672">/&lt;/span>testing&lt;span style="color:#f92672">/&lt;/span>selftests
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo mkdir &lt;span style="color:#f92672">-&lt;/span>p &lt;span style="color:#f92672">/&lt;/span>opt&lt;span style="color:#f92672">/&lt;/span>buildroot_topdir&lt;span style="color:#f92672">/&lt;/span>build_cfg_files&lt;span style="color:#f92672">/&lt;/span>buildroot&lt;span style="color:#f92672">/&lt;/span>root_loop&lt;span style="color:#f92672">/&lt;/span>tests
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo .&lt;span style="color:#f92672">/&lt;/span>kselftest_install.sh &lt;span style="color:#f92672">/&lt;/span>opt&lt;span style="color:#f92672">/&lt;/span>buildroot_topdir&lt;span style="color:#f92672">/&lt;/span>build_cfg_files&lt;span style="color:#f92672">/&lt;/span>buildroot&lt;span style="color:#f92672">/&lt;/span>root_loop&lt;span style="color:#f92672">/&lt;/span>tests
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&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>sudo umount &lt;span style="color:#f92672">/&lt;/span>opt&lt;span style="color:#f92672">/&lt;/span>buildroot_topdir&lt;span style="color:#f92672">/&lt;/span>build_cfg_files&lt;span style="color:#f92672">/&lt;/span>buildroot&lt;span style="color:#f92672">/&lt;/span>root_loop
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="running">Running:&lt;/h4>
&lt;p>Now we need to use the artifacts generated by Buildroot. QEMU has a CLI very powerful, we could append lines to the Kernel cmdline, use ramdisk rather a pure FS, etc. In order to boot that system, we should do something like this:&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"># a few notes:
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># 1) nographic option gives a feeling like minicom/picocom, very nice.
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># 2) both -hda and -drive seems to work, not sure the underlying differences regarding the disk image
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># but for this test, that is not very important
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>qemu&lt;span style="color:#f92672">-&lt;/span>system&lt;span style="color:#f92672">-&lt;/span>x86_64 &lt;span style="color:#f92672">-&lt;/span>kernel &lt;span style="color:#f92672">/&lt;/span>opt&lt;span style="color:#f92672">/&lt;/span>buildroot_topdir&lt;span style="color:#f92672">/&lt;/span>build_cfg_files&lt;span style="color:#f92672">/&lt;/span>buildroot&lt;span style="color:#f92672">/&lt;/span>images&lt;span style="color:#f92672">/&lt;/span>bzImage &lt;span style="color:#f92672">-&lt;/span>nographic &lt;span style="color:#f92672">-&lt;/span>append &lt;span style="color:#e6db74">&amp;#34;root=/dev/sda console=ttyS0&amp;#34;&lt;/span> &lt;span style="color:#f92672">-&lt;/span>hda &lt;span style="color:#f92672">/&lt;/span>opt&lt;span style="color:#f92672">/&lt;/span>buildroot_topdir&lt;span style="color:#f92672">/&lt;/span>build_cfg_files&lt;span style="color:#f92672">/&lt;/span>buildroot&lt;span style="color:#f92672">/&lt;/span>images&lt;span style="color:#f92672">/&lt;/span>rootfs.ext2 &lt;span style="color:#f92672">-&lt;/span>m &lt;span style="color:#ae81ff">12&lt;/span>G
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The system will looks like this:&lt;/p>
&lt;img style="display: block; margin: auto;" src="https://losgobbi.github.io/qemu.webp"/>
&lt;p>Running tests:&lt;/p>
&lt;img style="display: block; margin: auto;" src="https://losgobbi.github.io/qemu_fs.webp"/>
&lt;p>I’ve played around using the full suite of tests, generating the following results:&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"># run the entire suite
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>.&lt;span style="color:#f92672">/&lt;/span>run_kselftest.sh &lt;span style="color:#f92672">-&lt;/span>s
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&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">// failed and skipped tests:
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#75715e"># # Totals: pass:108 fail:2 xfail:0 xpass:0 skip:0 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:0 fail:1 xfail:0 xpass:0 skip:0 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:50 fail:1 xfail:0 xpass:0 skip:0 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:0 fail:2 xfail:0 xpass:0 skip:1 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:56 faii:4 xfail:0 xpass:0 skip:70 error:5
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:0 fail:21 xfail:0 xpass:0 skip:0 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:0 fail:8 xfail:0 xpass:0 skip:0 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:0 fail:4 xfail:0 xpass:0 skip:0 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:1 fail:6 xfail:0 xpass:0 skip:0 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:0 fail:1 xfail:0 xpass:0 skip:0 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:0 fail:1 xfail:0 xpass:0 skip:0 error:0
&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">// passed and skipped tests:
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#75715e"># # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:2 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:91 fail:0 xfail:0 xpass:0 skip:5 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:6 fail:0 xfail:0 xpass:0 skip:3 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:11 fail:0 xfail:0 xpass:0 skip:1 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Some tests were failing because some options for this Kernel were not enabled (menuconfig), others were failing because there are missing tools that weren’t enabled at Buildroot. Didn’t check all of the other failures, maybe I’ll do that in the future or maybe I will use a LTS version of the Kernel to compare the results.&lt;/p>
&lt;p>Yet, the purpose was to use QEMU, and he proved to be a very powerful alternative to VirtualBox.&lt;/p>
&lt;p>&lt;em>edit&lt;/em>: I’ve reduced a large amount of errors, but there are still tests failing. The configs are &lt;a href="https://github.com/losgobbi/lowlevel_misc/tree/main/Kernel_SelfTests/x86_configs">here&lt;/a>.&lt;/p></description></item><item><title>Adding an arm64 syscall entry</title><link>https://losgobbi.github.io/posts/x86-syscall/</link><pubDate>Thu, 27 Jul 2023 17:53:17 -0300</pubDate><guid>https://losgobbi.github.io/posts/x86-syscall/</guid><description>&lt;img style="display: block; margin: auto;" src="https://losgobbi.github.io/tux.webp"/>
&lt;p>For some architectures, kernel has changed the generation of some inner headers for syscall tables. Now at kernel 6.1.y (Pi fork) there are some utility scripts like &lt;em>syscallnr.sh&lt;/em> which acts over a table file called &lt;em>syscall.tbl&lt;/em>. Apparently, for arm64, this is not the case since we still have to add the entries manually like the old days.&lt;/p>
&lt;p>At linux-rpi-6.1.y folder, change the following headers:&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/linux/syscalls.h
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>asmlinkage &lt;span style="color:#66d9ef">long&lt;/span> &lt;span style="color:#a6e22e">sys_my_pi_syscall&lt;/span>(&lt;span style="color:#66d9ef">void&lt;/span>);
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&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/uapi/asm-generic/unistd.h
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#75715e">#define __NR_my_pi_syscall 451
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#a6e22e">__SYSCALL&lt;/span>(__NR_my_pi_syscall, sys_my_pi_syscall)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&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">// add a &amp;#39;plus one&amp;#39; at total number...
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#75715e">#define __NR_syscalls 452
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&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">// usr/include/asm-generic/unistd.h
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#75715e">#define __NR_my_pi_syscall 451
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#a6e22e">__SYSCALL&lt;/span>(__NR_my_pi_syscall, sys_my_pi_syscall)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&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">// add a &amp;#39;plus one&amp;#39; at total number...
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#75715e">#define __NR_syscalls 452
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&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">// arch/arm64/include/asm/unistd32.h
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#75715e">#define __NR_my_pi_syscall 451
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#a6e22e">__SYSCALL&lt;/span>(__NR_my_pi_syscall, sys_my_pi_syscall)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&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">// for syscall implementation: use an existing file or create a new one.
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// i&amp;#39;ve used the kernel/sys.c...
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#a6e22e">SYSCALL_DEFINE0&lt;/span>(my_pi_syscall)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>{
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">printk&lt;/span>(KERN_ERR &lt;span style="color:#e6db74">&amp;#34;my pi syscall called for arm64!!!&amp;#34;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#ae81ff">0&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>There is a document about this called &lt;em>adding-syscalls.rst&lt;/em> inside the tree, this info is also there. After updating the kernel image and installing the new headers:&lt;/p>
&lt;pre tabindex="0">&lt;code>sudo make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_HDR_PATH=/mnt/rootfs_sdcard/usr/ headers_install
&lt;/code>&lt;/pre>&lt;p>You can call the &lt;em>my_pi_syscall&lt;/em> with syscall function from libc.&lt;/p></description></item></channel></rss>