How to build LineageOS 17.1 for the Lenovo Tab4 10 Plus - Thinkpad Tablet General

Introduction
After being a user of LineageOS for some years, I wanted to do the next step and also be able to create my own build of LOS. After some futile attempts I finally succeeded in building LOS 17.1 for the Lenovo Tab 4 10 Plus. Meanwhile even the fingerprint sensor is working, so that I think it's time to upload my builds somewhere and share them with others. In the meantime I thought it might be interesting for some out there to get a step by step instruction on how to build LOS for the Tab 4 10 Plus.
Part 1: Setting up Ubuntu 20.04 as build system
I'm a Windows user myself. Since building LOS (AFAIK) is requiring a Linux system for building (I tried with Windows Subsystem for Linux once but failed), I went for installing Ubuntu 20.04 inside a VM. VMWare Player is IMO a good choice because it's free and it allows routing USB devices to the guest system, so that it's even possible to use adb commands from within the Linux guest system and access an Android device attached via USB to the host. For this build of LOS this is not necessary, but it can be nice. But probably any VM software or, of course, a native Ubuntu 20.04 will do.
I used the following settings for the Ubuntu VM:
- 16 GB RAM
- 250 GB HDD (8 GB I used as swap space, the rest I gave to the mount point "/")
- USB compatibility I set to 3.1 and set the checkboxes for showing all USB devices and for sharing them with the VM
The above USB settings don't matter for the build. But with less RAM (inkl. swap) or less HDD space I had problems during my first attempts, even though I suspect that a bit less or RAM and HDD space might be possible. But with these settings you should be on the safe side. I opted for the full Ubuntu installation, because I did not want any tools missing that might be needed for the build. Perhaps the minimal installation would also do.
Part 2: Building LOS
There is an official documentation on how to build LOS (in this case for the device "bacon") which can be found here: https://wiki.lineageos.org/devices/bacon/build
During my first attempts of building LOS some of the commands, e.g. "repo sync" would initially fail. As far as I understood this is due to the "python" command missing in Ubuntu 20.04 after the initial setup. "python3" is available. So the first thing I did is adding a symlink "python" that points to python3:
sudo ln -s /usr/bin/python3 /usr/bin/python
After this we can follow the official LOS build documentation for some steps. So first download the Android platform tools from Google and then move to the directory where you downloaded the zip file to, e.g. via
cd Downloads
Next unzip the file (mind that the version no. inside the zip might need to get adjusted):
unzip platform-tools_r31.0.2-linux.zip -d ~
Like the build docs say we now need to add some lines to the file ~/.profile. So type
nano ~/.profile
This will start the nano editor. There right-click and paste the following lines and the end of the file:
# add Android SDK platform tools to path
if [ -d "$HOME/platform-tools" ] ; then
PATH="$HOME/platform-tools:$PATH"
fi
Then press Ctrl O, Enter and Ctrl X to save and exit and then make sure that the changes get used:
source ~/.profile
Next the documentation says that a couple of software packages need to get installed. As of writing this guide, this can be done via
sudo apt-get install bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5 libncurses5-dev libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev
Afterwards some folders need to get created:
mkdir -p ~/bin
mkdir -p ~/android/lineage
Next the repo command needs to get downloaded and made executable:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
After this we again need to source the .profile file:
source ~/.profile
The ~/bin directory is already added to the path in the .profile of Ubuntu 20.04, so that there is no need to add it.
Next we need to setup the user email and name for the git commands. So replace the email address and name in the following commands:
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
Now we can change to the LineageOS directory we created above and check out the code:
cd ~/android/lineage
repo init -u https://github.com/LineageOS/android.git -b lineage-17.1
repo sync
Next I set up the build environment via
source build/envsetup.sh
At this point we need to deviate from the official build documentation and create a file .repo/local_manifests/TBX704.xml with the specific configuration for the Tab 4 10 Plus:
mkdir .repo/local_manifests
nano .repo/local_manifests/TBX704.xml
Then paste the following XML code into this file, then use Ctrl O, Enter and Ctrl X to save and exit:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="LineageOS/android_device_lenovo_TB8703" path="device/lenovo/TB8703" remote="github" />
<project name="LineageOS/android_device_lenovo_TB8704" path="device/lenovo/TB8704" remote="github" />
<project name="LineageOS/android_device_lenovo_TBX704" path="device/lenovo/TBX704" remote="github" />
<project name="LineageOS/android_device_lenovo_tb-common" path="device/lenovo/tb-common" remote="github" />
<project name="lenovo-devs/android_kernel_lenovo_msm8953" path="kernel/lenovo/msm8953" remote="github" />
<!-- Vendor -->
<project name="lenovo-devs/proprietary_vendor_lenovo" path="vendor/lenovo" remote="github" revision="lineage-17.1-gxfp" />
</manifest>
Afterwards I again executed
source build/envsetup.sh
Not sure if the last one is needed, but it won't hurt. In the same way I'm not sure whether the following repo sync -c is necessary or whether we might have skipped the repo sync above and only use the following command, but I did
repo sync -c
Now we are ready to prepare the build for the Lenovo Tab 4 10 Plus and then start the build.
lunch lineage_TBX704-userdebug
mka bacon
This will take some hours. You might have noticed that I skipped setting up ccache, which is done in the official documentation. This is not a necessary but an optional step. For the first build this won't matter. For subsequent builds activating ccache might speed up the build. But it also uses up some space on the hard drive (the recommendation in the build docs is 50GB, or 20GB when activating compression). Once the build was finished successfully, you should find the zip file with the LOS image in out/target/product/TBX704/.

Thanks for sharing @Ecthelion4
A quick couple of questions.
1. Can you share details of the machine (RAM, HDD/SSD, OS, OEM) on which you build this !
2. Any details on if this would work with 8Gigs of RAM?
3. Any ideas on if this can work on MacBook Air M1 with 16Gigs of RAM + 256 Gigs of SSD?
Thanks

VGisHere said:
Thanks for sharing @Ecthelion4
A quick couple of questions.
1. Can you share details of the machine (RAM, HDD/SSD, OS, OEM) on which you build this !
2. Any details on if this would work with 8Gigs of RAM?
3. Any ideas on if this can work on MacBook Air M1 with 16Gigs of RAM + 256 Gigs of SSD?
Thanks
Click to expand...
Click to collapse
Re 1: I'm working on a Windows 10 machine with an AMD Ryzen CPU. But the exact machine specs aren't that important, as long as you fulfill the minimum specs I listed in Part 1 above. More CPU cores of course help for getting the build done more quickly.
Re 2: If you can't affort to add more than 8 GB of physical RAM, then I would assume that the build will still work, as long as you assign 16 GB or more of swap space.
Re 3: The limiting factor in this setup could be the harddisk space. Would it be possible to add an external harddisk and then build on that device? An additional question will be whether to use a VM or not. I don't know whether there is VMWare or another VM solution that would allow you to create an Ubuntu 20.04 image on one of the latest M1 BacBooks. If that is the case, then you could try using my above build instructions on such a VM. I am not sure, though, whether everything will work the same way on the ARM-based M1 CPU, but it should do. For a native MacOS M1 build I cannot help. A search on the internet might reveal better instructions for this than mine.

How's the OS working on your tablet? I have a TB-X704F and am pretty fed up with the lack of official updates.

bryangb said:
How's the OS working on your tablet? I have a TB-X704F and am pretty fed up with the lack of official updates.
Click to expand...
Click to collapse
It's working fine, just like the LOS 17.1 version from codeworkx. There is a separate thread for the 17.1 version for the Tab 4 10 Plus where I posted the latest builds.

Hey, thanks for this!
Funny I find this thread when looking for a guide on "how to build android" and it points to exactly my device!
I am interested in building LOS for lenovo TB8704 myself and I have a pretty good understanding of how it works based on your tutorial.
One thing I don't fully understand is. You pull the sources from LineageOS/android_device_lenovo_tb-common but lenovo-devs/android_device_lenovo_tb-common is used in the other TB8704 thread ( [ROM][UNOFFICIAL][10.0][tb8704f/x/v] LineageOS 17.1 for Lenovo TAB 4 8 plus) which is a fork of the first repo. Is there any reason for that? Especially because there is not difference for the branch 17.1. Same for lenovo-devs/android_device_lenovo_TB8704.
Besides that. When you build a new rom, with the latest security fixes, how do you do that? I assume you merge an other repo first? Do you have any idea how that works?
That would be great. I want to get my understanding straight before I jump into hours of compiling.
Thanks again, really appreciate your time writing this guide.
Greeting

