[Android Software Development] Duhjoker:
I am in no way resposible for any negative effects to your device by trying any of this for yourself. Including bricking your device, divorce, nuclear meltdown, zombie apocalypse or any other malfeasance. Try at your own risk.

Hi guys

Im still a jr member here and learning but ive rooted a few phones and ported a twrp and now I want to build a custom kernel and ROM for my new phone the K8+ 2018 LMX210ULMA. I plan to do this all from the phone im building the ROM for using termux and Anlinux to install Ubuntu and all the proper build essentials. So lets get started!!!

First i have some questions and then ill note where i am in my project. Ive actually been working on this for a while using this and that thread but i have some questions i have never been able to find answers to. Like.......

1. Does the kernel source code need to be unpacked in the same folder as the device source code?

2. How can i build seperate modules like bootloader or recovery or anything else.

3. Is there a way for some one who has a locked network carrier device to build a kernel that is unlocked.

4. How do you find device, vendor and kernel trees for a device that hasnt been publicly built yet?

5. When installing dependency libraries to ubuntu what do i do when Ubuntu is unable to locate a package. For examle: lib32ncurses5-dev lib32z-dev and lib32esd1.0-dev

Ok now lets get to setting up the envrinonment or at least what i have so far.

A rooted phone is needed to get the job done as far as far as i know so you might want to work on that first. My particular phone variant doesnt seem to have a recovery option just yet due to some bit of hiding of hiding the fastboot mode but im hoping by compiling a custom ROM and Kernel i can alleviate that and help myself and all the other good folks that want to fully root thier phone and also learn to make thier own custom ROM.

So far im rooted using a temp root that utilizes an exploit called mtk-su. It gives basic root privilages and allowed me to make a couple changes to my build prop like adoptable storage and allow some changes here and there with out upsetting the system partition to much.

You will need adoptable storage storage for this to work as repo will need to unload ton of source code to your device so 32+ gigs of internal storage will be needed.

Im not going to go into the specifics of the two forementiined needs but a quick search should point you in the right direction and get you going.

1. Install termux and installed the basic packages in the welcome plus:

pkg install libandroid-support libandroid-support-static libandroid-shmem libandroid-shmem-static libusb libusb-static libccid

2. Install Anlinux and follow the instructions to build Ubuntu within the termux environment. Make sure to do it as root which is essential for this to work correctly.

3. Install a vnc viewer. I dont really use it. It would be nice to have a way to use a web browser with in it but so far no go.

4. Once you have Ubuntu built and started its time to install more dependecies. Yay!

apt-get install sudo

sudo apt-get install software-properties-common

sudo apt-get install bison build-essential curl ccache flex libncurses5-dev libsdl1.2-dev libxml2 libxml2-utils lzop pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev git-core make android-sdk gperf openjdk-8-jdk -y

So far i have been able to install all but 3 of the dependecies needed. Lib32ncurses5-dev lib32z1-dev and lib32esd0-dev any one knowing a work around or way to locate and install them please for the love of android speak up.

5. Now lets do some more setting up the build environment with repo. I have tp say repo is a pretty cool tool here but it has its problems. First the repo init command is sketchy and doesnt always work. I had a hard time with it at first. Second even though you tell it which manifest exactly you want to download it will download others as well and draw source code from every other build. This is a problem as it downloads every pre-built toolchain in the repisitory and almost every android repository in existance. They talk about the source code from repo taking up so much space well that is exactly why. Ive been compiling in C++ for years and i have never seen such a mess. But so be it. Maybe the android gods will straighten it out someday and make it easier and consume less space by only downloading the appropriate source code needed by your specific build.

This is the end of this post so i have to finish up on the next BRB