How can a developer port LineageOS to an unsupported device? - Android Q&A, Help & Troubleshooting

My question is really simple: How can I make an unofficial port of LineageOS? I've read this, which is based on an article from the (now death) CM Wiki, but some files (e.g. the mkvendor.sh script) are in older CM repos/branches. According to what I've read, there's not a full guide explaining the porting process since every device has its own tweaks (I imagine that it's due to ARM's nature)
What I want to do: Port LineageOS (the latest version) to the Samsung Galaxy Ace 4 Neo SM-G136ML (codenamed vivalto3mve3gltn). However there's not a LOS port at the latest version for a similar device which I could fork, so this would be "from scratch" in some way. I've seen Lineage's android repository at github but idk what are those xml files (they are definitively not the source code of a whole OS) EDIT: I realized that I had to clone it with `repo init`
What I've done so far: Documented myself as much as I could, read about how to get the vendor files, firmwares, kernel sources (in fact I requested the kernel source code for the device to the vendor), build.prop, recovery.fstab, and recovery/boot images.
My skills: I have a lot of experience with the GNU/Linux OS and I know some Linux kernel hacking, in fact I'm used to compile kernels for the x86_64, i686 and armv7h arch'es (not the vanilla kernel itself, but the Linux-libre kernel, which is basically vanilla but without binary blobs) and also patch them, and test them, etc. Besides kernel-stuff, I know shell scripting, advanced use of git (git clone, commit, add, push, remote, fetch, diff, apply, and more), use Heimdall, install custom recoveries and ROMs, and some advanced (non-noob ) Android hacking (Idk Java, C nor C++, however)
I know that here at XDA we've very talented developers who have experience with this, and much more. The only thing I need is some guidance to help me in my way to contribute the FLOSS community, I say this because when I asked in the LineageOS IRC channel if there was an official or well documented and updated guide, step-by-step, tutorial to port LOS that I could follow, someone answered me "it's impossible to have something like this", but I believe that there's ppl here who can demonstrate me the opposite
Thanks in advance

(...) I requested the kernel source code for the device to the vendor
Click to expand...
Click to collapse
Here it is https://gitlab.com/Megver83/android_kernel_samsung_vivalto3mve3gltn

Related

Forking and porting CM7 to an unsupported device? (Gio GT-S5660M)

