General LOS 19.1 sm8450-common in progress.Looking for contributers.

Search This thread

metrixx02

Senior Member
May 27, 2013
512
267
Izmir
OnePlus 10 Pro
I managed to compile the A13 kernel source after adjusting a few minor things in their source. I don't think the source tree is incomplete for the recently published branch (sm8450_t_13.0_10pro).

It does however bootloop when I try to repack and flash it on the phone.

If anyone has a tip on how to extract the failed bootlogs, I can probably debug my way to a booting kernel.
Problem is, the running (stock) kernel I have does not expose /proc/last_kmsg or /sys/fs/pstore/* for further debugging.

I haven't seen twrp for this device yet, I guess that would help too.
Could share ur tpack added source code and bootlogs?
İ m too busy nowadays.exams and got 2 project deadline in near future but i will back to work A13 source next week.
 

codpiecejohn

Member
Nov 28, 2022
12
16
My problem right now is getting the boot logs. Without last_ksmg and /sys/fs/pstore and no public custom recovery for this device, I don't really know how to get the bootlogs. I tried liveboot, but it doesn't cache the log for the failed boot.

Custom kernels for android in general is also sort of a new area for me.

I can say though, it compiles if you extract /proc/config.gz from a running device, add CONFIG_QCOM_SMEM=y and overlay 'android_kernel_modules_and_devicetree_oneplus_sm8450' by fixing the broken symlinks.
And apply the following minor patch:
Git:
diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
index b811b184b861..98465a17f49e 100644
--- a/drivers/android/binder_alloc.c
+++ b/drivers/android/binder_alloc.c
@@ -214,11 +214,11 @@ static int binder_update_page_range(struct binder_alloc *alloc, int allocate,
 
        if (mm) {
                mmap_read_lock(mm);
-               if (!mmget_still_valid(mm)) {
+               /* if (!mmget_still_valid(mm)) {
                        if (allocate == 0)
                                goto free_range;
                        goto err_no_vma;
-               }
+               } */
                vma = alloc->vma;
        }

AFAIK, mmget_still_valid does not even exist in the 5.10 source tree, but I could be wrong.
 
  • Like
Reactions: metrixx02 and dladz

dladz

Senior Member
Aug 24, 2010
14,985
5,340
Liverpool
Huawei Watch 2
OnePlus 10 Pro
I managed to compile the A13 kernel source after adjusting a few minor things in their source. I don't think the source tree is incomplete for the recently published branch (sm8450_t_13.0_10pro).

It does however bootloop when I try to repack and flash it on the phone.

