Is it possible to develop a Linux kernel module or driver using Kotlin/Native

kotlin · · 44 次点击    
<p>Rust seems to be capable of doing a lot of stuff including Kernel Modules or Drivers and Nautilus File Manager extensions.</p> <p>I&#39;d like to know if this is possible with Kotlin/Native.</p> <p>If not, why not? If yes, how?</p> <p>Linux programs like Nautilus seem to use <code>so</code>s or Share Objects for extensions. Since Kotlin/Native can be used to create <code>so</code>s, I think this may be possible.</p> <p>Rust can also compile Nautilus Extensions.</p> <p>However I&#39;m not sure if Linux Kernel Modules or drivers compile to <code>so</code>s and even if yes, I don&#39;t know if Linux Kernel supports other languages than <code>C</code></p> <p>I found this on</p> <p><code>LKM on Linux have to be compiled down do a specific ELF object code format.</code> Can Kotlin compile to ELF object code format?</p> <hr/>**评论:**<br/><br/>pjmlp: <pre><p>It would be quite a bumpy ride.</p> <p>The C code that runs in the kernel does not make use of libc, rather there are other utility functions adapted to the special needs of kernel code.</p> <p>So, first issue would be to have a Kotlin/Native version, with a minimal runtime able to execute on kernel space, only linking with kernel level libraries.</p> <p>Secondly, Kotlin has automatic memory management, which doesn&#39;t play well with UNIX kernels.</p> <p>On the OSes implemented in GC enabled systems programming languages, Lisp Machines, Oberon, Singularity, Midori,... the GC is a kernel service.</p> <p>Even to use C++, with its close relationship with C required quite a few kernel customizations as shown at the talk <a href="" rel="nofollow">Making C++ and the STL Work in the Linux / Windows Kernels</a> on CppCon 2016.</p> <p>So as an experiment it might eventually be possible, but be prepared to put the effort to actually make it work. </p></pre>
44 次点击  
加入收藏 微博
0 回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet