Understanding different source components of the custom ROM? - Android Q&A, Help & Troubleshooting

I have been experiencing some problems lately compiling kernels, and just wanted to take a step back to try to understand the bigger picture of Android custom ROMS.
Let's take this Havoc OS for the Realme 2 Pro as an example:
https://forum.xda-developers.com/realme-2-pro/development/rom-havoc-os-t3925153
Under sources there are 2 links:
https://github.com/Havoc-OS
https://github.com/Havoc-Devices
1) Can anyone explain the difference between the 2 sets of sources (OS vs. Devices) and which ones would be used for the above custom ROM?
2) Can we assume that the official kernel has been used (see link below) or a modified/generic one instead? Is this kernel included anywhere in the Havoc source code links?
https://github.com/realme-kernel-opensource/Realme2Pro-kernel-source
3) What is vendor.img? Is it simply another name for the compiled kernel?
4) How does the kernel know which OS/filesystem it's booting and how easy is it to interchange another OS with the same kernel?
5) Can just the kernel be updated and flashed without updating the main OS of the custom ROM? If so, which partition is the kernel flashed to?
6) Could an entire custom ROM be booted from the recovery partition instead of the boot/system partition?
7) Any useful links/books/resources for Android ROM development from scratch?

Related

Beginners guide to custom ROMs with linux

Hi,
I know there are a lot of guides out there but you still might want to read it
What are the different things I need to know ?
Well you will hear three terms very often. Baseband, Kernel and the ROM. Lets see what they are.
Baseband :
A firmware to drive the radio (2G/3G) chipset in your phone. Most of the time you don't need to bother thinking about it. But you might need to upgrade this firmware in order to get optimum performance. Just think of it as something you won't need to apply unless explicitly specified. For you xperia neo v, you can find out the baseband version by going into phone info and looking up baseband version number. I have not flashed any baseband. I recommend if you have not rooted/flashed your phone, install the official sony update you'll get the latest baseband without any troubles, this is what I did. Although if you need to flash it, there are very many tutorials available on this forum. You can check out the flashtool androxyde . github . com / Flashtool (sorry for the spaces in the links. I can't post outside links because of some forum rules which don't make any sense whatsoever)
Kernel:
This is the Linux (android) kernel image that drives all the hardware. Always install (flash) the recommended kernel for any ROM. Installing kernel and ROM is an absolute must.
ROM:
This is the actual thing you see running on your phone. It consists of the modified android source, user interface tweaks, the apps and some under the hood modifications done by the ROM developer for ex. cyanogenmod.
Now lets setup you linux (ubuntu) install fo installing a custom ROM on your phone.
Follow this wiki : wiki. cyanogenmod. com / wiki / Howto:_Install_the_Android_SDK
Don't forget to setup Udev by making a file /etc/udev/rules.d/51-android.rules with contents as
Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666", GROUP="plugdev"
now restart your udev daemon by running "sudo restart udev".
Now yo have the necessary kernel and ROM flashing tools at your disposal. I am going to tell you how to achieve a fast and very battery efficient cyanogenmod install.
1) Download CM9 ROM and gapps(for google apps) from here
ROM: download. cyanogenmod. com /get / jenkins/4630/cm-9.0.0-RC2-haida.zip
Gapps: cmw. 22aaf3. com/gapps /gapps-ics-20120317-signed.zip
Copy these two zips to your phone's sd card.
2) Download night elf's kernel for cyanogenmod 9 from here mediafire. com /?nm7g0zid8aazfl1
3) Follow this guide wiki. cyanogenmod. com/wiki/Sony_Ericsson_Xperia_Neo:_Full_Update_Guide
But instead of flashing the kernel inside the zip, flash the night elf's kernel (just provide the path to night elf's kernel instead of the ROM's boot.img).
4) As told in the link given in above step flash both the zips. Before flashing you may also clear the Dalvik cache by going into advanced options in the recovery menu.
5) Reboot your phone. Don't turn off the GPS !!! There is a bug in CM9 RC2 which results in substantial hit on battery life. Just let it be. Anyways the GPS antenna is turned off unless any application is using it.
I am having approx more than two days of battery life with light/moderate usage (No data connection, occasional wifi).
CM9 may not be the best looking ROM. But I can assure you nothing beats it in the performance and the default setup (its very sane !!! No need to change anything at all). Also I only trust cyanogen community with all my very personal information (its my phone, it has everything !! ). If you need eye candy more and are comfortable with taking privacy risks, you may try MIUI and the dozens more ROM in the thread. I am not trying to offend anyone, its just my opinion, feel free to call me paranoid.
Always keep in mind that there are no stupid questions only stupid answers Ask away !!
I wish you a free and serene future.
I am however more interested in using the source code provided by Sony with AOSP and compiling the system image by myself.
I know how to compile AOSP, but the files provided by Sony doesn't seem to contain the `device` directory.
Also is it possible to use the AOSP and compile a ROM that is exactly the same as the stock ROM?
I haven't done any reading or experimentation on the subject but as far as I know, Sony only provides the stock kernal sources, some hardware support libraries (not all for ex HDMI, xLOUD still not provided). You can compile the kernel from Sony sources. Android image and apps are not provided by sony. All the ROM makers who are releasing ROMs based on stock are modifying the stock ROM image to do it.
For compiling your own ROM, you will have to do it form AOSP or cyanogenmod (FXP) sources.

