The Mainline Kernel: Difference between revisions
m Added link on how to build mainline for Xperia devices |
|||
Line 34: | Line 34: | ||
* [https://github.com/postmarketOS/pmbootstrap/issues/91 #91: "The Mainline Kernel"] | * [https://github.com/postmarketOS/pmbootstrap/issues/91 #91: "The Mainline Kernel"] | ||
* [http://n900.elektranox.org/index.html Debian on N900] | * [http://n900.elektranox.org/index.html Debian on N900] | ||
* [https://developer.sonymobile.com/open-devices/how-to-build-and-flash-a-linux-kernel/how-to-build-mainline-linux-for-xperia-devices/ Build Mainline for Xperia devices] |
Revision as of 23:44, 2 September 2017
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 N900. The 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 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.
- 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. - 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). - 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
- Get a working serial cable
- Find out hardware details about your device, such as CPU, GPU, display, ...
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.