Kexec-hardboot patch - Nexus 6 Developer Discussion [Developers Only]

In this post, I would like to explain what kexec-hardboot patch is.
@kernel developers: I would like to ask you to merge this patch to your kernels, because it is essential part of MultiROM - it allows me to boot any kernel without changing the boot partition. I realize that it is no small request, but the patch is not big, touches relatively stable parts of kernel and should not cause any problems. Thank you.
What is kexec?
It is syscall of Linux kernel, which allows you to boot another Linux kernel without restarting the device - "Linux boots itself". The functionality is equivalent to fastboot -c *cmdline* boot zImage initrd.img, but without PC and fastboot. It is fairly known thing, so more info at wikipedia and man kexec.
Standard kexec call unfortunatelly does not work on Nexus 6. It freezes somewhere, and it is very difficult to find out where - probably some of the drivers are not shut down/re-initialized properly, it is a common thing among Android devices, which is why kexec-hardboot was made.
What is the difference between normal and hardboot kexec?
Kexec-hardboot patch adds a real device restart to that process, so that all the drivers can be properly reinitialized. It stores new kernel to RAM, reboots the device as usual, and kernel from boot partition immediately jumps to the one which was stored to RAM before reboot.
Unlike grouper's kexec-hardboot patch, this one only requires the host kernel to be patched. This is one of the improvements I made, and I think it is pretty significant.
To summarize the process:
kexec --load-hardboot.... is called and kernel it loaded into RAM.
kexec -e is called. Special info is written to memory (to area which is not overwritten on reboot) and the device is rebooted.
After reboot, very early in the boot process, kernel checks if that special info is present in RAM and if so, it loads new kernel from RAM and jumps to it.
Kexecd' kernel starts and boots.
For more info, read the original thread.
Patches:
Kernel patch: https://gist.github.com/Tasssadar/757c939f2d028c00d089, 5.1 AOSP kernel repo
This is the kernel patch. Only the host kernel needs to be patched.
Related CONFIG options:
CONFIG_KEXEC=y
# CONFIG_ATAGS_PROC is not set
CONFIG_KEXEC_HARDBOOT=y
CONFIG_PROC_DEVICETREE=y #this one is turned on by default
All these options must be enabled.​
Userspace kexec binary: https://github.com/Tasssadar/kexec-tools
I had to change some things in kexec userspace binary because of some kernel bugs, complete description is in that repository.​
Usage:
Once you have the kernel patches and kexec userspace binary in place, just run following command to boot into new kernel:
Code:
kexec --load-hardboot zImage --initrd=initrd.img --mem-min=0x20000000 --command-line="$(cat /proc/cmdline)" --boardname=shamu --dtb
kexec -e
Note the command line parameter - cmdline from bootloader is not added automatically, you have to put it there by yourself.
Authors:
This patch was made by Mike Kasick for Samsung Epic 4G. Since that, it was ported to several devices, one of them is Asus Transformer TF201 - I used patch from TF201 and modified it a bit (basically just changed few SoC specific constants). People at #ubuntu-arm helped me out with that, thanks.
For hammerhead, I've improved the patch a bit - only the host needs to be patched now and I've added support for DTB.
For shamu, it's pretty much the same as for hammerhead.

@Tasssadar, I'm trying to incorporate the patch in my kernel (LiquidSmooth, which I compile in-line with the ROM - sources below), but I'm having issues actually booting into the secondary ROM.
Here is the portion of the log that contains the kexec call failure.
I just can't seem to figure out what my issue is - any ideas?
My device tree
My kernel source
Other potentially relevant info:
- Building the kernel in-line (using "make bootimage" for kernel incremental testing purposes)
- 5.0.2 base for host (my) kernel
- Using standard GCC for builds
- Updated to most recent MR TWRP and zip releases
Any help you might have to offer would be awesome!

CPA Poke said:
@Tasssadar, I'm trying to incorporate the patch in my kernel (LiquidSmooth, which I compile in-line with the ROM - sources below), but I'm having issues actually booting into the secondary ROM.
Here is the portion of the log that contains the kexec call failure.
I just can't seem to figure out what my issue is - any ideas?
My device tree
My kernel source
Other potentially relevant info:
- Building the kernel in-line (using "make bootimage" for kernel incremental testing purposes)
- 5.0.2 base for host (my) kernel
- Using standard GCC for builds
- Updated to most recent MR TWRP and zip releases
Any help you might have to offer would be awesome!
Click to expand...
Click to collapse
Looks like you didn't enable the config options mentioned in the first post. Also, please don't merge my hack to force-enable serial console, it doesn't play well with multirom. Also, you can enable the console by running "fastboot oem config console true", which I didn't know when I made that commit.

Tasssadar said:
Looks like you didn't enable the config options mentioned in the first post. Also, please don't merge my hack to force-enable serial console, it doesn't play well with multirom. Also, you can enable the console by running "fastboot oem config console true", which I didn't know when I made that commit.
Click to expand...
Click to collapse
[emoji33] [emoji40]
I literally can't even right now. Can't believe I missed that...rebuilding now, hopefully that takes care of it.
And thanks for the fastboot tip, I'll revert that hack.