how to port device to different flavor of android?

Ok so I have built cm11 for my device (galaxys s 4g), and ported cm11 from another device to (aries -> galaxy s 4g). CM11 has too much going on IMO and I just want pure aosp on my device, the problem is that there are no (recent) aosp roms for my device, or any similar devices.
So how do I port my device to a different flavor of android when there are no roms of that flavor?
What have I tried?
So far I have setup the aosp 4.4 repo to a different folder than my cm11 repo (the build environment files should be the same right?)
I tried using the manifest from the cm11 rom and buidling with aosp,that didnt work it didnt even finish compiling =(.
I browsed the aosp source for other devices by the same manufacturer, but everything looked completely different from what I am used to.
The most helpful guide in this direction sofar has been cyanogenmods guide but it has left me with more questions than answers.
What [I think] I need to know
Custom recovery - aosp doent seem to include a recovery, the cm guide says to start with the recovery. So i need to know if I need to add a custom recovery to aosp, or if i can install aosp roms from twrp without breaking it.
Binaries - It is safe to use the binaries used in CM11 for aosp/any other flavor, or are the binaries flavor specific? (im thinking they are safe to use, but not entirely sure).
Device files - what files should be safe to use for any flavor?
Kernel - Cm builds the kernel when you compile the rom (or so it says), does aosp build the kernel when you build the rom, or do I have to build the kernel separately? Is it safe to say use a CM11 kernel with an aosp rom?

[Q] Building a custom ROM for Xperia-L from AOSP

Pardon my ignorance. Just for fun and learning, I am willing to build a custom ROM from scratch for Sony Xperia-L from Android AOSP. But, even after going through a number of tutorials, following are the issues which are yet unclear to me:
How to obtain Xperia-L specific drivers to intergrate it into my build. Please note that unlike a few tutorials has suggested, I don't want to start from CM ROMS. I want to do it from 'scratch'
I have downloaded Open source archive for build 15.3.A.1.12, 15.3.A.1.14 and 15.3.A.1.16. It contains two top level directories: kernel and platform. What are these two for? Given the size of AOSP so large, I presume this archive does NOT contain full source for Xperia-L stock ROM. Am I correct to reason that?
Without using kiddie-approach, e.g. different ROM kitchen, what is the recommended approach to for a beginner to master the art?

[Q] Porting kernel?

Hi guys, I'm doing a Cyanogenmod 12.1 porting for my device that is unsupported. I can build everything and I get a flashable zip but I'm using a prebuilt stock kernel image extracted from the stock lollipop rom. After flashing, the phone does not boot and It's impossible even to access to logcat, so I think it's a kernel related issue. My question is:
- I have the stock kernel source (v.3.10) given by the vendor
- I have the cyanogenmod kernel source (v.2.69)
Do I have to build the stock kernel or I can build the cyanogenmod one by merging the drivers modules and others stuff?
And if I flash a wrong kernel image can my device become unusable?
I read that is not fair importing built kernel modules from other kernel version, but if I merge the kernel trees, is it the same?
Sorry in advance if my question is a noob question
Well I don't know much about porting roms or kernels though. But with what I've heard flashing the wrong kernels can permanently render your phone useless..
Sent from my Tecno F7 a ...?

Build ROM from scratch

I would like to develop a custom ROM for my device. I read some guides and obtained some basic knowledge, but still don't know how to start. So I would like to ask some questions to test my knowledge and expand them.
My device: Wiko View
My Android version (actually installed): 7.1.2 almost pure Android (just some third-party apps)
Desired Android version: AOSP 9.0 (maybe?)
So as far as I know I need these things:
AOSP Source Code (9.0)
Kernel
Vendor (tree or blobs?)
Device tree
So for the AOSP: I can get it from the repo hosted by Google. How should it look once downloaded?
For the kernel: should I use that from my actual ROM, or the most recent one? And how to include it in my ROM before compiling?
For the Vendor: As far as I read, with project treble I shouldn't edit this. But since I'm not developing a treble ROM, I'm in troubles, right? In older ROMs (before Oreo and Treble), they're stored in /system/vendor. Is just that folder or are there more? Do I need to update something? Where do I need to put this folder?
For the device tree: I read some guides that explains how to extract it from ROM (only from 5.0 and up, since mine is 7.1 no problems, I hope). Is this right or are there other ways? Or do I need to write it myself?
I'm going to thanks anyone in advance. I know there are plenty of questions, but I hope this thread will be a place for begginer (like me) to know more about compiling from source a ROM. Have a great day!

Categories

Resources