postmarketOS

The mainline kernel

One of the major goals of the postmarketOS project is getting as many devices as possible working on the mainline upstream Linux kernel. The majority of the current devices run some form of Android kernel tree like AOSP, LineageOS or CyanogenMOD.

The current progress of the mainlining effort is in the linux-postmarketos package, which can be used by multiple devices. The only pmOS-supported device that is usable with Linux 4.12 is the [[Nokia N900|nokia-rx51-(Nokia-N900)]]. The [[Qemu|qemu-vexpress-(Qemu-with-vexpress-soc)]] packages also use the linux-postmarketos package.

To make the kernel work with multiple devices, it no longer appends the dtb file to the kernel image. It generate a vmlinuz-postmarketos file in the boot partition and puts all dtb files for the current architecture in /usr/share/dtb. The postmarketos-mkinitfs package appends the dtb file defined in the [[deviceinfo|deviceinfo-reference]] to the linux image in the boot partition.

Enable the mainline kernel for a new device

Before proceeding, make sure that you know that your device is supported by the mainline kernel. Otherwise use the source code of a vendor's fork of the kernel, which is known to work as described in the [[porting guide|Porting-to-a-new-device]].

  1. run pmbootstrap.py menuconfig linux-postmarketos and adjust the kernel config to add the drivers for the device if they are not enabled yet. Set as much drivers to build as external module as possible so the main vmlinuz filesize doesn't increase too much.
  2. Set the kernel dependency to linux-postmarketos in the APKBUILD for the device package if you want to make it the default kernel (more information).
  3. Add the name of the generated dtb file (without path or extension) to the deviceinfo_dtb file in the deviceinfo file.

A good example of a device using a mainline kernel is the device-nokia-rx51 package.

Porting drivers from a Linux fork to the mainline kernel

This is a massive amount of work, and you will need C knowledge, as well as knowledge about how to contribute to the kernel. It is probably a very frustrating path, so make sure that you are either up to that or consider contributing in pmOS in another, from a developers point of view, more enjoyable way. Documentation from our side is also pretty thin on this, so if you actually work on this, please expand it. Thanks!

Preparation

Boot with serial output and shell

You probably need to copy over the device tree source, from which the dtb file gets generated, to the mainline kernel. Please expand this.

Links