Making own rom for Mediatek device - Android Q&A, Help & Troubleshooting

Hello!
I'd like to build my own rom from AOSP 8.0 official branch. I'm looking for some kind of guide but couldn't find any So, let's say I've got android source code and files from other custom rom that makes camera work. What have I to do to make my rom now? How can I build it and be sure that everything will work. Generally my target is to install android 8 on my Leeco le 2 x620 device with Mediatek chip
Any help is appreciated ^v^

LEGOL2 said:
Hello!
I'd like to build my own rom from AOSP 8.0 official branch. I'm looking for some kind of guide but couldn't find any So, let's say I've got android source code and files from other custom rom that makes camera work. What have I to do to make my rom now? How can I build it and be sure that everything will work. Generally my target is to install android 8 on my Leeco le 2 x620 device with Mediatek chip
Any help is appreciated ^v^
Click to expand...
Click to collapse
"I'd like to build my own rom from AOSP"
So you mean an aftermarket os like lineageos or carbonrom or do you mean that you take the aosp repo and compile aosp for your device? You can look in source.android.com
"source code and files from other custom rom that makes camera work"
Is that an already compiled rom? Because you won't get source code out of that
"How can I build it and be sure that everything will work"
Ya don't. Nothing can ever be 100% bugfree, it can either be from your device tree's source code, or the aosp code itself.
Generally, if there is a caf tree for your device, it's going to be 3x as hard to create an aosp tree.
It is going to be 100000x as hard to create an aosp tree that is for a newly released, new hardware requirement operating system.
Wanna know the topping of the cake? Mediatek is notorious when it comes to releasing the source (in fact, it has become a meme in the Mediatek users world) but don't let that stop you son.
You can try, but don't give up just because it won't compile the first couple of hundred times. The errors when compiling should give you a great start
Good luck.

ramiabouzahra said:
"I'd like to build my own rom from AOSP"
So you mean an aftermarket os like lineageos or carbonrom or do you mean that you take the aosp repo and compile aosp for your device? You can look in source.android.com
"source code and files from other custom rom that makes camera work"
Is that an already compiled rom? Because you won't get source code out of that
"How can I build it and be sure that everything will work"
Ya don't. Nothing can ever be 100% bugfree, it can either be from your device tree's source code, or the aosp code itself.
Generally, if there is a caf tree for your device, it's going to be 3x as hard to create an aosp tree.
It is going to be 100000x as hard to create an aosp tree that is for a newly released, new hardware requirement operating system.
Wanna know the topping of the cake? Mediatek is notorious when it comes to releasing the source (in fact, it has become a meme in the Mediatek users world) but don't let that stop you son.
You can try, but don't give up just because it won't compile the first couple of hundred times. The errors when compiling should give you a great start
Good luck.
Click to expand...
Click to collapse
Oh God, how am I meant to do this ;0 There is Lineage 14.1 project on my device. I really want to have android 8 on my phone. Thank you for all the advice.

Yes im trying the same andere without any succes so far.
Im also trying to port from a different device ROM to the stock ROM what im running now.
The chip sets are the same but the Android versions not.
It would be really Nice if some mtk ROM developer find some time in his busy life to create a ROM for our phone.
Or a guide to compile/port Android o tot oud phone.

Related

[Q] Build a Custom ROM using only kernel source?

