[KERNEL][Z017/Z012][TREBLE][P5] Advanced Kernel for Custom ROMs

EggyFrima

Senior Member
Sep 30, 2013
277
63
0
Advanced Kernel P2 is up, now with an additional kernel module for rtl8812au/rtl8814au usb wifi adapters.
Check the third post (here) for more information on the module. A new version of it will be released with every new kernel version for pie.

The new AiO_hotplug can be used to statically set the number of cores the phone should use. It is not load-based, meaning it will not dynamically online/offline cores depending on the cpu load.

Changes:
New rtl88XXau kernel module for usb wifi adapters.
Check the third post for more information: https://forum.xda-developers.com/showpost.php?p=75805767&postcount=3
Updated AnyKernel installation scripts.
Updated spectrum balanced profile to use elementalx with maple.
Added AiO_hotplug.
Updated kernel to Linux 3.18.127, CAF Tag LA.UM.7.6.r1-03600-89xx.0.
can you add adreno boost ?
thanks for the update
 

rsuyogya

Member
Sep 29, 2017
15
1
0
i'm new on this sort of stuffs. please anyone do tell me the benefits on flashing a new kernel, the pros and cons of it? sre their any risks if i toggled smth wrong?
I'm running ZE552kl Resurrection Remix 9.0 build on twrp 3.2.1
 
  • Like
Reactions: Williknot
Mar 29, 2016
19
5
3
binfmt_misc for architecture emulation on Android Pie

+ "Running Pixel Experience 9.0 ZE552KL and its stock kernel as of 6th of February 2019."
•> Request
Can binfmt_misc be added to the advanced kernel? Should be useful to have to those who emulate or run Linux distributions and want/need to run i386, amd64, and other CPU architectures. I'm currently working on Xubuntu in my SDCard as arm64. Unfortunately, most apps such as Chrome/Chromium don't work as it require the amd64 arch. Linux Deploy also requires that kernel support to install and run other archs of other distros (sending debootstrap errors).
This should also add a new value for the overclocked kernel.
 
Last edited:

planet9

Senior Member
Apr 24, 2017
114
500
0
Advanced Kernel P3

It took quite a while but here's the new version of Advanced Kernel!
I haven't experienced any issues until now but be warned: It's kinda experimental, especially due to the new GCC 9.0.1 toolchain.

Changes:
  • Added adreno boost.
  • Updated rtl88XXau kernel module.
  • Updated toolchain to GCC 9.0.1 (experimental).
  • Updated kernel to Linux 3.18.135, CAF Tag LA.UM.7.6.r1-04100-89xx.0.
I couldn't find a setting for adreno boost in EX Kernel Manager or Kernel Adiutor so you may have to use the terminal:
To toggle it, write one of the available values to "/sys/class/devfreq/1c00000.qcom,kgsl-3d0/adrenoboost".
The following values can be set:
0 - Off (Default)
1 - Low
2 - Medium
3 - High
 

planet9

Senior Member
Apr 24, 2017
114
500
0
+ "Running Pixel Experience 9.0 ZE552KL and its stock kernel as of 6th of February 2019."
•> Request
Can binfmt_misc be added to the advanced kernel? Should be useful to have to those who emulate or run Linux distributions and want/need to run i386, amd64, and other CPU architectures. I'm currently working on Xubuntu in my SDCard as arm64. Unfortunately, most apps such as Chrome/Chromium don't work as it require the amd64 arch. Linux Deploy also requires that kernel support to install and run other archs of other distros (sending debootstrap errors).
This should also add a new value for the overclocked kernel.
Sure binfmt_misc can be added. Load the following kernel module to add binfmt_misc support to Advanced Kernel P3:
Download this binfmt_misc_P3.ko module to your phone, then execute "insmod binfmt_misc_P3.ko" as root. This will add binfmt_misc support to the running kernel. Rebooting the phone will remove binfmt_misc support again.

This should only work with Advanced Kernel P3. If you can make use of this module I'll release an update with every new kernel release.
I've never really used Linux Deploy so I couldn't test your use case. Hopefully it does work :fingers-crossed:
 
Mar 29, 2016
19
5
3
binfmt_misc missing directory (failed attempt)

Sure binfmt_misc can be added. Load the following kernel module to add binfmt_misc support to Advanced Kernel P3:
Download this binfmt_misc_P3.ko module to your phone, then execute "insmod binfmt_misc_P3.ko" as root. This will add binfmt_misc support to the running kernel. Rebooting the phone will remove binfmt_misc support again.

