• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

[REFERENCE] [OOS/CUSTOM] OnePlus 5T kernel source with linux-stable (4.4.162)

Search This thread

nathanchance

Senior Recognized Developer / Contributor
Jul 22, 2015
13,751
49,974
26
Mesa, AZ
nathanchance.dev
Introduction

Hello everyone, this is a thread to introduce both users and kernel developers to the concept of linux-stable as well as give developers some tips and a tree to either merge into their own, use as a base, or just as a reference. Feel free to ask questions and enjoy!


What is it?

linux-stable is, as the name implies, the stable branch of the Linux kernel, the base of Android. The phone could not run without the Linux kernel (at least not without reworking a lot of stuff). The Android kernels are based on the longterm stable trees:
Longterm

There are usually several "longterm maintenance" kernel releases provided for the purposes of backporting bugfixes for older kernel trees. Only important bugfixes are applied to such kernels and they don't usually see very frequent releases, especially for older trees.
Source: https://www.kernel.org/category/releases.html

All Linux development happens on the master branch, which is governed by Linus Torvalds. When issues are discovered there, the fixes are applied then backported to these various stable trees for consumption. It is not uncommon for a fix to need to go back a few years.

There is a LOT more information available in the notes repo in the android-linux-stable organization if you care to learn more in-depth: https://github.com/android-linux-stable/notes


What does this mean for me?

If you are a developer, this means you should be merging these changes into your own tree. These are vetted, stable fixes to real world problems and they are being handed out for free. It does not take long to get up to date (as you can just merge this tree directly into your own or do it yourself using the tree as a reference) and once you are up to date, there is usually a release once every two weeks, give or take. I provide a rebuttal to a lot of various complaints here. If you still feel like there is a good reason not to do this, please let me know, I'll be happy to try and debate on it!

If you are a user, it means that you should be looking for and using kernels that have these fixes, as it shows the developers care for your security and stability. The current version for this device is 4.4.78 on OOS and 4.4.100 on Lineage while the current version upstream is 4.4.162 so all you need to do is go into Settings > About phone and look at the kernel version to know if you are up to date.


How do I use?

If you are a developer, the reference tree is located in the android-linux-stable organization: https://github.com/android-linux-stable/op5

There are three branches, one for OxygenOS 8.0 stable, one for OyxgenOS 8.1 beta, and one for Lineage 15.1.

This can either be merged into your existing kernel tree if you have one or be used as a fresh base. You do not need my permission to use it nor do you need to give me credit (although it would be appreciated).

If you are a user, use a kernel that has the changes added in!


Getting notified about updates

There are a few ways to get notified of linux-stable updates:


Getting help

If you have any issues with getting these changes into your tree or want to ask a question, there are a few different ways to do it:
  • Post in this thread
  • Join the linux-stable support chat on Telegram: https://t.me/joinchat/C1UAJ1EMSX31PCFdwLnOSg
  • File an issue either in the android-linux-stable notes repo or the android-linux-stable repo for this device

When requesting help, please give some solid details as to what you are struggling with, as I am happy to provide assistant and clarity but not to do something for you (unless I screwed up).
 
Last edited:

AndroidGX

Inactive Recognized Contributor
Jun 24, 2010
3,339
9,091
★ Montpellier ★
Many thanks for your work and initiative @nathanchance :good: appreciated :highfive:

