OnePlusOSS / android_kernel_oneplus_sm8250

Other
148 stars 127 forks source link

OnePlus 8T kernel boots to black screen #20

Open HesThatGuy1 opened 2 years ago

HesThatGuy1 commented 2 years ago

I've compiled a kernel for the 8T using the stock source and it boots to a black screen. Are there any commits I need to add that will fix this?

I have this issue using both the stock unmodified source & with my fork that has a few commits that I've used to try to fix this. https://github.com/HesThatGuy1/android_kernel_oneplus_sm8250/commits/Kebab_Android11

ChrisMcMStone commented 2 years ago

Hi @HesThatGuy1, did you have any luck resolving this? Thanks

HesThatGuy1 commented 2 years ago

Hi @HesThatGuy1, did you have any luck resolving this? Thanks

Unfortunately no, I have asked around for help on other places like XDA Developers & someone was able to help me a bit by compiling my kernel source & packing it into a bootable image and that worked. So there isn't any patches I need to add to my sources.

That leaves the issue to be with either my build environment or the packing of the built kernel into a bootable image.

I have also setup a new build environment & added only the bare minimum packages needed to compile a kernel and it still only boots to a black screen :/.

Here's how I setup my new build environment if you want to test this out:

Ubuntu 20.04.3 LTS (minimal installation)

open terminal in /home directory & type: sudo su apt install git make python2 gcc bison flex libssl-dev ln -s /usr/bin/python2 /usr/bin/python ln -s /usr/lib/x86_64-linux-gnu/libmpfr.so.6.0.2 /usr/lib/x86_64-linux-gnu/libmpfr.so.4

download these toolchains: git clone https://bitbucket.org/matthewdalex/aarch64-linux-android-4.9 -b master git clone https://bitbucket.org/matthewdalex/arm-linux-androideabi-4.9 -b master https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/4bba08ffb64de58c6356d12727bb5d6a3099b8e9/clang-r407598b/ (click 'tgz' to download this in a zip folder)

download kernel source

add this build.sh file to your kernel source & modify it to your directories build.zip

open terminal in kernel source files & type 'bash build.sh'

if all goes well you will have a file labeled 'Image' in /out/arch/arm64/boot that you can pack into a bootable image using Android Image Kitchen https://forum.xda-developers.com/t/tool-android-image-kitchen-unpack-repack-kernel-ramdisk-win-android-linux-mac.2073775/

ChrisMcMStone commented 2 years ago

Hi @HesThatGuy1, thanks very much for your detailed response.

I have just ordered the OnePlus 8T which I am due to receive tomorrow. I will happily try building the kernel according to your instructions tomorrow and report back. I could also try flashing the image you have built onto my device if you'd like. Hopefully we can get to the bottom of it :-)

ChrisMcMStone commented 2 years ago

@HesThatGuy1

I've compiled the kernel successfully and I've set up my device for flashing the image. Do you have any resources you could link me too on packing it with Android Image Kitchen? Specifically how I can I extract the stock boot image from the phone? Cheers

HesThatGuy1 commented 2 years ago

Here's an XDA Developers thread for a custom recovery that I've used to extract the boot image: https://forum.xda-developers.com/t/recovery-11-official-teamwin-recovery-project-8t-kebab-2021-29-11.4302449/

You will need to check your RAM type because some 8T models have DDR4X & others have DDR5: https://www.xda-developers.com/oneplus-8t-oneplus-9r-shipping-faster-ram/

the number you get determines which custom recovery version you'll download: 0 = twrp-3.6.0_11-0-kebab.img 1 = twrp-3.6.0_11-1-kebab.img

check your ram type using ADB: adb shell getprop ro.boot.ddr_type

download custom recovery image Direct link to OnePlus 8T custom recovery here: https://dl.twrp.me/kebab/

boot into it using ADB (this can take 2 minutes): fastboot boot twrp-3.6.0_11-0-kebab.img

while in TWRP: Use your terminal thats open on your computer and type 'adb shell' then type 'dd if=/dev/block/bootdevice/by-name/boot of=/sdcard/boot.img'

if everything goes the way it should then you will have a copy of the boot image in /sdcard

you would be able to check this by clicking on 'Advanced' click on 'Terminal' from there navigate to /sdcard

HesThatGuy1 commented 2 years ago

Any issues? Is the kernel booting completely for you?

ChrisMcMStone commented 2 years ago

I screwed up somewhere and bricked the device so bear with me for a bit ;-)

ChrisMcMStone commented 2 years ago

@HesThatGuy1

I've now finally flashed the custom kernel (i built your fork), and I also have the same issue as you. On booting, the OnePlus circle animation runs for about 2-3 minutes and then when it finishes I get a black screen. It then seems to get stuck in a boot-loop, repeating the animation followed by the black screen.

I suspect then the packing with Android Image Kitchen is where the problem lies. Was the working image which the person on XDA packed using AIK or some other approach?

HesThatGuy1 commented 2 years ago

He also used AIK

HesThatGuy1 commented 2 years ago

Any luck finding a solution? I'm going to return the 8T if I can't run my own kernel on it and my return period is close.

ChrisMcMStone commented 2 years ago

@HesThatGuy1

So I found a buildable and bootable version of the kernel which has only minor modifications here:

https://git.drg.fi/drgreen/android_kernel_oneplus_sm8250/ https://forum.xda-developers.com/t/kernel-handelinkernel-for-oneplus-8t-v2-6-oos-11-op8t-wireguard.4234995/

The repo includes build scripts so is pretty easy to compile. Hopefully this works well for you :-)

HesThatGuy1 commented 2 years ago

I've compiled this kernel before and experienced the same issue. This is also the dev that I've talked to on XDA & he was able to compile my kernel & have it boot

azoller1 commented 2 years ago

Hey, I have also been trying to build from this source. However, I just forked this kernel here - https://github.com/engstk/op8 and built with that to see if I can atleast build from a working source directory. I got the build to build successfully and will try out flashing later. I suppose I will use AnyKernel3 to flash. I am just wondering how some devs built the dtb and dtbo images... If I look in their zip files, I see they have added a dtb image file.

I have my source here with a build script that may be useful - https://github.com/azoller1/op8

I used the latest clang toolchain from AOSP - https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/refs/heads/master/clang-r437112b/ and then I built binu-utils from here for aarch64-gnu stuff - https://github.com/ClangBuiltLinux/tc-build

azoller1 commented 2 years ago

I've compiled this kernel before and experienced the same issue. This is also the dev that I've talked to on XDA & he was able to compile my kernel & have it boot

Got mine to boot, look at my previous comment.

HesThatGuy1 commented 2 years ago

Have you found a way to build the dtb and dtbo images?

azoller1 commented 2 years ago

Have you found a way to build the dtb and dtbo images?

https://github.com/ppajda/android_kernel_oneplus_sm8250/commit/31f17022947a441354ee9ee799fef5763a141380

Using this you should have the dtbo img built. You will need python2 I believe. Then you can combine the dtbs at the end as well in addition.