This should only work with Advanced Kernel P3. If you can make use of this module I'll release an update with every new kernel release.
I've never really used Linux Deploy so I couldn't test your use case. Hopefully it does work :fingers-crossed:
"These are the information I have gathered so far."
>> Result - Linux Deploy installing a new Linux distribution (Ubuntu Bionic Beaver amd64)
Still receiving debootstrap errors of unable to start or execute its tasks
>> Result - Linux Deploy while starting container (Ubuntu Bionic Beaver arm64; "the one I currently use")
Code:
[09:07:41]binfmt-support ... mesg: ttyname failed: Inappropriate ioctl for device
[09:07:42]  * Enabling additional executable binary formats binfmt-support
[09:07:42] update-binfmts: warning: binfmt_misc module seemed to be loaded, but no /proc/sys/fs/binfmt_misc directory!  Giving up.
[09:07:42]    ...done.
[09:07:42] done
>> Troubleshooting
• Advanced Kernel P3 was installed and confirmed by "uname -a" terminal command
Linux localhost 3.18.135-Advanced_ZF3-P3 #1 SMP PREEMPT Wed Feb 20 16:27:44 CET 2019 armv8l

• Module was loaded via terminal as root inside /system directory with 0770 permissions
insmod /system/binfmt_misc_P3.ko

• Module was loaded as confirmed by /proc/modules and retrying insmod
modules: binfmt_misc 14489 0 - Live 0x0000000000000000
terminal: insmod: failed to load /system/binfmt_misc_P3.ko: File exists

• No ~binfmt_misc directory and no read/write capability in /proc, but it is mounted as "ls /proc" cmd shows folders and files of it.

• No /etc/fstab due to Android using other methods of 'fstab'

"I'm currently stumped on what can be done to get it working on my end unfortunately."
 
Last edited:

planet9

Senior Member
Apr 24, 2017
114
500
0
"These are the information I have gathered so far."
>> Result - Linux Deploy installing a new Linux distribution (Ubuntu Bionic Beaver amd64)
Still receiving debootstrap errors of unable to start or execute its tasks
>> Result - Linux Deploy while starting container (Ubuntu Bionic Beaver arm64; "the one I currently use")
Code:
[09:07:41]binfmt-support ... mesg: ttyname failed: Inappropriate ioctl for device
[09:07:42]  * Enabling additional executable binary formats binfmt-support
[09:07:42] update-binfmts: warning: binfmt_misc module seemed to be loaded, but no /proc/sys/fs/binfmt_misc directory!  Giving up.
[09:07:42]    ...done.
[09:07:42] done
>> Troubleshooting
• Advanced Kernel P3 was installed and confirmed by "uname -a" terminal command
Linux localhost 3.18.135-Advanced_ZF3-P3 #1 SMP PREEMPT Wed Feb 20 16:27:44 CET 2019 armv8l

• Module was loaded via terminal as root inside /system directory with 0770 permissions
insmod /system/binfmt_misc_P3.ko

• Module was loaded as confirmed by /proc/modules and retrying insmod
modules: binfmt_misc 14489 0 - Live 0x0000000000000000
terminal: insmod: failed to load /system/binfmt_misc_P3.ko: File exists

• No ~binfmt_misc directory and no read/write capability in /proc, but it is mounted as "ls /proc" cmd shows folders and files of it.

• No /etc/fstab due to Android using other methods of 'fstab'

"I'm currently stumped on what can be done to get it working on my end unfortunately."
Thanks for the detailed report! I completely forgot about the /proc entry of binfmt_misc... :silly:
The currently released versions of Advanced Kernel doesn't created the mount point at "/proc/sys/fs/binfmt_misc" for the binfmt_misc filesystem.
Please flash the following Advanced Kernel zip to fix this: https://drive.google.com/open?id=1zYUFHjN5544iurjkrcZg9E0tQUjCgdya (It's the OC version. If you don't want OC I'll glady provide another zip.)
After booting this kernel the "/proc/sys/fs/binfmt_misc" directory should exist. Insert the binfmt_misc kernel module from earlier, then mount the binfmt_misc filesystem using the following command:
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
Binfmt_misc should then be fully functional.
 

guntanx321

New member
Sep 11, 2017
1
0
0
It took quite a while but here's the new version of Advanced Kernel!
I haven't experienced any issues until now but be warned: It's kinda experimental, especially due to the new GCC 9.0.1 toolchain.

Changes:
  • Added adreno boost.
  • Updated rtl88XXau kernel module.
  • Updated toolchain to GCC 9.0.1 (experimental).
  • Updated kernel to Linux 3.18.135, CAF Tag LA.UM.7.6.r1-04100-89xx.0.
I couldn't find a setting for adreno boost in EX Kernel Manager or Kernel Adiutor so you may have to use the terminal:
To toggle it, write one of the available values to "/sys/class/devfreq/1c00000.qcom,kgsl-3d0/adrenoboost".
The following values can be set:
0 - Off (Default)
1 - Low
2 - Medium
3 - High
"Access denied" when trying to set the adreno boost in TE
 
Mar 29, 2016
19
5
3
binfmt_misc weirdness

