Do or do not, there is no try

Always do what you’re afraid to do.

传奇程序员 Andreas Kling 和他的 SerenityOS

我们今天故事的主角,是一个叫做Andreas Kling的瑞典程序员。 这个月的 9 月 12 日,Andreas 在他的个人网站上刊出了一篇文章来介绍他的Ladybird浏览器项目。浏览器大概是这个星球上最为庞大的软件项目,从零开始写出一个即便只是玩票性质的浏览器也是一项惊人困难的任务。如果你对它的难度没有直观认识的话,不妨猜一猜 Firefox 浏览器总共有多少行代码?答案是2100万行!数量庞杂(并且仍在爆炸式增加)的各种web标准使得编写浏览器几乎成了只有互联网寡头才能组织起人力和资源来完成的事情。所以,Andreas 的这个几乎以一己之力做出来的浏览器完全值得让人拍手称奇。 Figure 1: Ladybird 浏览器以满分的成绩通过了Acid3测试 事实上,在 Ladybird 项目之前,Andreas 已经完成了多项壮举,比如一个叫做SerenityOS的操作系统和一门叫做Jakt的系统级编程语言。用他自己的话说,他的目标是“从头编写一个完整的操作系统”。这些项目,不论单独拎出来哪一个,都显得过于庞大。如果这些项目的代码不是实实在在摆在大家的面前的话,我一定觉得这个人是痴人说梦。 而所有这些项目的起点,都可以追溯到 Andreas 下定决心戒除毒瘾的那个秋天。 没错,Andreas 曾经沾染毒瘾,是一名瘾君子。2018 年 10 月份,在结束了 3 个月的戒断治疗后,为了打发漫长难遣的时间,他开始疯狂地写起了代码。一开始,他完成了一个可执行文件的解析器。渐渐地,他又陆续写出来一个文件系统浏览器和一个图形界面框架。这时候 Andreas 惊奇地发现,一个简易的操作系统其实已经呼之欲出了。于是他将这若干个基础部件组合成一个操作系统,并称之为 SerenityOS。 Figure 2: 这是一款吸收了 90 年代美学理念的类 Unix 系统 这个由 Andreas 在 2018 年单枪匹马创建的项目,到现在已经蔚为大观。不同于浏览器,从头开始写出一个简单的操作系统并非难事,难的是聚拢各路牛人,形成真正有活力的社区。截至今日,该项目已经斩获了两万一千多颗 Github 星标,共有超过 700 位开发者向该项目贡献了代码。在我看来,Andreas 的这个操作系统谈不上有什么实际的用途,最多只是一个稍具规模的玩具而已。不过,不少重量级的软件都是“玩”出来的,难道不是吗?比如 Linux,这个在今天已经无处不在的操作系统(你甚至在火星上也能发现它的存在),Linux Torvalds 最初发布它的时候可没有想到有一天它竟会大放异采。 Figure 3: 图片来源:NASA 时至今日,Andreas 依然耕耘不辍,几乎全年无休。我们就以他的 Github 状态墙的截图结束本文吧,希望他能在写代码的道路上继续快乐地走下去。

September 14, 2022 · 1 min · 59 words · Yuankun Zhang

Setup a Development Machine

A few days ago, I did a home server build. Today I want to have a clean OS reinstallation on my development machine, because of a few things: The root partition on this machine is almost full (thank you, my two years ago self). I got a lot of __common_interrupt: 1.55 No irq handler for vector errors during the system bootup. There’s a thread in the Arch Forum discussing this issue. I tried booting up the system with several different combinations of kernel parameters mentioned in the thread, but none helped. It seems like the only working solution is to upgrade the BIOS firmware. I cannot decrypt the root partition without using my bluetooth keyboard, in the meantime I cannot use my bluetooth keyboard before the root partition is decrypted and mounted (because the bluetooth service sits in the root partition). This is a chicken-egg problem. My current hack around is to use a wired USB keyboard to decrypt the root parition. But I desperately want to eliminate the use of this USB keyboard. ...

July 7, 2021 · 3 min · 483 words · Yuankun

Setup a Home Server

Recently I got a retired computer. Better than letting it sit in the corner queitly and become a dust collector, I’ve been planning to turn it into a home server. I mainly need a Samba Server, but I may go further to run other self-hosted services like NextCloud. In this article I’ll talk about my setup of this home server. ...

June 21, 2021 · 6 min · 1149 words · Yuankun

A Terraform Module to List Google Cloud Service Agents

There are two types of service accounts in Google Cloud: user-managed service accounts, which are used by user applications to talk to Google Cloud; and Google-managed services accounts, which are used by Google Cloud internally. Among the second category, there is a special subtype of service accounts called Google Cloud Service Agents. Service Agents are used by Google Cloud services to run internal processes so that user requested operations can be fulfilled. A service agent has the following pattern: [email protected]_NAME.iam.gserviceaccount.com You can spot the service agents from the IAM section of Google Cloud Console. When managing IAM binding policies via Terraform, these service agents often generate noises. As an example, I’ll show you a code snippet coming from one of our Terraform files (I’m using xxxxx instead of the real project number). ...

April 1, 2020 · 2 min · 285 words · Yuankun

Debug Linux Kernel With QEMU and GDB

In last post we see how to run a raw Linux kernel in QEMU. QEMU offers another fancy feature: it can start a GDB Server and external GDB Debugger to connect. With this we can build a comfortable environment to debug system kernels and firmware. Let’s see how to leverage this feature to debug the Linux kernel. ...

March 20, 2020 · 2 min · 418 words · Yuankun

Running Raw Linux Kernel in QEMU

In last post we see how to run a packed Linux distribution in QEMU. This time let’s check out how to run a raw Linux kernel in QEMU. ...

March 16, 2020 · 4 min · 730 words · Yuankun

Running Alpine Linux in QEMU

How to run a Linux operating system in QEMU. ...

March 14, 2020 · 3 min · 463 words · Yuankun

Publishing Subdirectory to Github Pages

I’m using Hugo + Github Pages as my personal blog platform. A Hugo site yields the following directory structure, where the public/ subdirectory stores the generated static pages: ├── archetypes/ ├── config.toml ├── content/ ├── data/ ├── layouts/ ├── public/ ├── resources/ ├── static/ └── themes/ How do I publish the public/ subdirectory, instead of the root directory, to Github Pages? ...

March 12, 2020 · 1 min · 145 words · Yuankun