The HTC Desire 310 runs on a MediaTek SoC, and HTC only has the source code for the kernel. Is it possible to build a Custom ROM like CM for the device? And what are the drawbacks of doing this?
Lynuxen said:
The HTC Desire 310 runs on a MediaTek SoC, and HTC only has the source code for the kernel. Is it possible to build a Custom ROM like CM for the device? And what are the drawbacks of doing this?
Click to expand...
Click to collapse
Basically all a ROM development takes is a kernel source ,a device tree(how the source has to build your ROM {resolution,kernel source command lines....etc are set here}) , a vendor tree( usually proprietary shared libraries got from stock ROM ). Once you've got all these all you have to so is type make bacon. But since its mediatek its pretty hard to build anything since mediatek ril/libraries are not open source.
So doing this blindfolded won't work.
Lynuxen said:
So doing this blindfolded won't work.
Click to expand...
Click to collapse
Won't work, unless you set up a device tree for your SoC. MT6589 device tree may work for building only recovery but nothing further.
Yes, as @MasterAwesome said you need actually 3 components: Vendor tree, kernel source and device tree. Making vendor and device tree from scratch is hard.
GeekyDroid said:
Yes, as @MasterAwesome said you need actually 3 components: Vendor tree, kernel source and device tree. Making vendor and device tree from scratch is hard.
Click to expand...
Click to collapse
Hard, but not impossible? I really want to invest my time in something like this. Pretty long shot, will something like a method for reversed engineering the vendor and device tree work?
Lynuxen said:
Hard, but not impossible? I really want to invest my time in something like this. Pretty long shot, will something like a method for reversed engineering the vendor and device tree work?
Click to expand...
Click to collapse
Vendor tree is pretty easy to setup. You'd want to start with the CyanogenMod version which is similar your current android version. If your device has kitkat download cm11 sources. Read their docs about setting up a device tree(its not that hard). Vendor tree is basically just your stock ROM use it as a base to get your libs which are required for your ROM to start(logcats are helpful here). Since you have a similar SoC, you can use my device tree as a reference https://github.com/MasterAwesome/a210_device_tree/tree/master/micromax/a210. Initially just build a kernel and check if it works. And I have guides for kernel and ROM building,you could check it out.
MasterAwesome said:
Vendor tree is pretty easy to setup. You'd want to start with the CyanogenMod version which is similar your current android version. If your device has kitkat download cm11 sources. Read their docs about setting up a device tree(its not that hard). Vendor tree is basically just your stock ROM use it as a base to get your libs which are required for your ROM to start(logcats are helpful here). Since you have a similar SoC, you can use my device tree as a reference https://github.com/MasterAwesome/a210_device_tree/tree/master/micromax/a210. Initially just build a kernel and check if it works. And I have guides for kernel and ROM building,you could check it out.
Click to expand...
Click to collapse
Massive thanks MasterAwesome. :highfive:

[Questions] Kernel source issues when compiling LOS/TWRP

Hello guys.
This question is specially for devs or advanced users with development skills.
My question is related to the kernel source of one of my devices, Huawei Mediapad T1 10 (codename: hwt1a21l). I got the kernel source from the oficial Huawei website and uploaded it to a github repo. My device, which has a msm8916 chiset, doesn't have any development (roms, recoveries, device tree, etc) and his rom, EMUI 3.0, is based on Kit Kat 4.4.2.
I have been trying to bring development for this tablet many months ago because the stock rom is too deprecated for the hardware that has, with the msm8916 there is a huge potential to bring it a lot of development.
Well, i'm going to summarize my problems when trying to bring development for the device:
To get started development, for example a LineageOS build i needed a solid base to start with: device tree, propietary blobs and kernel source, so i got all of them. I ported the device tree from another one very similar to mine (with the same chipset), extracted the propietary blobs with the build tools from the source and got the kernel source from the Huawei website. So everything seemed to be good, but when i start the build process with my Linux machine (repo sync > source build/envsetup.sh > breakfast hwt1a21l > brunch hwt1a21l) i always receive thousands of build error by the kernel source, and i have been fixing (or at least avoid) a lot of them but it never ends, so i don't know if it's worth to keep trying to "fix" them or if i'm wasting my time.
So, what i have been trying to do: i have been trying to build a LineageOS 14.1 and TWRP recovery with my device tree This: Mustang-ssc/android_device_huawei_msm8916-common ported from this one from @dianlujitao : dianlujitao/android_device_huawei_msm8916-common and the specific kernel source for my device downloaded from the Huawei website Mustang-ssc/android_kernel_huawei_hwt1a21l. Here ends the summary.
So after a lot of hours, days and nights over the last months trying to make progress with this and not getting any help from the few devs i asked after seeing my lack of progress i decided to publicly ask for help.
The questions:
1. I have the official kernel source (Mustang-ssc/android_kernel_huawei_hwt1a21l) which i didn't have success to compile it, and then i saw the kernel source from a device almost identical to mine (same chipset, brand, ram, ...) (dianlujitao/android_kernel_huawei_msm8916). Can i use that kernel source as a base for my device after porting the specific configurations of my official kernel source (defconfig, drivers, libraries)? That one is much more updated and probably optimized than mine, but i don't know if it's possible to adapt a kernel source from other device using your kernel source.
2. This may be a dumb question: my device has Kit Kat 4.4.2. Is there any link between the kernel source and the android version the device has? I mean, i don't know if i should do something to adapt my kernel source for newer android versions (Marshmallow, Nougat) of if it's ok to just build with it without any change.
If you read it all, congratulations, you're awesome
Still waiting for a reply