Currently giving a try to make a kernel version based from linux .116 of your op5 branch and looks like I have the following error :
Code:
fs/f2fs/f2fs.h:136:20: error: static declaration of 'inode_nohighmem' follows non-static declaration
Any idea ? :( I was thinking of a "KBUILD_CFLAGS" addition into Makefile (or something like that), but I'm probably wrong I guess.
FYI I'm using stock 4.9 android google toolchain
 

nathanchance

Senior Recognized Developer / Contributor
Jul 22, 2015
13,751
49,974
26
Mesa, AZ
nathanchance.dev
Many thanks for your work and initiative @nathanchance :good: appreciated :highfive:

Currently giving a try to make a kernel version based from linux .116 of your op5 branch and looks like I have the following error :
Code:
fs/f2fs/f2fs.h:136:20: error: static declaration of 'inode_nohighmem' follows non-static declaration
Any idea ? :( I was thinking of a "KBUILD_CFLAGS" addition into Makefile (or something like that), but I'm probably wrong I guess.
FYI I'm using stock 4.9 android google toolchain

Wow I am so sorry about that, I must not have built 4.4.116 :( I removed all of the upstream f2fs code in my own kernel tree so I didn't encounter this error. I have pushed the fix that popped up in kernel/common, should be able to pull and build successfully now :good: :highfive:
 

AndroidGX

Inactive Recognized Contributor
Jun 24, 2010
3,339
9,091
★ Montpellier ★
Wow I am so sorry about that, I must not have built 4.4.116 :( I removed all of the upstream f2fs code in my own kernel tree so I didn't encounter this error. I have pushed the fix that popped up in kernel/common, should be able to pull and build successfully now :good: :highfive:
No worries ;)
Thanks, it works like a charm now (currently trying my kernel on .116), again good job :highfive:
Cheers'
 

aeppacher

Senior Member
Apr 14, 2012
792
777
thanks for making this, trying to build lineage and I keep getting the following error:

Code:
drivers/bluetooth/btfm_slim.c:26:23: fatal error: btfm_slim.h: No such file or directory

Any ideas?

---------- Post added at 10:47 PM ---------- Previous post was at 10:20 PM ----------

lol, found one of your comments on another post that helped

Use an out folder.

mkdir out
make O=out mata_defconfig
make O=out -j$(nproc --all)

new problem, the kernel compiles into an Image.gz, how would I go about getting a zImage for use in AnyKernel
 
Last edited:

nathanchance

Senior Recognized Developer / Contributor
Jul 22, 2015
13,751
49,974
26
Mesa, AZ
nathanchance.dev
thanks for making this, trying to build lineage and I keep getting the following error:



Any ideas?

---------- Post added at 10:47 PM ---------- Previous post was at 10:20 PM ----------

lol, found one of your comments on another post that helped



new problem, the kernel compiles into an Image.gz, how would I go about getting a zImage for use in AnyKernel

That is the zImage (you'll actually want to use Image.gz-dtb), you can just add it to the AnyKernel2 zip as is, the backend handles that name.

Sent from my Google Pixel 2 XL using XDA Labs
 

aeppacher

Senior Member
Apr 14, 2012
792
777
That is the zImage (you'll actually want to use Image.gz-dtb), you can just add it to the AnyKernel2 zip as is, the backend handles that name.

Sent from my Google Pixel 2 XL using XDA Labs

It booted perfectly, thanks so much! I would use the thanks button but it doesn't seem to be working :/
 

Top Liked Posts

  • There are no posts matching your filters.
  • 33
    Introduction

    Hello everyone, this is a thread to introduce both users and kernel developers to the concept of linux-stable as well as give developers some tips and a tree to either merge into their own, use as a base, or just as a reference. Feel free to ask questions and enjoy!


    What is it?

    linux-stable is, as the name implies, the stable branch of the Linux kernel, the base of Android. The phone could not run without the Linux kernel (at least not without reworking a lot of stuff). The Android kernels are based on the longterm stable trees:
    Longterm

    There are usually several "longterm maintenance" kernel releases provided for the purposes of backporting bugfixes for older kernel trees. Only important bugfixes are applied to such kernels and they don't usually see very frequent releases, especially for older trees.
    Source: https://www.kernel.org/category/releases.html

    All Linux development happens on the master branch, which is governed by Linus Torvalds. When issues are discovered there, the fixes are applied then backported to these various stable trees for consumption. It is not uncommon for a fix to need to go back a few years.

    There is a LOT more information available in the notes repo in the android-linux-stable organization if you care to learn more in-depth: https://github.com/android-linux-stable/notes


    What does this mean for me?

    If you are a developer, this means you should be merging these changes into your own tree. These are vetted, stable fixes to real world problems and they are being handed out for free. It does not take long to get up to date (as you can just merge this tree directly into your own or do it yourself using the tree as a reference) and once you are up to date, there is usually a release once every two weeks, give or take. I provide a rebuttal to a lot of various complaints here. If you still feel like there is a good reason not to do this, please let me know, I'll be happy to try and debate on it!

    If you are a user, it means that you should be looking for and using kernels that have these fixes, as it shows the developers care for your security and stability. The current version for this device is 4.4.78 on OOS and 4.4.100 on Lineage while the current version upstream is 4.4.162 so all you need to do is go into Settings > About phone and look at the kernel version to know if you are up to date.


    How do I use?

    If you are a developer, the reference tree is located in the android-linux-stable organization: https://github.com/android-linux-stable/op5

    There are three branches, one for OxygenOS 8.0 stable, one for OyxgenOS 8.1 beta, and one for Lineage 15.1.

    This can either be merged into your existing kernel tree if you have one or be used as a fresh base. You do not need my permission to use it nor do you need to give me credit (although it would be appreciated).

    If you are a user, use a kernel that has the changes added in!


    Getting notified about updates

    There are a few ways to get notified of linux-stable updates:


    Getting help

    If you have any issues with getting these changes into your tree or want to ask a question, there are a few different ways to do it:
    • Post in this thread
    • Join the linux-stable support chat on Telegram: https://t.me/joinchat/C1UAJ1EMSX31PCFdwLnOSg
    • File an issue either in the android-linux-stable notes repo or the android-linux-stable repo for this device

    When requesting help, please give some solid details as to what you are struggling with, as I am happy to provide assistant and clarity but not to do something for you (unless I screwed up).
    11
    4.4.145 has been merged in.
    10
    4.4.141 has been merged in.
    9
    4.4.144 has been merged in.
    9
    4.4.142 has been merged in. It is only three commits that Android doesn't care about so don't feel any pressure to rush out an update!