yashsingh1/xdaforums huggingface dataset:
[Asus Zenfone 9] Freak07:
taken from pixel 6 soon to be adjusted

AOSP Build Environment and Standalone Kernel builds (monolithic builds)

I´m sure some of you followed the movement towards the Generic Kernel Image (GKI) and Qcoms adaption to it called QGKI.

You can find more information about GKI following this link.

What does that mean for custom kernels and this custom kernel?

The last few years the kernel on android devices was more or less compiled as a monolith. That means the kernel is in the zImage with all (most) drivers compiled inline.

However with GKI this changed. There´s the base kernel image while vendor/device specific drivers are compiled as dynamically loadable kernel modules.

On last years devices like the Pixel 5 (using a 4.19 kernel) and this years devices with SD888 on a 5.4 kernel base, there was the possibility to change the QGKI kernel back into a monolithic kernel image. (building the drivers that are on stock kernel external modules back into the zImage to end with a monolithic kernel)

On the Pixel 6 I wasn´t able to achieve this yet. But during my tries I also wondered if maybe finally the time has come to follow suit, instead of trying to enforce old ways, when there´s a new way going forward.

What does that mean. This means that at this point the kernel is shipped as images that are to be flashed via fastboot. At a later stage I´m sure we can modify anykernel3 to allow flashing zips again, but at this early stage fastboot flashable images will be provided.

Those images can be flashed the same way the device is rooted, therefore I think everybody should be able to flash it easily since the device can´t be rooted any other way.

The kernel was compiled using the aosp kernel build environment. Information about it can be found on the documentation page from google.
[Asus Zenfone 9] Freak07:
this one too
[Asus Zenfone 9] Freak07:
and this one as well
[Asus Zenfone 9] tbalden:
Woohoo! Rock'n'roll! ^__^
[Asus Zenfone 9] Freak07:
Update to 1.1.0

Hey guys and girls,

Here´s the next update. It includes quite a few changes.

It also includes the few kernel changes from the latest firmware 32.2040.2040.23.

The link to the latest firmware can be found following this link.

More changes in the changelog below:

Changelog:

- Linux-Stable upstream bumped to 5.10.146

- merge latest CAF-Upstream

- bump clang to prebuilt 14.0.7 from google

- fixed clang warnings in the process

- other improvements and tweaks please check github

Download:

AFH is currently not working properly. Please check this post for the download. Kernel.zip is attached.

https://www.androidfilehost.com/?w=files&flid=335947

Instructions can be found in the OP!

But look at this post too :)

Have fun, enjoy the kernel and your phone.

Donations are not mandatory but very welcome.

If you like my work and want to buy me a coffee/green tea to keep development going: http://paypal.me/freak07
[Asus Zenfone 9] Lossani:
Hello sir,

How do you compile the original Kernel? Is any of vendor_boot or vendor_dlkm images the same as original stock or both are different? What about DTBO? I'm trying to build kernel for ROG Phone 6 but I thought kernal was still a monolithic file, so I flashed one only and failed to boot. ROG Phone 6 includes a script that apparently compiles everything but I don't which one is DTBO, vendor boot and vendor dlkm. Where and how you compile this kernel and where does the output go? For example I see kernel-platform/msm-kernel as the one you modified? That one is the vendor_boot?

Thank you for your help

And by the way, any plan for Kirisakura for ROG Phone 6?
[Asus Zenfone 9] Freak07:
Update to 1.1.1

Hey guys and girls,

Here´s the next update. It includes quite a few changes.

It also includes the few kernel changes from the latest firmware 32.2050.2050.29.

The link to the latest firmware can be found following this link.

More changes in the changelog below:

Changelog:

- included few changes from firmware 32.2050.2050.29

- other improvements and tweaks please check github

Download:

https://www.androidfilehost.com/?w=files&flid=335947

Instructions can be found in the OP!

But look at this post too :)

Have fun, enjoy the kernel and your phone.

Donations are not mandatory but very welcome.

If you like my work and want to buy me a coffee/green tea to keep development going: http://paypal.me/freak07
[Asus Zenfone 9] Freak07:
boot.img contains the zImage, vendor_boot contains first stage kernel modules, vendor_dlkm contains second stage kernel modules.

