PPA description

Ubuntu kernel with Rust support enabled

Git repository:

Steps to compile a Rust kernel module:

1) Add this ppa

2) Install prerequisite packages and rust-for-linux + linux-rust from this ppa (and reboot)

3) Git clone the linux source code:

$ git clone

4) Install kernel build dependencies

$ cd linux
$ fakeroot debian/rules clean
$ sudo apt build-dep .

5) Prepare the linux source to build Rust modules:

$ cp /boot/config-$(uname -r) .config
$ export PATH=/var/lib/rust-for-linux/bin:$PATH
$ make EXTRAVERSION=$(uname -r | sed "s/.*\(-.*-generic\)/\1/") LOCALVERSION= modules_prepare

5) Now you can build Rust modules using the prepared Linux source directory as your kernel source target


Example Rust module:

== ==

// SPDX-License-Identifier: GPL-2.0

//! Rust hello world example.
//! Build with:
//! $ make KDIR=<linux_source_directory>

use kernel::prelude::*;

module! {
    type: HelloRust,
    name: "hello_rust",
    author: "Andrea Righi <email address hidden>",
    description: "Rust hello world example",
    license: "GPL v2",

struct HelloRust {

impl kernel::Module for HelloRust {
    fn init(_module: &'static ThisModule) -> Result<Self> {
        pr_info!("hello from Rust!\n");

impl Drop for HelloRust {
    fn drop(&mut self) {
        pr_info!("Goodbye from Rust\n");

== Makefile ==


export PATH:=/var/lib/rust-for-linux/bin:$(PATH)

ifndef KDIR
KDIR:=/lib/modules/`uname -r`/build
PWD := $(shell pwd)

 $(MAKE) -C $(KDIR) M=$(PWD) modules
 $(MAKE) -C $(KDIR) M=$(PWD) modules_install
 rm -f *.o *.ko *.mod* .*.cmd *.d Module.symvers modules.order
 rm -rf .tmp_versions
 obj-m := $(NAME).o

Adding this PPA to your system

You can update your system with unsupported packages from this untrusted PPA by adding ppa:arighi/linux-rust to your system's Software Sources. (Read about installing)

sudo add-apt-repository ppa:arighi/linux-rust
sudo apt update
Technical details about this PPA

This PPA can be added to your system manually by copying the lines below and adding them to your system's software sources.

deb lunar main 
deb-src lunar main 
Signing key:
4096R/1FFEA0F2681BB21A6D5F86F9137DF367D1707550 (What is this?)

For questions and bugs with software in this PPA please contact Andrea Righi.

PPA statistics

0 updates added during the past month.
View package details

Overview of published packages

13 of 3 results
Package Version Uploaded by
linux-meta-rust Andrea Righi ()
linux-rust 6.2.0-1005.5 Andrea Righi ()
rust-for-linux 1.62.0ubuntu3 Andrea Righi ()
13 of 3 results

Latest updates

  • linux-rust 76 weeks ago
    Successfully built
  • linux-meta-rust 76 weeks ago
    Successfully built
  • rust-for-linux 76 weeks ago
    Successfully built