Asus Zenwatch 2 (Sparrow) - How to get rebuilt kernel work (need framebuffer console) - Android Q&A, Help & Troubleshooting

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...

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

[Q] Debugging Android kernel over phone

I am new to this forum, and I expect I posted on the correct forum (I cannot post on the development related forums).
I am new to Android and to Kernel development, but I would like to test some things. I just finished compiling the first version of my modified kernel, and put it in a phone. Obviously, it doesn't work. How can I debug the kernel on the mobile phone?
I'm working over a Nexus 5 (MSM architecture, Linux 3.4.0 based). The .config used is the one by default (hammerhead_defconfig). When the kernel is booted, it only shows the Google screen, and stops there, forever.
I tried (with a working boot image) changing the 'console' parameter when generating the image with mkbootimg (tty, tty0, ttyHSL0), and I tried with different .config options as MSM_SERIAL_DEBUGGER (compilation error), FIQ_DEBUGGER (compilation error) and SERIAL_MSM (compiled, but no difference, no new devices in /dev on my computer). I tried with kgdb, following this, but I could not make the patches work for my architecture. Any idea?

TP-LINK WN722N (ath9k driver) install on Ubuntu touch 15.04 (Nexus 10- Manta)

I've been through all the relevant threads on AskUbuntu and they are either outdated, conflicting and/or dont work.
My Nexus10 sees the atheros AR9271 device on Bus 001 USB but does not create an additional WLAN for it.(wlan0 is the normal integrated wifi) I assume I need the ath9k or ath9k_htc driver? I installed backports 4.4.2-1 and unzipped it. If I try to do a 'make' or 'make clean' I get:'your kernel headers are incomplete/not installed'. I've already got the latest version of build-essential. If I try to install 'firmware-atheros', it cannot find the package. I've been through several other things to no avail.
I've read the driver is installed with 15.x+ anyway, true? and if so how to install it? If someone could do a step-by-step wifi driver install for a U-touch or at least Ubuntu 15.x I'd be very very grateful.
I do not want to bridge the 722n, I want to use it instead of the integrated card. Not even there yet, but just in case it matters.
Thanks!
roninisc said:
I've been through all the relevant threads on AskUbuntu and they are either outdated, conflicting and/or dont work.
My Nexus10 sees the atheros AR9271 device on Bus 001 USB but does not create an additional WLAN for it.(wlan0 is the normal integrated wifi) I assume I need the ath9k or ath9k_htc driver? I installed backports 4.4.2-1 and unzipped it. If I try to do a 'make' or 'make clean' I get:'your kernel headers are incomplete/not installed'. I've already got the latest version of build-essential. If I try to install 'firmware-atheros', it cannot find the package. I've been through several other things to no avail.
I've read the driver is installed with 15.x+ anyway, true? and if so how to install it? If someone could do a step-by-step wifi driver install for a U-touch or at least Ubuntu 15.x I'd be very very grateful.
I do not want to bridge the 722n, I want to use it instead of the integrated card. Not even there yet, but just in case it matters.
Thanks!
Click to expand...
Click to collapse
anyone anyone, Beuller...
Hey, saw this was unanswered and figured I could help. First off, you will not be able to compile or install headers in the Ubuntu Touch system, as /lib/modules/<kernel version> is a bind-mount into the read-only LXC system image, one way to work around this issue on device is to mount the LXC container's system image read-write somewhere, move out the lib/modules directory to someplace else, umount, reboot and then link your moved lib/modules back into /lib/modules. You will need to do this compilation outside of your Nexus 10 in a cross-compilation environment or in an armhf chroot (imho, a chroot running the ARM build of Ubuntu works very well for this).
Once you have that, you can install the kernel package for your device (which I believe are labeled linux-headers-manta and linux-image-manta respectively) and build the driver you seek. However the kernel already comes with backports 4.4.2 in it's tree, so you may be able to apt-get source linux-image-manta and build the driver and/or the kernel itself if you wish. (I believe building the kernel builds the firmware needed for the drivers as well, but I have no way of knowing as I haven't actually rebuilt any drivers with firmware yet in my foray into linux-image-flo's source.)
One piece of advice: Make sure to join together the config.*.ubuntu files under the debian.flo and debian.master folders to get the working .config for your device. The defconfig from arch/arm/configs doesn't have all the needed options for uTouch and won't boot it.
Your 'thanks meter' improved, and big thanks for answering, but this is beyond my level. Was hoping I could run an external wifi stick on a tablet with some flavor of linux, but looks like a no go for mortal users.
roninisc said:
Your 'thanks meter' improved, and big thanks for answering, but this is beyond my level. Was hoping I could run an external wifi stick on a tablet with some flavor of linux, but looks like a no go for mortal users.
Click to expand...
Click to collapse
Sadly at this time, it definitely seems to be. The normal linux way of building drivers doesn't work on here because the modules directory (/lib/modules/3.4.0-5-flo) is read-only, also due to this kernel headers cannot be installed, this can be worked around, but it is definitely not something that the casual user can do easily. I hope this will change so I could start compiling modules and NOT need to rebuild the entire kernel for it.
Glad I could be of help and I love answering questions, I am currently using Ubuntu Touch as my main OS on my Nexus 7 as I'm trying to make it into my own portable workstation. So I'm constantly digging into the system and learning what I can, and I love to share.

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.