Thanks for the detailed report! I completely forgot about the /proc entry of binfmt_misc... :silly:
The currently released versions of Advanced Kernel doesn't created the mount point at "/proc/sys/fs/binfmt_misc" for the binfmt_misc filesystem.
Please flash the following Advanced Kernel zip to fix this: https://drive.google.com/open?id=1zYUFHjN5544iurjkrcZg9E0tQUjCgdya (It's the OC version. If you don't want OC I'll glady provide another zip.)
After booting this kernel the "/proc/sys/fs/binfmt_misc" directory should exist. Insert the binfmt_misc kernel module from earlier, then mount the binfmt_misc filesystem using the following command:
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
Binfmt_misc should then be fully functional.
"I've been troubleshooting from morning to evening and things doesn't seem to go well."
>> Notes
• The latest advanced overclocked kernel with binfmt_misc file directory is installed.
• The module was successfully loaded and mounted as confirmed by insmod, grep binfmt /proc/mounts cmd, and cat /proc/sys/fs/binfmt_misc/status = enabled.
• Linux Deploy did interact with the binfmt folder though mounting and 'writing' to ~binfmt_misc/register.
• Clarification, when I say module is loaded in the Problems and Issues section, I meant that binfmt is loaded and mounted.

>> Problems and Issues
• Whenever the module is ready and Linux Deploy tries to start a container, Root and Magisk goes invisible. By invisible, I mean root cannot be detected. All superuser apps including Magisk Manager fails to find 'su' and is unable to recover unless two methods are done: One is to keep a terminal running as su (#) before activating the module and/or starting a LDeploy container and enter the cmd- echo 0 > /proc/sys/fs/binfmt_misc/status -to say "disable' to restore root functions or two is to reboot (risky due to weird system errors once booted; which is the next issue). This makes starting a init.d script (via Kernel Adiutor; init.d emulation off) for starting binfmt_misc risky.

• If rebooted from failed attempts with the module active / root errors / Linux Deploy breaking root with module active, the Android OS crashes with "Process System isn't responding." To recover, one needs to go to Recovery Mode and reinstall the advanced kernel (binfmt_misc + OC) and Magisk 18.1. From there, the system works to normal status again.

• The binfmt_misc folder seems empty to FX File Manager (#), yet files can be seen when using the ls -l cmd inside the folder. I managed to find the files visible to FX FM once. Unable to recreate such event (yet?).

• When updating Linux Deploy operating environment, there are times when the module is loaded, root seems to break. Other times, root seems okay.

• Sometimes, new qemu files appear in the binfmt_misc folder. The qemu files have the usual data inside them containing interpreters in /usr/bin/... and stuff. Yet, I have no idea if it is looking for a /usr directory in Android itself or in the chroot container (Ubuntu in my case). Theory: I tried installing qemu binaries and libs inside my Linux distribution while the module is off. After shutting the container down, I loaded the module and tried updating the operating environment of the app. At times and if passed the root breaking, I'll see new qemu files in the binfmt_misc folder. Though, I am not certain if that's the cause. As long as there are binaries in the OP Env folder of Linux Deploy, similar files appear in the module's folder.

• When installing a new distro of foreign architecture with a valid or existing qemu file in the binfmt_misc directory (In my case, I found i386 in binfmt_misc and LDeploy's OP Env. So, I tried installing Ubuntu Bionic Beaver as i386), I bypassed the debootstrap error, but it returns an error that LDeploy could not execute other tasks as i386. (Unfortunately I was not able to capture the error. Recreating it may face the root problem of which I don't was risking for another recovery and reboots for the time being. Though I'll try if it is absolutely needed for LDeploy's log.)

"I'm currently giving myself and my phone a break to breathe and gather some energy back. That's the information I gathered so far. I'm not sure if I'm missing something or mistaken something. It seems tricky to find a decent binfmt guide online (even YT has almost to none; RedHat has simple ones)."
"As for what version of the kernel, I prefer the non-overclocked kernel for stability and battery for my current system setup. Thanks for the help.

P.S - I did frequent editing to this post. I apologize if confusions were made due to new text(s) popping up.
 
Last edited:

planet9

Senior Member
Apr 24, 2017
114
500
0

planet9

Senior Member
Apr 24, 2017
114
500
0
Advanced Kernel P4 - For Treble!

This version of Advanced Kernel is finally compatbile to treble ROMs!

Treble support notice:
There are two types of treble ROMs currently available:
1. Older releases using a newly created "vendor" partition.
2. Newer releases using the existing "APD" partition as vendor.
Advanced Kernel P4 is only compatible to the latest treble ROMs, meaning the second type.
You can't harm your device by flashing the wrong version but the ROM will stop booting.
Re-flash your ROM or flash the right Advanced Kernel zip to fix this.

Changes:
  • Now compatible to latest Treble ROMs! (APD partition only!)
  • Updated rtl88XXau kernel module.
  • Updated kernel to Linux 3.18.138, CAF Tag LA.UM.7.6.r1-04500-89xx.0.