[HELP] Porting Ubuntu Touch to Redmi Note 2 - Redmi Note 2 Q&A, Help & Troubleshooting

I'm learning how to port Ubuntu Touch to this device, but I'm not sure what files I need of Android to can do it.
Porting guide:
https://developer.ubuntu.com/en/phone/devices/porting-new-device/
Kernel, device & vendor by Nofearnohappy:
https://github.com/nofearnohappy/kernel_6.0_hermes
https://github.com/nofearnohappy/android_device_xiaomi_hermes
https://github.com/nofearnohappy/android_vendor_xiaomi_hermes
I'm stuck in this:
Enabling a new device
If you're repository is compatible with the AOSP tree, it's just a matter of adding the device specific git repositories and the vendor files (usually blobs that you need to extract from the original android image). Once that is done, you should be able build a small android system image that can be used by Ubuntu Touch in order to make it fully compatible with the device.
Device
Add your device specific git repositories under phablet/device ("phablet" is the repository you cloned by following the previous build example and/or Touch/Building).
Make sure it's respecting the format used by AOSP (device/<vendor>/<device name>).
Hardware
Add your hardware specifig git repositories under phablet/hardware.
Make sure it's respecting the format used by AOSP (hardware/<vendor>/<component>). As an example:
Code:
$ ls hardware/qcom/audio/
Android.mk hal legacy visualizer voice_processing
Vendor
Add your vendor specific binary blobs under phablet/vendor.
Make sure it's respecting the format used by AOSP (hardware/<vendor>/<component>).
Code:
$ ls vendor/asus/flo/
BoardConfigPartial.mk BoardConfigVendor.mk device-partial.mk device-vendor.mk proprietary
Retrieving the proprietary blobs from Android
Ubuntu Touch Preview uses some pre-compiled binary drivers from the Android layer for rapid enablement of devices. These are referred to as binary or proprietary blobs, as their source code is not available for the build, and are included in binary form.
Since we use AOSP as a base, for supported devices all you need to do is to download and extract and run as mentioned in the downloads from https://developers.google.com/android/nexus/drivers
Click to expand...
Click to collapse
Any help apreciated.

Related

[Q] Android .mk makefiles, prebuilt tools, NDK roles

Hello,
I actually have successfully build some kernels. Mainly, this is the linux way:
- get kernel sources
- get hardware specific changes
- get the toolchain -> i'm using google prebuilt tree, with ARM tool chain 4.4.3 already compiled
- build with usual steps: def_config, configure, kernel, modules
All is ok.
Now, i found Android.mk files. Precisely, a previous kernel, with sensors related to my device, that i would like to port.
But here comes the trouble. I have hard time to do the link between Linux kernel for ARM and Android makefile. I don't see how it goes with my kernel, how i could compile this using the prebuilt tools i could grab from Google.
In short, how to include .mk files into a classic kernel ? What should i get in the end ? A module ? A replacement binary ? More precisely, what is exactly NDK and where it stands in the above layers ?
ARM Linux Kernel <--> Dalvik JVM <--> APK
Last, is it possible with Google prebuilt to compile the .mk without referencing your kernel ?
Thank you !
Thank you for your help
Damn ! Either the questions is too obvious, either it is too complex. Any help ?
Self reply: downloading the NDK is mandatory
- you can use your favorite toolchain, provided with the NDK
- you can embed the .mk into your application, for Eclipse / Android studio, it will use the NDK to compile

Help! Trying to port for Lg P710