Question Instructions for compiling android 10 based twrp 3.5.2. Want to collaborate?

Hi everyone
I've been working on getting twrp to boot on our borneo device for a week or so, borrowed I the device tree made by mistersmee for the g9 power since the two devices are almost completely the same
https://github.com/TeamWin/android_device_motorola_cebu
heres where I'm at:
https://github.com/touchpro/twrp_device_motorola_borneo
The only thing I cant seem to get working is the touchscreen. I realize others have tried before me already and had the same non working touchscreen, I believe the majority of us have an Ilitek touchscreen while others have focaltech or nova. I got the driver framework up and recognizing it exists from dmesg output but cant seem to get any actual touch input to register. You can look at my changes to android 11 twrp in the github above by selecting branch twrp-android-11 and using a diff program. I use meld in ubuntu.
if you want to build for yourself and help out: (i'd use ubuntu 20.04, i tried 20.10 first but one of the packages is too new and doesnt like the toolchain)
follow the instructions here to set up your build environment
mkdir twrp (you can name this whatever you want)
cd twrp
repo init --depth=1 -u git://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git -b twrp-10.0
repo sync
add the device tree above to twrp/device/motorola/borneo
also add this to device in twrp/device/qcom/twrp-common
make your changes inside device/motorola/borneo then
. build/envsetup.sh
export LC_ALL=C
lunch omni_borneo-eng
mka -jx clobber && mka -jx recoveryimage (-jx is number of cores you have, i have quad core i7 with hyperthreading so i use -j8. personal preference really)
your completed build will be in twrp/out/target/product/borneo as recovery.img
reboot to fastboot (adb reboot bootloader) and type
fastboot boot recovery.img
see if your changes worked! look forward to seeing what you guys can do
mine for later
Have not had the time to toss together a build environment for this, since I'd have set up the entire OS and beyond for that task, since my only Linux is Garuda in a much too small VM that is nowhere near right for that., been only hacking my way through it with Android Image Kitchen in Windows and some other utilities to get touch support in my 3.5.2.10-0 cebu source image.
It works perfectly if booted into TWRP just takes about 30-seconds before touch enables itself fully, but not when flashed (fastboot or applied internally via DD, or using a modified TWRP zip via Magisk that has had my ramdisk swapped into it).
When flashed, touch simply will not function, so something is obviously not being carried over properly so when being loaded from the recovery partition it seems, despite it being the exact same ramdisk (I extracted the recovery img, pulled out my ramdisk, popped it back into a whole new image, booted it and it had touch, so I know it's supposed to have the data there but likely needs a full from the ground up build of TWRP to behave on flashed installs.
@whoshotjr2006, had any more luck with your building of it? I can test or anything you may need in your own efforts, but just have no time for the actual building of it to tinker.
Oh, and thought you should know this works if you were wanting to go RW for System, but you'll have to use Linux due to falling prey to Error 73 https://forum.xda-developers.com/t/script-android-10-universal-mount-system-r-w-read-write.4247311/. I put mine back because it didn't seem to behave quite right there, but could be useful in your own tinkering.
OK, got it where it is fully flashable and bootable with touch for mine. Used Android Image Kitchen, unpacked TWRP image that boots with touch working, copied out the kernel and ramdisk from split_img folder, extracted stock recovery, replaced those 2 items with properly renamed versions and then repacked it with --original argument, and then it boots and flashes properly. Just a quick hack on it, but functional for those that need it.
This should be easy to combine in your /vendor/lib/modules from your own, as well as /vendor/firmware as long as you're rooted to pull it, into your TWRP ramdisk before putting it into the stock recovery this way. So you can get fully functioning touch for any display type in use.
whoshotjr2006 said:
Hi everyone
I've been working on getting twrp to boot on our borneo device for a week or so, borrowed I the device tree made by mistersmee for the g9 power since the two devices are almost completely the same
https://github.com/TeamWin/android_device_motorola_cebu
heres where I'm at:
https://github.com/touchpro/twrp_device_motorola_borneo
The only thing I cant seem to get working is the touchscreen. I realize others have tried before me already and had the same non working touchscreen, I believe the majority of us have an Ilitek touchscreen while others have focaltech or nova. I got the driver framework up and recognizing it exists from dmesg output but cant seem to get any actual touch input to register. You can look at my changes to android 11 twrp in the github above by selecting branch twrp-android-11 and using a diff program. I use meld in ubuntu.
if you want to build for yourself and help out: (i'd use ubuntu 20.04, i tried 20.10 first but one of the packages is too new and doesnt like the toolchain)
follow the instructions here to set up your build environment
mkdir twrp (you can name this whatever you want)
cd twrp
repo init --depth=1 -u git://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git -b twrp-10.0
repo sync
add the device tree above to twrp/device/motorola/borneo
also add this to device in twrp/device/qcom/twrp-common
make your changes inside device/motorola/borneo then
. build/envsetup.sh
export LC_ALL=C
lunch omni_borneo-eng
mka -jx clobber && mka -jx recoveryimage (-jx is number of cores you have, i have quad core i7 with hyperthreading so i use -j8. personal preference really)
your completed build will be in twrp/out/target/product/borneo as recovery.img
reboot to fastboot (adb reboot bootloader) and type
fastboot boot recovery.img
see if your changes worked! look forward to seeing what you guys can do
Click to expand...
Click to collapse
finally having time to try to build an environment. Making a generic VM and will post it when done and easy to use, but running into some issues in my getting it to a point to test its success even. The steps you provided, missed a needed command "sudo ln -s /usr/bin/python3 /usr/bin/python" if using the 20.04 Ubuntu. But then how do you "add the device tree" as you put it? I'm normally a repacker to get things working, versus building things. I'm sure downloading the zip of the code and loading it into those folders is bound to break something as it always does when it comes to using links and ramdisks.
Perhaps you can provide more clear instructions of what you mean by that and I could finally gladly be able to contribute to this as more than a hackish throw-together process, since the description you provided "add the device tree" yields no meaningful results for any process for that to be pieced together from other builders.
git clone -b main https://github.com/touchpro/twrp_device_motorola_borneo.git
or you can just download the zip from my github, the only time it breaks symlinks so far that i know of is when you download a kernel in a zip file instead of git cloning it
take the twrp_device_motorola_borneo files and put them in /device/motorola/borneo and you should be good to go
whoshotjr2006 said:
repo init --depth=1 -u git://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git -b twrp-10.0
Click to expand...
Click to collapse
That won't work, as it doesn't seem to have a twrp-10.0 as it looks to be depreciated, https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni/tree/twrp-10.0-deprecated. How'd you get yours, or did you mean 9.0?
repo init --depth=1 -u git://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git -b twrp-10.0-deprecated
Twrp has always been built in an omnirom build environment but with a11 they switched to being built in an aosp environment. Twrp-10.0-deprecated they recently renamed to add the deprecated tag on but thats the one for android 10 that I initially used
Got my build environment set up and can upload the image in a bit if anyone wants it. @whoshotjr2006
using your steps it builds, but even having modified the firmware and modules to include the changes I put into mine to have it have touch support, it still will not. But the hacked android image kitchen one works just fine, which makes absolutely no sense when there are no errors, only warnings reported, but even those all look to be minor type casting of variables that I've noticed.
remind me again where you found that twrp that youve used android image kitchen on? was it from moto g9 power or another device? if you can let me know ill look through device trees and see what they have that we dont
seems like maybe its not insmod'ing the .ko file for your touchscreen, or it is and your touchscreen needs a firmware check/update at load. you'll have to remind me again which touchscreen you have (sorry its been a minute i've been busy) and we can look through other's device trees at the firmware loading portion
whoshotjr2006 said:
remind me again where you found that twrp that youve used android image kitchen on? was it from moto g9 power or another device? if you can let me know ill look through device trees and see what they have that we dont
seems like maybe its not insmod'ing the .ko file for your touchscreen, or it is and your touchscreen needs a firmware check/update at load. you'll have to remind me again which touchscreen you have (sorry its been a minute i've been busy) and we can look through other's device trees at the firmware loading portion
Click to expand...
Click to collapse
Source I used in AIK was cebu's 3.5.2.10-0 from https://twrp.me/motorola/motorolamotog9power.html. used AIK to unpack it.
To get touch using my quick hack, I just dropped in my matching .bin's from /vendor/firmware plus my ilitek_fw.bin to go with their novatech*.bin's and NT36xxx_MP_Setting_Criteria_601E.csv in place of their NT36xxx_MP_Setting_Criteria_6026.csv (deleted theirs).
Then also popped in my /vendor/lib/modules (minus audio ones).
At that point in tinkering it boots with touch. But fails to keep touch on booting into recovery.
Then I stumbled upon some obscure guidance about something in the kernel in recovery not initializing the touch on some devices and potentially being able to hex edit it after manually extracting the kernel using a hex editor. And then unpacked my booting version again, saw the kernel already separated out and pulled that and my ramdisk from split_image folder. cleaned up. unpacked the stock recovery. replaced with appropriately named kernel and ramdisk files and used the repack --original. Flashed it and it booted with perfect touch, just takes about 30-seconds on start before it's responsive. I have mine encrypted still so must input a passcode and just tap on the log button a few times till I know it's working then input my code and off it goes working normally.
Should not have anything too crazy different. I think the only thing I did was delete the etc file from the cebu, replacing it with an etc folder with a recovery.fstab and twrp.fstab I had scavenged from @svoc 's 3.4.0.0 (https://forum.xda-developers.com/t/working-twrp-but-very-unofficial-but-very-useful.4313665/ of which touch did not work for me, but it booted perfectly enough to extract my firmware and lib modules initially to put into my 3.5.2.10-0). Since every time I'd use Android Image kitchen to extract the cebu image it complained about things in /etc, and that was the only difference I could find between 3.5.2.10-0 and the 3.4.0.0. That is the only potential thing I did that could be of unknown consequence.
whoshotjr2006 said:
(sorry its been a minute i've been busy)
Click to expand...
Click to collapse
And never be sorry, you're helping out here, we understand, just like if you're waiting on a response back, that you're as understanding too
Compiled, touch working when booting it. Only change I made was to add my files as I outlined before, but into the firmware and lib folders respectively, but also edited the load_ts_firmware.sh to ensure nova and chiptone are no longer commented out. Flashed and has touch fully working as well. So it should be an easy build if I can get it working.
Edit: And touch does not take 30+ seconds per the 3.4.0.0 @svoc version I believe because it's not re-flashing the display code. So that could be why some perm lose touch, and I just got VERY lucky with mine to not.
Yes you are right all I did was put the touch screen driver in the twrp and send it to you that is why it takes less then 30 secs to do no need to recomile it each time just add your files in it and rezip it

Categories

Resources