Kernel is no longer monolithic by default. I´m using the build environment to get the relevant images for GKI.
[Asus Zenfone 9] Lossani:
Do you have any kind of tutorial to follow to pack the kernel like you do in AnyKernel zip?

Thank you
[Asus Zenfone 9] Freak07:
I´m sorry but a step by step tutorial I don´t have the time to type that all down.

Please check tbaldens github for ZF9. We did the "bringup" of the ZF9 GKI environment together.

That here contains the scripts/methods we basically use both.

GitHub - tbalden/android_kernel_asus_zf9_build_env

Contribute to tbalden/android_kernel_asus_zf9_build_env development by creating an account on GitHub.

github.com

Check all the other zf9 repos as well.

We took basically the asus build script inside the ROG 6 source, readjusted it for the ZF9 source, as the build environment for the ROG 6 was more complete than ZF9.

You either need to remove avb from fstab (that lands in vendor_boot) or disable vbmeta flags for verity/verfication before you can flash any modified vendor_dlkm.

Be aware, disabling the flags triggers an inevitable wipe.

Otherwise check the scripts and work yourself through all the repos.

Unfortunately with GKI kernels you need to adjust the ABI. Now it gets complicated. The gki kernel, the zImage is usually compiled, from the common repo, while the qcom specific drivers are built in the msm repo. Since I don´t care about preserving googles abi for the GKI kernel, I compile the zImage from the updated msm repo, as well as the qcom modules.

That means in my build environment common repo is a symlink of msm repo, while I compile with the same script found in ROG 6 source. I think once you start working through the build environment you´ll understand. Tbalden doesn´t need to do that, as his kernel is close to stock with only a few mild changes, so easier to keep abi in check.

Unfortunately at the moment there´s no easy way to compile it.
[Asus Zenfone 9] Lossani:
Thank you for your reply. I succeded to compile using ROG 6 script but I end up with a vendor_dlkm.img in out/target/platform/taro and in gki folder "dist" outputs Image, vendor_boot.img and another vendor_dlkm.img + dtbo.img but doesn't seem to be the correct size, I guess there's another step missing to compile or I don't know which one of the dlkm is the correct one or if I need another step to make the Image file and vendor_boot.img.

Thank you anyways
[Asus Zenfone 9] Freak07:
check the scripts I just sent you. the vendor_dlkm and vendor_boot from the environment don´t work on the device.

The thing is, asus just uses the kernel environment to precompile zImage,all the modules, dtb and dtbo, then transfer those to their complete build environment and those get includes into the images that end up in the firmware. The zImage they´re using on the device is actually not the one compiled in the build environment, but the GKI kernel uploaded by google. That´s why abi is so important. You´re not supposed to flash the ones produced by the build environment.

Check the scripts how repacking both of those works. If everything is right, that will get you to boot.

the zImage you can get from ASUS_AI2202-32.2030.2030.26-kernel-src/kernel_platform/out/msm-waipio-waipio-gki/dist
[Asus Zenfone 9] Freak07:
Update to 1.1.3

Hey guys and girls,

Here´s the next update. Linux-Stable up to 5.10.149, which also fixed the CVEs discussed here and here.

The link to the latest firmware can be found following this link.

More changes in the changelog below:

Changelog:

- included few changes from firmware 32.2050.2050.34

- merge latest kernel/common

- linux-stable to 5.10.149

- includes a few fixed CVEs

- other improvements and tweaks please check github

Download:

Attached to release post, AFH is currently broken

https://www.androidfilehost.com/?w=files&flid=335947

Instructions can be found in the OP!

But look at this post too :)

Have fun, enjoy the kernel and your phone.

Donations are not mandatory but very welcome.

If you like my work and want to buy me a coffee/green tea to keep development going: http://paypal.me/freak07
[Asus Zenfone 9] Freak07:
Update to 2.0.0

Hey guys and girls,

Here´s the next update with source for A13 stable merged. (not much changes, hence the fast release)

Update to A13 stable before flashing this.

The link to the latest firmware can be found following this link.

More changes in the changelog below:

Changelog:

- included few changes from firmware 33.0804.2060.65

- merge latest kernel/common

- linux-stable to 5.10.157

- other improvements and tweaks please check github

Download:

Attached to release post, AFH is currently broken

https://www.androidfilehost.com/?w=files&flid=335947

