Skip to content

Adding new kernel drivers

Jakov Petrina edited this page Jun 11, 2021 · 1 revision

There are currently two methods for adding new drivers to the Replica.one project: either (1) via the overlay mechanism, or (2) by forking the Linux kernel and modifying the target kernel remote URL.

NOTE: Although Portage supports patching, one of Replica.one design goals has been to avoid introducing patch files for the kernel in the repository tree (or any other patches for that matter); instead, we aim to upstream all patches before building production images.

NOTE: For development efforts, Sartura maintains a fork of the Linux kernel repository to build development images and as a staging area for the upstreaming process.

Overlay mechanism

  1. Start by pre-compiling out-of-tree kernel modules for the target Linux kernel version.
  2. Add them as kernel shared objects (.ko files) to the Replica.one file system overlay mechanism.

Linux kernel fork

  1. Fork the upstream Linux kernel repository.
  2. Once you have made the desired changes to the fork, navigate to the replica/targets directory.
  3. Open the target definition for the desired supported device and modify the target kernel remote repository URL by changing the second argument of the setdef(`__kernel_remote__', `<URL>')dnl macro. For example, to change the kernel remote repository URL for the rpi4 target, modify the https://github.com/raspberrypi/linux.git URL in the target definition file.