sxe said:
Hey, thanks for this!
Funny I find this thread when looking for a guide on "how to build android" and it points to exactly my device!
I am interested in building LOS for lenovo TB8704 myself and I have a pretty good understanding of how it works based on your tutorial.
One thing I don't fully understand is. You pull the sources from LineageOS/android_device_lenovo_tb-common but lenovo-devs/android_device_lenovo_tb-common is used in the other TB8704 thread ( [ROM][UNOFFICIAL][10.0][tb8704f/x/v] LineageOS 17.1 for Lenovo TAB 4 8 plus) which is a fork of the first repo. Is there any reason for that? Especially because there is not difference for the branch 17.1. Same for lenovo-devs/android_device_lenovo_TB8704.
Besides that. When you build a new rom, with the latest security fixes, how do you do that? I assume you merge an other repo first? Do you have any idea how that works?
That would be great. I want to get my understanding straight before I jump into hours of compiling.
Thanks again, really appreciate your time writing this guide.
Greeting
Click to expand...
Click to collapse
Regarding the fork of the Lenovo common device code I can't tell you why this was done. I only took the existing repos I found in the first posting, got some help from codeworkx with some details about building the code and then setup a build. Maybe codeworkx can answer this question, but I cannot. If there are no changes in the forked repo, then it might be possible to simply use the original repo. Perhaps you can try it out?
When starting a new build I usually do cd ~/android/lineage in my existing VMWare image, then source build/envsetup.sh, then repo sync -c (perhaps adding switches for forcing the sync, if the simple sync should fail), then lunch lineage_TBX704-userdebug, followed by mka bacon.

Ah that was fast. Thanks
Yeah I might do that. Problem is, I am not in any position to judge the outcome. So I wouldn't know what differences to looks for, especially cause I installed the rom for the first time yesterday. I am running Linux anyway tho, so I don't use a VM and building shoudl be much faster.
CHeers

Hey mate, I am running my own rom now, so it was successful.
Now teh fun begis figuring out if there is other stuff to tweak. A different kernel maybe or who knows what.
Thanks again!

Hi, I am trying to use this guide to build with lineage 19.0 source, let me know if this guide works just by replacing 17.1 with 19.0. TIA

I never tried, but I would expect it's not so easy as to just exchange the version.

2 years ago I made a docker-compose for the lenovo. I have *not* been using it ever since however the good news is that in those days I was able to run it from Docker-desktop (so on windows). Have a look if you are interested its using the 18.1 version of lineage. as my docker-desktop is now 'broken' I cannot see if it works It still works after today's changes even on WSL, my 32 GB laptop is struggling though. https://github.com/rutgerellen/lenovo_tab4plus_build_docker <-- look at this

Related

[GUIDE][CM12] Compiling CM12 for Moto G and cherry picking features.

Here's a little something for the guys (and flashaholics) who don't like to wait for devs to release new CM12 builds.
AFAIK ROMS CAN'T BE COMPILED ON 32 BIT SYSTEMS. ONLY 64 BIT.
YOU CAN USE ANY DISTRO YOU WANT. I USE UBUNTU 14.10 DUAL BOOTED, BUT THAT'S JUST A PERSONAL PREFERENCE.
We start with setting up the build environment:
First, start with installing this:
Code:
sudo apt-get install bison build-essential curl flex git gnupg gperf libesd0-dev libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-6-jdk openjdk-6-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
Once that is done, we go about installing JDK-7 since that's the one that works for lollipop
Code:
sudo apt-get install openjdk-7-jdk
Then we install the Android SDK for some useful stuff:
Code:
sudo apt-get install android androidsdk-uiautomatorviewer android-copyright android-src-vendor android-emulator android-tools-adb android-headers android-tools-adbd androidsdk-ddms android-tools-fastboot androidsdk-hierarchyviewer android-tools-fsutils androidsdk-traceview
Once all that is dealt with, we can move on to the repo tool. That's what will get your CM repos syncing:
Code:
mkdir -p ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
and then, reboot to apply the changes.
Now for the interesting part
Not really, actually.
Time to yank the CM source code.
Create a working directory where you're going to sync all the sources and do the dirty stuff.
For this guide, we'll call the working directory "cm12"
Create the directory by running
Code:
mkdir cm12
enter your working directory by typing
Code:
cd cm12
Inititialize the repo by throwing in:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-12.0
Wait for all the activity in the terminal to cease. And then type in:
Code:
repo sync
while the stuff is downloading, grab a ginger ale, or a cup of coffee and admire your handiwork. If you're the impatient type, find a generous dose of your favourite sedative, and knock yourself out for a few hours. When you're up again, you'll be faced with one of two things. Either your repos have synced successfully (yay!), or you get some nasty fetch errors. If it's the latter, then, Voila! You've just faced your first ever compiling frustration. Take some time out and break a few things, drive the neighbours crazy and then return to the PC and knock in:
Code:
repo sync -j1
This should (hopefully) work perfectly as long as you have an internet connection worth paying for. If not, then compiling probably isn't for you anyway.
Once all that stuff's over, create a folder called
Code:
local_manifests
in the .repo folder, and then make a new file in that folder called
Code:
roomservice.xml
open roomservice.xml using gedit, and add the following:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="CyanogenMod/android_device_motorola_falcon" path="device/motorola/falcon" remote="github" revision="cm-12.0"/>
<project name="CyanogenMod/android_device_motorola_msm8226-common" path="device/motorola/msm8226-common" remote="github" revision="cm-12.0"/>
<project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-12.0"/>
<project name="CyanogenMod/android_kernel_motorola_msm8226" path="kernel/motorola/msm8226" remote="github" revision="cm-12.0"/>
<project name="TheMuppets/proprietary_vendor_motorola" path="vendor/motorola" remote="github" revision="cm-12.0"/>
<project name="CyanogenMod/android_hardware_qcom_fm" path="hardware/qcom/fm" remote="github" />
</manifest>
Then cd back to your working directory
Code:
cd ~/cm12
YOU'RE READY TO ROLL!
Finally, to build, type in:
Code:
. build/envsetup.sh && brunch falcon
If you have a really powerful PC, then use:
Code:
. build/envsetup.sh && brunch cm_falcon-userdebug -j8
And if you have a really really powerful PC, then use:
Code:
. build/envsetup.sh && brunch cm_falcon-userdebug -j16
Wait for the build to compile. Usually takes about 2-3 hours on an okay PC. You'll find your completed build in cm12/out/target/product/falcon.
The next time you want to build, run:
Code:
make clean
repo sync
. build/envsetup.sh
brunch falcon
.. and so on.
Happy Building!
What're you looking at? This is mine!
One more. Just in case.
Thought I'd add to this
Instead of breakfast and editing room service
U can manually create a folder in .repo folder name it local_manifests make a file say falcon.xml
Add contents required Im on phone now will share the code in a while
Oh and brunch falcon is enough no need adding cm_falcon-userdebug part
Thank you for the guide! (I am limited to 8 thanks per day so ill hit the thanls button tomorrow xD ) You might want to add a few more details on why we use linux distros as our compiling OSes and what toolchains, etc. are. After all those 2 reserved posts do need to be put to use.
bharat_goku said:
Thought I'd add to this
Instead of breakfast and editing room service
U can manually create a folder in .repo folder name it local_manifests make a file say falcon.xml
Add contents required Im on phone now will share the code in a while
Oh and brunch falcon is enough no need adding cm_falcon-userdebug part
Click to expand...
Click to collapse
I know. But for the time being, brunch falcon -j8 doesn't work. It requires cm_falcon..... And, yeah. I was going to add that when I logged on to Ubuntu next.
Where is cherrypicking?
fabus said:
Where is cherrypicking?
Click to expand...
Click to collapse
I'll be typing out a guide for that once my hands get over this long post.
rudi_j7 said:
I know. But for the time being, brunch falcon -j8 doesn't work. It requires cm_falcon..... And, yeah. I was going to add that when I logged on to Ubuntu next.
Click to expand...
Click to collapse
I don't normally use -j8 so not sure
Add the ccache step for users I get my build ready within about 50minutes roughly by assigning 25gb find it more efficient this way,gimme a bit I'm making a new build I'll test the -j8 part then
bharat_goku said:
I don't normally use -j8 so not sure
Add the ccache step for users I get my build ready within about 50minutes roughly by assigning 25gb find it more efficient this way,gimme a bit I'm making a new build I'll test the -j8 part then
Click to expand...
Click to collapse
I use -j8 and -j16 when I'm in a hurry... and it does work. And, right now i was just focusing on adding the most basic stuff. It takes some time and effort to type out so much.
First of all,thanks for the tutorial.
But i have a question,wich distro you use? Linux? Ubuntu? And wich number? And do you use dualboot or native? Or you have an Virtual Machine? Please,i want to know wich should i use
DeHuMaNiZeD said:
First of all,thanks for the tutorial.
But i have a question,wich distro you use? Linux? Ubuntu? And wich number? And do you use dualboot or native? Or you have an Virtual Machine? Please,i want to know wich should i use
Click to expand...
Click to collapse
Personally, I dualboot Ubuntu 14.10 on a 1TB HDD and 128 GB SSD. Virtual machines are usually much much slower, but more convenient. It all depends on whether you want to take the trouble to set up a dual boot or not.
rudi_j7 said:
Personally, I dualboot Ubuntu 14.10 on a 1TB HDD and 128 GB SSD. Virtual machines are usually much much slower, but more convenient. It all depends on whether you want to take the trouble to set up a dual boot or not.
Click to expand...
Click to collapse
Well,i'll try to configure it,but i did this a long time ago and i'm not shure do i remember. Thanks man
I built this for a friend of mine, but he says CDMA doesn't work. Any fix?
topias123 said:
I built this for a friend of mine, but he says CDMA doesn't work. Any fix?
Click to expand...
Click to collapse
So far CDMA isn't working on CM12, but there's another thread in the general section where I think CDMA works.
Sent from my OnePlus One using XDA Premium 4 mobile app
Nice tutorial,and will it be same for if we compile paranoid 5.0 ? and i learned somewhere that there are patches also to fix some basic things ?
Bhavy123 said:
Nice tutorial,and will it be same for if we compile paranoid 5.0 ? and i learned somewhere that there are patches also to fix some basic things ?
Click to expand...
Click to collapse
Generally I suppose it would be the same except for the local_manifest entries. Dunno about the patches. I haven't gone about building PA 5.0.
Sent from my OnePlus One using XDA Premium 4 mobile app
You r such a big developer and even wrote such a wonderful guide but plz write for porting latest multirom for Falcon also ,I didnt understood tassador's guide as i am a newbie,sorry if i went offtopic
Bhavy123 said:
You r such a big developer and even wrote such a wonderful guide but plz write for porting latest multirom for Falcon also ,I didnt understood tassador's guide as i am a newbie,sorry if i went offtopic
Click to expand...
Click to collapse
I'm no big dev. Always learning. About multiROM, my friend is already porting it. If he's stopped work, I'll PM you a guide.
Sent from my OnePlus One using XDA Premium 4 mobile app
Thaaank you man for that guide!
It absolutely worked for me, awesome! So glad to know how to compile my own rom now

