Get the latest tech news

Let's Embed a Go Program into the Linux Kernel (2023)


Today, we would like to present a lesser-known feature of the Linux kernel. Instead of launching a program from a file system, regardless of whether it's virtual or not, it is also possible to embed a user-space program directly into the kernel image itself and start it from there.

However, things become complicated if you are a Board Support Package (BSP) supplier, either external or in-house, and don’t always have easy access to the workflow that determines what to install in the root file system. If we link the resulting object file, eprog_user_blob.o, with our Linux device driver, we can utilize the symbols to locate the contents of the Go program within the kernel image. We have seen that using a small assembly file and the User Mode Driver mechanism, it is possible to embed any kind of executable into the kernel image and run it later from there.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of program

program

Photo of linux kernel

linux kernel

Related news:

News photo

Madica, a program by Flourish Ventures, steps up pre-seed investing in Africa

News photo

CBD Proposed For The Linux Kernel: CXL Block Device

News photo

Lunatik: Lunatik is a framework for scripting the Linux kernel with Lua