Kernel Driver Support to Connect to Ender
For any rom, if you want to connect it to Ender 3, you need "ch341" driver added/activated in the kernel or you need a custom implementation of it (look for octo4a program). You could understand it by connecting the phone with a USB OTG cable to your printer and execute command "ls /dev | grep tty". If there is "ttyusb" or "ttyacm" , it means that kernel has the driver. If kernel does not have the driver you have two options:
- You need to compile a kernel with driver support. Also keep in mind that kernel needs to support "loopback" functionality to host a virtual linux system and accept/direct connections to that virtual linux over its loopback.
- You can install octo4a, which installs custom a ch34x driver. and you need to mount the serial pipe of the octo4a (you can check that part from: https://github.com/d4rk50ul1/klipper-on-android)
- Terminal Emulator (you need to give root priviliges)
Compiling Kernel for ARM64 (LG G4)
If you do not want to bother with all compiling, just download the boot.img that i compiled. It is for LG G4 H815 International Lineage OS.
I will be telling the procedure for LG G4 but it should be generally applicable to any ARM64 (not ARM) android phone. Here is the guide i followed if you would like to check: https://forum.xda-developers.com/t/reference-how-to-compile-an-android-kernel.3627297/
- Twrp installation on LG G4:
- Lineages Os 16.0: Lineageos 16.0 Android 10
The kernel used for LG G4 for this specific rom is Titan Kernel and luckily kernel aldready have ch341 driver, just not activated.
You need a linux environment to compile kernel (might be possible on windows too). First you need to download the kernel and a toolchain (Google) to compile it.
We need programs/files listed below:
- AIK KITCHEN folder (to split and merge new kernel into boot.img file)
- Google Toolchain
- Kernel folder (new kernel source code)
- boot.img file (we will replace the kernel in this original image file taken from firm zip file)
1. Installing prerequisites
sudo apt-get install libncurses5 libncurses5-dev
sudo apt-get install make
sudo apt-get install git
2. Install google toolchain
cd /home/ercin
git clone https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9
3. Download Android image kitchen and extract it to a folder. (/home/ercin/Downloads/AIK-Linux)
4. Download Lineage OS rom and extract boot.img file
At the end you will have a Download folder with folders and images like below:
5. Edit kernel configuration file to include ch341 driver (you need to find the defconfig file for your phone type, which is generally under /arch/arm64/configs folder inside kernel folder)
6. Compile New Kernel
export ARCH=arm64 && export SUBARCH=arm64
export CROSS_COMPILE=$(pwd)/bin/aarch64-linux-android-
cd /home/ercin/Downloads/elite-boeffla-kernel-lineage14.1-i9300-master/
make clean
make mrproper
make lineageos_i9300_defconfig
make -j$(nproc --all)
7.Now you have the kernel with name Zimage under arch/arm/boot folder:
/home/ercin/downloads/elite-boeffla-kernel-lineage14.1-i9300-master/arch/arm/boot/Zimage
8. Unpack boot.img (taken from lineage os zip file) and change old kernel with newly compiled one.
cd /home/ercin/Downloads/AIK-Linux/
./unpackimg.sh /home/ercin/Downloads/boot.img
cd /home/ercin/Downloads/AIK-Linux/split_img/
rm boot.img-zImage
cp /home/ercin/downloads/elite-boeffla-kernel-lineage14.1-i9300-master/arch/arm/boot/Zimage boot.img-zImage
cd /home/ercin/Downloads/AIK-Linux/
./repackimg.sh
Now you have image-new.img file under folder /home/ercin/Downloads/AIK-Linux
8. Install image-new.img file to phone boot section using TWRP
3 comments:
Im having a hard time following your write-up for compiling this setup for my Oneplus, I've finally figured out what youve extracted and which items you are saying to pay attention to. I also did notice a ch341.c file underneath drivers folder of most repositories. I will attempt to compile using your guide and enabling in my DEFCONFIG for ch341 to be enabled as ascribed by your Titan Kernal change. Everything after the file config I am having a really hard time following however, as far as compiling the kernel.
i'll try to make namings a bit more easy to follow when i'll find time. Thanks for the feedback.
Im having hard time to find CH341 config setting for my old devices(Lenovo k6 power,samsung core 2 duo and Moto e3 power) All these devices are rooted and have custom ROM. Please help me to find that setting :( Waiting for reply!
Post a Comment