[GUIDE] How to compile SlimLP (for d802)

Hello,
as the title says I want to help people who want to compile SlimLP Beta 0.6 for d802 themselves. I am myself a newbie to this, but found somehow out to get it working and want to share my findings. This will likely work for most d8xx versions. I make special notes where I guess you need to do a change for your d8xx version if it's not a d802.
Requirements
you need to know how to use a terminal
64-bit Linux
8GB of memory (swap counts)
at least 100GB of free disk space
recommended is also the lp bootstack and Cloudyfa's Modem
I used a VirtualBox VM with 4GB of memory with 4GB of Swap and 3 CPU Cores. I use Ubuntu 14.04 LTS (x64). If you use a different system, you might want to read the sources of these instructions.
Side Note: If you use a VM,please use "fixed size" hard disk, because dynamic allocation may lead to segmentation faults later, that are hard to track. For exchange of data you can use a shared folder or Airdroid or the likes.
100GB is adviced for compiling a single device source. 150GB is for single device with CCache. 200GB+ is for CCache and multiple devices I'd say. CCache will not be explained here, but is explained in the initializing source. Just you know it exists and it accelerates rebuilds.
Setup tools
ctrl+alt+t (on Ubuntu) to open the terminal and type in:
Code:
$sudo apt-get update
$sudo apt-get install openjdk-7-jdk
$sudo apt-get install phablet-tools
$sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zlib1g-dev:i386 zip
(the last command might be different on different OS versions see Source)
Setup and acquire the source
Code:
$mkdir ~/SlimLP
$cd ~/SlimLP
$repo init -u git://github.com/SlimRoms/platform_manifest.git -b lp5.1
Open or create a file in ~/SlimLP/.repo/local_manifests/slim_manifest.xml (.repo is hidden)
And insert the following text:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="TheLoonyBin/proprietary_vendor_lge" path="vendor/lge" remote="github" revision="lp5.1"/>
<project name="SlimRoms/device_lge_d802" path="device/lge/d802" remote="github" revision="lp5.1" />
<project name="SlimRoms/device_lge_g2-common" path="device/lge/g2-common" remote="github" revision="lp5.1" />
<project name="SlimRoms/kernel_lge_msm8974" path="kernel/lge/msm8974" remote="github" revision="lp5.1" />
</manifest>
Now download source and blobs. This takes some time, so get you a beer and wait
Code:
$cd ~/SlimLP
$repo sync
(Source)
Note: You can ignore the error from repo init.
Note2: It downloads ~30GB (compressed, so actual size is way lower) and this process takes some time mostly depending on the download rate.
Note: If you want to compile for another manufacturer's device you might want to check TheLoonyBin. An alternative might be TheMuppets, that is used by CM afaik.
Prepare make
Code:
$cd ~/SlimLP
$. build/envsetup.sh
$lunch slim_d802-userdebug
Note: When you just use $lunch you see all available options
go to ~/SlimLP/kernel/lge/msm8974/arch/arm/configs
copy the name of the file (it's "slim_d802_defconfig" for d802)
open ~/SlimLP/device/lge/d802/BoardConfig.mk with a texteditor
replace "cyanogenmod_d802_defconfig" with "slim_d802_defconfig"
As of 13.09. it is no longer necessary to edit the BoardConfig.mk (see)
Make your own build with blackjack and hookers.
Code:
$cd ~/SlimLP
$make -j4 bacon
Note: -j specifies how many threads are used in the compiling process.
After a few hours depending on the memory, disk speed and CPU power you have your fresh SlimLP build. Have fun.
Credits:
Google
SlimROMs
TheLoonyBin
Josue Rivera (he explained the procedure for SlimKat to someone here)
Kind Regards
NetDwarf
PS: Subsequent (updated) compiles are realized by:
Code:
$cd ~/SlimLP
$make clean
$repo sync
$. build/envsetup.sh
$lunch slim_d802-userdebug
$make -j4 bacon
Don't omit the point in the fourth line and this is the save way to do it, but you can usually omit make clean
Nice, thanks
Nice tutorial, thanks for sharing your hard work.
NetDwarf said:
replace "cyanogenmod_d802_defconfig" with "g2-open_com-perf_defconfig"
Click to expand...
Click to collapse
Simply change to slim_d802_defconfig
https://review.slimroms.eu/#/c/5818/1/BoardConfig.mk
Still not merged lol..
Tapatalk-kal küldve az én LG-D802-el
TaRsY said:
Simply change to slim_d802_defconfig
https://review.slimroms.eu/#/c/5818/1/BoardConfig.mk
Still not merged lol..
Tapatalk-kal küldve az én LG-D802-el
Click to expand...
Click to collapse
Thank you TaRsY, I will change my guide this way. I did not sync for 2 days and they already changed it Just in case you should follow the steps in the hide/spoiler. But it makes way more sense now with the naming.
NetDwarf said:
Thank you TaRsY, I will change my guide this way. I did not sync for 2 days and they already changed it Just in case you should follow the steps in the hide/spoiler. But it makes way more sense now with the naming.
Click to expand...
Click to collapse
As I can say last days arcardinal and gmillz are working on updating the G2 repos. You sould also check the review site: https://review.slimroms.eu/ and do a repo sync.
@arcardinal @gmillz Why are these commits not merged yet to fix kernel defconfig?
for example d802
https://review.slimroms.eu/#/c/4598/
https://review.slimroms.eu/#/c/5818/
TaRsY said:
As I can say last days arcardinal and gmillz are working on updating the G2 repos. You sould also check the review site: https://review.slimroms.eu/ and do a repo sync.
Click to expand...
Click to collapse
Good to hear. I will check reviews and repos and will update the guide accordingly.
One question, why do we do
Code:
make -j4 bacon
instead of
Code:
make -j4 d802
Shouldn't it be the second way?
errikosd said:
One question, why do we do
Code:
make -j4 bacon
instead of
Code:
make -j4 d802
Shouldn't it be the second way?
Click to expand...
Click to collapse
Sry for the late answer. I don't exactly know what "bacon" means in this context, but it's not referring to the OnePlus One. Might be referring to BaCon (Basic Converter), but I'm really only guessing.
Nice guide. But I do have one recommendation. Add the vendor repo to the local_manifest so it is automatically updated when you repo sync to fetch latest sources. Also I'll get those 2 commits merged.
Sent from my LG-D800 using Tapatalk
Thank you for the addition @gmillz. I added it to the guide

Guide - Introduction to Rom building/development

Hello everyone.
I’ve decided to build this tutorial in order to assist all developers and builders into the ROM and kernel development. I’ve felt motivating into writing this small post because I feel that the current information available is confusing and also do not provide the set of skills and information to help someone in the first steps.
This tutorial will be divided on:
The Machine Configuration
The tools of development
The Source
Hardware
Software
What to do to be able to Innovate
The Machine Configuration
In order to have a good machine configuration you should select your distro based on the packages which are provided to developers. In my opinion the best distros are Fedora and Ubuntu. It is important to learn a bit how Linux works in order to fully understand what we are editing as Android is nothing more than equivalent Linux system where you run java on a virtual machine. In other words, you’ll understand with time that many parts which are used on Linux Operating system it is also used on Android Operating System (example: bionic, kernel libs).
After you installed your Linux system you’ll need to prepare your machine for building. For that you’ll need to install the following packages:
Code:
sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven
sudo apt-get install openjdk-7-jdk
Code:
sudo apt-get install android androidsdk-uiautomatorviewer android-copyright android-src-vendor android-emulator android-tools-adb android-headers android-tools-adbd androidsdk-ddms android-tools-fastboot androidsdk-hierarchyviewer android-tools-fsutils androidsdk-traceview
After you have the basic packages installed we are going to add the repo instructions to you git in your machine. Basically this will interpret the source information when you are syncing new code from google repos and we’ll add to the folder /bin/repo.
To do that we’ll run.
Code:
[B]mkdir -p ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo[/B]
And run the /.profile. Basically this command will reload information of the new settings for your profile, where it’ll read the folder ~/bin/repo information for all situations. In the future only makes sense to load again in case you have added a new repo instruction.
Code:
[B]. ~/.profile[/B]
Now we are going to sync the source code. I’ll use here as an example CyanogenMod as I believe to be the easiest for anyone which is starting. Lets imagine we are going to put all the source on a folder named cm, you’ll have to just run the following commands.
Code:
[B]mkdir ~/cm
cd ~/cm
repo init -u git://github.com/CyanogenMod/android.git -b cm-13.0[/B]
So in order to explain what we’ve done here by steps. The repo init –u basically is a command instructing to go to the GitHub on that specific location and extract what is available on the cm-13.0 branch regarding to manifests. So basically it’ll automatically push the file which has all CyanogenMod source to .repo/ folder with the name manifest.xml
After you have loaded this command you’ll run the repo sync , basically this command consists on downloading all the code into your building folder (in this case cm folder).
After the repo sync is complete you’ll have interest on having a local_manifests. Basically on this local_manifests.xml , where some developers prefer to name it as roomservice.xml it is where you’ll add the changes to the manifest.xml or even sources which you wish to add to your building folder. This is a solution to you never edit the manifest.xml.
Usually it is added on the local_manifests the folders related to your device tree. I’ll give in this example how to build for the OnePlus One (bacon).
A device tree consists on configurations where you set information related to your device. Example if is qualcom, usually is android_device_qcom_common (where is the general settings) together with android_device_oneplus_bacon (where are the specific settings). When I say settings, for you to understand is like compile with the folder hardware/qcom/display for the display. You should take some time to explore to understand what is in it.
So you’ll add your local_manifests.xml this way.
Code:
[B]
mkdir .repo/local_manifests
nano .repo/local_manifests/local_manifests.xm[/B]l
You now add:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="CyanogenMod/android_device_oneplus_bacon" path="device/oneplus/bacon" remote="github" revision="cm-13.0" />
<project name="CyanogenMod/android_device_oppo_common" revision="cm-13.0" remote="github" path="device/oppo/common"/>
<project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-13.0" />
<project name="CyanogenMod/android_kernel_oneplus_msm8974" path="kernel/oneplus/msm8974" remote="github" revision="cm-13.0" />
<project name="TheMuppets/proprietary_vendor_oneplus" path="vendor/oneplus" remote="github" revision="cm-13.0" />
</manifest>
Now you need to run the repo sync command again.
This has to do separately the first time or it won’t sync all the files you need. In case the repo sync fails with an error saying you need to do –force-sync just run repo sync –force-sync (this happens only when you change common git sources with your manifest.
After the sync is done you are ready to build!
To start building you’ll need to run the .envsetup.sh , which will load all the source code into memory. After that breakfast bacon userdebug (in case it is for the OnePlus One device), then later make bacon (the word bacon it is to be used on all devices , here it is just a coincidence with OnePlus One)
Code:
[B]. build/envsetup.sh
breakfast bacon
make bacon[/B]
After it compiled your rom will be located at /cm/out/target/product/bacon/
Easy until here? I hope so.
Possible errors :
Q: Receive error: fatal: duplicate path xxx/xxx in ~/cm/.repo/manifest.xml
A: edit .repo/local_manifests/local_manifests.xml to remove the item which matches the item located in bold.
Q: How big is the repo?
A: 50GB just source code and around 10GB when built per device. Therefore you should aim to have about 60GB free on your system.
The tools of development
Git
Probably many of you question about what it is git, read about it on the github manuals etc and still cannot figure out how to work (I took two weeks to understand that it is really simple). So imagine that you have a diary, but instead of being separated by dates it is separated by titles, which we call commits. And what is a commit? Basically it is a portion of code. So when you make a change and want to record that change, you create a commit and in the end it’ll be a portion of code. This portion of code, known as commit, can be easily ported between different sources.
Here is an example:
https://github.com/jgcaaprom/androi...mmit/9f16b3cd79ad7bb8c821a518ca73725f19c38478
The commit number is: 9f16b3cd79ad7bb8c821a518ca73725f19c38478
This commit has recorded a change of IZAT_DEBUG_LEVEL = 2 .
Now how to bring other commits from different sources into our source.
The process comes in 3 phases:
First we’ll have to add the source where the commits that interests us are with git add source_name link
Second we’ll download that source by using git fetch source command
Thirdly we’ll cherry-pick (bring the portion of code recorded in the commit) into our source in order to make the changes automatically.
So lets see a real scenario. Imagin you are interested on cherry-picking this source:
https://github.com/CyanogenMod/android_device_oneplus_bacon
What you’ll have to do is.
Step one: git add cm https://github.com/CyanogenMod/android_device_oneplus_bacon.git
Step two: git fetch cm
Step three: (imagine this is the commit you want:
https://github.com/CyanogenMod/andr...mmit/58027fcbea4dd9fbb5aaeb8ae5f6e32bdf613573 )
The commit number is: 58027fcbea4dd9fbb5aaeb8ae5f6e32bdf613573
So you’ll git cherry-pick 58027fcbea4dd9fbb5aaeb8ae5f6e32bdf613573
And voila! You’ve done your cherry-pick . Now it is important to have in mind how the cherry-pick process works which I’ll explain on the next step.
Cherry-picking
Cherry-picking is a process of importing code from one source to another. So the process that git does basically is, compares your present files in the source with the files that was on the source you are cherry-picking and if everything is a match it’ll change the code automatically for you.
Now lets pick up the example above and imagine that the changes you are doing instead of being exactly the same as described here:
https://github.com/CyanogenMod/andr...mmit/58027fcbea4dd9fbb5aaeb8ae5f6e32bdf613573
Your source has a difference which doesn’t have this line:
32 private static String CONTROL_PATH = "/proc/touchpanel/keypad_enable";
You’ll notice that it’ll give a conflict. The reason for that is because the git when comparing understood that there was no match between the sources. When that happens means basically that there might be changes you should do in order for the code to be compatible, so you’ll have to review that code.
Now the review process is very simple. For you to see which files are in conflict you’ll have to run git status ( basically this command informs you of the situation of the commits which are being cherry-picked and the changes which you’ve done. )
You’ll notice that the files which need to be edited/review are in red. In case it appears files in green, means that there was a perfect match and doesn’t need a review.
Pretty useful right?
After you finish editing all the code you’ll do git add . and for this exercise do git status again just for you to see what happened . Everything is green. To finish the cherry-pick you’ll now do git commit and done!
How to record my own changes and create a commit with it.
Basically this process is exatly the same as the previous one, the only difference is that after you made the changes, you can make git status, then git add filename in case you want to commit only one file or git add . in case you wish to commit all the files and to record the commit you write git commit, or git commit –m “commit message”.
Congratulations! You’ve just recorded your commit!
Git push/pull
There will be moments where we just wish that we could be lazy and cherry-pick everything all at once. Well there are some scenarios where you can actually do that, but remember it is not perfect. Lets imagine we are using the source above, and CyanogenMod uploaded like 20 different commits, your source is not exactly like CM source but you wish to keep your changes and also have all changes from CM what to do?
1) You can cherry-pick one on one. And waste a lot of time…
2) You can make a new source based on cm and include your changes there
3) You can git pull
Git pull basically will update your source with CM source by merging all the commits. You do that with:
git pull cm cm-13.0 (in case your rom is Marshmallow)
The git pull should only be used when the sources are very similar and you are using as a base. Basically it’ll warn you that’ll merge the code and voila done! 20 commits added to the source.
Now when on the situation that the sources are slight different or very different it’ll create a conflict. Again the git will do comparisons between the entire sources, check which commits are missing, compare the files just like with cherry-picking. And when you do git status, it’ll appear on red all files where you need to review your code.
After you finish, same as before
Code:
[B]git add .
git commit[/B]
Done.
I hope you are understanding everything until here.
git reset HEAD~n
This command is rarely used but is super usefull. Basically you are saying to git that you with to remove n commits you've reated/cherry-picked. For you guys to understand how it works, basically imagin you have just written/cherry-picked 10 commits, and you do git reset HEAD~3 , he'll basically remove from records 3 commits. But... That doesn't mean he reverted the code! In case you wish reset the code you need to do git reset --hard.
Also it is very usefull to help rewrite the history. Lets think the example I given before. When you do a git reset HEAD~3 , basically on a history of A B C D E F G H I J commits, the git will remove only the recorded commits H I J. If you do after a git status, you'll understand that the code is still there, which means the changes you done on H I J will still be there. So you can create a new commit with H I J all together . Simple!
Another way to create a unique commit with H I J is by using git rebase -i HEAD~3 , where you basically are instructing the git that you wish to rebase the source with an interactive selection. You'll see that it'll appear a commit list where you can remove other commits from history. But since you wish to create a unique commit you'll wish to change the instruction from pick with the letter s (without capslock term for squash) . Example:
Code:
[B]pick d0c49f4 UsbDeviceManager: Remove charging from persisted function composition
s 2c755a6 SystemUI: fix NFC tile sometimes hiding
s e39d1d7 Revert "base: start nfc service prior to systemui"
pick 9164274 DocumentsUI : Hide advanced menu option when in forced mode
pick 5f8d3f8 Themes: Expose Power Dialogs
pick 9153396 SysUI: Don't let rogue themes ruin notifications
pick 226797c Revert "Only show keyguard panel if on lockscreen + no activity on top"
pick e843aaf Fix NPE in DocumentsUI when rotate UI before format as internal
pick 26079d3 SystemUI: detect rotation and resize mKeyguardBlur accordingly
pick 80b060d Automatic translation import
pick 4282864 Automatic translation import
pick d442df6 wifi: Enable WiFi IpReachabilityMonitor by default
pick 9cf937f SystemUI: Add margin in qs_tile_top between instruction text and add button[/B]
Cool right?
And I believe I've covered with some examples the git. As you can see, once you get used to git you'll be able to use it easily.
Toolchains
There has been a big debate from many developers on which toolchains to use. Many prefer sabermod, others prefer uber, others google toolchain, etc. It is in fact debatable. If you ask me which one to use, I would say google or uber (very similer to google) and the gcc used by stock on the source. The reason is simple, the code is optimized for a certain gcc version, if you start using a gcc version which is not prepared to be used on the code, it won't translate correctly your instruction.
The source
When you start building roms, you should at least know a little about how the source of android is organized, what language it is used, etc. On android it is used C, C++, Java, Assembly. Withing the following folders inside the source it is used:
Java
Frameworks
Packages
external (some packages)
C++
ART
bionic
hardware
C
kernel
hardware
Assembly
bionic
some of the kernel libs
This is important for you to navigate easily within it. Some of you ask yourselfs what is one thing or another. I'll represent that to the following image which is published on the google developers page.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Now I believe you wish to know which parts should be used in order to put a rom working for a certain device. Those parts are:
Hardware
Kernel
device tree
Vendor blobs
These parts are the "base" of your build to put a certain device in a working, since on these parts is where lies the instructions for the device to understand what to do.
The build folder is where you specify instructions of the building process. For example : Certain optimization, which GCC to use, where will the compiler find the apps to compile.
frameworks, system, packages and some of the folders within the external folder are the packages of what you will have inside the rom which is general and can be present on any rom.
external folder has present different things, compilers such as proguard, jemalloc. external software used by the rom such as sqlite.
prebuilts folder has present everything related to stuff which is already compiled, in this case clang, gcc toolchains.
I've done a very summarize version of the source in order for you to understand how that google built things, so I hope it is simple to understand these basics.
(to continue)
reserve1
reserve2
reserve3
Another great contribution bro. Thanks for your work and for your help. Starting read right now
Edit: Amazing guide
Just one request, please bold when you write a command. I think it becomes more eligible.
@jgcaap I think this is useful
For those already have JDK8 installed, they can use it by adding this code to $HOME/.bashrc
Code:
EXPERIMENTAL_USE_JAVA8=true
You just have to source ~/.bashrc before make bacon
There's nothing better than learning something from a professional who you know has done such a great work. Thanks a million!! @jgcaap
Very useful.. Thanks for sharing =D>
Sent from my A0001 using XDA-Developers mobile app
FSadino said:
@jgcaap I think this is useful
For those already have JDK8 installed, they can use it by adding this code to $HOME/.bashrc
Code:
EXPERIMENTAL_USE_JAVA8=true
You just have to source ~/.bashrc before make bacon
Click to expand...
Click to collapse
I'll speak about different custom GCC and also other compilers, but it'll be on another section. I'll continue writing this on wednesday (exam tomorow). I believe that my guide will help understand all the basics.
If I speak about that mode, I believe it'll give the idea that it is a feature of linux and it isn't. It is something you can change inside the source in many different ways.
jgcaap said:
I'll speak about different custom GCC and also other compilers, but it'll be on another section. I'll continue writing this on wednesday (exam tomorow). I believe that my guide will help understand all the basics.
If I speak about that mode, I believe it'll give the idea that it is a feature of linux and it isn't. It is something you can change inside the source in many different ways.
Click to expand...
Click to collapse
This might sound a little stupid but which JDK version is recommended? 7 or 8? Seems like 7 cause you have to enable "Experimental Use" for 8.
Great guide! Can you, if you have time, also post a guide only focusing on kernel building?
abhibnl said:
Great guide! Can you, if you have time, also post a guide only focusing on kernel building?
Click to expand...
Click to collapse
The guide is incomplete, will write more on wednesday. I'll cover everything in a very simple waywith praticle solutions.
thank you , that what was looking to develop on my tablet , I can use basic as this tutorial for other devices.
continue with tutorial , as many want to learn, but has no simple guide to base
you must wrote revision="cm-13.0" /> instead of revision=”cm-13.0” /> 'cause it give you an error that you can't be able to repo sync
fafa77140 said:
you must wrote revision="cm-13.0" /> instead of revision=”cm-13.0” /> 'cause it give you an error that you can't be able to repo sync
Click to expand...
Click to collapse
i literally stared at this for like 1h and didn't find any difference could you please elaborate more...
baconxda said:
i literally stared at this for like 1h and didn't find any difference could you please elaborate more...
Click to expand...
Click to collapse
The quotation marks surrounding cm-13.0 in first post are not the right ones. So you need to replace those quotation marks if you copied and pasted the code in your manifest. Just delete the quotation marks and type them again.
joshuous said:
The quotation marks surrounding cm-13.0 in first post are not the right ones. So you need to replace those quotation marks if you copied and pasted the code in your manifest. Just delete the quotation marks and type them again.
Click to expand...
Click to collapse
ohhhkayyy.........:good:
fafa77140 said:
you must wrote revision="cm-13.0" /> instead of revision=”cm-13.0” /> 'cause it give you an error that you can't be able to repo sync
Click to expand...
Click to collapse
good catch. I never thought the keyboard would be writting differently when not on the terminal. Thanks
jgcaap said:
good catch. I never thought the keyboard would be writting differently when not on the terminal. Thanks
Click to expand...
Click to collapse
No problems
fafa77140 said:
No problems
Click to expand...
Click to collapse
updated more stuff today.