Hello!
I am trying to port some Custom ROM to my Lg P710 (Lg L7 II). Since the bootloader got unlocked and now i have CWM i decided to start to port a custom rom. I read some tutorials and i understood the basics but how can i get the stock rom from Lg. I downloaded the Kdz file and tried to build from source but i am stuck here. I don't know what i shall do. When i build from source i get a really small output like e 30 MB output. Can someone help me clarify this please?
Lg Instructions for building android and kernel:
1. Android build
- Download original android source code ( Jelly Bean 4.1 ) from http://source.android.com
- Unzip opensource packages of P710(Optimus L7 II)_Android_JB_P710V10h_EUR.zip into downloaded android source directory
- And, merge the source into the android source code(Jelly Bean)
- Run following scripts to build android
a) source build/envsetup.sh
b) choosecombo
c) make -j4
- When you compile the android source code, you have to add google original prebuilt source(toolchain)
into the android folder
( add prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin to PATH )
- After build, you can find output at out/target/product/generic
2. Kernel Build
- Unzip using following command at the android folder
- When you compile the kernel source code, you have to add google original prebuilt source(toolchain)
into the android folder.
- cd kernel
- export ARCH=arm
- export TARGET_PRODUCT=vee7e_open_eu
- export CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
- make vee7-rev_10_defconfig
- make zImage
3. After Build, You Can find the build image at arch/arm/boot.
christi9503 said:
Hello!
I am trying to port some Custom ROM to my Lg P710 (Lg L7 II). Since the bootloader got unlocked and now i have CWM i decided to start to port a custom rom. I read some tutorials and i understood the basics but how can i get the stock rom from Lg. I downloaded the Kdz file and tried to build from source but i am stuck here. I don't know what i shall do. When i build from source i get a really small output like e 30 MB output. Can someone help me clarify this please?
Lg Instructions for building android and kernel:
1. Android build
- Download original android source code ( Jelly Bean 4.1 ) from http://source.android.com
- Unzip opensource packages of P710(Optimus L7 II)_Android_JB_P710V10h_EUR.zip into downloaded android source directory
- And, merge the source into the android source code(Jelly Bean)
- Run following scripts to build android
a) source build/envsetup.sh
b) choosecombo
c) make -j4
- When you compile the android source code, you have to add google original prebuilt source(toolchain)
into the android folder
( add prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin to PATH )
- After build, you can find output at out/target/product/generic
2. Kernel Build
- Unzip using following command at the android folder
- When you compile the kernel source code, you have to add google original prebuilt source(toolchain)
into the android folder.
- cd kernel
- export ARCH=arm
- export TARGET_PRODUCT=vee7e_open_eu
- export CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
- make vee7-rev_10_defconfig
- make zImage
3. After Build, You Can find the build image at arch/arm/boot.
Click to expand...
Click to collapse
Please help!
christi9503 said:
Hello!
I am trying to port some Custom ROM to my Lg P710 (Lg L7 II). Since the bootloader got unlocked and now i have CWM i decided to start to port a custom rom. I read some tutorials and i understood the basics but how can i get the stock rom from Lg. I downloaded the Kdz file and tried to build from source but i am stuck here. I don't know what i shall do. When i build from source i get a really small output like e 30 MB output. Can someone help me clarify this please?
Lg Instructions for building android and kernel:
1. Android build
- Download original android source code ( Jelly Bean 4.1 ) from http://source.android.com
- Unzip opensource packages of P710(Optimus L7 II)_Android_JB_P710V10h_EUR.zip into downloaded android source directory
- And, merge the source into the android source code(Jelly Bean)
- Run following scripts to build android
a) source build/envsetup.sh
b) choosecombo
c) make -j4
- When you compile the android source code, you have to add google original prebuilt source(toolchain)
into the android folder
( add prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin to PATH )
- After build, you can find output at out/target/product/generic
2. Kernel Build
- Unzip using following command at the android folder
- When you compile the kernel source code, you have to add google original prebuilt source(toolchain)
into the android folder.
- cd kernel
- export ARCH=arm
- export TARGET_PRODUCT=vee7e_open_eu
- export CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
- make vee7-rev_10_defconfig
- make zImage
3. After Build, You Can find the build image at arch/arm/boot.
Click to expand...
Click to collapse
One question. You have the bootloader unlock? you as unlock the bootloader? Sorry for my bad English and greetings from Mexico.
Enviado desde mi LG-P714 mediante Tapatalk
neutrondev said:
Hello!
I am trying to port some Custom ROM to my Lg P710 (Lg L7 II). Since the bootloader got unlocked and now i have CWM i decided to start to port a custom rom. I read some tutorials and i understood the basics but how can i get the stock rom from Lg. I downloaded the Kdz file and tried to build from source but i am stuck here. I don't know what i shall do. When i build from source i get a really small output like e 30 MB output. Can someone help me clarify this please?
Lg Instructions for building android and kernel:
1. Android build
- Download original android source code ( Jelly Bean 4.1 ) from http://source.android.com
- Unzip opensource packages of P710(Optimus L7 II)_Android_JB_P710V10h_EUR.zip into downloaded android source directory
- And, merge the source into the android source code(Jelly Bean)
- Run following scripts to build android
a) source build/envsetup.sh
b) choosecombo
c) make -j4
- When you compile the android source code, you have to add google original prebuilt source(toolchain)
into the android folder
( add prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin to PATH )
- After build, you can find output at out/target/product/generic
2. Kernel Build
- Unzip using following command at the android folder
- When you compile the kernel source code, you have to add google original prebuilt source(toolchain)
into the android folder.
- cd kernel
- export ARCH=arm
- export TARGET_PRODUCT=vee7e_open_eu
- export CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
- make vee7-rev_10_defconfig
- make zImage
3. After Build, You Can find the build image at arch/arm/boot.
Click to expand...
Click to collapse
Which Rom are u BUILDING?
All guides are here -> http://forum.xda-developers.com/showthread.php?t=2073370

