TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Kerla: Monolithic kernel in Rust, aiming for Linux ABI compatibility

471 点作者 Klasiaster超过 3 年前

13 条评论

nuta超过 3 年前
Author here. I&#x27;m surprised to see my <i>hobby</i> project on Hacker News.<p>I know this kind of stuff spark the ``it&#x27;s meaningless to rewrite everything (especially Linux) in Rust&#x27;&#x27; debate. I agree 100% that rewriting Linux in Rust (or your favorite language) is just a waste of time and such a project won&#x27;t live long.<p>That said, what I&#x27;d say here is that it&#x27;s fun. Really fun. Implementing ABI compatibility requires you to understand under the hood of the kernel. You can learn how printf(3) works. You can learn what happens before main().<p>Especially, in Rust, it&#x27;s inspiring to explore ways to write a kernel safely and expressively. One of my favorite part is the implementation of read system call [1].<p>Lastly, You can try this OS on SSH. Hope you enjoy :)<p><pre><code> ssh root@kerla-demo.seiya.me </code></pre> [1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;nuta&#x2F;kerla&#x2F;blob&#x2F;main&#x2F;kernel&#x2F;syscalls&#x2F;read.rs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nuta&#x2F;kerla&#x2F;blob&#x2F;main&#x2F;kernel&#x2F;syscalls&#x2F;read...</a>
评论 #28986923 未加载
评论 #28989980 未加载
评论 #28991640 未加载
评论 #28987060 未加载
评论 #28987118 未加载
评论 #28987211 未加载
评论 #28987319 未加载
评论 #28991368 未加载
评论 #28992211 未加载
评论 #28990206 未加载
评论 #28988061 未加载
评论 #28992084 未加载
评论 #28988867 未加载
评论 #29009691 未加载
评论 #28988967 未加载
评论 #28989394 未加载
ordu超过 3 年前
Just to clarify goals of the project:<p>&quot;I completely agree that rewriting existing large, feature-rich, and robust operating system kernels is not a good idea. However, a question came to my mind: what are the pros and cons of writing a practical UNIX-like OS kernel in Rust from scratch? How does it look like? This is why I started this project.&quot;[1]<p>[1] <a href="https:&#x2F;&#x2F;seiya.me&#x2F;writing-linux-clone-in-rust" rel="nofollow">https:&#x2F;&#x2F;seiya.me&#x2F;writing-linux-clone-in-rust</a>
jacquesm超过 3 年前
Rewriting the Linux kernel in rust would be a rehash of why we ended up with Linux in the first place: rewriting an older OS from scratch.<p>I would love to see a solid implementation of a real micro kernel based OS based on a message passing core in Rust to become a viable alternative to the now 50 year old Unix architecture. This would give us a possibility of some real progress on the security and process scheduling front, both of which are severely lacking in the Unix model.
评论 #28990356 未加载
评论 #28987229 未加载
评论 #28990647 未加载
评论 #28991665 未加载
评论 #28990022 未加载
评论 #28990826 未加载
ativzzz超过 3 年前
What are some ways I can increase my knowledge in this domain that the OP is very skilled at, meaning low level OS development?<p>I&#x27;ve taken an intro to OS class and am currently going through Linux From Scratch [1], which is interesting and is teaching me a lot, but it&#x27;s more about how to setup a Linux distro using existing packages and not really about reading&#x2F;writing the code involved.<p>Any recommendations?<p>[1] <a href="https:&#x2F;&#x2F;www.linuxfromscratch.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.linuxfromscratch.org&#x2F;</a>
评论 #28993329 未加载
评论 #28995244 未加载
评论 #29001243 未加载
EdSchouten超过 3 年前
This is awesome. Imagine the potential if it was just complete enough to run Kubernetes’ kubelet on a cloud instance. Lots of security minded folks would love it.
评论 #28990932 未加载
评论 #28993459 未加载
Klasiaster超过 3 年前
A minimal interactive demo running busybox is here:<p><pre><code> ssh root@kerla-demo.seiya.me</code></pre>
评论 #28986358 未加载
评论 #28986476 未加载
fork-bomber超过 3 年前
Very cool!<p>I think a killer feature would be to emulate the Linux kernel device driver model such that existing C driver modules could be used with Kerla. Further, borrow (no pun intended!) the Linux device driver Rust wrappers from the Rust for Linux kernel project to then enable writing Linux device drivers in Rust.<p>The question is whether emulating the Linux device driver model (by which I kind of mean mimicking the set of core kernel services needed to support drivers - kernel threads, sync primitives, allocators etc) ends up being a massive task akin to writing the core kernel itself.<p>I think there might be reasonable trade offs that make the problem more tractable.<p>Having the ability to have a significantly simpler kernel with Rust’s memory and thread safety guarantees plus the ability to use even a small set of Linux’s massive set of drivers would be very compelling.
评论 #28986562 未加载
评论 #28986583 未加载
评论 #28986534 未加载
exabrial超过 3 年前
Dunno: just a hobby, won&#x27;t be big and professional like linux.<p>:)
krylon超过 3 年前
This may be a naive question, but I cannot help but wonder: As C and Rust aim to be link-compatible, wouldn&#x27;t it be easier to gradually replace parts of the Linux kernel with Rust code?<p>The only technical problem I can think of is that Rust may not be available for all CPU architectures Linux supports, but this is just speculation on my part having done no research on the matter.
评论 #28986631 未加载
评论 #28986619 未加载
评论 #28989877 未加载
评论 #28987014 未加载
评论 #29011277 未加载
评论 #28987530 未加载
jll29超过 3 年前
Kudos, it works and thee source code is a beautiful read.<p>Thanks so much for sharing!
gabrielhidasy超过 3 年前
For each piece of software, there just be a version in Rust, and that version must advertise it&#x27;s rustiness
评论 #28986589 未加载
评论 #28986460 未加载
评论 #28987040 未加载
评论 #28986698 未加载
评论 #28986519 未加载
rvz超过 3 年前
A star has been born. A Linux alternative needs to be compatible with Linux binaries and also support modern architectures.<p>If you want Linux to survive, it needs to be <i>re-written</i> from scratch, optimised in Rust and compatible with the existing Linux binaries or drivers.<p>This project might have a chance.<p>From: [0]<p>&gt; TL;DR: I&#x27;m writing a Linux clone in Rust just for fun. It does NOT aim to replace the Linux kernel.<p>A certain someone thought that their hobby OS Minix clone won&#x27;t be &#x27;big or professional like GNU&#x27;.<p>It&#x27;s time for &#x27;change&#x27;.<p>[0] <a href="https:&#x2F;&#x2F;seiya.me&#x2F;writing-linux-clone-in-rust" rel="nofollow">https:&#x2F;&#x2F;seiya.me&#x2F;writing-linux-clone-in-rust</a>
评论 #28986425 未加载
评论 #28986416 未加载
评论 #28986443 未加载
评论 #28986450 未加载
评论 #28986567 未加载
nivenkos超过 3 年前
Post it when it&#x27;s production ready.<p>A big problem in the Rust ecosystem is the lack of continued work and support on libraries (understandably, since many are new and aren&#x27;t commercially supported).<p>For example, pyroute2 is still better for Linux admin that the equivalent Rust crates. Whilst the latter often fully support async, none of them cover all of the features of pyroute2 nor the easy-to-use API.<p>Hopefully things will improve over time, it&#x27;s always a shame to see great projects be abandoned.
评论 #28986712 未加载
评论 #28986566 未加载