[HOW-TO] Building TWRP from source with goodies

I decided to put together a guide on how to build TWRP from source, having successfully built it myself and restored a few of the goodies that disappeared in the 3.3.1-0 release (e.g. install kernel). Also, marlin (Pixel XL) has had a few advancements over sailfish (Pixel), so this is a way to get back on par even if unofficially.
Whilst I'll go into a good level of detail, this will not be a hand-holding guide. You are expected to be able to use the Linux command line, and tools such as Git and repo.
Download sources
This guide is based upon building from the Minimal TWRP sources, which are based upon a subset of Omnirom. At the time of writing, the latest branch is twrp-9.0 (Pie). (If you are reading this some months after I have written this guide, check for later branches.) Follow this link for the repo, and the instructions:
https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni/tree/twrp-9.0
Firstly, create a folder to put this in, e.g. $HOME/twrp-minimal-omni, and change to that directory. Then execute the following for a shallow clone (to save space...):
Code:
repo init --depth=1 -u git://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git -b twrp-9.0
Before doing the repo sync, we will need a few extra repositories to be downloaded. Create a subfolder .repo/local_manifests and create an XML file (e.g. custom.xml) with the following content:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="android_device_google_marlin" path="device/google/marlin" remote="TeamWin" revision="android-9.0" />
<project path="hardware/qcom/bootctrl" name="platform/hardware/qcom/bootctrl" groups="pdk-qcom" remote="aosp" />
<project path="hardware/qcom/msm8998" name="platform/hardware/qcom/msm8998" groups="qcom_msm8998,pdk-qcom" remote="aosp" />
</manifest>
android_device_google_marlin - contains the configuration and build instructions for marlin and sailfish
hardware/qcom/bootctrl - this is part of AOSP, and is required for building TWRP
hardware/qcom/msm8998 - extra chipset stuff that is required for marlin/sailfish
You can do a repo sync now to download the sources.
Additionally, we will need some driver binaries that are available from Google. Get the Google (Qcom is not necessary) drivers for the latest Pie release here:
https://developers.google.com/android/drivers#sailfishpq3a.190801.002
Extract the files into the same folder as you created, and execute e.g as follows, and follow the prompts:
Code:
./extract-google_devices-sailfish.sh
The binaries will be extracted into a vendor/google-devices/ sub-folder. Do not rename the sub-folder - the configuration looks for exactly this path.
You now have all of the source files needed.
Do the build
We then more-or-less follow the instructions as per the original minimal manifest page:
Code:
export ALLOW_MISSING_DEPENDENCIES=true
. build/envsetup.sh
lunch omni_sailfish-eng
mka bootimage
The boot image will be created at out/target/product/sailfish/boot.img.
Use fastboot boot out/target/product/sailfish/boot.img to test it in fastboot mode on your device.
Hope this helps someone out there!
XDA:DevDB Information
Building TWRP for Sailfish, Tool/Utility for the Google Pixel
Contributors
NZedPred
Version Information
Status: Stable
Created 2020-01-03
Last Updated 2020-04-26
Downloads
Occasionally I will make available one of my builds. They will be in the folders below.
Please note the following:
You are always encouraged to use the official versions of TWRP instead of these
I am not liable for anything that goes wrong as a consequence of using them
As a general rule, I will not be fixing bugs or adding features to these builds (other than enabling features that already are in the code) - they are built straight from the TWRP sources
Google Pixel (Sailfish) Unofficial TWRP
Google Pixel (Marlin) XL Unofficial TWRP
GPL compliance
The downloads in this folder use pre-compiled Linux kernels. The source for these can be found here (thanks to @razorloves for pointing out the correct URL):
[URL="https://github.com/bigbiff/android_kernel_google_marlin/commits/lineage-16.0[/URL]
Refer to the tags/branches prefixed with "android-msm-marlin-".
Log
20200301 - Added version "3.3.1-4-experimental-multi-user-decrypt" for Sailfish and Marlin, ability to decrypt data for multiple users. Refer to the advanced menu.
20200223 - Added version string "3.3.1-3-unofficial-nzedpred" for Sailfish, very minor updates from TWRP
20200115 - Added a build of OrangeFox Recovery for Sailfish
20200105 - Added f2fs support (consider the f2fs option to be experimental, and it may not even work)
20200104 - Initial version for sailfish with feature parity with marlin
Building other recoveries - Orangefox
Orangefox
Quick guide for the impatient
Create a folder that will be your OrangeFox folder, and change into it. All commands below will be relative to this folder.
Code:
# Initialize the repo
repo init --depth=1 -u https://gitlab.com/OrangeFox/Manifest.git -b fox_9.0
# Create local manifests folder
mkdir .repo/local_manifests
# Create the local manifest for sailfish/marlin - use gedit, kate, leafpad, whatever your text editor is
gedit .repo/local_manifests/orangefox-marlin.xml
After the last command, the text editor window will open. Paste the following content into it.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="TeamWin" fetch="https://github.com/TeamWin" review="https://gerrit.twrp.me" />
<project name="external_magisk-prebuilt" path="external/magisk-prebuilt" remote="TeamWin" revision="master" />
<project name="android_device_google_marlin" path="device/google/marlin" remote="TeamWin" revision="android-9.0" />
<project path="hardware/qcom/bootctrl" name="platform/hardware/qcom/bootctrl" groups="pdk-qcom" remote="aosp" />
<project path="hardware/qcom/msm8998" name="platform/hardware/qcom/msm8998" groups="qcom_msm8998,pdk-qcom" remote="aosp" />
</manifest>
Then save and close the editor, and continue with the following commands.
Code:
# Sync the repos
repo sync -j8
Additionally, we will need some driver binaries that are available from Google. Get the Google (Qcom aren't necessary) drivers for the latest Pie release here:
https://developers.google.com/android/drivers#sailfishpq3a.190801.002
Extract the files into the same folder as you created, and execute as follows, and follow the prompts:
Code:
./extract-google_devices-sailfish.sh
The binaries will be extracted into a vendor/google-devices/ sub-folder. Do not rename the sub-folder - the configuration looks for exactly this path.
You now have all of the source files needed.
At the time of writing, there is a bug that prevents the FB2PNG module building (I think this is FrameBuffer2PNG - screenshots). Edit the file as below
Code:
# Edit sailfish config
gedit device/google/marlin/sailfish/BoardConfig.mk
# Edit marlin config
gedit device/google/marlin/marlin/BoardConfig.mk
Around line 204, change
Code:
TW_INCLUDE_FB2PNG := [U]true[/U]
to
Code:
TW_INCLUDE_FB2PNG := [U]false[/U]
Now continue to build as normal
Code:
. build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
# For building sailfish use this line
lunch omni_sailfish-eng
# For building marlin use this line
lunch omni_marlin-eng
mka bootimage
NOTE: If you are building for sailfish, don't run the lunch omni_marlin-eng line. Also, you may get an error "Your device can't be found in device sources..". That's actually OK, it's just because there isn't a folder called device/google/sailfish. If the error bothers you, just create the folder and re-run the lunch command (and ignore the warning about device/google/sailfish/omni.dependencies file not found).
This will create a fastboot bootable image in the $OUT folder called boot.img. You can try booting it with your device in fastboot mode:
Code:
fastboot boot $OUT/boot.img
There are also a number of environment variables that OrangeFox has available. I haven't really tested whether or not they are necessary. Will update this post after I do some investigation.
Could you make twrp for marlin with support F2FS? I did but unsuccesed.
chuate92 said:
Could you make twrp for marlin with support F2FS? I did but unsuccesed.
Click to expand...
Click to collapse
You will need to add a flag to the device/google/marlin/marlin/BoardConfig.mk file:
Code:
TARGET_USERIMAGES_USE_F2FS := true
Additionally, the kernel needs to support f2fs. No idea if the one that comes with the repos supports it, but you could always grab one from a kernel that does and try that.
I'll try doing a build later on, but you will have to test at your own risk.
NZedPred said:
You will need to add a flag to the device/google/marlin/marlin/BoardConfig.mk file:
Code:
TARGET_USERIMAGES_USE_F2FS := true
Additionally, the kernel needs to support f2fs. No idea if the one that comes with the repos supports it, but you could always grab one from a kernel that does and try that.
I'll try doing a build later on, but you will have to test at your own risk.
Click to expand...
Click to collapse
I followed your guide but, I didn't know how to do "Create a subfolder .repo/local_manifests and create an XML file (e.g. custom.xml) with the following content:". So I downloaded manual. Then I do build recoveryimage, I still got error them same I posted here https://forum.xda-developers.com/showthread.php?p=81384609#post81384609.
I didn't know why.
chuate92 said:
I followed your guide but, I didn't know how to do "Create a subfolder .repo/local_manifests and create an XML file (e.g. custom.xml) with the following content:". So I downloaded manual. Then I do build recoveryimage, I still got error them same I posted here https://forum.xda-developers.com/showthread.php?p=81384609#post81384609.
I didn't know why.
Click to expand...
Click to collapse
For the above, using the command line, from the folder you originally created you do this:
Code:
mkdir .repo/local_manifests
gedit .repo/local_manifests/custom.xml
If you don't have gedit, use e.g. kate, or whatever other text editor you have.
Also, you don't build a recovery image - you build a boot image.
Code:
mka bootimage
Anyway, I've updated the second post with a folder for Google Pixel XL as well. I'll upload there later (once AFH sorts itself out - I can't upload anything into the new folder yet).
For now, try using the build here (at your own risk):
https://www.dropbox.com/s/gvkvhklmu2fh0tx/twrp-marlin-unofficial-20200105.img?dl=0
tried this unofficial twrp for sailfish. it boots just fine as temporary recovery, when trying to install into ramDisk it acts as the official image, too large to fit the ramDisk
wizardwiz said:
tried this unofficial twrp for sailfish. it boots just fine as temporary recovery, when trying to install into ramDisk it acts as the official image, too large to fit the ramDisk
Click to expand...
Click to collapse
Yes, TWRP is now getting quite big and a lot of features would have to be removed to get it to fit into the ramdisk. This is something I've been spending some time on, but it seems to be a difficult ask at this point. I'll post if I ever get there...
I'm having some trouble with your guide. I am trying to compile not TWRP but orangefox recovery. I have the files and I will link them below. If you could either walk me through building orangefox or building it yourself, that would be amazing. I have a sailfish.
Link: https://gitlab.com/OrangeFox/Recovery
Spookybear said:
I'm having some trouble with your guide. I am trying to compile not TWRP but orangefox recovery. I have the files and I will link them below. If you could either walk me through building orangefox or building it yourself, that would be amazing. I have a sailfish.
Link: https://gitlab.com/OrangeFox/Recovery
Click to expand...
Click to collapse
I've had a look at this, and I don't think it's as straight forward as merely dropping in in the TWRP sailfish device tree and building. It reports success when building, but it hasn't actually built anything...
I'd suggest you go to their Telegram chat for building OrangeFox: https://t.me/OrangeFoxBuilding
@Spookybear - I managed to do a build. If you want to test (at your own risk!) you can get it here:
https://www.androidfilehost.com/?fid=4349826312261701399
@Spookybear - I managed to do a build. If you want to test (at your own risk!) you can get it here:
https://www.androidfilehost.com/?fid=4349826312261701399
NZedPred said:
@Spookybear - I managed to do a build. If you want to test (at your own risk!) you can get it here:
https://www.androidfilehost.com/?fid=4349826312261701399
Click to expand...
Click to collapse
Can you send me the zip file of your build environment, I'm getting ninja error 1. Thank you.
NZedPred said:
@Spookybear - I managed to do a build. If you want to test (at your own risk!) you can get it here:
https://www.androidfilehost.com/?fid=4349826312261701399
Click to expand...
Click to collapse
tested it. Working just fine. to bad it is based on twrp 3.3.1 (naturally) and therefor still to large to fit the RamDisk.
wizardwiz said:
tested it. Working just fine. to bad it is based on twrp 3.3.1 (naturally) and therefor still to large to fit the RamDisk.
Click to expand...
Click to collapse
I meant that you could compress your /scripts folder and so I could try to build different versions for when it gets updated or when I need to fix a bug.
Thank you
Spookybear said:
I meant that you could compress your /scripts folder and so I could try to build different versions for when it gets updated or when I need to fix a bug.
Thank you
Click to expand...
Click to collapse
I'll add a guide into the third post of this thread for it. It's a bit much trying to compress some 40GB of files. Best you use the guide and try to work out where things went wrong. Will update once its up.
Quick and dirty guide to compiling OrangeFox now up
NZedPred said:
I'll add a guide into the third post of this thread for it. It's a bit much trying to compress some 40GB of files. Best you use the guide and try to work out where things went wrong. Will update once its up.
Quick and dirty guide to compiling OrangeFox now up
Click to expand...
Click to collapse
Thank you, I will work on this later.
NZedPred said:
I'll add a guide into the third post of this thread for it. It's a bit much trying to compress some 40GB of files. Best you use the guide and try to work out where things went wrong. Will update once its up.
Quick and dirty guide to compiling OrangeFox now up
Click to expand...
Click to collapse
Thank you, it worked.
Is it possible to merge this patch into your build? It should fix the issue when doing multi-user backup. Thanks.
https://gerrit.omnirom.org/c/android_bootable_recovery/+/33944

[GUIDE/HOW-TO] Building LineageOS for an Unsupported Device

Foreword:
This is my own notes I created to build LOS for my device (SM-T713 or gts28vewifi). After reading this, I encourage you to create your own notes as it will help you better understand the build process.
I followed the official guide here with additional reading here since we are building this for a device no longer officially supported by LOS.
Requirements:
A fast CPU. How fast? All depends on how long you can wait for the build.
At least 16Gb RAM is a must.
Around 300Gb 50Gb disk space since at least 100Gb of it will be devoted to "ccache".
*nix system, mine is on Ubuntu so the commands below are Debian-based.
Step 1: Setup the environment.
sudo apt install -y bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5 libncurses5-dev libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev python-is-python3
mkdir -p ~/bin
mkdir -p ~/android/lineage
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
cd ~/android/lineage
repo init -u https://github.com/LineageOS/android.git -b lineage-17.1
Step 2: Get the device manifest file.
local_manifests/gts28vewifi.xml at lineage-17.1 · team-infusion-developers/local_manifests
Contribute to team-infusion-developers/local_manifests development by creating an account on GitHub.
github.com
...and save to ~/android/lineage/.repo/local_manifests/gts28vewifi.xml
Then do:
repo sync
Step 3: Turn on caching to speed up build. Note that I used 300Gb instead of 100Gb (just personal preference).
mkdir ~/ccache
export CCACHE_DIR=~/ccache
export USE_CCACHE=1
export CCACHE_EXEC=/usr/bin/ccache
ccache -M 300G 50G
Step 4: Select Build.
source build/envsetup.sh
lunch
select lineageos_gts28vewifi-userdebug (whatever number it's identified under)
Step 5: Prepare the output:
make clean-apache-xml
make clean
make apache-xml
make ims-common
Step 6: Build it!
brunch gts28vewifi
Now go have a few coffees and come back later.
Epilogue:
I'm sure there are many different ways to build this but this method works for me. Just want to get the knowledge out so you can find a way that works for you.
@thisisludachris, I have been building roms for about 18 months now and can share that ccache is typically less than 10G per rom.
You can check by doing
ccache -s
Here is output from my machine building one rom.
Bash:
$ ccache -s
Summary:
Hits: 758742 / 837008 (90.65 %)
Direct: 693243 / 845272 (82.01 %)
Preprocessed: 65499 / 143805 (45.55 %)
Misses: 78266
Direct: 152029
Preprocessed: 78306
Uncacheable: 293976
Primary storage:
Hits: 1499615 / 1682320 (89.14 %)
Misses: 182705
Cache size (GB): 7.89 / 20.00 (39.45 %)
Also, it is possible to build a rom with less than 16GB DRAM if you apply these patches below. Obviously, the more the better, but I have use the patches below to build when I had less than 16GB DRAM.
https://forum.xda-developers.com/t/guide-how-to-build-android-11-with-low-ram.4298483/
Thanks for the info
thisisludachris said:
Step 2: Get the device manifest file.
local_manifests/gts28vewifi.xml at lineage-17.1 · team-infusion-developers/local_manifests
Contribute to team-infusion-developers/local_manifests development by creating an account on GitHub.
github.com
...and save to ~/android/lineage/.repo/local_manifests/gts28vewifi.xml
Then do:
repo sync
Click to expand...
Click to collapse
Sorry but for me this step fails. The repo command doesn't seem to find the files from team infusion:
team-infusion-developers/android_device_samsung_team-infusion-developers:
remote: Repository not found.
fatal: Repository »https://github.com/team-infusion-developers/android_device_samsung_team-infusion-developers/« nicht gefunden
error: Cannot fetch team-infusion-developers/android_device_samsung_team-infusion-developers from https://github.com/team-infusion-developers/android_device_samsung_team-infusion-developers
Does the procedure still work for you?
Paradroid
paradroid28 said:
Sorry but for me this step fails. The repo command doesn't seem to find the files from team infusion:
team-infusion-developers/android_device_samsung_team-infusion-developers:
remote: Repository not found.
fatal: Repository »https://github.com/team-infusion-developers/android_device_samsung_team-infusion-developers/« nicht gefunden
error: Cannot fetch team-infusion-developers/android_device_samsung_team-infusion-developers from https://github.com/team-infusion-developers/android_device_samsung_team-infusion-developers
Click to expand...
Click to collapse
It looks like whomever put up the manifest screwed up with cut and paste. It should probably be
Code:
<project name="team-infusion-developers/android_device_samsung_msm8976-common" path="device/samsung/msm8976-common" remote="github" revision="lineage-17.1" />
otherwise all the common code won't get compiled and integrated into the rom.
Yes @retiredtab is correct, there is an incorrect entry in the manifest file from team-infusion-developers. Please update the correct line as pointed out. Thanks.
@paradroid28 I just went over to my build folder and pulled out my manifest file as per below if you want to copy & paste them:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="LineageOS/android_hardware_samsung" path="hardware/samsung" remote="github" revision="lineage-17.1" />
<project name="LineageOS/android_hardware_sony_timekeep" path="hardware/sony/timekeep" remote="github" revision="lineage-17.1" />
<project name="team-infusion-developers/android_device_samsung_gts28vewifi" path="device/samsung/gts28vewifi" remote="github" revision="lineage-17.1" />
<project name="team-infusion-developers/android_device_samsung_msm8976-common" path="device/samsung/msm8976-common" remote="github" revision="lineage-17.1" />
<project name="team-infusion-developers/android_kernel_samsung_msm8976" path="kernel/samsung/msm8976" remote="github" revision="lineage-17.1" />
<project name="team-infusion-developers/proprietary_vendor_samsung_msm8976" path="vendor/samsung" remote="github" revision="lineage-17.1" />
</manifest>
​@thisisludachris
@retiredtab
Thank you for your efforts. I compared your manifest against the one I downloaded -> they are identical. So I probably have made a different error. ATM i don't know where to look, but i admit, i do not speak "git" fluently. Last time i built an Android ROM successfully was probably 2016-ish , therefore i was very happy about your notes thisisludachris.
If you have another idea where i can have messed up, please let me know.
paradroid28 said:
Thank you for your efforts. I compared your manifest against the one I downloaded -> they are identical.
Click to expand...
Click to collapse
If you followed post #1 exactly, namely
Code:
mkdir -p ~/android/lineage
# save manifest to
~/android/lineage/.repo/local_manifests/gts28vewifi.xml
check to make sure ~/android/lineage/.repo/local_manifests/gts28vewifi.xml is the correct file.
There should only be one .xml file in that directory otherwise the build system will try and parse it.
Another thing you can do is
Code:
cd ~/android/lineage/.repo
grep -iRl "android_device_samsung_team-infusion-developers"
to see where that statement is hiding from you.
paradroid28 said:
​@thisisludachris
@retiredtab
Thank you for your efforts. I compared your manifest against the one I downloaded -> they are identical. So I probably have made a different error. ATM i don't know where to look, but i admit, i do not speak "git" fluently. Last time i built an Android ROM successfully was probably 2016-ish , therefore i was very happy about your notes thisisludachris.
If you have another idea where i can have messed up, please let me know.
Click to expand...
Click to collapse
Perhaps start with which step from above that you are stuck on. Also, if you want to post a screenshot of your error, perhaps I can try to help troubleshoot. Bear in mind though I have limited knowledge in codes and compiling but will try nonetheless.
For those on Windows OS, you can install Ubuntu via WSL2 with the following command run in PowerShell:
Code:
wsl.exe --install
More info here if you require more details on running Ubuntu in Windows.
I'd be interested to see how you go with compiling on Ubuntu via WSL2 in Windows OS
thisisludachris said:
Perhaps start with which step from above that you are stuck on. Also, if you want to post a screenshot of your error, perhaps I can try to help troubleshoot. Bear in mind though I have limited knowledge in codes and compiling but will try nonetheless.
Click to expand...
Click to collapse
The step that fails is 'repo sync'. I Now deleted line 6 in the local manifest (which is generating the error because a certain repository is not found by my computer) and the sync command finished successfully .
Now i will try building it and see, if i am missing something vital.
Maybe you have a very smart computer which finds more repos than mine.
Good work @paradroid28, hope it went well.
@thisisludachris
@retiredtab
Well, i have to thank you again and to apologize, because at first i misread post #5. There lies the solution. So every file of the local manifests from team infusion is faulty atm and refers to a repo that does not exist.
With the corrected manifest i was able to successfully build a ROM for my gts28velte. It remains to be tested on the device.
You might update post #1 to give people following it, a hint, that there is a problem with the manifest and how it can be fixed.
Paradroid
@thisisludachris, @paradroid28, the next step for the 2 of you is to actually fix some the problems. I started just like you guys compiling what was given, but after a while, I learned how to fix the bugs and then take the next step and actually make the next Android version. I don't write code, but I copy working code from other repos (giving credit to original authors of course).
If you want guidance on how to do this, let me know.
retiredtab said:
@thisisludachris, @paradroid28, the next step for the 2 of you is to actually fix some the problems. I started just like you guys compiling what was given, but after a while, I learned how to fix the bugs and then take the next step and actually make the next Android version. I don't write code, but I copy working code from other repos (giving credit to original authors of course).
If you want guidance on how to do this, let me know.
Click to expand...
Click to collapse
yes please!
just bought a new POCO m4 pro 5g
never done that before but what the hell, might as well
any bit of guidance would be very much appreciated
retiredtab said:
@thisisludachris, @paradroid28, the next step for the 2 of you is to actually fix some the problems. I started just like you guys compiling what was given, but after a while, I learned how to fix the bugs and then take the next step and actually make the next Android version. I don't write code, but I copy working code from other repos (giving credit to original authors of course).
If you want guidance on how to do this, let me know.
Click to expand...
Click to collapse
that would be nice - would be good to try and get 18.1 on my Galaxy Tab TM-813 (gts210vewifi)
been a long time since built android, but would be fun to try and get back into it
On curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo, it gets stuck on this:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 45277 100 45277 0 0 278k 0 --:--:-- --:--:-- --:--:-- 279k
When I enter the link, (https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo) in a browser, it comes out with an error:
<Error>
<Code>AccessDenied</Code>
<Message>Access denied.</Message>
<Details>
Anonymous caller does not have storage.objects.get access to the Google Cloud Storage object.
</Details>
</Error>
Ok few questions, what if your device is unofficial? what about the manifest? Also the guide differs if i want to build lineage 19.1?
Skorpion96 said:
what if your device is unofficial?
Click to expand...
Click to collapse
It's the same steps whether it's official or unofficial.
Skorpion96 said:
what about the manifest?
Click to expand...
Click to collapse
That's something you need to build or use an existing one. If you're new to building, I suggest building a rom that is offiical for a device you have. That way, you will see the entire process start to end.
Skorpion96 said:
Also the guide differs if i want to build lineage 19.1?
Click to expand...
Click to collapse
No. It's basically the same.

Categories

Resources