If anyone has a tip on how to extract the failed bootlogs, I can probably debug my way to a booting kernel.
Problem is, the running (stock) kernel I have does not expose /proc/last_kmsg or /sys/fs/pstore/* for further debugging.

I haven't seen twrp for this device yet, I guess that would help too.

Anything here helpful?

 

codpiecejohn

Member
Nov 28, 2022
12
16
Anything here helpful?

Thanks! Stumbled upon that link earlier I tried those options, but unfortunately, the stock kernel is not configured with the /sys/fs/pstore/console-ramoops option, which would have helped immensely.

I'm trying to see if I can make the kernel dump its logs very early in the boot process.
 
  • Like
Reactions: dladz

dladz

Senior Member
Aug 24, 2010
14,985
5,340
Liverpool
Huawei Watch 2
OnePlus 10 Pro
Thanks! Stumbled upon that link earlier I tried those options, but unfortunately, the stock kernel is not configured with the /sys/fs/pstore/console-ramoops option, which would have helped immensely.

I'm trying to see if I can make the kernel dump its logs very early in the boot process.
Ah ok, sorry man. ... Never had to deal with such things .. I'm super intrigued with your progress so far
 

neelchauhan

Senior Member
Dec 25, 2016
137
223
Google Pixel 3
Google Pixel 6
Thanks! Stumbled upon that link earlier I tried those options, but unfortunately, the stock kernel is not configured with the /sys/fs/pstore/console-ramoops option, which would have helped immensely.

I'm trying to see if I can make the kernel dump its logs very early in the boot process.
You will also have to compile the modules. GKI devices also need modules compiled with the same kernel. You can't use a custom kernel with stock modules, hence your bootloop.

I dealt with GKI on the Pixel 6/7 (which is why I have my unofficial images). I could also be wrong about my reason.
 
  • Like
Reactions: Drethis and dladz

codpiecejohn

Member
Nov 28, 2022
12
16
You will also have to compile the modules. GKI devices also need modules compiled with the same kernel. You can't use a custom kernel with stock modules, hence your bootloop.

I dealt with GKI on the Pixel 6/7 (which is why I have my unofficial images). I could also be wrong about my reason.
These modules? https://github.com/OnePlusOSS/andro...eplus_sm8450/tree/oneplus/sm8450_t_13.0_10pro

I'm overlaying this repository over the kernel tree, but I might have missed parts of it.
 
  • Like
Reactions: dladz and Drethis

neelchauhan

Senior Member
Dec 25, 2016
137
223
Google Pixel 3
Google Pixel 6
  • Like
Reactions: dladz and Drethis

codpiecejohn

Member
Nov 28, 2022
12
16
Yes.

Although I primarily dealt with LOS GKI on Pixel 6/7 and not OnePlus 10, this documentation could be useful: https://source.android.com/docs/core/architecture/kernel/generic-kernel-image
Yeah alright, so I'm on the right track. The published kernel source comes with a defconfig for "waipio_GKI", where waipio is a codename for the Oxygen version matching the source tree.
This config has a bunch of vendor modules set to =m or =y, whereas the /proc/config.gz does not.
So I'm wondering if a merge of the two configs result in a kernel which has the needed modules.

In any case, if there was a way to figure out which modules are critical for a booting kernel, it would help a lot.
 
  • Like
Reactions: Drethis and dladz

codpiecejohn

Member
Nov 28, 2022
12
16
Is this a matter of unpacking the vendor_boot partition, recompiling the modules in there and flashing them along with the new kernel?
(Or building them into the kernel for a start, the documentation specifies that the kernel will not try to externally load modules that are already built-in)
 
Last edited:
  • Like
Reactions: Drethis and dladz

neelchauhan

Senior Member
Dec 25, 2016
137
223
Google Pixel 3
Google Pixel 6
It's a matter of building your own kernel modules and a new vendor_boot partition with your images.

For a build script (CalyxOS on Pixel 6/7 as a reference), you could look at this file: https://gitlab.com/CalyxOS/kernel_build/-/blob/android13/build.sh

Script repo: https://gitlab.com/CalyxOS/kernel_build/-/tree/android13
Kernel repo: https://gitlab.com/CalyxOS/kernel_google_gs101 and https://gitlab.com/CalyxOS/kernel_google_gs201

For Pixels, the modules are individual repos, whereas on OnePlus all the GKI modules are in one repo.

There is also my LOS patch, while originally for Pixel 6, can be used on sm8450 as well: https://review.lineageos.org/c/LineageOS/android_vendor_lineage/+/334413
To use it in a device tree: https://review.lineageos.org/c/LineageOS/android_device_google_raviole/+/334404

UPDATE: The manifest.xml commit for Pixel 7 is: https://github.com/LineageOS/android/commit/9190c0392eb0e85ffd6048477f9deee546b6a519

On OP, you'll only need one manifest.xml line for the GH repo.
 

codpiecejohn

Member
Nov 28, 2022
12
16
It's a matter of building your own kernel modules and a new vendor_boot partition with your images.

For a build script (CalyxOS on Pixel 6/7 as a reference), you could look at this file: https://gitlab.com/CalyxOS/kernel_build/-/blob/android13/build.sh

Script repo: https://gitlab.com/CalyxOS/kernel_build/-/tree/android13
Kernel repo: https://gitlab.com/CalyxOS/kernel_google_gs101 and https://gitlab.com/CalyxOS/kernel_google_gs201

For Pixels, the modules are individual repos, whereas on OnePlus all the GKI modules are in one repo.

There is also my LOS patch, while originally for Pixel 6, can be used on sm8450 as well: https://review.lineageos.org/c/LineageOS/android_vendor_lineage/+/334413
To use it in a device tree: https://review.lineageos.org/c/LineageOS/android_device_google_raviole/+/334404

UPDATE: The manifest.xml commit for Pixel 7 is: https://github.com/LineageOS/android/commit/9190c0392eb0e85ffd6048477f9deee546b6a519

On OP, you'll only need one manifest.xml line for the GH repo.
Thanks, this is very helpful, I'll have a look at it.

The vendor_boot partition in this case contains around ~420 kernel modules. I'd imagine it's quite the work to get a defconfig stapled together that aligns with all of them.
 
  • Like
Reactions: Drethis

neelchauhan

Senior Member
Dec 25, 2016
137
223
Google Pixel 3
Google Pixel 6
Thanks, this is very helpful, I'll have a look at it.

The vendor_boot partition in this case contains around ~420 kernel modules. I'd imagine it's quite the work to get a defconfig stapled together that aligns with all of them.
You can just use a bash/python script to iterate the vendor_boot and make a defconfig from it. That's how I did it for the Pixel 6

UPDATE: The Linux find utility can iterate the vendor_boot partition.
 
Last edited:

der_akinator

Senior Member
Mar 27, 2015
130
187
Berlin
OnePlus 3T
OnePlus 9 Pro
Thanks, this is very helpful, I'll have a look at it.

The vendor_boot partition in this case contains around ~420 kernel modules. I'd imagine it's quite the work to get a defconfig stapled together that aligns with all of them.
Do you have root on that device? If that's the case you can dump vendor_boot with dd and see what modules you have to build. Or just extract payload.bin from OOS zip.
I had a similar issue while bringing up the new TWRP to op9 and had to additionally build a vendor_boot image containing all vendor kernel modules. But I think op10 is also a bit differnet in terms of its boot process. Maybe this page helps to find out about the boot process https://source.android.com/docs/core/architecture/bootloader/partitions/generic-boot. Does this device on OOS13 use an init_boot partition or does it stick to its A12 root with just boot and vendor_boot partition?
Maybe it help to look into other sm8450 device with working trees. In case the msm_drm module is present on op10 you have to either build it inline or load it from somewhere in order to get to an graphical environment. All other modules can be loaded later. At least on op9.

Good luck
 
  • Like
Reactions: Drethis

codpiecejohn

Member
Nov 28, 2022
12
16
Do you have root on that device? If that's the case you can dump vendor_boot with dd and see what modules you have to build. Or just extract payload.bin from OOS zip.
I had a similar issue while bringing up the new TWRP to op9 and had to additionally build a vendor_boot image containing all vendor kernel modules. But I think op10 is also a bit differnet in terms of its boot process. Maybe this page helps to find out about the boot process https://source.android.com/docs/core/architecture/bootloader/partitions/generic-boot. Does this device on OOS13 use an init_boot partition or does it stick to its A12 root with just boot and vendor_boot partition?
Maybe it help to look into other sm8450 device with working trees. In case the msm_drm module is present on op10 you have to either build it inline or load it from somewhere in order to get to an graphical environment. All other modules can be loaded later. At least on op9.

Good luck
Yes I have root on the device. I dumped vendor_boot from the corresponding partition on the running environment and checked it against the unpacked content from the payload.zip update.
I believe there is no a init_boot parition (it's running OOS13).

But thanks a lot, it's very helpful.

I'm hoping that other people are getting progress on this project at some point as well. I'm well versed in the linux and linux kernel world, but as I've mentioned, this is my first time building a custom kernel for an Android device. The lack of debugging info and ouput is definitely making this a bit tricky and blackbox.
 
Last edited:

emabertax

Senior Member
Dec 2, 2015
270
352
Cuneo IT
Yes I have root on the device. I dumped vendor_boot from the corresponding partition on the running environment and checked it against the unpacked content from the payload.zip update.
I believe there is no a init_boot parition (it's running OOS13).

But thanks a lot, it's very helpful.

I'm hoping that other people are getting progress on this project at some point as well. I'm well versed in the linux and linux kernel world, but as I've mentioned, this is my first time building a custom kernel for an Android device. The lack of debugging info and ouput is definitely making this a bit tricky and blackbox.
Don't forget to share in other place and not only here, ask other developers from other devices and probably someone can help you because this will show interest to op10 pro.
Best Regards
 
  • Like
Reactions: Drethis

twinnfamous

Senior Member
May 31, 2012
1,316
745
sacramento
Do you have root on that device? If that's the case you can dump vendor_boot with dd and see what modules you have to build. Or just extract payload.bin from OOS zip.
I had a similar issue while bringing up the new TWRP to op9 and had to additionally build a vendor_boot image containing all vendor kernel modules. But I think op10 is also a bit differnet in terms of its boot process. Maybe this page helps to find out about the boot process https://source.android.com/docs/core/architecture/bootloader/partitions/generic-boot. Does this device on OOS13 use an init_boot partition or does it stick to its A12 root with just boot and vendor_boot partition?
Maybe it help to look into other sm8450 device with working trees. In case the msm_drm module is present on op10 you have to either build it inline or load it from somewhere in order to get to an graphical environment. All other modules can be loaded later. At least on op9.

Good luck
Op10 pro has dedicated recovery partition but we are on v4 headers so if we can get a kernel built from source it can benefit both custom recovery and custom roms. I'm going to have some time Saturday to experiment on this as I have 2 I can take the chances of bricking 1 of them it won't matter I do this all the time
 

emabertax

Senior Member
Dec 2, 2015
270
352
Cuneo IT
Op10 pro has dedicated recovery partition but we are on v4 headers so if we can get a kernel built from source it can benefit both custom recovery and custom roms. I'm going to have some time Saturday to experiment on this as I have 2 I can take the chances of bricking 1 of them it won't matter I do this all the time
Wow, it is a great news, I don't know OnePlus very well but I follow the project with interest
Best Regards
 

Top Liked Posts