[Q] Error when running brunch command

So, I'm attempting to build my first ROM from source, but when I run the breakfast command, I get this displayed:
Code:
[email protected]:~$ cd /home/admin2/source/
[email protected]:~/source$ . build/envsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including sdk/bash_completion/adb.bash
[email protected]:~/source$ breakfast victara
build/core/product_config.mk:222: *** Can not locate config makefile for product "omni_victara". Stop.
WARNING: Trying to fetch a device that's already there
build/core/product_config.mk:222: *** Can not locate config makefile for product "omni_victara". Stop.
** Don't have a product spec for: 'omni_victara'
** Do you have the right repo manifest?
[email protected]:~/source$
I've ran the brunch command as well and no luck. Anyone think they know the problem? Anything else I could provide to help you solve this? Any help is appreciated. Thanks in advance!
It is because the ROM has not officially been built for your device, hence no sources defining your device are present in it.
This means you will have to add device specific tree yourself and port out the ROM yourself.
This means you will be *porting instead of *building (in rough words). I suggest you try building some other ROM instead which is available for your device.
Jaskaranbir Singh said:
It is because the ROM has not officially been built for your device, hence no sources defining your device are present in it.
This means you will have to add device specific tree yourself and port out the ROM yourself.
This means you will be *porting instead of *building (in rough words). I suggest you try building some other ROM instead which is available for your device.
Click to expand...
Click to collapse
I don't see the need to build a ROM that is already available for my device. Any pointers you could provide to adding a victara device tree?
FooBazza said:
I don't see the need to build a ROM that is already available for my device. Any pointers you could provide to adding a victara device tree?
Click to expand...
Click to collapse
I am not telling you to build an already available ROM because its easy, I am telling you to do so because you will then know how the build system (embedded android in other words) works. Porting out isnt easy, you are going to be getting a lot of dependency errors even after settings up device tree. Kernel may not be compatible, so with recovery. It may need additional flags.... a lot of stuff.
And for porting, it is necessary that you know the basic things: Location of most common and most used makefiles, knowledge of toolchains and kernels, adding device name to workflow etc.
Still, if you wanna try, first download the device tree from Cyanogenmod (you can use this tree as reference for porting): https://github.com/CyanogenMod/android_device_motorola_victara
Just clone it out in a folder "devices" in your source tree's root directory.
Then get the kernel sources.
Then you will have to get a kernel which is compatible with the ROM you are building (unfortunately, I dont have an info on that. But check out the xda, there must be some avilable.)
Then you will have to get the proprietary vendor blobs (search out how to pull those from device).
There's more (like integerating the device into device tree etc). But I am not really that good when it comes to explaining, so you can have a look at this tutorials: Porting Cyanogenmod
Although its for Cyanogenmod, but procedure is quite similar for all custom ROMs (some make filenames may change, so as I said, you need to have the knowledge of directory tree).
Again, I would recommend you to build a ROM thats already available (Cyanogenmod is, luckily). Play around with it and get to know the device structure.
Good luck