Instructions can be found in the OP!

But look at this post too :)

Have fun, enjoy the kernel and your phone.

Donations are not mandatory but very welcome.

If you like my work and want to buy me a coffee/green tea to keep development going: http://paypal.me/freak07
[Asus Zenfone 9] Freak07:
Update to 2.0.6

Hey guys and girls,

Here´s the next update. That´s a bigger one. I´ll explain a few things below in more detail.

The link to the latest firmware can be found following this link.

Monolithic kernel build

Thanks to @arter97 it´s now possible to build the 5.10 qcom kernel now as a monolithic kernel, not needing to build as a GKI style kernel.

To explain it simple: The problem is QCOM/Google are no longer required to test if drivers are loading in the correct order and or test compilation of a monolithic kernel at all.

The gki style kernel has 100s of drivers build as external kernel modules, instead of directly into the zImage.

Having a monolithic build eases development a bit, but won´t directly make an impact to the user.

If you´re interested check my github, it contains the commits. and be sure to drop @arter97 a few thanks somewhere!

Introduction of Lazy RCU

Usually I´m not stating remarks about a change improving battery life notably. But this is one of the few kernel changes that really does make a noticeable difference.

This kernel has the entire(!) RCU subsystem updated to latest linux 6.0 kernel state. This also allowed for Lazy RCU to be merged into the kernel, which should result in power-savings while the device is lightly-loaded or idling (which is basically the case all the time a smartphone isn´t being interacted with (nothing touching the screen and no other workload such as video editing is done).

If you´re interested in details check the slides, which are also linked in the article mentioned/linked above.

A very simplified explanation: RCU functionality can be called 1000s of times a second, batching RCU calls can save power by not calling as often.

Please keep in mind, those are kernel changes and battery life will not be improved magically by huge amounts, but there´s definitely an improvments.

Sony Scheduler Improvements

Import some scheduler changes around Walt from Sony Xperia 1 IV. This improves jitter by a significant amount.

More changes in the changelog below:

Changelog:

- merge latest kernel/common lts branch

- linux-stable to 5.10.160

- merge latest qcom upstream to main branch

- bump clang to latest prebuilt from google 16.0.2

- lazy rcu backported

- scheduler improvements from Sony Xperia 1 IV

- remove wlan rx wakelock as it´s unnecssary

- other improvements and tweaks please check github

Download:

Attached to release post, AFH is currently broken

https://www.androidfilehost.com/?w=files&flid=335947

Instructions can be found in the OP!

But look at this post too :)

Have fun, enjoy the kernel and your phone.

Donations are not mandatory but very welcome.

If you like my work and want to buy me a coffee/green tea to keep development going: http://paypal.me/freak07
[Asus Zenfone 9] luki2411:
is there any possibility you could try to make such a kernel for rog 6 ? if you had a tester
[Asus Zenfone 9] Nagibator7000:
hi everybody. this is a very voluminous work, but still, if you decide, I am ready to take an active part in testing.
[Asus Zenfone 9] NoodlesBoy:
Hi Freak :D Will you port this kernel to ROG Phone 6 ?
[Asus Zenfone 9] adeklipse:
Quick question:

The firmware you linked to is WW-33.0804.2060.73, whereas the most recent firmware is WW-33.0804.2060.88. I suspect the minor version difference is a small hotfix from ASUS, so it should still be compatible, right?
[Asus Zenfone 9] Freak07:
Yeah, should still be compatible :)

I have an update kind of ready for latest as well i just need to find time to release it.
[Asus Zenfone 9] fityanferry:
wow. very nice sir. hope will release soon 😁
[Asus Zenfone 9] iforek:
Hi Freak07, thanks for all the hard work! I have a question. I built (with no changes) a kernel Image from your GitHub, put it into the .zip file instead of yours, and flashed using Kernel Flasher. All good. I can see phone running my build.

Now, I adjusted the config and enabled CORESIGHT_SOURCE_ETM4X and CORESIGHT_TRBE, but after rebuilding the Image, and re-flashing the phone, the phone keeps restarting after displaying ASUS logo. I appreciate those are non-trivial changes, so I don't expect you to debug it for me, but anything trivial I may be missing? I didn't expect that adjusting the config would break the kernel straightaway, but again my Android experience is very limited - I only use it as this is one of few pieces of hardware that has ARMv9 and can run Linux (in chroot).

