[GUIDE + HELP]Rom Making, Stock and Compiled, With Emphasis on Moto MSM8960 - RAZR HD Original Android Development

Please don't quote this post.
Nobody likes an OPs Wall of Text in the middle of page 3.
One of the best things about Android is the ability to make roms, whether it be from source or stock. A lot of guides go into details about how to get your Linux system set up and running, this one won't. I expect that you already have a running Linux system and have followed one of the many guides around to have all the required software installed.
If you don't have Linux installed, preferably Debian or Debian based (I use Debian Testing) and set up for compiling an Android rom, stop reading this, install Linux, and follow one of the Android guides below Everything in this guide requires Linux, I might add in some Windows tools in the future. Ask for Linux install help in what ever disto you choose's forums, not here.
This is Google's guide for compiling Android
This is a guide I found here on XDA.
Required Tools
Attached is a zip containing a lot of tools that I use, and sadly, I've acquired them at different times over the years and I don't remember where I got them all at, so giving proper credit isn't possible. If you developed a tool I used here, please know that you have my thanks and gratitude, and if you let me know, I'll remove it or add proper credit.
Some of the included tools I won't even discuss because they're not relevant to this platfore (like sbf_flash...Linux tool for flashing old school moto firmware to the Bravo, Defy, and other omap3 based moto phones), but they're included because I've added all the things I have installed in my local Android $PATH. They are only 1.9mb extracted, so it's not like they take up a lot of space...anyways...
Just extract all the tools into $HOME/bin, or any other preferred location in your $PATH
Ensure they have the proper permissions; run "chmod 755 +x $HOME/bin/*", change $HOME/bin to where ever you installed the tools at
log out
log back in
and you're done with the tool installation part (there's also a source /blah/blah command that can be used, but log out and log in is universal). I keep all my sources and tools on their own hard drive, located on /android, so nothing is lost if I ever change Linux distros -- All I have to do is add /android/bin to my $PATH and I'm good to go (once I've copy/pasted the commands in one of the above guides )
Some Linux terms/commands
$HOME -- The current users home directory. I'm logged in as skeevy420, so my $HOME is /home/skeevy420, $HOME/bin is /home/skeevy420/bin
$PATH -- all the directoies your system will look for executable files....Google it or check Arch Linux's guides, they're great
su -- you should really know this one....shame on you if you don't
sudo -i -- similar to sudo, only it opens an interactive sudo shell where every command is done as sudo
Converting a Fastboot into a flashable zip
This is pretty straight forward and only requires dumpperms.pl and simg2img.py (in the zip you should have already installed)
To make things easier all the terminal commands are colored blue
First Step -- Converting system.img into a mountable format
Download and Extract a fastboot zip file
Open a terminal in the folder you extracted the zip to
run "simg2img.py ./system.img ./system.img.raw" (it's system.img.ext4, not system.img, if you're converting an ICS fastboot image)
Second Step -- Mount the converted image
Obtain a root shell, use "sudo -i" or "su" depending on how your system handles regular users accessing superuser privileges ***$PATH HINT***
Every single command in every step done after this will be as su/sudo -i
cd back to the folder with the converted image, if necessary
mkdir -p /mnt/tmp/zip/system
mount -o loop system.img.raw /mnt/tmp/zip/system
Thrid Step -- Get file permissions
dumpperms.pl /mnt/tmp/zip/system > /mnt/tmp/perms
Fourth Step -- Add in META-INF (this is from Gummy Rom June 02, 2014)
Download the attached META-INF.zip
unzip META-INF.zip -d /mnt/tmp/zip
Fifth Step -- Modify Updater Script
Open /mnt/tmp/perms with a text editor
Select everything and copy it
Open /mnt/tmp/zip/META-INF/com/google/android/updater-script with a text editor
Select the marked line, highlighted blue in the template below
Paste in the permissions
Save it as /mnt/tmp/zip/META-INF/com/google/android/updater-script
Sixth Step -- Add in kernel/boot.img
cd into extracted fastboot folder if necessary
cp boot.img /mnt/tmp/zip
Seventh Step -- Pack it all up
zip -r /mnt/tmp/zip/rom.zip /mnt/tmp/zip
Eight Step -- Flash it
You should really know how to get a rom on your phone at this point in the game....
If you don't, we're all gonna laugh at you.
Updater Script Template
Code:
assert(getprop("ro.product.device") == "moto_msm8960" || getprop("ro.build.product") == "moto_msm8960" ||
getprop("ro.product.device") == "xt901" || getprop("ro.build.product") == "xt901" ||
getprop("ro.product.device") == "solstice" || getprop("ro.build.product") == "solstice" ||
getprop("ro.product.device") == "xt905" || getprop("ro.build.product") == "xt905" ||
getprop("ro.product.device") == "smq_u" || getprop("ro.build.product") == "smq_u" ||
getprop("ro.product.device") == "scorpion_mini_u" || getprop("ro.build.product") == "scorpion_mini_u" ||
getprop("ro.product.device") == "xt907" || getprop("ro.build.product") == "xt907" ||
getprop("ro.product.device") == "scorpion_mini" || getprop("ro.build.product") == "scorpion_mini" ||
getprop("ro.product.device") == "xt925" || getprop("ro.build.product") == "xt925" ||
getprop("ro.product.device") == "vanquish_u" || getprop("ro.build.product") == "vanquish_u" ||
getprop("ro.product.device") == "xt926" || getprop("ro.build.product") == "xt926" ||
getprop("ro.product.device") == "vanquish" || getprop("ro.build.product") == "vanquish" ||
getprop("ro.product.device") == "mb886" || getprop("ro.build.product") == "mb886" ||
getprop("ro.product.device") == "qinara" || getprop("ro.build.product") == "qinara" ||
getprop("ro.product.device") == "xt897" || getprop("ro.build.product") == "xt897" ||
getprop("ro.product.device") == "asanti" || getprop("ro.build.product") == "asanti" ||
getprop("ro.product.device") == "xt897c" || getprop("ro.build.product") == "xt897c" ||
getprop("ro.product.device") == "asanti_c" || getprop("ro.build.product") == "asanti_c" || abort("This package is for \"moto_msm8960,xt901,solstice,xt905,smq_u,scorpion_mini_u,xt907,scorpion_mini,xt925,vanquish_u,xt926,vanquish,mb886,qinara,xt897,asanti,xt897c,asanti_c\" devices; this is a \"" + getprop("ro.product.device") + "\"."););
show_progress(0.500000, 0);
format("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "0", "/system");
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");
show_progress(0.500000, 40);
ui_print("{x}...Installing System...");
ui_print("");
package_extract_dir("system", "/system");
ui_print("{x}...Creating Symlinks...");
ui_print("");
ui_print("{x}...Setting Permissions...");
ui_print("");
[B][COLOR="MediumTurquoise"]HIGHLIGHT THIS LINE AND PASTE YOUR PERMISSIONS HERE[/COLOR][/B]
show_progress(0.200000, 0);
show_progress(0.200000, 10);
ui_print("{x}...Flashing Kernel...");
ui_print("");
package_extract_file("boot.img", "/dev/block/platform/msm_sdcc.1/by-name/boot");
show_progress(0.100000, 0);
ui_print("{x}...Installation Complete!");
ui_print("");
Amended Hints
***$PATH HINT*** Make sure root/sudo has access to the primary users $HOME/bin or where every you installed the tools to, It's that or you'll have to figure out your own workarounds and do a lot of jumping between user and su.
THIS IS A WIP, I'LL BE ADDING MORE THINGS IN THE FUTURE. I'M HUNGRY AND I WANT A BREAK FROM TYPING

Please don't quote this post either. Thank you.
Introduction
One of the reasons people download rom sources is to just compile them, but the nostalgia from that wears of pretty fast and you're left thinking -- What Next??? There's plenty of things that can be done, you can add in things like Archidroid's Optimizations, take an AOKP feature and port it to Gummy, you could optimize the build with Linaro or a different GCC version, you might want to try your hand at compiling an optimized toolchain to optimize the rom's compile even further, you could do bug fixes and submit them to CM or your rom of choice's developer..the possibilities are endless, but where to start? How to start?
The example below is based on adding Archidroid's Optimizations to PAC and will be on my GitHub page for anyone to see and use. I'm using Archidroid's Optimizations because they're well documented, they don't cleanly pick with PAC, and they're a neat thing that can be done to nearly any rom -- all that makes it a good candidate for a basic first source based mod tutorial. I'll also be adding in Arrrghhh's kernel because why not.
First thing you need to do is get a Github account.
You're gonna want this. It's free and it gives you a place push your modified sources to; so when you sync, you get your changes. It also serves as a good backup for the projects you're working on. I'll go into remotes and pushing when the time comes.
Now, Archidroid and PAC...where to start?
I'm gonna assume that you've already synced PAC's sources as well as initialized a PAC build to create roomservice.xml and sync the device sources. If you haven't synced yet, but you already have, say, CM or AOSP synced, you can add --reference=/path/to/your/CM/sources and your PAC sync will use your local CM files if they're the same as what PAC needs. --reference is one of my favorite repo commands.
Well, you start by forking all the projects PAC has that are modified by Archidroid's Optimizations, which are android_build, android_art, & for PAC, android_vendor_pac to incorporate it properly into PAC's build script. See, PAC's build script already allows defining the GCC O Level which is a big part of what Archidroid's Optimizations target, but if done right, they can be integrated in a way that allows defining Os, O2, O3, Oa (O Archidroid), and Of (his Ofast commit that he's testing). I might even get around give PAC's build script a way to define GCC version and Google or Linaro GCC...
You're gonna want to open PAC's manifest, located here, and determine from where you fork the 3 projects. You'll see that android_art is from CM, so fork it from Cyanogenmod. To Fork, sign in to Github, go to where the project is located, and click the fork button in the upper right hand corner...simple. android_build and android_vendor_pac are PAC repos, so fork them from PAC.
Thought you were done forking? Nope, you have one more to fork IF you plan on submitting this to PAC's Gerrit like I plan on doing. That fork is PAC-man/pacman because Archidroids GCC repos and (a forked) android_art will have to be added to PAC's manifest.
I'm also going to go into detail and write the guide from the perspective view of using a local manifest, removals, and whatnot -- IMHO, Forking and updating manifests is better if you plan on contributing to a project/submit for Gerrit review, local manifests are better for personal projects, testing, and preparing to do a proper, correct submission to Gerrit review.
Create Local Manifests
Probably the easiest part of AO is adding GCC 4.8. This is done by simply making a file named (pretty much anything except roomservice.xml) linaro.xml. It'll be a standard repo xml file that looks like this
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- Generic Github remote -->
<remote name="github"
fetch="https://github.com" />
<!-- LINARO TOOLCHAIN -->
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" remote="github" revision="4.8-eabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" remote="github" revision="4.8-androideabi" />
</manifest>
The only problem with that is, for us, Linaro GCC 4.8 built roms seem a bit more error prone, but we can't just add in Linaro GCC 4.7 like above because we'll get sync errors since PAC already has Google GCC 4.7...so we'll add some project removal lines in the xml...sources in local manifests take precedent.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- AOSP remote -->
<remote name="aosp"
fetch="https://android.googlesource.com" />
<!-- Generic Github remote -->
<remote name="github"
fetch="https://github.com" />
<!-- Removals -->
<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" />
<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" />
<!-- ADDS -->
<!-- LINARO TOOLCHAIN -->
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" remote="github" revision="4.7-eabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" remote="github" revision="4.7-androideabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" remote="github" revision="4.8-eabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" remote="github" revision="4.8-androideabi" />
<!-- Google 4.8 TOOLCHAIN -->
<!-- Uncomment the two lines, comment out both Linaro 4.8s, then repo sync to change toolchains -->
<!-- <project name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" remote="aosp" revision="master" />
<project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" remote="aosp" revision="master" /> -->
</manifest>
NOTE: The remote lines aren't needed here. They're already in PAC's manifest and I only included them above to get you thinking about your remotes when you're setting up a manifest. If you wanna compile PAC following this guides instructions, before you click save after you copy and paste the above xml, delete lines 3 to 11, making the new line the be the Removals line. You should also check the remotes before you use this with other roms, because this is pretty rom independent; the removal lines may not be necessary on some roms.
Now that we have an xml file that handles our toolchain, I'll break it down and explain where the different things come from.
The first thing you'll notice is the remotes. In the xml files, the remote is the website or location you're getting your sources from. They can also be used to use less characters in the xml -- I could have added a remote named Archi with fetch="https://github.com/JustArchi", then I'd change the remote to Archi and the name to just "Linaro". While the 4 repos here isn't that big of a deal, imagine having 300 name="CyanogenMod/blah" projects, name="blah" remote="cm" seems like a better idea doesn't it?.
Below the remotes are the removals, and they're determined by the name= part of a project line of your main manifest.xml or roomservice.xml. Adding in more removals is simply copy/pasting the name= line of a project and having it formatted like you see above.
The Adds....those are just your standard lines of a manifest containing the stuff you want to add to your project or use now that the crap you don't want to use is removed.
Side Project -- Adding in a Arrrghhh's Custom Kernel to the Local Manifest
This part here is generic and geared towards CyanogenMod. I won't be using this with the rest of the Archidroid tutorial.
Simple two line mod
Code:
<remove-project name="CyanogenMod/android_kernel_motorola_msm8960-common" />
<project name="arrrghhh/android_kernel_motorola_msm8960-common" path="kernel/motorola/msm8960-common" remote="github" revision="cm-11.0_mod" />
Adding Arrrghhh's Kernel to PAC Vendor
While the Dev Team's kernel is nice and stable, it just doesn't have all that many tweaks. That's where Arrrghh's kernel comes into play. It's the Dev Team's kernel with both higher and lower frequencies to use, more governors and schedulers, adjustable voltage table, and more.
Before I go on, there are two programs I use that help with merge conflicts, and those are Meld and Git-Cola. I'll be using them below, but if you have a preferred way of dealing with merge conflicts, then by all means use that (I like SmartGit HG too). For most Debian/Ubuntu distros, they can be installed with the following terminal command.
Code:
[COLOR="Blue"]sudo apt-get install meld git-cola[/COLOR]
IMPORTANT: I'll be using my own personal repos and directories below. I'll try to point them out, but for general note, /android/pac is my sources' root directory and remotes created named skeevy are mine, you need to create them with a different name and have the URL set to your github account, not mine.
Now that that's out of the way, fire up the terminal and go to your sources root directory, for me it's cd /android/pac, and do a repo sync. Once the sources update, we start.
Code:
Go to vendor/pac -- [COLOR="Blue"]cd vendor/pac[/COLOR]
Add your remote -- [COLOR="blue"]git remote add [/COLOR][COLOR="SeaGreen"]skeevy [/COLOR][COLOR="Blue"]https://github.com/[/COLOR][COLOR="SeaGreen"]skeevy420[/COLOR][COLOR="Blue"]/android_vendor_pac.git[/COLOR]
fetch remotes -- [COLOR="Blue"]git fetch --all[/COLOR] (or git fetch [I]name_of_remote[/I] to only fetch a single remote)
Add a new branch and switch to it -- [COLOR="Blue"]git checkout -b pac-4.4[/COLOR] [COLOR="green"]***BRANCH NOTE***[/COLOR]
Fire up your text editor, I use gedit, and use that to open up our pac device dependencies file
Code:
/android/pac/vendro/pac/dependencies/moto_msm8960.dependencies
Code:
[
{
"remote": "github",
"account": "PAC-Motorola",
"repository": "android_device_motorola_moto_msm8960",
"target_path": "device/motorola/moto_msm8960",
"revision": "cm-11.0"
},
{
"remote": "github",
"account": "CyanogenMod",
"repository": "android_device_motorola_qcom-common",
"target_path": "device/motorola/qcom-common",
"revision": "cm-11.0"
},
{
"remote": "github",
"account": "CyanogenMod",
"repository": "android_device_qcom_common",
"target_path": "device/qcom/common",
"revision": "cm-11.0"
},
{
"remote": "github",
"account": "CyanogenMod",
"repository": "android_kernel_motorola_msm8960-common",
"target_path": "kernel/motorola/msm8960-common",
"revision": "cm-11.0"
},
{
"remote": "github",
"account": "Pinky-Inky-and-Clyde",
"repository": "proprietary_vendor_motorola",
"target_path": "vendor/motorola",
"revision": "cm-11.0"
}
]
And modify the kernel part so it looks like this
Code:
"remote": "github",
"account": "arrrghhh",
"repository": "android_kernel_motorola_msm8960-common",
"target_path": "kernel/motorola/msm8960-common",
"revision": "cm-11.0_mod"
Save it. Gedit, by default, saves a backup file in the same directory as the file you saved, make sure you delete that file if it did. And back to the terminal.
Code:
Commit the change -- [COLOR="Blue"]git commit -a -m "Change moto_msm8960 kernel to arrrghhh's kernel"[/COLOR]
Push and set remote as upstream -- [COLOR="blue"]git push --set-upstream [/COLOR][COLOR="SeaGreen"]skeevy[/COLOR][COLOR="Blue"] pac-4.4[/COLOR]
Now that Arrrghhhs kernel has been added to PAC, we'll move on to adding Archidroid to android_art....just kidding, we gotta play with removals and local manifests again...remove PAC's vendor and use your forked one.
Code:
<remove-project name="android_vendor_pac" />
<project name="[COLOR="SeaGreen"]skeevy420[/COLOR]/android_vendor_pac" path="vendor/pac" remote="github" revision="pac-4.4" />
Android Art
Finally, actually doing something related to Archidroid's Optimizations. Yay.
JUST A TEMP SAVE. I'M STILL WORKING ON THIS
Art -- Remote
Art -- Branch
Art -- Pick
Art -- Push
Build -- Remote
Build -- Branch
Build -- Pick
Build -- Fix\Build Script Integration
Build -- Push
Vendor -- Almost same as above
Vendor -- Archidroid into Pac Build Script
Vendor -- Add Arrrghhh kernel
Pac Compile 0a
Pac Compile 0f
This part of the guide will take me 5 or 6 hours....but you'll get some cool builds out of it
Submitting to PAC's Gerrit if builds are successful, doesn't actually have to boot or work...I'll explain...
Wait a for anything above's upstream to be updated, and an update my forked stuff with master guide.
***BRANCH NOTE*** pac-4.4 (the branch name) can be whatever you want it to be, but if it's something you'll submit for a gerrit review, use the branch the project you're committing to is using. There's also using a temp branch then cherry-picking in the changes when your done...but we're not going into gerrit strategies here.

reserved for other things

and a third just in case
EDIT: Feel free to post rom tweaking and compile questions and advise while I'm finishing the guide up. There's quite a bit of content and I'd like to make sure it's correct and working before posting.

So I've done some testing with the Linaro toolchain and the HD. General consensus (and source) seems to indicate the S4 Plus in the device is closer to the Cortex-A9 than the Cortex-A15 but has some extra goodies that "kind of make up for it".
Testing against both the A9 and A15 optimized toolchains, the A9 feels "better" but the A15 works just fine too. Main problem is the razrqcom source in CM11 defaults to A15 so there lies a problem. I will probably have to bite the bullet and compile my own optimized A9 toolchain with VFPv4 (vs VFPv3) and see how it turns out.
Either way, the performance benefit is clearly there. Benchmarks somewhat reflect it but "real world use" it shines vs non-optimized. Once I'm happy, I'll post my findings so others can try their hand at it.
EDIT: I'll make two builds available and update this post. Both are identical except for the toolchain + arch related opts applied. One is Cortex-A15 tuned and one is Cortex-A9 tuned. You decide from there. Keep in mind I'm still using the default GCC (4.7) with no special optimizations applied to it other than for ARM (under build/); everything else is stock and I'm not using my own toolchain yet.

So great to follow this thread! Looking forward to test optimized build, especially with the new kernel.
Huge thanks!

CWGSM3VO said:
So I've done some testing with the Linaro toolchain and the HD. General consensus (and source) seems to indicate the S4 Plus in the device is closer to the Cortex-A9 than the Cortex-A15 but has some extra goodies that "kind of make up for it".
Testing against both the A9 and A15 optimized toolchains, the A9 feels "better" but the A15 works just fine too. Main problem is the razrqcom source in CM11 defaults to A15 so there lies a problem. I will probably have to bite the bullet and compile my own optimized A9 toolchain with VFPv4 (vs VFPv3) and see how it turns out.
Either way, the performance benefit is clearly there. Benchmarks somewhat reflect it but "real world use" it shines vs non-optimized. Once I'm happy, I'll post my findings so others can try their hand at it.
EDIT: I'll make two builds available and update this post. Both are identical except for the toolchain + arch related opts applied. One is Cortex-A15 tuned and one is Cortex-A9 tuned. You decide from there. Keep in mind I'm still using the default GCC (4.7) with no special optimizations applied to it other than for ARM (under build/); everything else is stock and I'm not using my own toolchain yet.
Click to expand...
Click to collapse
Did you ever manage to compile the toolchain with VFPv4?
And I never go by benchmarks other than real world performance in apps...like FPS in ProjectM or FPse...run the wrong IO scheduler during a benchmark and get a bad score, cheat and swap io schedulers during the read/write tests and have *****in scores...benchmarks are too easy to cheat, and due to caching, memory management, etc, lower numbers don't necessarily mean crappier performance

skeevydude said:
Did you ever manage to compile the toolchain with VFPv4?
And I never go by benchmarks other than real world performance in apps...like FPS in ProjectM or FPse...run the wrong IO scheduler during a benchmark and get a bad score, cheat and swap io schedulers during the read/write tests and have *****in scores...benchmarks are too easy to cheat, and due to caching, memory management, etc, lower numbers don't necessarily mean crappier performance
Click to expand...
Click to collapse
No I haven't gone that far yet. It would only be applicable to Cortex-A9+VFPv4. One thing I've noticed running the A9 optimized build is that while it seems to perform almost as well (In most cases) as A15 optimized builds do but seems to run into some kind of I/O stall. I can mitigate it from changing to deadline (from ROW) but this isn't necessary in the A15 builds.
I did (earlier) a quick grok of the source tree for particular flags and seems armv7-a and A15 is the general assumption. I'm now since eating crow because the A9 build is running into intermittent stalls (I see it in the UI, response time is 0 for a split-second). Given the source assumptions and performance I've seen with the A15 builds, it makes sense for me to pursue that build. Unfortunately one performance gain to be had would be very time consuming because it's scattered throughout the tree would be to change the float abi to hard as the compatibility (at the sake of performance due to overhead) is preferable for something like CM11 versus a personal build.
For benchmarking, I've only been using Quadrant standard. Mainly because it gives me a chance to visually see the differences. Memory I/O scores are in the 11-12K range currently, much higher than I ever got with stock repo. I'm not quite happy with a few things and would like to reduce my footprint into the source. But I do have both an A9 and A15 test build ready, just need to upload them somewhere if anyone wants to play with them (I'll try to get this done soon, done!).
A9: http://www.filedropper.com/cm-11-20140609-unofficial-motomsm8960a9
A15: http://www.filedropper.com/cm-11-20140609-unofficial-motomsm8960-a15
Through work, I might be able to lay my hands on ARMcc and would like to play with that. Their opensource/free offerings of course don't include the compiler.
I think from here, it's worth exploring expanding this to beyond the toolchain.
EDIT: It should be worth noting these screenshots are based in Interactive/Deadline (stock) settings. Didn't bother going into airplane to "get that extra bit" One is A9 and one is A15, guess which is which Also, no -O's were hurt during the making of this project, everything is stock (-O2, very safe opts) compiler flag-wise except where A9/15+NEON are applicable.

CWGSM3VO said:
No I haven't gone that far yet. It would only be applicable to Cortex-A9+VFPv4. One thing I've noticed running the A9 optimized build is that while it seems to perform almost as well (In most cases) as A15 optimized builds do but seems to run into some kind of I/O stall. I can mitigate it from changing to deadline (from ROW) but this isn't necessary in the A15 builds.
I did (earlier) a quick grok of the source tree for particular flags and seems armv7-a and A15 is the general assumption. I'm now since eating crow because the A9 build is running into intermittent stalls (I see it in the UI, response time is 0 for a split-second). Given the source assumptions and performance I've seen with the A15 builds, it makes sense for me to pursue that build. Unfortunately one performance gain to be had would be very time consuming because it's scattered throughout the tree would be to change the float abi to hard as the compatibility (at the sake of performance due to overhead) is preferable for something like CM11 versus a personal build.
For benchmarking, I've only been using Quadrant standard. Mainly because it gives me a chance to visually see the differences. Memory I/O scores are in the 11-12K range currently, much higher than I ever got with stock repo. I'm not quite happy with a few things and would like to reduce my footprint into the source. But I do have both an A9 and A15 test build ready, just need to upload them somewhere if anyone wants to play with them (I'll try to get this done soon, done!).
A9: http://www.filedropper.com/cm-11-20140609-unofficial-motomsm8960a9
A15: http://www.filedropper.com/cm-11-20140609-unofficial-motomsm8960-a15
Through work, I might be able to lay my hands on ARMcc and would like to play with that. Their opensource/free offerings of course don't include the compiler.
I think from here, it's worth exploring expanding this to beyond the toolchain.
EDIT: It should be worth noting these screenshots are based in Interactive/Deadline (stock) settings. Didn't bother going into airplane to "get that extra bit" One is A9 and one is A15, guess which is which Also, no -O's were hurt during the making of this project, everything is stock (-O2, very safe opts) compiler flag-wise except where A9/15+NEON are applicable.
Click to expand...
Click to collapse
I'm gonna guess the 2nd one is A9 based on the IO readout.
All the optimizations are done, I just have to finish the guide with how I did it all. With the PAC build script in my repos, it's possible to choose between Os, O2, O3, Archidroid O3, and Archidroid Ofast when compiling PAC. Just add in my local manifest after the first, initial, sync completes, then sync again.
The build is using Google GCC 4.8 (and replaces Google GCC 4.7 with Archi/Linaro 4.7, though it's unused by default).
Based on what you posted, I'm gonna tweak android_build to use A15 for Krait over A9 which is currently in place. I'll have two builds posted tomorrow -- one build with Archi O3 and the other with Ofast, only no one will no which is which. Gonna do the A15, update my forks if needed, start the first of two builds without syncing, and call it a night. I'm tired, worked 10 hours today, got home, and I've been doing this, playing with my dogs, and getting things done around the house....I can't believe it's 10 past 11pm already :crying: Today went by way too fast.
local.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- REMOVALS -->
<remove-project name="android_art" />
<remove-project name="android_build" />
<remove-project name="android_vendor_pac" />
<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" />
<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" />
<!-- ADDS -->
<!-- ARCHIDROID LINARO TOOLCHAINS -->
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" remote="github" revision="4.7-eabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" remote="github" revision="4.7-androideabi" />
<!-- <project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" remote="github" revision="4.8-eabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" remote="github" revision="4.8-androideabi" /> -->
<!-- Google 4.8 TOOLCHAIN -->
<!-- Uncomment the two lines, comment out both Linaro 4.8s, then repo sync to change toolchains -->
<project name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" remote="aosp" revision="master" />
<project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" remote="aosp" revision="master" />
<!-- MY MODIFIEDS -->
<project name="skeevy420/android_art" path="art" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_build" path="build" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_vendor_pac" path="vendor/pac" remote="github" revision="pac-4.4" />
</manifest>
EDIT: Kept getting weird build errors with Google GCC 4.8; switched to Archi 4.7; starting again; really calling it a night this time (if the build goes more than 10 minutes )
EDIT2: I think I screwed up cherry-picking android_build (easy for cm, complicated for PAC).... or could also be a ccache error...Gonna figure it out tomorrow.
And you know you're tired when you do a change to android build, open the terminal, cd to vendor/pac, try to commit and push the change, multiple times over 15 minutes going wtf???, when you finally realize you're in the wrong directory....

I've since updated my build to use Linaro 4.7.4 for the host compilation. Everything else is the same, see how it goes (letting it compile overnight). I'm definitely sticking with A15 over A9, I'll post more updates in the morning, wiped out

CWGSM3VO said:
I've since updated my build to use Linaro 4.7.4 for the host compilation. Everything else is the same, see how it goes (letting it compile overnight). I'm definitely sticking with A15 over A9, I'll post more updates in the morning, wiped out
Click to expand...
Click to collapse
According to this, we're really close to arm A12.
Redoing my android_build picks from last night. Hopefully not being exhausted will make a difference.

skeevydude said:
According to this, we're really close to arm A12.
Redoing my android_build picks from last night. Hopefully not being exhausted will make a difference.
Click to expand...
Click to collapse
There are enough differences to make it hard to peg the Krait as an A9, A12 or A15 Curious to see how A12 turns out for you. Everything I've been able to find, it's more "like a" A9 than an A15.

CWGSM3VO said:
There are enough differences to make it hard to peg the Krait as an A9, A12 or A15 Curious to see how A12 turns out for you. Everything I've been able to find, it's more "like a" A9 than an A15.
Click to expand...
Click to collapse
I'm not testing A12...at least not right now...wasn't even able to get a standard O2 build to compile last night, getting cc1 errors with .o's
But on that chart, we're really close to 12, more-so than we are A9.
Just thought it curious.
Anyhoo, redid everything, might have missed a single endif last night that was causing my errors, we'll see.
I hope this works, I'd like to move on to finishing that part of the guide then getting a 3.4 kernel build of PAC going...not that I can run it, but some of ya'll can.

Figured out my build errors....-Werror....that cflag is annoying, but I didn't do the remove that flag fix, instead appended -Wno-error=unused-parameter to the parts failing, and so far the build seems to be running good.
Starting a second build with a different set of tweaks (may not finish, using Ofast...), when done, will start a third build with a different set of tweaks, and I'll upload all three when I'm done. There will not be a repo sync between builds so the only differences will be cflags, o level, and gcc.
Probably won't finish the 2nd post until tomorrow evening, until then, here is my local manifest if you want to compile PAC with Archidroids V2...I could probably update it to V3...reverted to V2 cause that worked flawlessly a week ago...it had the same build errors as V3...damn 4.4.3 update messing with me...
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- REMOVALS -->
<remove-project name="android_art" />
<remove-project name="android_bootable_recovery" />
<remove-project name="android_build" />
<remove-project name="android_hardware_qcom_display-caf" />
<remove-project name="android_system_vold" />
<remove-project name="android_vendor_pac" />
<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" />
<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" />
<!-- ADDS -->
<!-- ARCHIDROID LINARO TOOLCHAINS -->
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" remote="github" revision="4.7-eabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" remote="github" revision="4.7-androideabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" remote="github" revision="4.8-eabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" remote="github" revision="4.8-androideabi" />
<!-- Google 4.8 TOOLCHAIN -->
<!-- Uncomment the two lines, comment out both Linaro 4.8s, then repo sync to change toolchains -->
<!-- <project name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" remote="aosp" revision="master" />
<project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" remote="aosp" revision="master" /> -->
<!-- MY MODIFIEDS -->
<project name="skeevy420/android_art" path="art" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_bootable_recovery" path="bootable/recovery" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_build" path="build" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_hardware_qcom_display-caf" path="hardware/qcom/display-caf" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_system_vold" path="system/vold" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_vendor_pac" path="vendor/pac" remote="github" revision="pac-4.4" />
</manifest>
EDIT:
Build 2 complete, waiting on apk's to optimize then build 3 starts.

Two test builds uploaded, third one compiling, poll, links, and description in PAC thread.
EDIT: Third build available in Pac post 13 (same as the others)
That build marks 3 successful builds with various Archidroid & GCC options.

So as I get more and more into this, I realize I might be missing something. Here's what I got so far:
- Linaro 4.7.4 host compiler under prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7 and this is verified by running prebuilts/gcc/linux-x86/arm/arm-androideabi-4.7/bin/arm-linux-androideabi-gcc --version which reports Linaro GCC 4.7-2014.04-1~dev 4.7.4 20140402 (prerelease)
- Linaro 4.7.4 toolchain under prebuilts/gcc/linux-x86/arm/arm-cortex_a15-linux-gnueabihf-linaro_4.7.4-2014.04 and build/envsetup.sh is hardcoded to use this path. GCC in there reports as arm-cortex_a15-linux-gnueabihf-gcc (crosstools-NG linaro 1.13.1+bzr2651 - Linaro GCC 2014.04 - Cortex-A15) 4.7.4 20140402 (prerelease)
Code:
case $ARCH in
x86) ..
arm) toolchaindir=arm/arm-cortex_a15-linux-gnueabihf-linaro_4.7.4-2014.04/bin
..
My local_manifests/gcc.xml contains:
Code:
<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" remote="github" revision="4.7-androideabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" remote="github" revision="4.7-androideabi" />
But I've been reading about NDK and having problems locating the Linaro NDK r8e which I believe will give me a 4.7.x build. The NDK as I understand it is used to optimize APKs, etc. Whereas the toolchain/compiler does Kernel/Libs+ROM.
Is this correct? I'd like to make it Linaro all the way through in my builds. I noticed during a build yesterday that it was using the stock arm-4.7 compiler (as far as I could tell) and I think this is related to the NDK. I don't think I'm compiling everything with Linaro that I could be. I also noticed that S-Tools shows no Linaro tag in the kernel uname string/info.
sources:
https://wiki.linaro.org/Platform/Android/Toolchain
http://forum.xda-developers.com/xperia-z/development/tutorial-compile-xperia-z-rom-linaro-t2330970
Anyone shed some light on this for me?

CWGSM3VO said:
So as I get more and more into this, I realize I might be missing something. Here's what I got so far:
- Linaro 4.7.4 host compiler under prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7 and this is verified by running prebuilts/gcc/linux-x86/arm/arm-androideabi-4.7/bin/arm-linux-androideabi-gcc --version which reports Linaro GCC 4.7-2014.04-1~dev 4.7.4 20140402 (prerelease)
- Linaro 4.7.4 toolchain under prebuilts/gcc/linux-x86/arm/arm-cortex_a15-linux-gnueabihf-linaro_4.7.4-2014.04 and build/envsetup.sh is hardcoded to use this path. GCC in there reports as arm-cortex_a15-linux-gnueabihf-gcc (crosstools-NG linaro 1.13.1+bzr2651 - Linaro GCC 2014.04 - Cortex-A15) 4.7.4 20140402 (prerelease)
Code:
case $ARCH in
x86) ..
arm) toolchaindir=arm/arm-cortex_a15-linux-gnueabihf-linaro_4.7.4-2014.04/bin
..
My local_manifests/gcc.xml contains:
Code:
<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" remote="github" revision="4.7-androideabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" remote="github" revision="4.7-androideabi" />
But I've been reading about NDK and having problems locating the Linaro NDK r8e which I believe will give me a 4.7.x build. The NDK as I understand it is used to optimize APKs, etc. Whereas the toolchain/compiler does Kernel/Libs+ROM.
Is this correct? I'd like to make it Linaro all the way through in my builds. I noticed during a build yesterday that it was using the stock arm-4.7 compiler (as far as I could tell) and I think this is related to the NDK. I don't think I'm compiling everything with Linaro that I could be. I also noticed that S-Tools shows no Linaro tag in the kernel uname string/info.
sources:
https://wiki.linaro.org/Platform/Android/Toolchain
http://forum.xda-developers.com/xperia-z/development/tutorial-compile-xperia-z-rom-linaro-t2330970
Anyone shed some light on this for me?
Click to expand...
Click to collapse
I checked the Linaro site, then repos, and the first one I found with a 4.7 GCC was kitkat-cts-dev. Everything newer than that doesn't contain 4.7, at all. It doesn't surprise me, 4.8+ is better on paper and 4.7- really needs to be phased out. Seeing as how PAC only needed 3 fixes for 4.8, we're almost there, and it looks like 64bit ARM support was added with GCC 4.8, so I expect that to take the place of 4.6 and 4.7 to be phased out (a guess, but a logical one).
GCC 4.9 is required to use A12 tuning.
Speed wise, most benchmarks show 4.7 and 4.8 to be pretty similar in speeds. Didn't check with 4.9.
Good catch on the Linaro NDK part. Now I gotta update my adds/removes, add a Linaro remote, and add in the NDK from their Android repos.
I'm glad I didn't have to fix as many repos as the Sony dude did back then. I tried this with PAC 6 months to a year ago and around the 20th repo that needed fixing I said screw it. Only 4...sure. Oddly, 4.8 needed 3 fixes, 4.7 needed a 4th -- interpret that however you want.

skeevydude said:
GCC 4.9 is required to use A12 tuning.
Speed wise, most benchmarks show 4.7 and 4.8 to be pretty similar in speeds. Didn't check with 4.9.
Good catch on the Linaro NDK part. Now I gotta update my adds/removes, add a Linaro remote, and add in the NDK from their Android repos.
Click to expand...
Click to collapse
Can you provide the necessary XML so I can be on the same page too? For me the NDK looked like it contained the toolchain and a few other things but wasn't sure how to fit it in other than replacing the NDK folder. I'll switch to 4.8/9 here, there's optimized toolchains I can use for that too.

CWGSM3VO said:
Can you provide the necessary XML so I can be on the same page too? For me the NDK looked like it contained the toolchain and a few other things but wasn't sure how to fit it in other than replacing the NDK folder. I'll switch to 4.8/9 here, there's optimized toolchains I can use for that too.
Click to expand...
Click to collapse
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- REMOTES -->
<remote name="linaro" fetch="git://android.git.linaro.org/" />
<!-- REMOVALS -->
<remove-project name="android_art" />
<remove-project name="android_bootable_recovery" />
<remove-project name="android_build" />
<remove-project name="android_dalvik" />
<remove-project name="android_hardware_qcom_display-caf" />
<remove-project name="android_system_vold" />
<remove-project name="android_vendor_pac" />
<remove-project name="platform/ndk" />
<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" />
<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" />
<!-- ADDS -->
<!-- ARCHIDROID LINARO TOOLCHAINS -->
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" remote="github" revision="4.7-eabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" remote="github" revision="4.7-androideabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" remote="github" revision="4.8-eabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" remote="github" revision="4.8-androideabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.9" remote="github" revision="4.9-eabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9" remote="github" revision="4.9-androideabi" />
<!-- Google 4.8 TOOLCHAIN -->
<!-- Uncomment the two lines, comment out both Linaro 4.8s, then repo sync to change toolchains -->
<!-- <project name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" remote="aosp" revision="master" />
<project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" remote="aosp" revision="master" /> -->
<!-- LINARO -->
<project path="ndk" name="platform/ndk" remote="linaro" revision="refs/tags/android-4.4.3_r1.1" />
<!-- MY MODIFIEDS -->
<project name="skeevy420/android_art" path="art" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_bootable_recovery" path="bootable/recovery" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_build" path="build" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_hardware_qcom_display-caf" path="hardware/qcom/display-caf" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_system_vold" path="system/vold" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_vendor_pac" path="vendor/pac" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_dalvik" path="dalvik" remote="github" revision="pac-4.4" />
</manifest>
Also, everything in that is CM compatible except for android_build and, obviously, android_vendor_pac. To add Archi to CM, all one has to do is cherry-pick android_build, add cm as a remote to the projects under my modifieds, fetch all and "git merge -m1 cm/cm-11.0 $HEAD" (provided you name the remote "cm"). I'll do that later today when I'm off, but just sayin....also, that's any device, not just us.
Added linaro remote, linaro ndk, and Archidroid GCC 4.9.
EDIT:
Updated all my forks, changed Archi V2 to V3 in android_build, added cortex-a12 as an option, changed to gcc 4.9, pushed and synced, starting build
EDIT: 2 removed cortex-a12...

If anyone want's to build PAC with a 3.4 kernel, here's my local manifest. Don't use gcc 4.9 yet, has out of memory bugs with android/dalvik (used all of my 8 gigs of ram and crashed).
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- REMOTES -->
<remote name="linaro" fetch="git://android.git.linaro.org/" />
<!-- REMOVALS -->
<remove-project name="android_art" />
<remove-project name="android_bootable_recovery" />
<remove-project name="android_build" />
<remove-project name="android_dalvik" />
<remove-project name="android_hardware_qcom_display-caf" />
<remove-project name="android_system_vold" />
<remove-project name="android_vendor_pac" />
<remove-project name="platform/ndk" />
<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" />
<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" />
<!-- ADDS -->
<!-- ARCHIDROID LINARO TOOLCHAINS -->
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" remote="github" revision="4.7-eabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" remote="github" revision="4.7-androideabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" remote="github" revision="4.8-eabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" remote="github" revision="4.8-androideabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.9" remote="github" revision="4.9-eabi" />
<project name="JustArchi/Linaro" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9" remote="github" revision="4.9-androideabi" />
<!-- Google 4.8 TOOLCHAIN -->
<!-- Uncomment the two lines, comment out both Linaro 4.8s, then repo sync to change toolchains -->
<!-- <project name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" remote="aosp" revision="master" />
<project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" remote="aosp" revision="master" /> -->
<!-- LINARO -->
<project path="ndk" name="platform/ndk" remote="linaro" revision="refs/tags/android-4.4.3_r1.1" />
<!-- MY MODIFIEDS -->
<project name="skeevy420/android_art" path="art" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_bootable_recovery" path="bootable/recovery" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_build" path="build" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_dalvik" path="dalvik" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_hardware_qcom_display-caf" path="hardware/qcom/display-caf" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_system_vold" path="system/vold" remote="github" revision="pac-4.4" />
<project name="skeevy420/android_vendor_pac" path="vendor/pac" remote="github" revision="pac-4.4-HD-test" />
</manifest>

Related

[Solved] Building CM9

With there being a bit of an hiatus on CM9 development (waiting for HTC kernel source, working on JB), I thought I'd learn more about building ROMs.
I'm running Ubuntu 10.04 (and 12.04) under VMware Player on Windows 7 Home.
I downloaded the JB AOSP repository and built it successfully for the emulator.
Next, I wanted to build a working ROM, so I chose to do CM9 (ICS).
I've followed [TUTORIAL]Setting up and compiling CM9 from source
and some info regarding building JB:
nk111 said:
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
repo sync
./build/envsetup.sh
brunch saga
Click to expand...
Click to collapse
Here's what I did:
repo init -u git://github.com/CyanogenMod/android.git -b ics
Added a "remote" to get the proprietary files for HTC devices by creating WorkingDir/.repo/local_manifest.xml
Note: An alternative to using nexx/proprietary_vendor_htc is to run ./extract-files.sh from WorkingDir/device/htc/saga with your PC connected to your phone (it used adb to pull down the proprietary files)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote fetch="https://github.com/" name="nexx" revision="ics" />
<project name="nexx/proprietary_vendor_htc" path="vendor/htc" remote="nexx" revision="ics" />
<!-- the following lines were added automatically by "brunch saga" command -->
<project name="CyanogenMod/android_device_htc_saga" path="device/htc/saga" remote="github" revision="ics" />
<project name="CyanogenMod/android_device_htc_msm7x30-common" path="device/htc/msm7x30-common" remote="github" revision="ics" />
<project name="CyanogenMod/htc-kernel-msm7x30" path="kernel/htc/msm7x30" remote="github" revision="android-msm-2.6.35-ics" />
</manifest>
repo sync
Note: the next bit adds the ROM Manager and Term packages which are required by CM
cd vendor/cm
./get-prebuilts
cd ../..
. build/envsetup.sh
brunch saga (I also tried breakfast saga; lunch;mka)
The build failed with these errors:
target SharedLib: audio.primary.msm7x30 (out/target/product/saga/obj/SHARED_LIBRARIES/audio.primary.msm7x30_intermediates/LINKED/audio.primary.msm7x30.so)
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/saga/obj/SHARED_LIBRARIES/audio.primary.msm7x30_intermediates/AudioHardware.o: in function android_audio_legacy::AudioHardware::setMicMute_nosync(bool):hardware/qcom/media/audio/msm7x30/AudioHardware.cpp:932: error: undefined reference to 'msm_device_mute'
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/saga/obj/SHARED_LIBRARIES/audio.primary.msm7x30_intermediates/AudioHardware.o: in function android_audio_legacy::AudioHardware::AudioHardware():hardware/qcom/media/audio/msm7x30/AudioHardware.cpp:566: error: undefined reference to 'msm_reset_all_device'
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/saga/obj/SHARED_LIBRARIES/audio.primary.msm7x30_intermediates/AudioHardware.o: in function android_audio_legacy::updateDeviceInfo(int, int, unsigned int, unsigned int):hardware/qcom/media/audio/msm7x30/AudioHardware.cpp:449: error: undefined reference to 'msm_device_mute'
collect2: ld returned 1 exit status
Note this error occurs both in Ubuntu 10.04 and 12.04
What am I missing and what do I need to do to get the error fixed?
Thanks
Edit:
Solution
The version of Ubuntu has nothing to do with the problem.
The errors point to some missing functions called by hardware/qcom/media/audio/msm7x30/AudioHardware.cpp
The modules in nexx/proprietary_vendor_htc are missing the required functions so copy them from a working CM9 ROM.
tuttifrutas said:
i mean you should run the file extract-files.sh, this will copy the files from your phone to the folder vendor/htc/saga/proprietary, just notice that your phone should have at least one of the latest cm9 nk111 roms.
or you can extract the nk111 cm9 rom to a folder, goto that folder and under sytem/lib, copy the needed .so files to the vendor/htc/saga/proprietary replacing the files on this folder
or you can add repository that is not nexx for example https://github.com/AOKPDS/proprietary_vendor_htc
you can check if the files contain that function by using this command in the folder vendor/htc/saga/proprietary
Code:
grep -R msm_device_mute .
My output
Code:
~/cm9/vendor/htc/saga/proprietary$ grep -R msm_device_mute
.Binary file ./libaudioalsa.so matches
Click to expand...
Click to collapse
Thanks Bill for the start and the steps, please keep updating the OP as you proceed on your journey.
I would also like to Build CM9 myself atleast once
Hi maybe you are missing some projects
try this on you local_manifest.xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="CyanogenMod/android_device_htc_saga" path="device/htc/saga" remote="github" revision="ics" />
<project name="CyanogenMod/android_device_htc_msm7x30-common" path="device/htc/msm7x30-common" remote="github" revision="ics" />
<project name="nexx/proprietary_vendor_htc" path="vendor/htc" remote="github" revision="ics" />
</manifest>
i think you need to go to vendor/cm/ and excute get-prebuilds or something like that if you get some rommanager error
This is what my local_manifest.xml looks like:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote fetch="https://github.com/" name="nexx" revision="ics" />
<project name="nexx/proprietary_vendor_htc" path="vendor/htc" remote="nexx" revision="ics" />
<project name="CyanogenMod/android_device_htc_saga" path="device/htc/saga" remote="github" revision="ics" />
<project name="CyanogenMod/android_device_htc_msm7x30-common" path="device/htc/msm7x30-common" remote="github" revision="ics" />
<project name="CyanogenMod/htc-kernel-msm7x30" path="kernel/htc/msm7x30" remote="github" revision="android-msm-2.6.35-ics" />
</manifest>
The brunch saga command added these additional entries automatically.
I know this seems like a long shot and it may not fix the problem but it could be Ubuntu 12.04 causing problems. 10.04 is the best version. Also you don't need to add the kernel to the local manifest unless you're creating a custom one. It's already in the device tree
Sent from my Desire S using Tapatalk 2
Is your repository properly synchronized? If not it is probably your build machine
Sent from my Desire S using xda app-developers app
Thanks, guys. I'll try using Ubuntu 10 instead of 12.
Sent from my HTC Desire S
I did a complete reinstall on Ubuntu 10.04. But I still get the same errors. Note, I've updated the OP with more details on my environment and the steps I went through.
i got the same error when i tried to compile it on a Virtual machine. I'm not an expert but it seems to me that the file vendor/htc/saga/proprietary/libaudioalsa.so should have that function but it doesn't !? correct me if i'm wrong
try extracting the files from one of cm9 alpha builds using the script extract-files.sh under the folder device/htc/saga/
or just open the cm9 alpha zip file goto system/lib copy and replace the file libaudioalsa.so in the dir vendor/htc/saga/proprietary/
EDIT:
the proprietary repository, that is added using brunch saga, is the culprit it breaks the build
I managed to get a working build!
The errors point to some missing functions called by hardware/qcom/media/audio/msm7x30/AudioHardware.cpp
So I had a look at the code and found that there were two conditions that invoked the problem code:
#ifdef WITH_QCOM_RESETALL
and
#ifdef WITH_QCOM_VOIPMUTE
So I commented out these sections and, voila, it compiled!
Now, I have no idea what is the broader impact of what I've done, but the build work and runs on the phone.
So I'm changing this thread for [Q] to [Partial solution]
tuttifrutas said:
EDIT:
the proprietary repository, that is added using brunch saga, is the culprit it breaks the build
Click to expand...
Click to collapse
Can you please be a bit more specific? The CyanogenMod/android_device_htc_saga project adds the proprietary files only if you connect your phone and run ./extract-files.sh.
Are you saying:
Don't run extract-files.sh, or
Remove the CyanogenMod/android_device_htc_saga project, which doesn't make sense to me because it includes a lot more than just the proprietary files, or
????
BillGoss said:
Can you please be a bit more specific? The CyanogenMod/android_device_htc_saga project adds the proprietary files only if you connect your phone and run ./extract-files.sh.
Are you saying:
Don't run extract-files.sh, or
Remove the CyanogenMod/android_device_htc_saga project, which doesn't make sense to me because it includes a lot more than just the proprietary files, or
????
Click to expand...
Click to collapse
i mean you should run the file extract-files.sh, this will copy the files from your phone to the folder vendor/htc/saga/proprietary, just notice that your phone should have at least one of the latest cm9 nk111 roms.
or you can extract the nk111 cm9 rom to a folder, goto that folder and under sytem/lib, copy the needed .so files to the vendor/htc/saga/proprietary replacing the files on this folder
or you can add repository that is not nexx for example https://github.com/AOKPDS/proprietary_vendor_htc
you can check if the files contain that function by using this command in the folder vendor/htc/saga/proprietary
Code:
grep -R msm_device_mute .
My output
Code:
~/cm9/vendor/htc/saga/proprietary$ grep -R msm_device_mute
.Binary file ./libaudioalsa.so matches

[Guide]How to download/compile specific ROM parts

This is a tutorial about how to download and compile specific parts in aosp based roms (such as CM10)
Written for AOSP noobs like me a year ago.
Note: I wrote this tutorial actually for my blog, as a beginners repo/compile tut, but why not share here
Introduction:
Downloading rom sources is done with the tool “repo”, this is the most awesome downloader in existence. Not only it looks very cool, it also reaches top speed at all times. But it’s only for linux (which is good since when you are busy with aosp roms you should be on linux)
Why is it awesome? Since you decide yourself how many jobs (aka connections) you make with the server. This means you always will get top speed, there is probably no faster download method available on the Internet (except for speedtests, but they don’t count). Next to the downloading of specific parts it’s of course also handy to know how to actually compile them.
Download:
The easiest way of fetching for example a batch of AOSP apps is like this:
1. Choose the desired tag you want to use, in the example I will use android-4.2.2_r1
2. Now make a dir somewhere:
Code:
- mkdir ~/aosp-apps
- cd ~/aosp-apps
3. Download repo when not installed yet:
Code:
- curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
- chmod a+x ~/bin/repo
4. Enter the line that will download the initial manifest.
for AOSP:
Code:
- repo init -u https://android.googlesource.com/platform/manifest -b android-4.2.2_r1
Enter your name and email address and wait until it completes
for CM
Code:
- repo init -u https://github.com/Cyanogenmod/android -b cm-10.1
5. Go in the hidden “.repo” dir and change the manifest
Code:
- cd .repo
- gedit manifest.xml (if you don’t have decent text editor such as “gedit”, install it! “sudo apt-get install gedit”
)
For example when you only want to download the apps, just remove all lines that are not app related. simple as that:
Code:
<?xml version=”1.0″ encoding=”UTF-8″?>
<manifest>
<remote name=”aosp”
fetch=”..” />
<default revision=”refs/tags/android-4.2.2_r1″
remote=”aosp”
sync-j=”4″ />
<project path=”packages/apps/BasicSmsReceiver” name=”platform/packages/apps/BasicSmsReceiver” />
<project path=”packages/apps/Bluetooth” name=”platform/packages/apps/Bluetooth” />
<project path=”packages/apps/Browser” name=”platform/packages/apps/Browser” />
<project path=”packages/apps/Calculator” name=”platform/packages/apps/Calculator” />
<project path=”packages/apps/Calendar” name=”platform/packages/apps/Calendar” />
<project path=”packages/apps/Camera” name=”platform/packages/apps/Camera” />
<project path=”packages/apps/CellBroadcastReceiver” name=”platform/packages/apps/CellBroadcastReceiver” />
<project path=”packages/apps/CertInstaller” name=”platform/packages/apps/CertInstaller” />
<project path=”packages/apps/Contacts” name=”platform/packages/apps/Contacts” />
<project path=”packages/apps/DeskClock” name=”platform/packages/apps/DeskClock” />
<project path=”packages/apps/Email” name=”platform/packages/apps/Email” />
<project path=”packages/apps/Exchange” name=”platform/packages/apps/Exchange” />
<project path=”packages/apps/Gallery” name=”platform/packages/apps/Gallery” />
<project path=”packages/apps/Gallery2″ name=”platform/packages/apps/Gallery2″ />
<project path=”packages/apps/HTMLViewer” name=”platform/packages/apps/HTMLViewer” />
<project path=”packages/apps/KeyChain” name=”platform/packages/apps/KeyChain” />
<project path=”packages/apps/Launcher2″ name=”platform/packages/apps/Launcher2″ />
<project path=”packages/apps/LegacyCamera” name=”platform/packages/apps/LegacyCamera” />
<project path=”packages/apps/Mms” name=”platform/packages/apps/Mms” />
<project path=”packages/apps/Music” name=”platform/packages/apps/Music” />
<project path=”packages/apps/MusicFX” name=”platform/packages/apps/MusicFX” />
<project path=”packages/apps/Nfc” name=”platform/packages/apps/Nfc” />
<project path=”packages/apps/PackageInstaller” name=”platform/packages/apps/PackageInstaller” />
<project path=”packages/apps/Phone” name=”platform/packages/apps/Phone” />
<project path=”packages/apps/Protips” name=”platform/packages/apps/Protips” />
<project path=”packages/apps/Provision” name=”platform/packages/apps/Provision” />
<project path=”packages/apps/QuickSearchBox” name=”platform/packages/apps/QuickSearchBox” />
<project path=”packages/apps/Settings” name=”platform/packages/apps/Settings” />
<project path=”packages/apps/SoundRecorder” name=”platform/packages/apps/SoundRecorder” />
<project path=”packages/apps/SpareParts” name=”platform/packages/apps/SpareParts” />
<project path=”packages/apps/SpeechRecorder” name=”platform/packages/apps/SpeechRecorder” />
<project path=”packages/apps/Stk” name=”platform/packages/apps/Stk” />
<project path=”packages/apps/Tag” name=”platform/packages/apps/Tag” />
<project path=”packages/apps/VideoEditor” name=”platform/packages/apps/VideoEditor” />
<project path=”packages/apps/VoiceDialer” name=”platform/packages/apps/VoiceDialer” />
</manifest>
When done, save it and go a dir back in the terminal
Code:
- cd ..
6. Download the packages
Code:
- repo sync -j16 (-j16 stands for 16 jobs max. This is for around a 100mbit line)
(With my 60mb/s connection I get max speed 7.2mb/s at -j8)
The packages will be download as quickly as possible to your harddrive now.
Compile:
To compile the obtained packages separately you will need a AOSP environment (or CM/AOKP etc). When you have a succesfull environment which is able to compile for your device you may enter:
Code:
- source build/envsetup.sh
- lunch (now choose your device, for example, full_ariesve-userdebug)
- now you’re theoretically ready to compile
to compile an app on the easiest way:
Code:
- make Appname -j8
where “Appname” is the name of the folder placed in packages/apps/..
This also counts for “SystemUI” which is not in that folder.
Code:
- make Calculator -j8 (for example)
And the -j param again stands for the number of jobs, remember that this is compiling and not downloading, so the “standard rule” with this is, number of cores of your CPU + 1.
Which makes a regular quad core (-j5) but makes a i7 CPU with Hyper threading (-j9). When using -j16 for example there could be moments that your cpu will be overloaded so much that your mouse will lag all over the place.
(Linux forces the cpu to perform higher then it actually should, resulting in a very strange fan sound in my case)
When having trouble, when it stops or just nags about some useless stuff.
You should try using the “-k” param, this tells the make command to keep going when a non-critical error occurs.
Code:
- make Calculator -k -j8
When having issues with the local module tags, you should enter this:
Code:
- make Calculator -k LOCAL_MODULE_TAGS=optional -j8
To compile other parts you also need to enter the folder name, here are some examples from /frameworks/base
Code:
- make policy (the power menu and lockscreen)
- make framework (the initial framework files)
- make framework-res (the initial framework resources)
- make services (the services.jar file)
or more examples:
Code:
- make sdk (builds the android sdk)
- make modules (builds all modules)
- make installclean (removes all staging directories, such as out/target/product/boardname/system)
- make clean (removes the whole /out directory)
:silly:
Good Job
this isnt so bad I will be giving your guide to people from my community who want to compile.
only problem is the cm branch you put jellybean you should put cm-10.1 if you are using googles 4.2.2 source
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
Unjustified Dev said:
this isnt so bad I will be giving your guide to people from my community who want to compile.
only problem is the cm branch you put jellybean you should put cm-10.1 if you are using googles 4.2.2 source
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
Click to expand...
Click to collapse
Thanks for mentioning
broodplank1337 said:
Thanks for mentioning
Click to expand...
Click to collapse
Can you teach me everything you know
Do you know how to cherry Pick? I need help merging it when it conflicts other strings
I want to learn everything im only 15 and I have time to learn now.
I plan on eventually building my own rom based off aosp here's my github
https://github.com/TeamRegular
I took a look at your projects and tutorials you are awesome.
This looks like a great tutorial :good: and when I saw it I thought it might answer a question I've been thinking about for a while now: would it be possible to compile Pie controls from Paranoid Android into one independent app?
I'm a n00b at compiling anything, I've attempted (and failed) to compile a kernel, so could you give me some direction on how air would do this? Thanks :laugh:

[GUIDE]Building any ROM from source for HTC One S aka ville!

Do you know about a ROM that it's not builded for our beloved One S? Do you want to port it for our device? This easy guide will help you.
Requirements:
A One S.
A relatively recent computer (Linux, OS X, or Windows) w/a reasonable amount of RAM and about 35 GB of free storage. The less RAM you have, the longer the build will take. Using SSDs results in faster builds than traditional hard drives.
A micro USB cable.
A decent Internet connection & reliable electricity
Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with what a recovery image such as ClockworkMod is, for example. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.
​HERE IS THE GUIDE.
Installing Build Packages
Open the terminal and type: (for 64-bit&32-bit)
Code:
sudo apt-get install bison build-essential curl flex git-core 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
In addition to the above, for 64-bit systems:
Code:
sudo apt-get install g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
Creating Directories
In order to start building ROMs you'll need to create some directories
Code:
mkdir -p ~/bin
mkdir -p ~/yourworkingdirectory
Installing the REPO command
Enter the following to download the "repo" binary:
Code:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Now lets give this the proper permissions to make it runnable:
Code:
chmod a+x ~/bin/repo
Put the ~/bin directory in your path of execution
Make sure that the ~/bin directory you just created is in your path of execution so that you can easily run the repo command even when you're not in ~/bin.
Code:
export PATH=${PATH}:~/bin
Initialize the source repository
Code:
cd yourworkingdirectory
Now you'll need the repo init related to the rom you'd like to build. Here i will insert some of the I used. Anyway to find this you can go the rom's github and search for the manifest (android or platform-manifest).Just choose the right branch.
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
repo init -u git://github.com/LiquidSmooth/android.git -b kitkat
repo init -u git://github.com/SlimRoms/platform_manifest.git -b kk4.4-caf
Download the source code
This will download all the source code to your computer.Prepare to wait a long time while the source code downloads.
Code:
repo sync
Download device,kernel and vendor tree for Liquid
We will use CM ones. Thanks a lot.
Basically we need to add some projects to the download list. To do this we'll need a local_manifest.
Go in the .repo folder in your working directory(it's an hidden folder press ctrl+h). Create a new folder called "local manifests" then double click on it. Now you'll have to create a roomservice.xml file for the most of the ROMs and a slim_manifest.xml for SlimRoms, it's the same thing just the name it's different.
Open this file and paste this inside:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="github"
fetch="git://github.com/" />
<project name="CyanogenMod/android_device_htc_ville" path="device/htc/ville" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_s4-common" path="device/htc/s4-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_msm8960-common" path="device/htc/msm8960-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_kernel_htc_msm8960" path="kernel/htc/msm8960" remote="github" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_htc" path="vendor/htc" remote="github" revision="cm-11.0" />
</manifest>
Now give another:
Code:
repo sync
and wait.
Do some modifications to the .mk files
Since we are using CM device tree we need to modify them for the choosen ROM.
Go into the device folder(device/htc/ville) and do some modifications. I will explain you what i mean using LiquidSmooth as example.
1) Create a new file called vendorsetup.sh . Open it and inside you'll have to write a script to add it to the lunch list.
Code:
add_lunch_combo liquid_ville-userdebug
You can choose if you want an userdebug version of the rom or an eng one just by writing eng instead of userdebug.
2) Now rename cm.mk into liquid.mk(for other ROMs this file should be renamed in a different way. Use an existing device tree to see the correct naming.)
3) Open the .mk file. You'll find something like this:
Code:
# Release name
PRODUCT_RELEASE_NAME := ville
# Boot animation
TARGET_SCREEN_HEIGHT := 960
TARGET_SCREEN_WIDTH := 540
# Inherit some common CM stuff.
$(call inherit-product, vendor/cm/config/common_full_phone.mk)
# Inherit device configuration
$(call inherit-product, device/htc/ville/device_ville.mk)
# Device naming
PRODUCT_DEVICE := ville
PRODUCT_NAME := cm_ville
PRODUCT_BRAND := htc
PRODUCT_MODEL := One S
PRODUCT_MANUFACTURER := HTC
# Set build fingerprint / ID / Product Name ect.
PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=htc_ville BUILD_FINGERPRINT=htc_europe/ville/ville:4.1.1/JRO03C/128506.8:user/release-keys PRIVATE_BUILD
You need to modify some things to make it buildable:
Code:
# Inherit some common CM stuff.
$(call inherit-product, vendor/cm/config/common_full_phone.mk)
becomes:
Code:
# Inherit some common LiquidSmooth stuff.
$(call inherit-product, vendor/liquid/config/common_phone.mk)
To understand the changes you'll have to go in the vendor folder searching the rom specific vendor and open the config folder to see what .mk file you need.You need to use your brain to understand what you should write instead of cm every ROM has different naming conventions.
This:
Code:
PRODUCT_NAME := cm_ville
becomes:
Code:
PRODUCT_NAME := liquid_ville
4) Now rename cm.dependencies in liquid.dependencies(SlimRoms does not require this step for unsupported devices.)
Start the build
Code:
source build/envsetup.sh
If you created the vendorsetup.sh in the right way you will read the ville folder.
Code:
lunch
Now you have to choose the number near the ville in the list of the supported devices.
If you have done all in the correct way in your terminal you'll see a page like this:
View attachment 2470228
Build
After lunching you have to start the build using the right command:
For liquid:
Code:
time mka liquid
For others:
Code:
make bacon
make
brunch devicename
Wait some time till the build ends hopefully with no errors.​
Now You could think that i forgot you hboot 2.16 users.But this is not true. This is a cherry-pick that let you build every rom for 2.16 hboot.
Code:
cd device/htc/ville
git fetch http://review.cyanogenmod.org/CyanogenMod/android_device_htc_ville refs/changes/47/53647/9 && git cherry-pick FETCH_HEAD
Since you have no 4.4 recovery you'll need this other step:
Code:
Flashable via normal TWRP
add this line
SKIP_SET_METADATA := true
in device/htc/s4-common/BoardConfigCommon.mk
cherry-pick i think.
Code:
cd workingdirectory/build
git fetch http://review.cyanogenmod.org/CyanogenMod/android_build refs/changes/59/53559/6 && git cherry-pick FETCH_HEAD
​
Credits: http://wiki.cyanogenmod.org/w/Build_for_ville
and all the experience i got in this 2 months of building.
For most ROMS you'll have some overlays errors.
Just go in the overlay folder linked in the error and open config.xml. Just delete the lines in the error or search in the folder history the commit that you have to revert.
To revert a commit:
Code:
cd intheinteressedfolder
git revert thenumberofthecommit
Here is a screenshot of the what the number/name of the commit is:
View attachment 2470242
it might be a stupid question: so i dont need any programing skills?
Hai96 said:
it might be a stupid question: so i dont need any programing skills?
Click to expand...
Click to collapse
For building from source nope
phoenixita said:
For building from source nope
Click to expand...
Click to collapse
Ok, then I will test your Guide
Hai96 said:
Ok, then I will test your Guide
Click to expand...
Click to collapse
Added some lines in purple for 2.16 users.
@phoenixita Iam stucking at the point of doing modifications to the mk. files, i dont have a ville folder in my device folder...
View attachment 2471072
Hai96 said:
@phoenixita Iam stucking at the point of doing modifications to the mk. files, i dont have a ville folder in my device folder...
View attachment 2471072
Click to expand...
Click to collapse
Download device,kernel and vendor tree for Liquid
We will use CM ones. Thanks a lot.
Basically we need to add some projects to the download list. To do this we'll need a local_manifest.
Go in the .repo folder in your working directory(it's an hidden folder press ctrl+h). Create a new folder called "local manifests" then double click on it. Now you'll have to create a roomservice.xml file for the most of the ROMs and a slim_manifest.xml for SlimRoms, it's the same thing just the name it's different.
Open this file and paste this inside:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="github"
fetch="git://github.com/" />
<project name="CyanogenMod/android_device_htc_ville" path="device/htc/ville" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_s4-common" path="device/htc/s4-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_msm8960-common" path="device/htc/msm8960-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_kernel_htc_msm8960" path="kernel/htc/msm8960" remote="github" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_htc" path="vendor/htc" remote="github" revision="cm-11.0" />
</manifest>
Now give another:
Code:
repo sync
and wait.
@phoenixita I had followed your guide and now I have the 3.0 liquid smooth build and it boots.
But the build process was very slow, my computer needed 4 hours to build this. Does it need only at the first building process so long or it's my computer ?
If I want to build paranoid android, what do I need to change?
Hai96 said:
@phoenixita I had followed your guide and now I have the 3.0 liquid smooth build and it boots.
But the build process was very slow, my computer needed 4 hours to build this. Does it need only at the first building process so long or it's my computer ?
If I want to build paranoid android, what do I need to change?
Click to expand...
Click to collapse
Paranoid android it's a different thing anyway rmbq has written a guide for porting PA.
4 hours it's okay...
i have another question
When I want to build AOKP,Slim Rom,... I need to create for every Rom a new working directory and download Repositorys,or?
Hai96 said:
i have another question
When I want to build AOKP,Slim Rom,... I need to create for every Rom a new working directory and download Repositorys,or?
Click to expand...
Click to collapse
Yes you need to download each source for each ROM you want to build in its own directory
---------- Post added at 09:02 PM ---------- Previous post was at 08:48 PM ----------
Hai96 said:
@phoenixita I had followed your guide and now I have the 3.0 liquid smooth build and it boots.
But the build process was very slow, my computer needed 4 hours to build this. Does it need only at the first building process so long or it's my computer ?
If I want to build paranoid android, what do I need to change?
Click to expand...
Click to collapse
Google how to set up ccache. It will reduce the time of the builds after you first initial build using it
phoenixita said:
Download device,kernel and vendor tree for Liquid
We will use CM ones. Thanks a lot.
Basically we need to add some projects to the download list. To do this we'll need a local_manifest.
Go in the .repo folder in your working directory(it's an hidden folder press ctrl+h). Create a new folder called "local manifests" then double click on it. Now you'll have to create a roomservice.xml file for the most of the ROMs and a slim_manifest.xml for SlimRoms, it's the same thing just the name it's different.
Open this file and paste this inside:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="github"
fetch="git://github.com/" />
<project name="CyanogenMod/android_device_htc_ville" path="device/htc/ville" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_s4-common" path="device/htc/s4-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_htc_msm8960-common" path="device/htc/msm8960-common" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_kernel_htc_msm8960" path="kernel/htc/msm8960" remote="github" revision="cm-11.0" />
<project name="TheMuppets/proprietary_vendor_htc" path="vendor/htc" remote="github" revision="cm-11.0" />
</manifest>
Now give another:
Code:
repo sync
and wait.
Click to expand...
Click to collapse
Can you incorporate the above instructions in the OP? You did lose me a bit.
Thanks for the guide perhaps a sticky?
ttaidapos said:
Can you incorporate the above instructions in the OP? You did lose me a bit.
Thanks for the guide perhaps a sticky?
Click to expand...
Click to collapse
they are in the OP...I've copied them........................................................
I want to build omni Rom for the One S but i get big Error after the lunch command...
Do you know what iam doing wrong?
View attachment 2474393
Hai96 said:
I want to build omni Rom for the One S but i get big Error after the lunch command...
Do you know what iam doing wrong?
View attachment 2474393
Click to expand...
Click to collapse
Have you renamed cm.mk in omni.Mk? And have you done the right chsnges?
phoenixita said:
Have you renamed cm.mk in omni.Mk? And have you done the right chsnges?
Click to expand...
Click to collapse
Yes I have renamed the .Mk files....
What do you mean with changes?
I have changed all the things from liquid to Omni
Gesendet von meinem HTC One S
Hai96 said:
Yes I have renamed the .Mk files....
What do you mean with changes?
I have changed all the things from liquid to Omni
Gesendet von meinem HTC One S
Click to expand...
Click to collapse
If you are just starting to build. Pick a different ROM than omni. It has a few more changes that needs made than the ones in this guide. And it will error with invalid integers which will be difficult for a new builder to fix.
WhiTeRhiNo said:
If you are just starting to build. Pick a different ROM than omni. It has a few more changes that needs made than the ones in this guide. And it will error with invalid integers which will be difficult for a new builder to fix.
Click to expand...
Click to collapse
I will give omni a try!
WhiTeRhiNo said:
If you are just starting to build. Pick a different ROM than omni. It has a few more changes that needs made than the ones in this guide. And it will error with invalid integers which will be difficult for a new builder to fix.
Click to expand...
Click to collapse
Can you name one Rom that can be build with this guide?

Building custom Lineage rom [Guide needed]

Hey guys, so at its root, it's a common question that has many answers and posts already, but I'm still kinda lost on how one would build for a device that you can't just run "breakfast" on, like our Honor8.
There are things like:
https://forum.xda-developers.com/showthread.php?t=2320007
https://cohaolain.wordpress.com/2017/01/07/building-lineageos-14-1-with-specifics-for-the-oneplus-3/
and many many more that explain how to get the android base repo setup, and that's as far as I am now. I've already done repo sync for android, but now it's down to the device specifics.
https://forum.xda-developers.com/honor-8/development/rom-t3500171
and
https://forum.xda-developers.com/honor-8/development/rom-t3521731
have the sources for Huawei-Dev for the device tree, but where do you tie that into everything?
I had a problem with 14.1, so I had to go with 14.0, so I KNOW there will be issues in the end result. Since I'm going to be mixing 14.0 and 14.1 together. I'm not too worried about that, I'm just trying to learn how the overall compilation actually works or atleast have the guide in mind for how
In that WP link I provided, they mentioned for OnePlus to do a "roomservice.xml" and then a subsequent repo sync. So my guess would be that I my setup would be along the following lines:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="Huawei-Dev/android_vendor_huawei_frd" path="vendor/honor8" remote="github" revision="7.1.1" />
<project name="Huawei-Dev/android_device_huawei_frd" path="device/honor8/honor8" remote="github" revision="cm-14.1" />
<project name="Huawei-Dev/android_kernel_huawei_frd" path="kernel/honor8/kirin950" remote="github" revision="cm-14.1" />
<project name="LineageOS/android_external_stlport" path="external/stlport" remote="github" revision="cm-14.1" />
<project name="LineageOS/android_vendor_nxp-nfc_opensource_Nfc" path="vendor/nxp-nfc/opensource/Nfc" remote="github" revision="cm-14.1" />
<project name="LineageOS/android_vendor_nxp-nfc_opensource_frameworks" path="vendor/nxp-nfc/opensource/frameworks" remote="github" revision="cm-14.1" />
<project name="LineageOS/android_vendor_nxp-nfc_opensource_libnfc-n:ci" path="vendor/nxp-nfc/opensource/libnfc-nci" remote="github" revision="cm-14.1" />
</manifest>
After that would come another repo sync to get those paths downloaded, then I guess I do lunch and brunch?
Okay, so i've ended with this
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="Huawei-Dev/android_vendor_huawei_frd" path="vendor/huawei" remote="github" revision="7.1.1" />
<project name="Huawei-Dev/android_device_huawei_frd" path="device/huawei/frd" remote="github" revision="cm-14.1" />
<project name="Huawei-Dev/android_kernel_huawei_frd" path="kernel/huawei/kirin950" remote="github" revision="7.1.1" />
<project name="LineageOS/android_external_stlport" path="external/stlport" remote="github" revision="cm-14.1" />
</manifest>
for the roomservice.xml
now i went ahead and did "breakfast frd" and then did "mka". But I get the following:
Checking build tools versions...
build/core/binary.mk:1253: external/deqp/Android.mk: libdeqp: Unused source files: \
build/core/binary.mk:1253: external/deqp/Android.mk: libdeqp: Unused source files: \
build/core/binary.mk:1253: external/pdfium/third_party/pdfiumbigint.mk: libpdfiumbigint: Unused source files: bigint/BigInteger.cc bigint/BigIntegerUtils.cc bigint/BigUnsigned.cc bigint/BigUnsignedInABase.cc
build/core/binary.mk:1253: external/pdfium/third_party/pdfiumbigint.mk: libpdfiumbigint: Unused source files: bigint/BigInteger.cc bigint/BigIntegerUtils.cc bigint/BigUnsigned.cc bigint/BigUnsignedInABase.cc
./external/speex/Android.mk:56: TODOArm64: enable neon in libspeex
build/core/package_internal.mk:143: Empty argument supplied to find-subdir-assets
find: `/home/tim/CM14.1/android/system/out/target/common/obj/SHARED_LIBRARIES/libwifi-hal-mock_intermediates': No such file or directory
build/core/package_internal.mk:143: Empty argument supplied to find-subdir-assets
build/core/base_rules.mk:183: *** system/core/rootdir: MODULE.TARGET.ETC.init.rc already defined by device/huawei/frd/rootdir.
build/core/ninja.mk:166: recipe for target '/home/tim/CM14.1/android/system/out/build-cm_frd.ninja' failed
make: *** [/home/tim/CM14.1/android/system/out/build-cm_frd.ninja] Error 1
make: Leaving directory '/home/tim/CM14.1/android/system'
#### make failed to build some targets (19 seconds) ####
Hate to bump, but does anyone have any ideas or input on what i may be doing wrong?
uaktags said:
Hate to bump, but does anyone have any ideas or input on what i may be doing wrong?
Click to expand...
Click to collapse
I'm not building for our Honor 8, but maybe the following will help.
1) I've never had much luck with ninja. The following is what I use to disable ninja and build for the OnePlus One.
cd android/system
repo sync
. build/envsetup.sh
export USE_NINJA=false
./prebuilts/sdk/tools/jack-admin kill-server
export ANDROID_JACK_VM_ARGS="-Xmx5g -Dfile.encoding=UTF-8 -XX:+TieredCompilation"
JACK_SERVER_VM_ARGUMENTS="-Xmx5g -Dfile.encoding=UTF-8 -XX:+TieredCompilation" ./prebuilts/sdk/tools/jack-admin start-server
brunch bacon
2) I have not explored the github for Huawei stuff, but again, here is the roomservice.xml that works for the OnePlus One. Maybe you can compare this with yours for the Honor8 and determine if some resources are missing.
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="LineageOS/android_device_oneplus_bacon" path="device/oneplus/bacon" remote="github" />
<project name="LineageOS/android_device_oppo_common" path="device/oppo/common" remote="github" />
<project name="LineageOS/android_kernel_oneplus_msm8974" path="kernel/oneplus/msm8974" remote="github" />
<project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" />
<project name="LineageOS/android_packages_resources_devicesettings" path="packages/resources/devicesettings" remote="github" />
</manifest>
take a look at cm.dependencies (https://github.com/Huawei-Dev/android_device_huawei_frd/blob/7.1.1/cm.dependencies) and add those three to your room service file as well. I haven't tried to build with the cm14 trees, but I do know the cm13 trees were in a buildable state two months ago.
anks329 said:
take a look at cm.dependencies (https://github.com/Huawei-Dev/android_device_huawei_frd/blob/7.1.1/cm.dependencies) and add those three to your room service file as well. I haven't tried to build with the cm14 trees, but I do know the cm13 trees were in a buildable state two months ago.
Click to expand...
Click to collapse
Thanks, I'll take a look and see if I can apply your two posts.

Porting Lineage 14.1 - Kernel Can't Compile Drivers

This is my first time porting a "new" device to a "new" version of Android. I'm trying to port Lineage 14.1 to the LG Leon LTE, which previously only ran CM 12.1. It's based on the msm8916 chipset. Codenames are c50 and ms345 depending on carrier variant but largely the same thing. I know Lineage 14.1 is out of date, but it was the latest version that still had LG-based msm8916 trees so I figured this was good to bump it up to. Hey, still a lot better than Lollipop.
My sources are set up as such: Everything synced is from Lineage 14.1 as a base, except the LG Leon LTE device tree and the vendor tree which are from CM 12.1. So that means:
Leon-specific device tree: CM 12.1
MSM8916-common device tree: Lineage 14.1
Kernel tree: Lineage 14.1
Vendor tree that has Leon blobs: CM 12.1
Other dependencies like qcom_common and such: Lineage 14.1
The Leon CM 12.1 trees were set up to use a prebuilt kernel image which I do not have, so I had to modify the device tree a bit to build from the Lineage 14.1 generic LG MSM8916 kernel source. I set the defconfig to kernel/arch/arm/configs/c50_tmo_us_defconfig (although this error persists with any defconfig I choose including the generic MSM8916 one). Everything builds just fine until I get to kernel compilation. I get one error message which is the following:
FAILED: /bin/bash -c "(make -j3 CFLAGS_MODULE=\"-fno-pic\" -C kernel/lge/msm8916 O=/home/administrator/lin-14.1/out/target/product/ms345/obj/KERNEL_OBJ ARCH=arm CROSS_COMPILE=\" arm-linux-androidkernel-\" zImage ) && (if grep -q '^CONFIG_OF=y' /home/administrator/lin-14.1/out/target/product/ms345/obj/KERNEL_OBJ/.config; then echo \"Building DTBs\"; make -j3 CFLAGS_MODULE=\"-fno-pic\" -C kernel/lge/msm8916 O=/home/administrator/lin-14.1/out/target/product/ms345/obj/KERNEL_OBJ ARCH=arm CROSS_COMPILE=\" arm-linux-androidkernel-\" dtbs; fi ) && (if grep -q '^CONFIG_MODULES=y' /home/administrator/lin-14.1/out/target/product/ms345/obj/KERNEL_OBJ/.config; then echo \"Building Kernel Modules\"; make -j3 CFLAGS_MODULE=\"-fno-pic\" -C kernel/lge/msm8916 O=/home/administrator/lin-14.1/out/target/product/ms345/obj/KERNEL_OBJ ARCH=arm CROSS_COMPILE=\" arm-linux-androidkernel-\" modules; fi )"
Afterwards I get lots of errors about driver compilation failing for the kernel, but this is the first error message I get. Any guidance would be appreciated, as I feel this is the only major thing standing between me and a successful build.
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
EDIT: I'll post up info about my system and build environment:
Running Ubuntu 18.04.5 with kernel 4.15.0-143, trying to build Lineage 14.1
AMD Phenom tri-core processor with 8GB RAM
Using the following roomservice manifest:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="TeamRegular/android_device_lge_ms345" path="device/lge/ms345" remote="github" revision="cm-12.1" />
<project name="TeamRegular/android_device_lge_c50-common" path="device/lge/c50-common" remote="github" revision="cm-12.1" />
<project name="LineageOS/android_device_lge_msm8916-common" path="device/lge/msm8916-common" remote="github" />
<project name="LineageOS/android_kernel_lge_msm8916" path="kernel/lge/msm8916" remote="github" />
<project name="TeamRegular/vendor_lge" path="vendor/lge" remote="github" revision="cm-12.1" />
<project name="LineageOS/android_external_bson" path="external/bson" remote="github" />
<project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" />
<project name="LineageOS/android_packages_resources_devicesettings" path="packages/resources/devicesettings" remote="github" />
<project name="LineageOS/android_packages_apps_FlipFlap" path="packages/apps/FlipFlap" remote="github" />
</manifest>
The device trees are more split up than usual: there are 3 with 2 common ones. MSM8916-common is expected, but c50-common and ms345 are also split up to account for the different variants of the Leon LTE out there.
To get this far I had to:
Edit c50-common's BoardConfig.mk to point to the kernel source and defconfig
"remove" liblight from c50-common by going to the c50-common/liblight/Android.mk and commenting out every line so the msm8916-common version was used instead (there were conflicts)
Export LC_ALL=C before building to get around some Java issues
Fixed the problem thanks to the help of @bcrichster
The issue lied in kernel/lge/msm8916/drivers/media/radio/radio_iris.c
Copying the entire block of code so you can see what I did. Note this problem may not be universal for everything, but just to state what it was for me: I had to go AROUND the error message to see that radio_hci_smd_init didn't actually exist so I had to "work around" it as you can see below
#ifndef MODULE
extern int radio_hci_smd_init(void);
static int iris_fops_open(struct file *f) {
//jasonmercfix see below for obvious "patching"
if (transport_ready < 0) {
//transport_ready = radio_hci_smd_init();
transport_ready = transport_ready;
}
return transport_ready;
}
#endif
I'm a developer now

Categories

Resources