Build instructions

We need build instructions in order for people to more easily make custom roms. Currently most roms here only provide a repo or two, hardly describing the build process if anything. Not sure if those repos contain all the sources/blobs you need either.
It's not that hard to build and you can always go on th cheap and hire a cloud vps for a few hours, so don't bother with local building unless you have the powerful hardware.
Anyhow, so far what I know is that some people just replace the kernel and firmware, it seems this is called repacking.
Others are building Lineage from source as per their instructions, which are not descriptive when you're porting to a new device.
We need concrete and concise information about how it's done.
Lineage wiki is pretty accurate and if someone ask here I can try to solve his doubt.
I am not the best developer but I know the basics xD
Can you describe the basic workflow?
Which repos to check out, what build scripts are there, how to combine them. Basically a short tutorial on stuff. Also how come you're using 821 kernel from zl1, i know 820 and 821 are alike, but when do you patch the kernel to work for 820, i read that you need some config changes and a different gpu blob.
I am a developer myself, but not an android rom one. Things look really fragmented and chaotic. Besides Lineage wiki, I haven't found anything that resembles docs. I really want to contribute on this and have the hardware to build, just need some info on where to begin.
Thanks for taking your time to reply.
randxor said:
Can you describe the basic workflow?
Which repos to check out, what build scripts are there, how to combine them. Basically a short tutorial on stuff. Also how come you're using 821 kernel from zl1, i know 820 and 821 are alike, but when do you patch the kernel to work for 820, i read that you need some config changes and a different gpu blob.
I am a developer myself, but not an android rom one. Things look really fragmented and chaotic. Besides Lineage wiki, I haven't found anything that resembles docs. I really want to contribute on this and have the hardware to build, just need some info on where to begin.
Thanks for taking your time to reply.
Click to expand...
Click to collapse
Thats thanks to codeworkx code. Basically you compile a rom for zl1 and works for zl0.
My workflow is
repo init/sync the rom
Fix libhidl and libbfquio if needed (Dont know why they fix an error creating a bigger one tho)
Take the device tree, vendor and kernel
Adapt the device tree for the rom (Like in cosmic where config is in root not in config folder, boardconfig...)
And just brunch or make or lunch depends on rom xD
Edit: Forgot u need like 200 frameworks/av commits to make zoom work https://github.com/mosimchah/frameworks_av/commits/o8.1 all the january 15th and this one http://gerrit.aicp-rom.com/#/c/54436/
You init the Lineage repos?
What are those libhidl and libfquio about, and how do you fix them?
Vendor is the firmware blobs?
Kernel is obvious
What is a device tree? And how it relates to the kernel?
How did you adapt it to the device?
Different devices have different partion layouts I assume. How do you make the zl1 rom work for both zl0 and zl1? Earlier people were reporting bricks because of flashing roms for zl1 on zl0
randxor said:
You init the Lineage repos?
What are those libhidl and libfquio about, and how do you fix them?
Vendor is the firmware blobs?
Kernel is obvious
What is a device tree? And how it relates to the kernel?
How did you adapt it to the device?
Different devices have different partion layouts I assume. How do you make the zl1 rom work for both zl0 and zl1? Earlier people were reporting bricks because of flashing roms for zl1 on zl0
Click to expand...
Click to collapse
Yout init the rom source you want to compile
You dont need to adapt anything codeworkx already did it for us we just compile zl1 roms with his device tree (Los one) or any of the forked ones (Like Aicp which I recommend).
Libhidl and libbfquio depends on the rom you are building. Libhidl is solved by reverting this changes https://github.com/PixelExperience/system_libhidl/commit/607e961b85eea8969503d8ff8437c014f04f0ca2 and libbfquio by taking this http://gerrit.aicp-rom.com/#/c/56488/
You dont adapt device tree to device you adapt it to the rom you are compiling see how other devs do it in their github (Every rom is different for example in cosmic you rename lineage/aicp.mk to cos.mk and change where to import things)
---------- Post added at 01:53 PM ---------- Previous post was at 01:49 PM ----------
Start by picking up a rom you want to compile that has 8.1 source working and better if a msm8996 device is there (zuk z2, oneplus 3...)
Thanks for the info. Will experiment a bit when I have free time. Planning on making an in-depth guide if I succeed and clarify the concepts.
Btw I see that everyone is using kernel 3.18.20, why can't we get a newer kernel? If we have the sources for it and the blobs? Is the reason being that the drivers are not in the mainline kernel so they need to be ported to a newer kernel?
randxor said:
Thanks for the info. Will experiment a bit when I have free time. Planning on making an in-depth guide if I succeed and clarify the concepts.
Btw I see that everyone is using kernel 3.18.20, why can't we get a newer kernel? If we have the sources for it and the blobs? Is the reason being that the drivers are not in the mainline kernel so they need to be ported to a newer kernel?
Click to expand...
Click to collapse
Np
Not sure dont know much about android kernels