Same happened when I tried to enable loading modules on runtime - I hoped I can load coresight dynamically, but no success.

For completeness I'm running firmware: 33.0804.2060.88.
[Asus Zenfone 9] Freak07:
Update to 2.0.12

Hey guys and girls,

Here´s the next update. I´m short on time, but I wanted to release it.

QCOM and Linux-Stable upstream contain a lot of little improvements and security fixes this time around.

It´s compatible with the recent firmware UL-ASUS_AI2202-ASUS-33.0804.2060.100, but then again there were barely any changes in asus kernel the last few updates.

The link to the latest firmware can be found following this link.

More changes in the changelog below:

Changelog:

- linux-stable to 5.10.169

- merge latest qcom upstream to main branch

- other improvements and tweaks please check github

Download:

Attached to release post, AFH is currently broken

https://www.androidfilehost.com/?w=files&flid=335947

Instructions can be found in the OP!

But look at this post too :)

Have fun, enjoy the kernel and your phone.

Donations are not mandatory but very welcome.

If you like my work and want to buy me a coffee/green tea to keep development going: http://paypal.me/freak07
[Asus Zenfone 9] Freak07:
It seems i forgot to reply.

I'd start by looking at pstore/ramoops, which might point you in the right direction.

Simply flash your working first compilation using my zip (dtb from my zip must be included) and let the phone just sit there for 5 minutes. Do a reboot and confirm you can see a file in sys/fs/pstore. (That's the kernel log from the last running session before the reboot)

Backup the boot.img from that working first compilation and copy it to your PC so you can restore it via fastboot.

Now flash the kernel with your changes, let the phone crash and try to time the button combination so you get back to bootloader.

Flash the boot.img you backup earlier. Check sys/fs/pstore to see what happened.
[Asus Zenfone 9] sakun-ice:
This kernel comes with the Cleanslate functions, right? Because after turning on the "k.adaway" ad blocker from the Cleanslate settings app and rebooting, I seem to still see ads in the apps (not YouTube or similar, obviously)
[Asus Zenfone 9] Freak07:
Yes they are included, but the Cleanslate adblocker is not one of them.

I don't intended to use my kernel without magisk root. That's why I'm using AdAway/systemless Hosts, which allows me to change/update the host file during runtime. Otherwise it's compile time bound and if hosts change, ads may come through.
[Asus Zenfone 9] sakun-ice:
It is what I had thought from the beginning, but something strange happens to me. When I use adaway with the magisk module to get the hosts file off the system, I get random reboots every few days.
[Asus Zenfone 9] Freak07:
Unfortunately I can´t help you there. I read on a forums for devices that I own that supposedly some users face this, but I never personally had it happen on any of my devices in the last year. Using systemless hosts all the time and never had a random reboot due to it.

Might be either an actual magisk issue or one of the hosts that being blocked can bring the system down for whatever reason, maybe a specific app causes this (that´s very unlikely, but adblocking can cause issues like broken deepsleep, apps constantly trying to reach a server that´s being blocked etc leading to increased cpu usage)

I´m still sticking to magisk canary 25206 as all newer release have some issues like broken module loading.
[Asus Zenfone 9] fityanferry:
Sorry can't take the log. but its rebooting when activate usb tethering on this latest kernel build sir.
[Asus Zenfone 9] Freak07:
thanks for the report, will be fixed in the next build :)
[Asus Zenfone 9] Freak07:
Update to 2.0.18

Hey guys and girls,

Here´s the next update.

QCOM and Linux-Stable upstream contain a lot of little improvements and security fixes this time around.

It´s compatible with the recent firmware UL-ASUS_AI2202-ASUS-33.0804.2060.100.

The link to the latest firmware can be found following this link.

More changes in the changelog below:

Changelog:

- linux-stable to 5.10.175

- merge latest qcom upstream to main branch

- few improvements that should speed up face unlock and camera launch time by quite a bit

- fix a kernel panic when using usb tethering option

- other improvements and tweaks please check github

Download:

Attached to release post, AFH is currently broken

https://www.androidfilehost.com/?w=files&flid=335947

Instructions can be found in the OP!

But look at this post too :)

Have fun, enjoy the kernel and your phone.