[GUIDE]Working with Android Kernel from Scratch

Introduction
I am writing this guide as I was unable to find a well-documented thread over XDA (there are just a lot of them). In case there is anything that concerns this guide, feel free to ask in this thread. I expect you to know the basics of Linux, GIT, Android. Please look over some guides in the forum in case you are not familiar with them. In case you want to contribute to this, feel free to do so. I welcome everyone's contribution to be it fixing my derp, pointing a mistake or adding a new section.
Links to some nice documentations:
Git Documentation
Linux Kernel Newbies
How to take logs in Android
How to get an Android kernel up to date with linux-stable
Checking Current CAF Tag of the Kernel
We will be using best_kernel for this purpose, whose aim is to compare your current kernel source code with different CAF tags and select the best possible match using git diff.
Clone/Download your kernel repo and commit your changes(if not already committed) as best_kernel depends upon git diff to compare changes.
Depending upon your kernel version, add required CAF kernel repo as remote and fetch it. best_kernel will use this fetched data to compare changes.
After fetch is done, run best_kernel. It should run automatically if you have placed dotfiles in the $BIN directory and have the necessary dependencies installed.
best_kernel will compare changes and will provide results based on that. However, depending on the number of tags, it will take time. A lot of time, so go and grab a cup of coffee till then.
A Dummy Example:
Downloading stock kernel source code from OEM’s website
Code:
wget http://nokiaphones-opensource.azureedge.net/download/phones/Nokia6.1_V2.22J.tar.bz2 && tar xvjf Nokia6.1_V2.22J.tar.bz2 && cd kernel
Adding and committing all files due to lack of a .git dir.
Code:
git init && git add --all && git commit -m "Initial Commit"
As the kernel source code version is 4.4, I will add 4.4 remotes from CAF and fetch it.
Code:
git remote add caf https://source.codeaurora.org/quic/la/kernel/msm-4.4/ && git fetch caf
After fetch, I will check for the current CAF tag using best_kernel. As my device platform is sdm660 and CAF has been releasing sdm660 tags as sdm660.0, I will be using it as an argument in best_kernel. This will ensure that best_kernel doesn’t waste time checking CAF Tags of other platforms and will speed up the process considerably.
Code:
best_kernel "*sdm660.0"
RESULT will be something like this:
Code:
Best match TAG: LA.UM.6.2.r1-06900-sdm660.0 Lines changed: 177924
What is CAF/Code Aurora | CodeAurora Android Releases Page | CAF Kernel Sources​
Creating/Importing GIT History for Kernel Source
A lot of OEMs release kernel sources in a compressed format excluding the .git dir which results in no git history. Creating or it's better to say to import one is simple and easy.
Download and check the current CAF tag of your Android kernel source.
Note: If your chipset is not Qualcomm, you should visit Linux Kernel Source or AOSP's Kernel Common and use that as a base while checking out to the specific version of your kernel source you are going to copy-paste. Qualcomm devices can also use that as a ref but I will recommend them to use CAF source.
Based on that CAF tag, download the respective kernel repository from CAF and checkout for that specific tag.
Copy and paste your downloaded kernel source (with no history) over the CAF one (which has the history of that CAF tag).
Commit the changes.
You have accomplished creating/importing history.
A Dummy Example:
My current CAF tag is LA.UM.6.2.r1-06900-sdm660.0.
Therefore, cloning kernel source from CAF and checking out for this tag while creating a new branch named rebase.
Code:
git clone https://source.codeaurora.org/quic/la/kernel/msm-4.4/
cd msm-4.4/
git checkout tags/LA.UM.6.2.r1-06900-sdm660.0 -b rebase
Now, I will copy-paste the kernel source that I downloaded from OEM's website over the CAF one. Assuming the downloaded kernel is in ~/Downloads/kernel and CAF kernel source is in ~/msm-4.4 directories.
Code:
#Renaming the dir so, that it will get merged while copying due to similar names
mv kernel/ msm-4.4/
cp -avr msm-4.4/ ~/msm-4.4
cd ~/msm-4.4
git status
git commit -m "Import Nokia Kernel Source"
Keep in mind that a .gitignore is generated which can and will ignore files during commit which were not getting ignored earlier due to its absence. In case during compilation you encounter any error stating about missing file, add it forcefully and commit again.
Remember, its always good to split that one big commit into small parts. It's helpful when you start rebasing your kernel usually when new CAF Tag for new android versions come out. Solving a few conflicts ina lot of commit is much better than solving a load of them in one. It also gives you a chance to easily diff on websites like GitHub so that you can figure what's a particular line is doing.
Doing that is also easy. Just reset head for a particular folder like driver/touchscreen and commit them separately. Check git rebase documentation which will help you with this.
Upstreaming your Kernel
Merging upstream versions is a really good thing. It brings in security patches, stability, new features and much more. The usual and best way is to visit Linux Kernel Source and check if there are upstream updates available. If yes, start merging them in your kernel source one by one.
Note: If your chipset is not Qualcomm, you should visit Linux Kernel Source or AOSP's Kernel Common and use that as a base. Qualcomm devices can also use that as a ref but I will recommend them to use CAF source.
A Dummy Example:
Assuming my current kernel version is v4.4.205, I will fetch v4.4.206 from Linux Kernel Source and merge that. I can also fetch and merge different branches from CAF Source which are usually upstreamed with Linux-stable (for example, aosp/upstream-linux-4.4.y branch)
Code:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git v4.4.206
git merge FETCH_HEAD
Fix conflicts if you get some. What to keep and what not is a question that depends upon the device to device. Usually, you should compare local changes and upstream and try to figure out what could be the best way to fix it. I will advise to check the history of that file in upstream and see which commit caused that conflict and why. You can also check similar merges by other same kernel versions to see if they had the same conflict and how they fixed it.
I will also advise merging AOSP's kernel/common and new CAF upstream tags (Only QCOM devices should merge new CAF tags) regularly when available. The reason is pretty simple. There are commits that get merged in AOSP like which improves performance or other stuff which doesn't get merged in Linux Kernel Source. This way you can get the benefit from all sources. This, however, is not pretty easy and might result in a huge number of conflicts considering if OEM has modified the source a lot from upstream.
CAF also hosts f2fs and other file system changes on their servers. Merge it if you want and use it.
Compiling Standalone Kernel
Compiling a kernel standalone requires you to have a compatible toolchain like GCC or Clang. The best way to figure out which one suits your need is testing and debugging. The standard AOSP GCC toolchains are recommended for devices with old kernels, to begin with, while newer ones can use clang with backports or upstream merges. In case you want to compile with clang, checking out android-kernel-clang is a good way, to begin with.
Compiling standalone kernels can give a lot of missing headers errors/warnings. This is due to not compiling it in a ROM environment. This can be easily fixed either by correcting paths of those header files being included or creating an out dir manually and using it as output. You can also use this commit to do that automatically.
Clone your kernel source and desired toolchain(s). Export arch and cross compiler arguments. Choose the desired defconfig to make and compile.
A Dummy Example:
I will clone the kernel source and toolchain in the same dir and export the following arguments in kernel source root dir.
Code:
export ARCH=arm64
export CROSS_COMPILE=/media/hdd/aayush/kernel/aarch64-elf-gcc/bin/aarch64-elf-
make nokia_defconfig
make -j$(nproc --all)
Kernel conflicts might occur. You can search on GitHub to check if someone has fixed that already, otherwise fix the issues yourself. Comparing code with upstream repositories is also a way to figure out the differences. Choosing defconfig can be a bit tricky if you are doing bringups. I recommend pulling the current defconfig from your device itself. Its usually by the name of config.gz in /proc/ of your device.
Links to some cross compiler
GNU Toolchain by ARM
DragonTC
GNU and Linaro
Working with TWRP from Scratch
This post is supposed to help you with building TWRP from scratch for the first time if you are a newbie. There are some good resources already available for that over the web, specially XDA. I am linking some good ones below that you can read for more info on it.
How to compile TWRP Touch Recovery
The aim of a device tree is to contain the device-specific code for the build you are doing. In this case, as we are building TWRP which is a custom recovery, only flags relating to building TWRP and a normal recovery are enough to build it. Adding system specific codes like partition sizes for the system, vendor, boot and other doesn't contribute anything. An example tree can be begonia's tree hosted on TeamWin's org maintained by me.
Now coming to the device you want to build TWRP for, you will the following :
- A working kernel
- Device-specific binaries/libraries etc required for features like encryption which heavily differs on OEM implementation
AB devices need an extra commit in their kernel to make 'fastboot boot' command work: init: initramfs: disable do_skip_initramfs . Additionally if your device ships a separate DTBO image you will also need the following flag and the DTBO image: begonia: Build DTBO image into recovery
Newer devices are nowadays coming with 'fastboot boot' command disabled. Nokia 8.1 is an example of it. To make it work again, you might need to tweak bootloader which can prove to be risky.
Now coming to creating a device tree for TWRP. The very first step is to look out if someone else has booted TWRP on a similar SOC, OEM or same device. It can be used as a reference to fix similar/OEM related bugs and hacks quickly. In case, one doesn't exist, just pick a latest one from Teamwin's Github org for the android version you are compiling for.
Reserved (2)
Wew many thanks,
Thanks
Have just started exploring xda chef central.
I cam across this guide, really ahlepful Hope you complete it soon.
Updated the thread. Fixed formatting, links and added a new section.
How To Unofficially Unlock Bootloader For LG G8
We all know LG G8 is a android device. It's open source. But I recently bought a LG G8 only but it's locked to sprint sim . No any sim work. I can't unlock bootloader. I can't root. I can't flag firmware or install custom recovery. Anyone know here , how to totally remove firmware and but another firmware ? Why we can't build a method to do that?
TheImpulson said:
Updated the thread. Fixed formatting, links and added a new section.
Click to expand...
Click to collapse
Can you create a guide for, "How to Rebase an Android Kernel". Like from Android 9 to Android 10?
thanks for this guide bro
While using best caf kernel, Prefix of the caf tag should start with a -
For example, "*- sdm660.0"
@theimpulson
Hey there,
Am getting this error del.dog/megupebinu.txt
While trying execute best_kernel script
This is helpful, thanks mate
@theimpulson I had a question: (Before reading this guide) I had already downloaded stock Samsung sources and git init push the thing to my Github. So will anything bad happen if I did it this way or do I have to rebase it with CAF?
Also what are the benefits of these so-called CAF based kernels everywhere? Improved performance? Cuz I really wanted to compile my own kernel specifically for performance with WSL-2 (shameless plug)
Thanks in advance and sorry if the @ bothered you,
Ishaq
NullCode said:
@theimpulson I had a question: (Before reading this guide) I had already downloaded stock Samsung sources and git init push the thing to my Github. So will anything bad happen if I did it this way or do I have to rebase it with CAF?
Also what are the benefits of these so-called CAF based kernels everywhere? Improved performance? Cuz I really wanted to compile my own kernel specifically for performance with WSL-2 (shameless plug)
Thanks in advance and sorry if the @ bothered you,
Ishaq
Click to expand...
Click to collapse
The existing sources are fine, no issues if you are fine without any git history.
SOC specific optimizations, bug fixes etc. Nothing more. So, yeah, if you want SOC specific optimizations, performance improvements, you will want to merge latest CAF tags for your kernel.
theimpulson said:
The existing sources are fine, no issues if you are fine without any git history.
SOC specific optimizations, bug fixes etc. Nothing more. So, yeah, if you want SOC specific optimizations, performance improvements, you will want to merge latest CAF tags for your kernel.
Click to expand...
Click to collapse
thanks a lot for the reply! Another thing, because of your suggestion I tried to Import the git history (and i succeeded). Then I wanted to upload these sources to my own Github, which I can't figure out how to do. It only gives Github repo for the place where it came from (msm-3.18). Help me please
Edit: The guides which I found for merging CAF tags say that my base also has to be CAF (which it isn't) and this guide here basically does not work

M3 note ported kernel source and twrp 3.3.0

Dear all,
I successes compiling a kernel (and combined with twrp) for M3 note. Please find the source git below.
Youtube show the new kernel boot with twrp is as below:
https://youtu.be/ps6ngeDPiHc
Code:
PLEASE BE WARNED CRACKING MIGHT MAL-FUNCTIONING YOUR DEVICE. I AM NOT RESPONSIBLE TO ANY DAMAGE MADE. ALSO I AM NOT LIABLE TO ANY OF CAUSE OR DAMAGE MADE.
First of all, kernel tree is available for developer:
https://github.com/99degree/android_kernel_m3note.git
branch: m3note_20190813
Its based on a v3.18.35 kernel from below, credit goes to this git user
https://github.com/mtkkkk/mt6755_wt6755_66_n_kernel.git
TWRP image is provided here, licensed GPL, freely redistribute accordingly to GPL:
http://s000.tinyupload.com/index.php?file_id=68522221679326215968
Short summary:
The branch contain changes to make the Image.gz-dtb kernel code base working with twrp 3.3.0 (ramdisk.gz from elephone P9000)
changes included:
(1)PMIC sm5414 sm5414.c/sm5414.h/charger_hw_sm5414.c
(2)various Makefile and adding missing include path
(3)DT overlay support ported from newer branch
(4)LCM ported from MEIZUOSC/m681/
(5)various other small changes.
The idea to add kernel dt-overlay support is due to it's hacky HW's fw nature, as the combination of (1)unlocked boot-loader, together with (2)Chinese version of lk, both caused dtb overwrite by internal copy, detailed below.
With fastboot boot feature enabled, there come a very development unfriendly feature, aka dt overlay, happened before booting into the kernel. Thus the kernel might not work with many LCM (the info passed down by kernel CMDLINE within DTB node) from other model varient (included but not limited to M681A, M681G, M681C). I have to mention that the m681-intl (at least three variant) version of update.zip DOES NOT have a fastboot boot enabled lk(.bin) provided.
The full list of M3 note variant is as below:
http://deviceinfohw.ru/devices/uplo...0&brand=brand598&filter=m3+note&submit=Search
The base tree is cloned from https://github.com/mtkkkk/mt6755_wt6755_66_n_kernel.git so i dont have any idea what happened in the code. So no garentee the security/feature completeness.
Finally I would conclude the current kernel tree branch with working feature.
(0)unlock bootloader
(1)LCD/LCM
(2)PMIC charger partly supported (sm5414, bq24196) so remove usb cable wont reboot
(3)touch (gt9xx, ft5x0x)
(4)RTC/TEMPRETURE/WDT
(5)MMC/SD (internal/external)
(6)Vibrator
(7)USB mtp/adb
The sm5414 code is port from the original m681 tree from meizuosc, thus not working very well with newer mtk battery driver. BQ24196 driver added but not tested. Other feature are not tested. it might work, or not at all.
Happy hacking.
Uleak
unlock bootloader manually
removed duplicated content, plz refer to below link for unlock bootloader
https://forum.xda-developers.com/m3-note/how-to/m3note-unlock-bootloader-manually-apply-t3957419
technical detail of unlock logic is as below
sec_unlock.c
fastboot_get_unlock_perm {
...
index = partition_get_index(FRP_NAME);
...
size = partition_get_size(index);
unlock_allowed_flag_offset = size - sizeof(unsigned int);
...
}
ok, sizeof(unsigned int) is dword. the offset is (size-1 * dword). so set to 1 means unlock.

Categories

Resources