Please keep the thread on topic for the section. If you aren't sure, read this: http://forum.xda-developers.com/nexus-6/devs-only/section-guidelines-read-t2959988
@Tasssadar, would this be better here in dev discussion (where I'm supposed to be an anal retentive moderator) or in "original development"? The reason for my asking is that your message states it's a release, as opposed to a discussion of the process of creating.
In the meantime, I've cleaned the thread...
Take care
Gary (posting as moderator of the dev discussion section.)

I put the patch here because it is quite different from most things posted in original development. It's pretty much for kernel devs only, and putting it in this section ensures it won't get lost (after couple of initial comments, there usually isn't any discussion related to this patch) and filters out most "thx" and "lolwhatsthis" posts (although obviously not all of them). I honestly didn't look up what's the exact goal of this section, it just seemed just right for this kind of thing. If you think it belongs to original development, feel free to move this topic.

Tasssadar said:
I put the patch here because it is quite different from most things posted in original development. It's pretty much for kernel devs only, and putting it in this section ensures it won't get lost (after couple of initial comments, there usually isn't any discussion related to this patch) and filters out most "thx" and "lolwhatsthis" posts (although obviously not all of them). I honestly didn't look up what's the exact goal of this section, it just seemed just right for this kind of thing. If you think it belongs to original development, feel free to move this topic.
Click to expand...
Click to collapse
Hey I don't know if you compile with ndk or cross compile for arm (statically or ndk) but I had to add some missing includes in *kexec/arch/arm/Makefile for kexec-tools to compile with the new board option. Just thought I'd mention.
https://github.com/Surge1223/androi...mmit/4b4629db76d64b7048274748d3e3366b52e1017d
Also, Ignore the other stuff. Testing kexec via module for locked devices so I have quite a bit of changes compared to regular kexec-tools.

Related

[UTIL] Kexecboot Bootloader for Galaxy Note i717 - Boot Multiple Kernels

Well, it only took 2 years lol!
What is Kexec?
Kexec (kernel-execute) is a function of the Linux kernel that allows it to act as a bootloader to boot other kernels. Unfortunately, the standard implementation of kexec doesn't work quite right on most ARM devices due to poor driver support for hardware resets. The workaround is kexec-hardboot, a patch set that allows a kernel to be staged in RAM before performing an actual hardware reset through the phone's bootloader. Upon reboot the kexec-supporting kernel will check the magic location in RAM to see if a previously stored kernel is available, and if so, it will transfer execution to that kernel instead of booting itself.
Why use Kexec
It's a second-stage bootloader. The standard Android bootloader only allows two kernels to be installed at once - boot and recovery. This means that if you want a working recovery, you're only allowed one real OS kernel. If you want to dual-boot (or tri-boot or more) you're screwed. Kexec provides an answer to this. By replacing the boot kernel, kexec (with the kexecboot GUI) acts as a "second stage bootloader" allowing you to boot any number of kernels from any available storage devices. For instance, you have kexecboot in your boot partition and you can keep a kernel for Android installed in your Android system partition as well as an Ubuntu kernel and root filesystem on your SD card and be able to switch between Android and Ubuntu at boot time.
What is kexecboot
http://imgur.com/4GYomKX
Kexecboot is a graphical front-end for kexec. I have modified it to work with the kexec-hardboot patches. It scans all available storage devices for a boot.cfg file in which you define kernels, ramdisks, and kernel commandlines. You control it using volume up and down to move cursor, power to select.
Download
Get it here: https://mega.co.nz/#F!0ct3EaTD!wHWnGo1M_2smyKdzGMIYmw
The code
Kernel builder: https://github.com/CalcProgrammer1/kernel_quincyatt_kexec
This repository contains all the things you need to build a flashable kexecboot/kexec-hardboot enabled kernel image. It contains the ramdisk with the kexecboot binary and a script to package a flashable zip file. Included as submodules are the kernel source itself (kexec-hardboot branch, required to build the image) and the kexecboot source (optional, not used by default as you must build it using an ARM system, a pre-built binary is included if you don't want to build your own). The kernel source includes a defconfig called kexec_quincyatt_defconfig that sets the required config options for building a kexec-hardboot kernel.
Kexecboot Configuration File
Kexecboot replaces your boot kernel, so when you power up your phone it will go straight to the Kexecboot screen. The issue is now to provide kernels for kexecboot to boot into. This requires some work on your part, as you will have to store the kernel files (zImage and initrd) in a partition and write a configuration file to tell kexecboot where they are. This configuration file may contain multiple kernels, allowing you to have several different kernels available for the same OS or multiple OSes entirely. If you're coming from an Android system that distributes their kernel as a boot.img, you can use the abootimg program to extract it into a separate zImage and initrd.img binary.
The configuration file must be located on the path /boot/boot.cfg. This is relative to whatever partition/disk you are on, so for instance if you're setting up Android to boot from kexecboot, you would put your configuration file in /system/boot/boot.cfg (/data/boot/boot.cfg would work as well). You can also put a boot.cfg file on your SD card as long as you follow the /boot/boot.cfg path. Kexecboot automatically scans all available partitions for a boot.cfg file before it starts and builds a list of all available kernels across all detected boot.cfg files, so you may have Android in your /system partition and Debian on your SD card and both kernel lists will be shown together.
The Kexecboot web site provides a nice tutorial: http://kexecboot.org/documentation/how_to_write_config
The Note i717 bootloader passes a fairly long string of kernel arguments to the boot kernel. Since kexecboot overrides this for the kexec-booted kernel, you must provide this boot string in your boot.cfg file. Additionally, you may edit or add arguments to the command string here (such as setting console=tty0 instead of the default console=null so you can use the framebuffer console).
For example, here is my /system/boot/boot.cfg for CyanogenMod 11 (with kernel and initrd.img, extracted via abootimg, in /system/boot/)
Code:
# kexecboot configuration file
# CM11 default kernel
LABEL=CyanogenMod 11
KERNEL=/boot/zImage
INITRD=/boot/initrd.img
APPEND="androidboot.hardware=qcom usb_id_pin_rework=true no_console_suspend=true zcache [email protected] [email protected] sec_debug.reset_reason=0x1a2b3c00 pmem_sf_addr=0x7a000000 pmem_sf_size=0x6000000 console=null sec_debug.enable=0 sec_debug.enable_user=0 appsbark=0 msm_watchdog.enable=1 msm_watchdog.bark_time=30 msm_watchdog.bite_time=31 vmalloc=512m hw_rev=12 lpj=67702 androidboot.emmc=true androidboot.serialno=32c245ca androidboot.baseband=csfb"
I'm not sure how much of that you actually need, but you do need at least some of it because with an empty APPEND= it does not boot. You also do have to put the quotation marks around it or else parsing of one of the options will fail.
I'll admit limited understanding of what you're accomplishing here, but seems to me that this could lead to dual booting on the Note. Nice work.
Good luck.
Nice work! Thanks for the work you've done thus far. Unfortunately I have no way to help you out other than morale support! :highfive:
lactardjosh said:
I'll admit limited understanding of what you're accomplishing here, but seems to me that this could lead to dual booting on the Note. Nice work.
Good luck.
Click to expand...
Click to collapse
Pretty much what it comes down to, testing kernels and roms without having to flash into nand. I can't wait for dualbooting from Sd on the Note.
I have ORD , please help!!
My main goal here is native Linux, but if kexec works then you can boot custom Android dev kernels, native Linux kernels, other mobile OS'es, etc. The SGSIII team seems to have found some interesting kexec solutions for the Verizon SGSIII due to its locked bootloader. They've posted a good deal of kexec patches which I'm trying to bring to the Note, including a custom kexec-hardboot option that fully reboots the device into the new kernel (apparently to make sure the radio and such are working).
CalcProgrammer1 said:
My main goal here is native Linux, but if kexec works then you can boot custom Android dev kernels, native Linux kernels, other mobile OS'es, etc. The SGSIII team seems to have found some interesting kexec solutions for the Verizon SGSIII due to its locked bootloader. They've posted a good deal of kexec patches which I'm trying to bring to the Note, including a custom kexec-hardboot option that fully reboots the device into the new kernel (apparently to make sure the radio and such are working).
Click to expand...
Click to collapse
Wonderful, wonderful work!!! :thumbup::thumbup::thumbup:
Sent from my SAMSUNG-SGH-I717 using xda premium
Uh...It all sounded like this:
dual kernel (i'm gonna brick) kexec will allow (me to brick my phone).....with native linux applications ('im gonna brick my phone cause i'm stupid)....LOL
while i know what your doing, that in no way means i will ever understand it...LOL
But i will thank you in advance for what sounds like a sick mod for our notes...
Many thanks Dev !!!!
Kexec is actually (if done right) a good way *not* to brick your phone. To run kernels, you usually have to flash them to a restricted boot section of the memory, and if you flash all non-working kernels (to download, recovery, and main) then you have no way to use your phone, as it won't boot up. If you use kexec, your working kernel is safely stored on the boot partition and your development kernels can be wherever, and if it doesn't boot you can just hold down POWER to hard reboot into your good kernel.
The problem is that it doesn't seem to be working, I think I have the kexec support built properly but haven't been able to boot any kernels without it crashing.
CalcProgrammer1 said:
Kexec is actually (if done right) a good way *not* to brick your phone. To run kernels, you usually have to flash them to a restricted boot section of the memory, and if you flash all non-working kernels (to download, recovery, and main) then you have no way to use your phone, as it won't boot up. If you use kexec, your working kernel is safely stored on the boot partition and your development kernels can be wherever, and if it doesn't boot you can just hold down POWER to hard reboot into your good kernel.
The problem is that it doesn't seem to be working, I think I have the kexec support built properly but haven't been able to boot any kernels without it crashing.
Click to expand...
Click to collapse
I know you'll crack it ....
And when you do ....you'll be the galaxy note GOD !!!....LOL
your effort is much appreciated Sir ....even if I'm scared to use it , but will anyway ...lol
So I'm still confused as to why my kexec didn't work. I'm going to build a TouchPad kernel with it enabled and repeat the test on it, since I have a known-good kernel to boot against. I'll let you know how that goes.
Sent from my SAMSUNG-SGH-I717
Ok, so long-time-no-see but I'm reviving this post! Now that my Note 3 is happily running Cyanogenmod I have no urgent need for my Note 1 and can hack on it!
So far I haven't gotten kexec working, but I do have:
1. Kexecboot (graphical kexec frontend) is working, detects OS images appropriately
2. Framebuffer Console (text-mode display, USB OTG keyboard supported for interactive command line)
3. Overriding bootloader command line (to enable the fbconsole you need console=tty1 but the bootloader passes console=null)
4. Framebuffer console rotation (boot up in landscape or portrait, no way to switch without recompiling at the moment)
5. Most of kexec-hardboot ported from the HP TouchPad port, no clue if it's promising or not as so far it just crashes after a while of nothing
6. Ubuntu 13.04 (desktop edition) rootfs installed on SD card in a chroot, also taken from HP TouchPad
What I'm working on:
1. Kexec-hardboot port (needed to use kexec properly and boot kernels)
2. Fixing fbconsole glitching (framebuffer console displays garbled text that slowly clears up, no clue why...reading /dev/fb0 repeatedly clears up the display immediately and is a dirty hack that works well enough for testing)
3. Networking (either USB Ethernet or integrated WiFi, going to try backported brcmfmac driver)
4. Ubuntu (that's the long-term plan here)
5. Note 3 S800 port if I get everything figured out here
CalcProgrammer1 said:
Ok, so long-time-no-see but I'm reviving this post! Now that my Note 3 is happily running Cyanogenmod I have no urgent need for my Note 1 and can hack on it!
So far I haven't gotten kexec working, but I do have:
1. Kexecboot (graphical kexec frontend) is working, detects OS images appropriately
2. Framebuffer Console (text-mode display, USB OTG keyboard supported for interactive command line)
3. Overriding bootloader command line (to enable the fbconsole you need console=tty1 but the bootloader passes console=null)
4. Framebuffer console rotation (boot up in landscape or portrait, no way to switch without recompiling at the moment)
5. Most of kexec-hardboot ported from the HP TouchPad port, no clue if it's promising or not as so far it just crashes after a while of nothing
6. Ubuntu 13.04 (desktop edition) rootfs installed on SD card in a chroot, also taken from HP TouchPad
What I'm working on:
1. Kexec-hardboot port (needed to use kexec properly and boot kernels)
2. Fixing fbconsole glitching (framebuffer console displays garbled text that slowly clears up, no clue why...reading /dev/fb0 repeatedly clears up the display immediately and is a dirty hack that works well enough for testing)
3. Networking (either USB Ethernet or integrated WiFi, going to try backported brcmfmac driver)
4. Ubuntu (that's the long-term plan here)
5. Note 3 S800 port if I get everything figured out here
Click to expand...
Click to collapse
Long time in the making. Glad to see you're still at it. Hope you are able to get it working. Would be pretty cool. Good luck
If you can get this working up to kernel with freedreno I'd be all over working on getting Plasma Active onto this thing. I've missed having a real linux phone since my n900 died.
Got Bluetooth working from the command line!
Code:
# rfkill unblock all
# hciattach /dev/ttyHS0 any
# hcitool scan
It detected my Note 3 which I had set to visible! Hopefully I can pair a BT keyboard with this and lose the USB OTG dependency. Still working on figuring out WiFi, I have the brcmfmac driver from 3.13 backports compiled and loaded but the WiFi chip isn't being detected so the driver never creates an interface for it. The chip is a Broadcom BCM4330 WiFi/Bluetooth chip, and although both WiFi and Bluetooth share the same chip they use different interfaces to the SoC (UART for BT and SDIO for WiFi).
I plan on doing more research into getting the hardware working before I do any more work on kexec. It will be much easier to debug kexec I think knowing how to use WiFi/BT/USB/etc. The only hardware I'm not going to attempt at all is the modem as I don't use this device as a phone anymore and don't have a SIM card in it. That said, all the rmnetX entries that I think are modem interfaces show in ifconfig -a so maybe it is working.
My kernel source is here:
https://github.com/CalcProgrammer1/ubuntu-kernel-quincyatt
The kexec branch will have the kexec hardboot patches once I figure them out. I've also got a folder set up with a script to automatically build the kernel zImage, build the modules, build the backport driver modules, build the ramdisk from a ramdisk root folder, build the boot.img, and then package that up in a flashable .zip. I'll upload parts of this system as I complete them. I also have an Ubuntu rootfs on my external ext4 (or was it 3?) SD card that I ripped straight off my TouchPad. For now I'm just using a busybox shell in my ramdisk, dropping out of kexecboot into ash, setting up a chroot for the SD card, and chrooting into the Ubuntu rootfs that way. It's not ideal since Ubuntu's init process doesn't run but it does allow me to run all the installed utilites from said rootfs.
Edit: Rii Mini Bluetooth Keyboard paired and working! It was a roundabout way of doing so because dbus and upstart don't work in chroot so I had to use an old package called bluez-compat which provides the hidd command. I sideloaded the .deb with a flash drive. The command to pair a keyboard:
Code:
# hcitool scan
Scanning ...
XX:XX:XX:XX:XX:XX Bluetooth device name
# hidd --connect XX:XX:XX:XX:XX:XX &
XX:XX:XX:XX:XX:XX will be a hex value that is your keyboard's address. You find the address with the scan command and enter it on the hidd command to connect. I didn't have to enter any kind of passcode or pairing key, after running hidd it just started working.
http://imgur.com/2sV3TJr
I got it! I finally managed to get kexec hardboot working! I had to rewrite a bit of code in the kexecboot program to support kexec-hardboot better but I now have a bootloader that is working correctly, if slowly. I'll be posting my kernel source soon (it's a branch off of CyanogenMod's msm8660-common kernel) as well as my modifications to kexecboot itself. The kexec-tools binary I took out of the HP TouchPad port unmodified so I don't have the source for that (though it shouldn't be hard to find). I'll be looking into a Note 3 port soon, basically used the Note 1 as the guinea pig for this experiment.
If, somehow, you could adapt this for the ATT Mega 6.3 so as to bypass the locked tight bootloater.....you would be considered a hero!! People would build statues of you....write songs and name their children after you!!!!!?
Sent from my SM-T310 using XDA Premium 4 mobile app
Unfortunately you require an unlocked bootloader to install the kexecboot kernel. This isn't going to be a magic bullet for locked bootloaders. People have tried. For devices with exploitable bootloaders, it may help as you won't have to fake-sign kexec-booted kernels though.
CalcProgrammer1 said:
Unfortunately you require an unlocked bootloader to install the kexecboot kernel. This isn't going to be a magic bullet for locked bootloaders. People have tried. For devices with exploitable bootloaders, it may help as you won't have to fake-sign kexec-booted kernels though.
Click to expand...
Click to collapse
Grasping at straws, My Friend. Hoping that maybe this could be something like SafeStrap and could be d/l and installed as an APK.
Sent from my SAMSUNG-SGH-I527 using XDA Premium 4 mobile app
Got Debian booting! I also figured out how to get WiFi working from a non-Android Linux OS so this is definitely on track towards a full desktop OS!
To-do:
* X server, preferably with Freedreno GPU driver eventually
* Audio (q6.* firmware files and possibly an ALSA config)
* Startup scripts for Bluetooth initialization
* Figure out how to rotate the screen
dparrothead1 said:
If, somehow, you could adapt this for the ATT Mega 6.3 so as to bypass the locked tight bootloater.....you would be considered a hero!! People would build statues of you....write songs and name their children after you!!!!!?
Sent from my SM-T310 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
I wont be having anymore children to name, but I can do a dog. He is too stoopid to know the difference. I can say aluminum foil and he will come running.
Sent from my SAMSUNG-SGH-I527 using XDA Free mobile app

Finding out which blobs are needed for a device (CM13)

Hi everybody,
I'm currently in process of making my first builds of CM13 for my A310F.
The repositories for CM are unofficial, maintained by a user i tried to get in contact with, who didn't respond yet.
Now, while the stock kernel sources of MM are open sourced and a few hacks were already done in the unofficial CM repositories, the CM device/vendor/kernel sources are already a bit deprecated with a few erroneus configurations in the device repo, so I'm on my way to clean it up a bit.
Currently CM itself builds, but after booting most of the hardware features are broken and they were using the 5.1.1 kernel instead of the 6.0.1, and the blobs were not taken over correctly, or not all blobs were taken.
My question is now, how are you managing to get the correct list of the blobs needed? What is the best way to find out which blobs i need to take from the system.img?
I'm wondering the same thing. How do you know which blobs to pull in the first place when you're trying to build up the first rom?
There will be some dlopen errors for missing files in the logcat. After resolving them, it's mainly trial and error
Believe it or not, there is a method to this, and it requires some trial and error and a good sense of knowing what android needs to boot. If you look at the start up classpath and are just generally aware that the modem/network connection and filesystem utils need to be executed first (though for some reason binder and zygote can't start them themselves, despite the fact they are to running under init, but whatevs) so after bootloader hands off to kernel, you can go through the ramdisk and make sure all the on boot, on init on fs related libs/binaries are present. If you use a qcom device, just assume any lib or binary that starts with "libq" or even just the letter "q" is proprietary and required. Qcom is a bit full of themselves (ironic were talking about cm here) but anyways then there's the rild/crypto/fs libs and binaries. rngd, rmt_storage, rild daemons and anything that starts drmsever or netd will be required as well.
You can get significant hints from boot logs as well.
Aside from that, just keep note of what isn't produced by the aosp tree yet is present on the devices stock system, then determine how important it looks for android to able to start up

[MODS DELETE THIS THREAD] exNoShadez-eas

Mod edit: Thread closed on owner's request.
exNoShadez-EAS Kernel
Hey Pixel XL forum. I'm a Pixel/Sailfish owner, who also enjoys hacking on kernel code. I recently released a Kernel in the Google Pixel forum => but we are all using the same kernel, sooo.... I thought after pushing my second stable release, that I should probably post on the XL forum too.
My kernel is a bit different than most kernels available, you will quickly notice. Lots of interesting features and some unique ones too.
FEATURES
- Current LTS release -> Linux-3.18.114
- Energy Aware Scheduling
- Schedutil (default Cpu Governor)
- RCU infrastructure backport (with expert mode enabled)
- Cpu-Boost / Input Boosting (enabled by default)
- BINFMT_MISC support (NOT mounted on boot).
- Kernel Hardening/Protection (CopperheadOS/Grsec/Pax Marlin kernel hardening features)
- leds-qpnp: Notification LED control - V1.1c (Boeffla) - Adapted for Marlin
- Binder_rt = My own re-implementation of AOSP Binder that uses rt_mutexes; supporting priority inheritance
- Improved scheduling/determinism for high priority threads/tasks
- Backported Scheduling, Locking and Workqueue subsystem code from Newer Linux kernels.
- Audio Driver enhancements / backports (from Wahoo/Pixel 2)
- Sound/Audio driver Tweaks (bug fixes, scheduling improvements)
- forced Interrupt threading enabled
- Wifi Mac Address Randomization
- WireGuard (VPN) kernel module support
- KCal Advanced Colour control
- Improved ASLR (in kernel)
- USB Fast Charge
- Wake Gestures
- GCC 6/7+ Fixes
- Built with GCC-8.x-dev
- and more
Contains code from everywhere: Code Aurora, Flar2/Marlin, CopperheadOS, AOSP, Project-EAS, Freak7/Kirisakura, Linaro, Pixel 2 kernel sources, mainline linux and elsewhere. Modifications and backports by me, as well.
BACKGROUND
I wanted a kernel for My Pixel that had 'all of the things', it didn't exist... So I'm working on my own kernel. I try to balance Security/hardening, experimental features with high Performance and battery life. <- not an easy task! ... Some of the security features do come with overhead, but if you use apps that are CPU heavy / processing and/or require low latency - they will perform well (at the cost of chewing some battery life, of course).... Battery life and SOT are very reasonable though.
WARNING / VERY IMPORTANT: This kernel isn't compatible with installing TWRP ~> meaning; you must use the fastboot version of TWRP (used in RAM) , flash the kernel and NOT install TWRP to your system (the kernel is too big for TWRP to co-exist).... This may sound inconvenient, but there are a number of valid reasons to avoid reducing a kernel's size in order to support TWRP installation, in the boot partition.
***Fun facts on not supporting TWRP below => 2nd post: PLEASE READ: to understand my motivation***
TWRP REMOVAL
*To remove TWRP from your system; You need the stock boot.img from your running/current firmware (which is inside of the factory image zips) or use the Nov Stock boot.img provided here. Then it's as simple as flashing the boot.img to wipe TWRP;
fastboot flash boot_a /path/to/boot.img
fastboot flash boot_b /path/to/boot.img
Stock 8.1 July 2018 Boot.img => https://github.com/nine7nine/Apps/raw/master/MarlinStockJulyBoot.img
Now you can proceed with using the TWRP fastboot boot.img to flash my kernel, magisk/supersu or whatever else....
Fastboot twrp boot image => https://dl.twrp.me/marlin/twrp-3.2.2-0-marlin.img
WARNING: This shouldn't need to be said, but we did have someone on the Pixel forum who did this, so I'm adding a sticky/warning here; do NOT EVER re-lock your bootloader after flashing any kind of custom software, kernels, etc to your device - *it will brick your phone*. Meaning you are screwed would need an RMA / replacement device ... everyone in the XDA community should know better, but still; worth mentioning....
IMPORTANT:
Before asking questions; Please read through the thread (starting with the last few pages) - I shouldn't need to be repeatedly answering the same questions over and over again. It's good practice to get into the habit of reading through threads before asking questions in any thread on XDA, as more often then not; you're question has probably been answered. Thanks!
EXNS-EAS KERNEL DOWNLOAD:
JULY 2018 OREO 8.1 RELEASE exNoShades-eas Kernel Flashable zip
https://github.com/nine7nine/Apps/raw/master/exNoShadez_eas_v2.8.2_f94351f.zip
It is stable, high performance and very responsive...
Important: You will need root; I don't support non-rooted devices && some features require it. I recommend using Magisk; https://forum.xda-developers.com/apps/magisk/beta-magisk-v13-0-0980cb6-t3618589 ...
NOTE: Make sure to flash the latest Magisk beta *before* flashing the kernel zip ...
More Background / Important Notes:
Binder_RT:
My own port and re-implementation of the Binder Kernel Driver; a slightly modified version of The AOSP binder.
Binder_RT uses rt_mutexes as oppsed to mutexes for locking in Binder, ion, ashmem, etc... rt_mutexes support priority inheritance and should improve determinism in Binder, speed up IPC, Ion and Ashmem => Allowing applications that require low-latency, tight deadlines, low jitter and deterministic behaviour to perform better ~ This re-implementation is proving to be the great for those types of applications. The goal here is to help ensure that the Kernel and Binder's high priority && time critical threads and tasks are properly prioritized... Example; audio buffers arriving on time / no buffer underruns... *Further development work is planned to research, experiment with and improve Binder_RT.
rt_mutex documentation, for those interested;
https://github.com/nine7nine/Marlin_exns-eas/blob/EXNS_EAS/Documentation/locking/rt-mutex.txt
https://github.com/nine7nine/Marlin_exns-eas/blob/EXNS_EAS/Documentation/locking/rt-mutex-design.txt
CPU-Boost / Input Boosting:
Touch inputs boost CPU frequencies (thus improves performance and responsiveness).
# Cpu-boot / Input boost settings
write /sys/module/cpu_boost/parameters/input_boost_enabled 1
write /sys/module/cpu_boost/parameters/input_boost_freq "0:1363200 1:0 2:1900800 3:0"
write /sys/module/cpu_boost/parameters/input_boost_ms 100
IO/ CPU Governors:
This kernel doesn't include a thousand io/cpu governors. IO-wise; CFQ is the default, but we've got a few in there. chose your poison, but know that the majority of my testing is centered around cfq and deadline. CPU Governor-wise the common Linux CPU governors are there; along with Sched and Schedutil....
Stick with Schedutil - on idle, it draws very little power and in most 'peak performance situations, it should do very well..... I'm getting great battery life, sot and performance.
Managing Kernel Settings:
Get EX Kernel Manager - my original code on github was forked from EX kernel, before rebasing it - but EXKM will give you access to 99% of my kernel's settings.
My 8.1 Kernel Sources: https://github.com/nine7nine/Marlin_exns-eas
Donations via PayPal very much appreciated. I do put a significant amount of energy and time into researching, development, testing / QA and also providing support/help to end-users... It's definitely not mandatory to donate; but If you appreciate the effort, see value or benefits from using my kernel on your device and can afford to; Use the "Donate to me" button or the below link... It makes a big difference. thanks!
https://www.paypal.me/jrdnjhnstn
Why TWRP Installations are NOT supported:
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
(and why I'm not using it!)
Most custom/android kernel devs are using the above configuration in kernel compilation, which is arguably very BAD... I understand that boot partitions are small and the desire to install TWRP to them, thus there is a need to reduce the kernel's size....and yes, this will achieve that - However;
1. SUSE, RedHat, etc (Enterprise linux) disable CONFIG_CC_OPTIMIZE_FOR_SIZE -> it's original use case has proven to be invalid. Even Google (in their own documentation) advise against using this; https://source.android.com/devices/tech/perf/boot-times ....
2. It suppresses useful compiler warnings....
3. As SOCs have become more powerful, google has come to the same conclusion that Enterprise Linux did back in 2012.
4. by turning off CONFIG_CC_OPTIMIZE_FOR_SIZE, we achieve better performance, boot time and better cache utilization.
Clark Williams / Redhat Bugzilla said:
* Cause: CONFIG_CC_OPTIMIZE_FOR_SIZE set with assumption that smaller code would yield hot cache lines and good performance
* Consequence: this config caused gcc to generate jump-to-jump code which causes cache line bouncing, hurting performance
* Fix: turn off CONFIG_CC_OPTIMIZE_FOR_SIZE
* Result:slightly larger kernel but better cache utilization
Click to expand...
Click to collapse
(The Above is quoted from Clark Williams, A Senior Software Architect @ RedHat -> https://bugzilla.redhat.com/show_bug.cgi?id=796297)
I know of no other way to significantly reduce kernel size. Disabling some debugging, unneeded features, etc helps - but not enough.... I am focusing on optimization, using newer builds of GCC/Linaro, performance enhancements, fixing compilation errors, etc, etc -> these things are more important than trying to support TWRP installation.
Therefore; I do NOT support installing TWRP....
This sounds incredible. All those features.. and then some. Hard for me to test as I rarely use my PC but I may have to go and give this a try.
Edit: would it be possible to create a build for those who do want to use TWRP? Would be great to do some benchmarks (real work using DiscoMark and synthetic using geekbench/AnTuTu/etc) to see differences between the two.
All those features are welcome in this poor Oreo pixel community! thanks for your work..
i'll try it as soon as possible!
spr33 said:
This sounds incredible. All those features.. and then some. Hard for me to test as I rarely use my PC but I may have to go and give this a try.
Edit: would it be possible to create a build for those who do want to use TWRP? Would be great to do some benchmarks (real work using DiscoMark and synthetic using geekbench/AnTuTu/etc) to see differences between the two.
Click to expand...
Click to collapse
No. like I said. I don't/won't support installing twrp. it would require reverting a bunch of patches/ work that I've already put in... and also not using linaro GCC 7.2.1 compiler, either...
the time invested would be a complete waste for me and I would have maintain another separate branch. test another build, etc, etc'... i'm not doing it. my current goal is to reduce my branches into one single branch/build;. ... which will end up hopefully being binder_rt... not create more.
feature wise, pretty much a 'best of' what any other custom kernel offers for Marlin, all of the hardening stuff (I think I'm the only Marlin kernel on XDA with that), etc... afaict, I'm the only one rolling in EASv1.4, cpu-boost, dynamic stune boost; all of which I've ported myself... some of the audio driver stuff I personally ported (more coming) and binder_rt is my baby; I ported aosp binder and researched / Inplemented all of the changes to Binder...
in my yet-to-be-released binder builds I also have backported a large chunk of the linux locking, workqueues and scheduling code and some other bits from newer mainline linux kernels (which allow me to pull in some new features and use them).
so I'd rather work on this kind of stuff, over caring about twrp, doubling my workload to support running synthetic benchmarks between gcc's -Os vs. -O2 optimization levels...
Thanks for the new kernel. Sounds very interesting. Can't try it atm because i am on dp1 from 8.1. Hope you gonna also support 8.1 when official sources are out. For me battery life is already great on dp1.
housepabldroid said:
All those features are welcome in this poor Oreo pixel community! thanks for your work..
i'll try it as soon as possible!
Click to expand...
Click to collapse
haha. pixel community isn't too bad. there's just not a lot of custom oreo ROMs.... myself, I wouldn't want to run any of those custom roms anyway. they usually are built without odexing or proper signiture key signing = less secure and way less optimized... Stock ROM is great, just needs root and a few apps to modify / customize it a bit.
for me, the kernel has always been the issue. lol... therefore, roll my own. lol....
ya, for sure give it a try... I honestly would say binder_rt is the best build... the 'stable build' is a bit of a misnomer - all of the builds are stable, just the binder ones are running more experimental code... binder_rt blows the socks off any other Marlin kernel for certain kinds of workloads... I'm aiming fir it to become my default build...
Donric13 said:
Thanks for the new kernel. Sounds very interesting. Can't try it atm because i am on dp1 from 8.1. Hope you gonna also support 8.1 when official sources are out. For me battery life is already great on dp1.
Click to expand...
Click to collapse
yup. I have to wait until kernel sources are released. you got it!. but when they are / 8.1 is released; I will be upgrading to 8.1, so no worries - there will be an 8.1 version...
I've heard heard that battery life is pretty good on 8.1, there's a thread in the pixel forum about it... but by what they were saying, it didn't seem that much better than what I see from my kernel.....
I'm more interested to see what performance improvements are in 8.1 kernel sources... I've found stock kernel to be a bit crappy for some stuff...
well, if at some point you are bored and want to test my kernel on 8.1, go for it. ya never know: maybe it will work. the reason I say that?
IIRC - it was tested with my old kernel / sources build... could've been a bug, not present in the new one.... or something else. IdK.. being as I'm on 8.0 I can't even look into why that might be or have been...
just make sure if u do ever try it, keep the stock boot.IMG for 8.1 around, in case it doesn't work..... and report back, if it does work. lol
Gotta say super smooth. Thanks for sharing. Maybe it's just a glitch in ex kernel manager but zram "stopping..." Or nothing to worry about.
JS.zip said:
Gotta say super smooth. Thanks for sharing. Maybe it's just a glitch in ex kernel manager but zram "stopping..." Or nothing to worry about.
Click to expand...
Click to collapse
Ah yes, I should've mentioned that ~ zram is working fine - but EXKM is being denied permission to read those files on the file system - I think it's due to a change in cgroups code (from merging in EASv1.4), but I haven't gotten to the bottom of it yet....
No worries though ~ I HAVE completely verified that zram is working, mounted swapon and behaving as it should... Honestly, the defaults for zram are fine ~ if they ever weren't; you would have bigger problems on your hands, that changing swapping wouldn't help. lol
Which build are you using? (just curious)
nine7nine said:
Ah yes, I should've mentioned that ~ zram is working fine - but EXKM is being denied permission to read those files on the file system - I think it's due to a change in cgroups code (from merging in EASv1.4), but I haven't gotten to the bottom of it yet....
No worries though ~ I HAVE completely verified that zram is working, mounted swapon and behaving as it should... Honestly, the defaults for zram are fine ~ if they ever weren't; you would have bigger problems on your hands, that changing swapping wouldn't help. lol
Which build are you using? (just curious)
Click to expand...
Click to collapse
Thanks that's what I thought. The bad boy "Binder RT" lol
JS.zip said:
Thanks that's what I thought. The bad boy "Binder RT" lol
Click to expand...
Click to collapse
bad boy eh? haha.
Ya, no worries - I check that sort of stuff, when it crops in... fixing that particular issue just hasn't been a huge priority, over other stuff that I'm working on. (and because I think it's pointless that EXKM even displays it to begin with - it just gives users the false impression that they are tweaking something, that in 99.99999% of cases - is absolutely pointless to touch).
Anyhoo, cool - let me know how things are working out with the binder_rt build, as you get some more use in ~ I really want it to become my main focus / implementation. (I personally won't be going back to using any other build day to day, anyway.)
nine7nine said:
bad boy eh? haha.
Ya, no worries - I check that sort of stuff, when it crops in... fixing that particular issue just hasn't been a huge priority, over other stuff that I'm working on. (and because I think it's pointless that EXKM even displays it to begin with - it just gives users the false impression that they are tweaking something, that in 99.99999% of cases - is absolutely pointless to touch).
Anyhoo, cool - let me know how things are working out with the binder_rt build, as you get some more use in ~ I really want it to become my main focus / implementation. (I personally won't be going back to using any other build day to day, anyway.)
Click to expand...
Click to collapse
I just wanted to point out that I grabbed your stock kernel from the OP and had planned to use that to flash my stock image. However, I happened to have the latest boot.img release decompressed on my drive so I compared it to the one I had on hand.
MD5 for your Stock Image: 7A2D92981FDE96E5D60D806019ACFA0C
MD5 for Google's Stock Image: BF9EDA2888C8C6A1FCD0A7DB6E37F739 (Latest November build)
Now I don't want to sound like the suspicious type, because in reality the stock kernel you provided is just to get TWRP off the device before flashing your kernel, but I'm forced to ask why your stock image is not identical with the main stock image? Unless your stock kernel isn't from the latest release but instead from a prior month or something of that nature (It would take me quite awhile to download the other month's releases just to check so I was hoping to ask you instead)
AlkaliV2 said:
I just wanted to point out that I grabbed your stock kernel from the OP and had planned to use that to flash my stock image. However, I happened to have the latest boot.img release decompressed on my drive so I compared it to the one I had on hand.
MD5 for your Stock Image: 7A2D92981FDE96E5D60D806019ACFA0C
MD5 for Google's Stock Image: BF9EDA2888C8C6A1FCD0A7DB6E37F739 (Latest November build)
Now I don't want to sound like the suspicious type, because in reality the stock kernel you provided is just to get TWRP off the device before flashing your kernel, but I'm forced to ask why your stock image is not identical with the main stock image? Unless your stock kernel isn't from the latest release but instead from a prior month or something of that nature (It would take me quite awhile to download the other month's releases just to check so I was hoping to ask you instead)
Click to expand...
Click to collapse
Easy explanation - I'm on Sailfish, you aren't; so the md5 wouldn't match...
I can do one of two things; you can post a upload/link to your boot.img and I will replace the link for Marlin's nov boot.img (adding it to my github) OR I will remove the link from the post and Marlin users will have to fend for themselves. (have to download 1.8GB firmware themselves for a boot.img... Obviously i'm NOT downloading your guys Nov Firmware images).
nothing suspicious at all here, dude.
EDIT: I've removed the link to the sailfish Nov boot.img, as a sign of good faith; I can replace it with the Marlin Nov boot.img - but that will require you to post a download/link to me, so I can add it in. thx
nine7nine said:
Easy explanation - I'm on Sailfish, you aren't; so the md5 wouldn't match...
I can do one of two things; you can post a upload/link to your boot.img and I will replace the link for Marlin's nov boot.img (adding it to my github) OR I will remove the link from the post and Marlin users will have to fend for themselves. (have to download 1.8GB firmware themselves for a boot.img... Obviously i'm NOT downloading your guys Nov Firmware images).
nothing suspicious at all here, dude.
EDIT: I've removed the link to the sailfish Nov boot.img, as a sign of good faith; I can replace it with the Marlin Nov boot.img - but that will require you to post a downlink to me, so I can add it in. thx
Click to expand...
Click to collapse
No problem, I download every Marlin release so I'll just update my AFH folder to include the monthly kernel release and users can download it from there. You can either link to my folder or download from it to add to your repository; either one is fine with me Thanks, and I do appreciate what you're doing but I have a 'verify first' stance since these devices are a big part of people's lives. I'm going to give your kernel a spin now, I appreciate you getting back to me so quickly. If only AFH was this fast, I just spent 25 minutes trying to get it to create an empty folder...
Link to Marlin Stock Images: https://www.androidfilehost.com/?w=files&flid=231142
Edit: I attempted to flash the "exNoShadez_eas-3.18.83_Binder_b0b66e0.zip" from the fastboot installed version of TWRP after flashing the stock boot to slot_a and slot_b, but it is failing with an error that states, "New image larger than boot partition. Aborting..." Then updater process Error 1. Any idea what would cause that?
AlkaliV2 said:
Edit: I attempted to flash the "exNoShadez_eas-3.18.83_Binder_b0b66e0.zip" from the fastboot installed version of TWRP after flashing the stock boot to slot_a and slot_b, but it is failing with an error that states, "New image larger than boot partition. Aborting..." Then updater process Error 1. Any idea what would cause that?
Click to expand...
Click to collapse
Hey, I added your nov boot.img to the OP. put it on github to save a few clicks for people.
The error you are seeing would suggest that TWRP is installed to the system. That is the only time anyone has ever bumped into that message. So, I'm not sure what's going on with your end but it would seem you have twrp actually installed...?!
the TWRP that you are supposed to use, is this one;
https://dl.twrp.me/marlin/twrp-3.1.1-1-fastboot-marlin.img
that loads and runs from RAM. twrp can't be "installed from fastboot" ~ it installs to the boot partition; leaving not enough room for the kernel.
nine7nine said:
Hey, I added your nov boot.img to the OP. put it on github to save a few clicks for people.
The error you are seeing would suggest that TWRP is installed to the system. That is the only time anyone has ever bumped into that message. So, I'm not sure what's going on with your end but it would seem you have twrp actually installed...?!
the TWRP that you are supposed to use, is this one;
https://dl.twrp.me/marlin/twrp-3.1.1-1-fastboot-marlin.img
that loads and runs from RAM. twrp can't be "installed from fastboot" ~ it installs to the boot partition; leaving not enough room for the kernel.
Click to expand...
Click to collapse
Yeah, that actually explains it. I was using a kernel with TWRP installed last go round and now it seems just flashing the factory boot.img is not getting rid of the installed TWRP. I'll figure out how to get TWRP removed for good this time; thank you for letting me know where to look.
AlkaliV2 said:
Yeah, that actually explains it. I was using a kernel with TWRP installed last go round and now it seems just flashing the factory boot.img is not getting rid of the installed TWRP. I'll figure out how to get TWRP removed for good this time; thank you for letting me know where to look.
Click to expand...
Click to collapse
Yup. TWRP can't be installed along side. Running it from RAM has to be used. ie: I don't support TWRP installations. lol
Flashing the factory boot.img DOES get rid of TWRP for good ~ you just have to make sure to use the TWRP fastboot boot.img for flashing my kernel after (since fastboot/twrp doesn't install to the boot partition)...
I've added a link to the OP to Marlin's twrp fastboot boot.img....
I also updated all of the download links and double-checked to make sure that all of the Marlin zips are packed properly with AnyKernel2 + relabelling every file on my github (by re-packing all of them all... This is mostly just paranoia on my part - but now that I'm supporting 2 devices, best to make sure that nothing gets tangled together.)
@everyone
just a few notes, since you guys are just getting exposure to my kernel, the way I do things; in regards to development, etc.
-> I post test builds (this usually happens when I make big changes.). reports are helpful on these builds.
-> Development happens fast; *I routinely add new features, bug fixes, etc and i'm almost always ahead on LTS updates over the Stock kernel.
examples;
=> lts -3.18.83 build available on the day of release
=> my Binder_rt branch is currently 140+ commits (code changes) ahead of the the other branches.
(changes since in the current downloads/releases)
=> There are a number of bug fixes, a few added features (mostly in-kernel stuff), some optimizations *and* there are massive upgrades to parts of the kernel's subsystems. (100+ commits are related to that)...
(changes since the current downloads/releases)
NOTE: The binder Branch (non-rt) will see the majority of the above changes code, but the Stable branch will only see a subset of these commits + bug fixes.
I probably won't roll out a test build for Binder_rt builds, until I've had the newest code running for a couple of days.... At that point, once things have proven to be stable good ~ i'll roll out a test build for anyone who wants to help out and dogfood test builds....
Then, I will push back changes back into the Binder builds, Stable, etc... I usually try and line up actual releases to LTS and/or => more importantly monthly android security / firmware updates....
**So the gist is; there will be frequent updates. Update as you see fit - anyone who wants to help out - run test builds and report back issues.
So pending a detail or two, I likely will be phasing out my other builds in favor of the Binder_rt build.
- I've had quite a lot of feedback via the Pixel forum, PMs and email (and a couple of friends using it too).
- The Binder_rt build seems to be very stable for everyone.... not too mention just all around better.
- there seem to be no drawbacks and quite a few benefits to that build over the others.
The one thing I'm waiting on is; I've joined the Android Kernel Developers Google Group and am currently waiting to see if I can't get some help with porting a missing Kernel function into Marlin's sources ~ this particular kernel function is what's stopping me from having Binder be sync'd with the AOSP binder implementation.... I'm hoping to resolve this sooner than later, at which point I will be able to merge in those commits (and test them).
In the meantime I'm working on a few backports to the audio driver and a few other bits (taken from Wahoo/Pixel 2 kernel sources). I've also pulled in a few fixes to binder from Wahoo, as well....
So I might post a test build for Binder_rt tomorrow - as it's accumulated a number of changes, bug fixes, etc.... I'm not sure If I will have any resolution to the missing kernel function - but that doesn't affect pushing a test build....

Asus Zenwatch 2 (Sparrow) - How to get rebuilt kernel work (need framebuffer console)

Hello XDA developers,
First of all my motivation to write here is to create a commandline GNU/Linux-like UI (and maybe add desktop GUI later) on the Asus Zenwatch 2, so I could see the kernel messages at bootup and use Midnight Commander without starting the entire main system (for example, get a text-mode shell and stop after every devices got initialized, firmwares got loaded, but before loading any Surfaceflinger and Dalvik stuff). I did similar thing on an Android tablet before by writing my own keyboard and touchscreen handlers based on Yaft. But that didn't help with boot-time kernel messages and the built-in framebuffer console in the kernel is probably much better. It's not enabled in the stock kernel, so I tried to recompile the Sparrow kernel from source (I didn't modify the default configs yet). After some tweaks to the kernel-source (which doesn't compile without them) I could build the Momentum-kernel and the stock Sparrow-kernel too using the provided .config files (e.g: make sparrow_defconfig). I used Android NDK's r13b gcc on Lubuntu 18.04, because an earlier attempt with NDK r18b wanted to use clang and compilation stopped early with errors.
My problem is that despite the kernel finally got compiled it doesn't seem to start at all. (I had similar experience with the Android-kernel in the past, but more success with Raspberry PI)...
I used mkbootimg to repack the generated zImage-dtb and the previously decompressed initrd into a boot.img, and ran fastboot boot on it, but booting simply stucked at fastboot screen, the animated ASUS logo never came in.
Can anyone point me into the right direction how I could troubleshoot further why the kernel doesn't work?
(I assume the 4.9 gcc isn't the issue here, though I got a zImage with slightly different filesize. I've read somewhere the earlier 14.04 Ubuntu and 4.8 gcc is advised for Sparrow kernel compilation but do these versions matter here? Should I replace the modules too on the system partition with their newly built versions, as the zImage changed?)
I know others managed to build a working kernel, for example TWRP has its own custom kernel and it works fine on the Sparrow watch... Is there any step I might have missed? Is there a debug-tool or logging which helps me to find out why the kernel doesn't boot? Something to troubleshoot the kernel-loading and booting? (A simulator for example? Or how do the experts do it in practice?)
I hope I declared every aspects to get some help. If for some reason I don't succeed I might try to make more linux-like AsteroidOS or PostmarketOS to get my complete Linux console on the smartwatch. The thing is that these don't support all hardware on the watch, that's why I'm trying with Android in the first place.
I guess if I'll be able to compile and then run the stock original kernel somehow the rest will be easy. (To enable framebuffer-console, set governors, remove unnecessary drivers, etc.)
Thanks in advance for the help, XDA gurus...

Question Trying to build the kernel

I've not built a kernel since my Samsung Galaxy Nexus, so bear with me. I'm trying to learn and see if I can't be of some service somehow.
So I've forked the repository for the kernel source from here, to my Github HERE. After working through learning more than I though I would about gcc and clang toolchains, I attempted to build the kernel. Turns out, I think the kernel is missing at least one folder.
Code:
techpack/oneplus/Makefile:58: "techpack LINUXINCLUDE " -I./arch/arm64/include -I./arch/arm64/include/generated -I./include -I./arch/arm64/include/uapi -I./arch/arm64/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -I./techpack/oneplus/include -I./techpack/oneplus/overlay -include ./techpack/oneplus/config/oneplus.h -include ./techpack/oneplus/config/coretech.h -include ./techpack/oneplus/config/oneplus.h -I./techpack/oneplus/include
scripts/Makefile.clean:15: techpack/oneplus/power/Makefile: No such file or directory
When I look in the source code, I see that the techpack/oneplus/power folder is not there, so it would not be able to be made.
Any ideas on how to get it, or if I could bring it from a different oneplus device?
The main idea was to work on some governors and IO Schedulers, but mainly to see if we could disable dm-verity for the TWRP build. Honestly, I don't know how people get into this anymore. Every time I go to build, I get errors such as above, or I try to Make Clean, and I end up with errors that it can't clean. I'll take direction as to where I can go to learn, without attending University.
I think you can flash magisk to disable dm verity. You might be able to manually strip out avb from a boot.img as well (I'm sure guides are somewhere in xda).
Why would you wanna do this for TWRP though?
As for the actual kernel building, I just think OnePlus hasn't shipped out the complete sources, it has happened before. I am no expert though so might be wrong.

Categories

Resources