Donations are not mandatory but very welcome.

If you like my work and want to buy me a coffee/green tea to keep development going: http://paypal.me/freak07
[Asus Zenfone 9] Freak07:
Update to 2.0.19

Hey guys and girls,

Here´s the next update.

It´s compatible with the recent firmware UL-ASUS_AI2202-ASUS-33.0804.2060.113.

The link to the latest firmware can be found following this link.

More changes in the changelog below:

Changelog:

- linux-stable to 5.10.176

- merge qcom upstream

- merge UL-ASUS_AI2202-ASUS-33.0804.2060.113

Download:

Attached to release post, AFH is currently broken

https://www.androidfilehost.com/?w=files&flid=335947

Instructions can be found in the OP!

But look at this post too :)

Have fun, enjoy the kernel and your phone.

Donations are not mandatory but very welcome.

If you like my work and want to buy me a coffee/green tea to keep development going: http://paypal.me/freak07
[Asus Zenfone 9] adeklipse:
Cheers, man.

I have a few questions (again, haha).

The firmware link you provided links to the source code instead of the firmware files.

And the official firmware download page doesn't display the 2060.113 update, both for the kernal source and firmware. Could you direct us to where you got the 2060.113 update?

Thanks in advance!
[Asus Zenfone 9] Freak07:
Fixed the link to the firmware file.

You can "guess" the link. Once the files are uploaded to Asus servers it sometimes takes a while until the website is updated.

Source is here:

https://dlcdnets.asus.com/pub/ASUS/ZenFone/AI2202/ASUS_AI2202-33.0804.2060.113-kernel-src.tar.gz
[Asus Zenfone 9] NisseGurra:
Note that this fw is for the JP version, not for WW/EU/RU/IN/TW

"Steps of Update:

1. Check software version of your device**

2. Download device software and Update SOP (From “Manual” Item)

3. Only apply to same SKU update, Example: WW->WW, CN->CN, TW->TW.

4. Software update cannot transfer the software SKU and downgrade the software version.

5. Wrong SKU may cause update failure, please update the same SKU version only."
[Asus Zenfone 9] adeklipse:
Thanks for the heads up! I have the WW version, so I guess I'll be waiting for Asus.
[Asus Zenfone 9] Freak07:
Thanks for the heads up. (y)

No problems flashing on WW unit here. Did that a few times in the past on zenfones already. Flashing TW firmware on WW unit 😄

On ROG devices CN firmware won't flash on WW unit and vice versa.

I don't think there's any harm in flashing, but maybe Asus will push an incremental update over this the next few days.

So if users want to be on the safe side don't flash.

Kernel source never differed between different SKUs though.
[Asus Zenfone 9] Freak07:
edit
[Asus Zenfone 9] Freak07:
Update to 2.0.21

Hey guys and girls,

Here´s the next update.

It includes an option to block the fp reader while device is in pocket. Thanks to @tbalden this option is easily accessible via the CleanSlate config app. Needs to have the cleanslate companion app installed as well. If you want to use this feature please make sure to update both apps to the latest version available in the CleanSlate thread or on playstare.

It´s compatible with the recent firmware UL-ASUS_AI2202-ASUS-33.0804.2060.113.

The .113 firmware was now also pushed for all device including WW.

The link to the latest firmware can be found following this link.

More changes in the changelog below:

Changelog:

- linux-stable to 5.10.177

- implement option to block fp reader in pocket, accessible via cleanslate config app (needs cleanslate companion app installed as well!

Download:

Attached to release post, AFH is currently broken

https://www.androidfilehost.com/?w=files&flid=335947

Instructions can be found in the OP!

But look at this post too :)

Have fun, enjoy the kernel and your phone.

Donations are not mandatory but very welcome.

If you like my work and want to buy me a coffee/green tea to keep development going: http://paypal.me/freak07
[Asus Zenfone 9] fityanferry:
Installed this version on latest WW .113 fw. Pocket mode on but fingerprint still work. installed both companion and config app.
[Asus Zenfone 9] Freak07:
You need to enable the pocket mode for fingerprint in Cleanslate config app. Not the one in normal Rom settings from Asus.

If both apps are setup correctly it works.

No problems on my end.
[Asus Zenfone 9] fityanferry:
yeah both enabled sir.

so maybe only on my device. thanks