How to build aosp from source for mido?

Hey there devs.
I'm looking forward to build a pure aosp rom based on oreo 8.1 for mido.
So far I've tried and successfully built los 14.1 and rr 5.8.5 from source, but I want to build aosp source so as to create a vanilla aosp rom. I've looked on the internet and asked a couple of devs here in the forum and they told me to merge caf patches. I totally understand the point of caf but then i don't know how to do it. Also I'm pretty sure that some patches (caf maybe) need to be added to source since the compilation always gives an error related to board config, when i followed the official guide at android website. (But then I don't understand what overlays i have to apply or even what they are)
Edit : i use gcloud to build.
If anyone can guide me as to how i can build aosp, it would be really helpful:fingers-crossed:
But then any help is appreciated.:good:
Thanks in advance!
i've no knowledge on building rom but im waiting for your vanilla for sure, hopefully you made it from Note 4X as base since all 8.1 rom i have tried are giving me various app are stopping after using it for sometime. i hope i can help you in some way though i have limitation in helping. thank you for your spirit!
groovepeppy said:
i've no knowledge on building rom but im waiting for your vanilla for sure, hopefully you made it from Note 4X as base since all 8.1 rom i have tried are giving me various app are stopping after using it for sometime. i hope i can help you in some way though i have limitation in helping. thank you for your spirit!
Click to expand...
Click to collapse
Don't worry man, I'll find out some way to build it. I'm Waiting for los 15.1 to get official so that the kernel source and other sources are out which i can use. But still I'm trying to learn and build.:laugh:

Willing to build Lineage OS... But will require community help

As there is no interest nor popularity on this device to stimulate a healthy developer community, I have decided to look into ROM building and what is required. I have followed this three part video in explaining how to build Lineage OS from source to a device. I have made it to part two where I download the Lineage OS source code to my Linux work-space. Where I get stuck is adding the source to the ROM. The question now is How do I attach the Lineage OS source code to the kernel source code for this device?
Information sources...
Part 1 https://www.youtube.com/watch?v=iZmjOlUq_3c&t=1s
Part 2 https://www.youtube.com/watch?v=MGI3NSJFtKA
Part 3 https://www.youtube.com/watch?v=AJCgOHtli64&t=153s
Current Kernel source code from Asus https://www.asus.com/ca-en/Phone/ZenFone-4-ZE554KL/HelpDesk_Download/
Just ordered one. I've never built Lineage OS either, but maybe we can work together to figure it out.
I have the lineage OS sorce code ready to compile on my system. I just need to know how to add the nesary kernel with it. Any ideas?
Any progress?
Sent from my [device_name] using XDA-Developers Legacy app
Nope! Unless you have anything to contribute.
someaguy said:
As there is no interest nor popularity on this device to stimulate a healthy developer community, I have decided to look into ROM building and what is required. I have followed this three part video in explaining how to build Lineage OS from source to a device. I have made it to part two where I download the Lineage OS source code to my Linux work-space. Where I get stuck is adding the source to the ROM. The question now is How do I attach the Lineage OS source code to the kernel source code for this device?
Click to expand...
Click to collapse
I also looked into building Lineage, seems like it's going to be more than I'm willing to commit to, so I'll share what I found in hopes that it will help you or anyone else move forward with this.
I found this restored CM wiki page on the subject: fat-tire.github.io/porting-intro.html (Sorry, can't make it clickable since I'm new)
The gist seems to be that you need to make three directories in the lineage source (note z01kd appears to be the codename for the Zenfone 4 based on the build.prop file I pulled from my phone)
device/asus/z01kd - Device file tree
kernel/asus/z01kd - Kernel
vendor/asus/z01kd - Proprietary blobs
In the above CM guide, it says to use ./build/tools/device/mkvendor.sh to generate the Device file tree from a boot.img file extracted from an update.zip (from Asus) or extracted from the phone, but that didn't work with the version I was trying to do (15.1), mkvendor.sh wasn't there at all. So I explored option #2 which was to fork an existing device file tree repo from a similar device and tweak it for the device you want to port and I found that the Zenfone Max Pro M1 (X00TD) (github.com/LineageOS/android_device_asus_X00TD) is the closest lineage supported device that we could copy from (at least that I could find). It looks like you might even be able to use the same kernel as that device (github.com/LineageOS/android_kernel_asus_sdm660) because the SOCs are pretty close (Snapdragon 630 vs Snapdragon 636), but you may need to use the stock kernel that you linked to in your original post, not sure.
There's a part in the lineage docs about building from source (only for supported devices) (wiki.lineageos.org/devices/X00TD/build#extract-proprietary-blobs) about extracting proprietary blobs (wiki.lineageos.org/extracting_blobs_from_zips.html) for the vendor/asus/z01kd folder. It said that you could use a lineage update.zip, but I was able to do it with the Asus update.zip. Don't know if that will work or not, but it seems like the only option since the Zenfone 4 doesn't have a lineage update.zip to pull proprietary blobs from.
And that's about as far as I got
Once you have those three folders set up and properly configured you should in theory be able to build it.
Update 9/3/2018
I just found the device file tree and kernel for Zenfone 4 that @shakalaca used to build TWRP. Looks like there are some different naming conventions from what lineage would expect (omni_Z01K.mk vs lineage.mk), but a lot of the stuff looks to be the same (eg BoardConfig.mk) and the files that do have a different name look like they're roughly equivalent.
github.com/TeamWin/android_device_asus_Z01K - Zenfone 4 TWRP device file tree
github.com/shakalaca/android_kernel_asus_ze554kl - Zenfone 4 TWRP kernel
Between these and the above X00TD device file tree and kernel links, we should be able to get pretty close to a working config.
What if you compile what you have and see if it boots on your device?
someaguy said:
What if you compile what you have and see if it boots on your device?
Click to expand...
Click to collapse
Sorry...I already deleted the environment I had set up, to reclaim the 50+ GB of disk space.
If it's any consolation, I never made it far enough for it to build successfully.
I am trying to build Lineage OS too
In this guide(https://forum.xda-developers.com/chef-central/android/guide-android-rom-development-t2814763)
It says we need three files(device tree,kernel,vendor) to build it.
We have kernel and device tree from github(https://github.com/TeamWin/android_device_asus_Z01K)
but we still need vendor from our device,and the commend under this guide(https://www.isthnew.com/archives/build-lineageos.html) says that we can get vendor files by running "extract-files.sh".
But where can we find that?
(Sorry for my bad English
rol.
try to look here.https://forum.xda-developers.com/pr.../tool-capire-le-treble-terble-vendor-t3774629
I have tried that CLT project,but it didn't work
Maybe use this?
https://forum.xda-developers.com/axon-7/development/tool-party-v0-1-vendor-partition-t3831517

Categories

Resources