Hello,
So far, I have:
A working Android build environment (Ubuntu 11.10 x64).
Managed to build, install and boot AOSP on my Nexus S. (I have downloaded but not attempted to build CM7 yet.)
Created a Github account.
Samsung's open source files for my target device, the Galaxy Gio GT-S5660M.
I've read some documentation and forum posts about Github, but I remain unsure as to what I should do to fork in a way that:
I'll be able to keep on syncing the remainder of the code.
My new device directories and modifications could be brought back (pulled?) to the main CM7 code base.
Will avoid needless frustrating re-downloads of the source code.
Thanks in advance,
Darkshado
After some further reading, I'm beginning to grasp some git basics...
I've forked two CM7 repos so far, added them as remotes in the appropriate installations. (Instead of forking and cloning, since I already had repo sync'ed the whole CM7 source. My commits show up on Github like they should, and I should be able to merge in commits to the origin remotes.)
I'm not going to do any pull requests until I've managed to build and boot.
By the way, yesterday I attempted to build AOSP with a bunch of files overwritten by the Samsung sources (that's how they tell you to do it!!) and this failed, as I expected.
Goodbye,
Darkshado
Update: I'm currently trying to port CM7 to the Gio 5660M. Still attempting a first successful build as I'm writing these lines.
My main issue so far has to do with the camera. I get the following error message:
make: *** No rule to make target « out/target/product/gio5660M/obj/lib/libcamera.so », needed by « out/target/product/gio5660M/obj/SHARED_LIBRARIES/libcameraservice_intermediates/LINKED/libcameraservice.so ». Stop.
After toggling off the camera by using the stub, I hit the same error further into the build with this:
make: *** No rule to make target « vendor/samsung/gio5660M/proprietary/wifi/ath6k/AR6003/hw2.0/athtcmd_ram.bin », needed by « out/target/product/gio5660M/system/wifi/ath6k/AR6003/hw2.0/athtcmd_ram.bin ». Stop.
I know this has to do with makefiles, but that's about it...
Thanks in advance for any help,
Darkshado
hi i'm interested too.
hi I found your github because I also interested poriting cyanogemod to galaxy gio korea(SHW-M290K). the device hardware is different from s5660. so I need some modification.
and your libcamera problem is that there is some reason that the make system can't find libcamera.so, so they cannot compile libcamera service. it should be in ./vendor/samsung/gio/proprietary according to your extract-files.sh .
have one cuorisity. I searched gio android device make file. and none of them are relreased source code. how did you make them?
I found this information. it may help you.
http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1_PortingGuides
I'll have to update my Github, hadn't been in a rush due to lack of progress, but now my problem lies with libaudio instead.
I got the Samsung sources for the 5660M on their open source website, although I mostly worked with the CM7 ports for similar devices like Tass and Cooper as well as a Gio source provided by Phiexz but it didn't build either.
Thanks for the link, I'll check it out.
proprietary does not help
do you have any progress since last time?
well, I admit that proprietary files does not help.
does your s5660m hardware identical to s5660v?
becasuse galaxy gio in Korea(shw-m290k,shw-m290s) does different hardware.
well in this case, like me, you need to hack into not only android pdk, but also android kenel.
I have seen that phiexz has released kernel with latest cyanogenmod kenel in his github and I am modifing it to shw-m290k. there are some hardware differences i have to apply to.
I suggest you to compare phiexz's kernel and samsung original kernel from samsung opensource homepage.
My problem right now is that I don't have that much spare time to put into this, and that I'm very much learning as I go, so progress is not always that quick. Also, I'd like to get my Touchwiz based ROM updated and working properly before trying to build AOSP or CM again.
Another thing I want to try is building the kernel (probably based on Phiexz's) that will support ext4, and compare performance of the Touchwiz ROM on ext4 versus RFS.
As far as we can tell, GT-S5660 (Europe/Asia) GT-S5660M, L and V are identical except for the radio firmware. People with the 5660M initially encountered issues after flashing 5660 ROMs because they also contained the AMSS image.
my cyanogen kernel is based on samsung open source kernel
because cm-kernel on cyanogenmod github dont support our device, if we wnt use that kernel we must add some hardware pofile & board for galaxy gio
so alternative is make samsung's open source kernel compatible with cyanogenmod
Wouldn't it be much better from a code maintainability standpoint to make the CM kernel work on the Gio? (Also if you ever hope to get official CM team support, that's a given.)
The way I understand repo and git, you could create a github repo for your device and board configs and add those to your repo manifest so the whole CM7 source and your modifications all sync properly.
I've forked the CM7 manifest files off github, added my gio files and removed all those extra devices I didn't need, so my repo syncs are much faster too. (The idea comes from http://slightlymorethanworthless.blogspot.com/2011/05/remove-unwanted-devices-from.html)
hey a quick question...
just starting out here..
i'm on win7 32 bit, going to run ubuntu on virtualbox.
shud i choose ubuntu 32 bit or 64?
sorry for OT.
doesn't really matter
roofrider said:
hey a quick question...
just starting out here..
i'm on win7 32 bit, going to run ubuntu on virtualbox.
shud u choose ubuntu 32 bit or 64?
sorry for OT.
Click to expand...
Click to collapse
doesn't really matter. but compiling process needs much cpu power. so 64x would be better.
Well, im not a dev or a user of gt5660m, but good luck to you, hope u can finally port it
Sent from the GUN in my pants
darkshado, if you have same problem untill now.
http://strazzere.com/blog/?p=220
look this page. and check out koush's proprietary page. especially for samsung cooper(galaxy ace). because many of kernel procedure are same for gio.
https://github.com/coolya/android_device_samsung_cooper.git
https://github.com/koush/proprietary_vendor_samsung
i've upload galaxy gio source + proprietary files for galaxy gio
please see & help to fix some problem
github.com/phiexz
Darkshado said:
Hello,
So far, I have:
A working Android build environment (Ubuntu 11.10 x64).
Managed to build, install and boot AOSP on my Nexus S. (I have downloaded but not attempted to build CM7 yet.)
Created a Github account.
Samsung's open source files for my target device, the Galaxy Gio GT-S5660M.
I've read some documentation and forum posts about Github, but I remain unsure as to what I should do to fork in a way that:
I'll be able to keep on syncing the remainder of the code.
My new device directories and modifications could be brought back (pulled?) to the main CM7 code base.
Will avoid needless frustrating re-downloads of the source code.
Thanks in advance,
Darkshado
Click to expand...
Click to collapse
Really the best kernel for your phone is here:
http://forum.xda-developers.com/showthread.php?t=1991020
BLN enabled, optimized&stable kernel, jelly bean look
Whoa! Zombie thread!
Dude: the ROM you linked was published over a year after my original post in this thread. I'm pretty sure there was NO CM7 build available for the Gio back then. That's what I was trying to work on, but got beat to the punch by Maclaw and a couple others. (Hard-bricking my Gio and having a sluggish laptop to build on didn't help.)
Besides, I got rid of my Gio a long time ago. I enjoy my Note 2 and keep my Nexus S as backup.

[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

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

Working on/building more than one custom ROM

I wanted to learn about some best practices about working on more than one Custom ROM (for the same device), I already have a working LineageOS build environment for my device (kebab).
I want to get to see how building an other ROM differs from the LineageOS building process, if a ROM has any sketchy Google requirements I don't like, and how functional a ROM is when building it with the device trees and kernel sources provided by LineageOS. Don't worry, I don't want to create buggy binaries of 10 different ROMS, post them on XDA and abandon them after two days. I just want to get more experience and try to build other ROM's myself, and to see what modification are required for a ROM port.
Is it possible copying some source code from my working LineageOS building environment so that repo doesn't have to re-download everything?
Is it okay to use the same ccache for both ROM's, so that I don't to re-compile binaries these both ROM's share? (As of my understanding, ccache keeps my build times lower when re-building a ROM, is that right?)
Any other tips about managing multiple building environments are appreciated! Thanks!

Categories

Resources