FORUMS
Remove All Ads from XDA

[ROM][5.0.2/LRX22G][AOSP][LINARO/OPTIMIZED] FML: Fork My Life (2015/01/08)

916 posts
Thanks Meter: 5,547
 
Post Reply Email Thread
Announcement from MWisBest: Try the Camera, I hear it's yummy.
The Tale of FML.
In mid-August of 2013, I decided to set out to improve the performance of my phone with a more optimized build. I had already begun building CyanogenMod 10.2 shortly after all the repositories were updated on GitHub, so I just started forking stuff on GitHub to improve what I could... 42 forks later I finally had a build that finished, booted, etc. And since 42 is 'the answer to the ultimate question of life, the universe, and everything', and the amount of times I was saying FML during this process, I thought the name 'Fork My Life' would be (in?)appropriate. Now I've finally brought all of the optimizations I was doing with CM-10.2 to CM-11.0 as well, and more recently settled on OmniROM.
Oh, and now there's these Lollipops I'm handing out. They are free as always, and they are very very delicious.


Why Should You Use FML? What's Different?!
To be honest, I don't necessarily care how many users or downloads my ROM has. What I do care about is people liking and enjoying their phone, if you try FML and you like it, great! I'm happy you enjoy it. If you don't, maybe leave some feedback on how I can improve it, and go try something else in the meantime. There are lots of ROMs to choose from, made by lots of talented developers, if you find something you like then I'm happy, regardless of whether or not it's FML. If you'd like to know what I've done that makes FML unique, here's a list:
- Lollipops. They are yummy.*
- Highly optimized, similar to (and in many ways, better than) Linaro, resulting in a smoother and faster Android.**
- Built with the latest GCC 4.9 toolchains from Linaro, with C++11 enabled.**
- Completely developed in the open, everything I do is right on my GitHub for anybody to use and improve upon.
- A (somewhat-)accurate ambient temperature sensor.*
- A unique kernel which attempts to balance features, stability, and of course, performance.
- Complete support for F2FS and EXT4, no 'conversions' required.*
*: Something that was done first by FML and later used and built-upon by other developers for their users to enjoy as well!
**: Something that I think is important yet is notably absent from many ROMs.


Also available is a custom TWRP recovery image (separate download, not in the ROM itself). Notable changes/improvements over official TWRP builds:
- Possibly improved speed. Most notable is the speed of decryption, other things are mostly limited by the speed of the eMMC instead though.
- Completely seamless support of both EXT4 and F2FS.
Lately the TWRP builds have fallen behind though. They will be updated as I get time.


Current Information
With all the stuff I do in FML, I don't think I can ever feel comfortable declaring it as stable. What I can say, is that I test everything I do on my personal device before it goes out to yours. There are some developers out there who feel that testing of their work is for their users, not them, and this is very unfortunate. This is not an attitude I see directly from the wonderful developers the Galaxy Nexus has working for it, but there's one major custom ROM project that screws up everything for itself and any other ROM that is based on it, due to a lack of review of their changes.
Anyway...

Code:
#include 
/*
 * I am not responsible for bricked devices, dead SD cards, thermonuclear
 * war, or the current economic crisis caused by you following these
 * directions. YOU are choosing to make these modifications, and
 * if you point your finger at me for messing up your device, I will
 * laugh at you.
 */
I need people testing and finding bugs if anything is going to be fixed. I might not have the Bluetooth devices you have, I might not use the camera as much as you, I might not use mobile data as much as you; you get the idea.
NOTE: FML is built and tested on the Verizon Galaxy Nexus variant, also known as toro. The GSM Galaxy Nexus variant (the one pertaining to the forum section you're currently in), also known as maguro, is extremely similar in hardware to the Verizon Galaxy Nexus, however I'm not able to test these builds personally. There aren't any code changes between builds for toro and maguro so that I know there shouldn't be any huge issues, but things specific to maguro I'll need feedback on to make sure they're working OK.


How-To
1st FML Flash:
1. Do a backup in recovery and (optionally) backup apps with Titanium Backup or something similar.
2. Factory Reset in recovery (wipe data (NOT /SDCARD THOUGH), dalvik-cache, cache)
3. Wipe /system in recovery.
4. Flash ROM in recovery.
5. Flash GApps in recovery.
6. Reboot, and be patient. First boot takes longer than others.

Subsequent FML Flashes, unless otherwise instructed:
1. Do a backup in recovery and (optionally) backup apps with Titanium Backup or something similar.
2. Wipe /system, cache, and dalvik-cache in recovery.
3. Flash ROM in recovery.
4. Flash GApps in recovery.
5. Reboot, and be patient. First boot takes a while.
NOTE: You can probably get away with just wiping the 2 caches without wiping /system, however if any issues occur please re-test with a /system wipe.

Flashing the TWRP .img:
For this you can either use fastboot or the Flashify app, however I'm not going to delve into the details of that as it's really more deserving of a separate thread to fully explain.


Latest Build
KitKat/ROM Stable: omni-4.4.4-20140705-maguro-FML.zip (159.07 MB)
KitKat/TWRP Stable: fml-twrp-2.7.1.0-20140705-maguro.img (8.58 MB)
KitKat/ROM Beta: omni-4.4.4-20141015-maguro-FML.zip (160.13 MB)
KitKat/ROM Beta Hotfix: boot.img (4.83MB)
Hotfix Info: The latest beta had a bug on maguro causing the radio to be a jerk and not work. Flashing this boot.img will resolve that issue. If you'd rather not flash it with fastboot like is normally done for .img files, you can use the Flashify app for it, or you can open up the ROM zip and replace the boot.img in there with the hotfix.
Lollipop/ROM Beta: FML-AOSP-5.0-20150108-maguro.zip (194.45 MB)

LOLLIPOP INFO:
USE THESE GAPPS: FML-GApps-5.0.x-20150101-tuna.zip (167.81 MB)
They are based on PA's GApps, huge thank you to them!
Known Issues:
- Camera can be a little touchy, but it generally works.
- Long SMS messages fail to send, fix is on-the-way though.
Lollipop Changelogs can be found in the post below!

(KitKat) BETA INFO:
Beta builds are using updated GPU drivers (and an updated kernel to go with them) courtesy of @Ziyan, as well as being up to date with the latest stuff from OmniROM. NOTE: YOU CANNOT FLASH A DIFFERENT KERNEL WITH THESE BUILDS.
Currently broken with the new GPU drivers:
- Hardware Video Decoding FIXED 2014/10/06
- Hardware Video Encoding(?) FIXED 2014/10/08
- Camera (PARTIALLY) FIXED 2014/10/08
- The stock camera app (as well as Google Camera) has this weird quirk of crashing when pressing the shutter button to take a picture, however many different camera apps on the Play Store (in particular Camera ZOOM FX) work flawlessly. Video recording is generally OK, however I've been getting some reports of the audio and video being a little out of sync, so your mileage may vary...
See the Changelog post below for..... well..... changelogs.


GApps
I'm now recommending these GApps, thanks to PA for putting these together.
Personally, I'm using the 'Modular Mini' version, so if you have issues pertaining to GApps, please give that version a try.
IF YOU PLAN ON USING ART, PLEASE READ THIS:
Some GApps packages can be too large for DexOpting to /cache when using ART. As a result, I've added the option of enabling and disabling the 'DexOpt /system to /cache' feature. You can find this right next to the thing in Development Settings to change from/to Dalvik and ART. If you're using a larger, more fully-featured GApps package, and you want to use ART, make sure you uncheck this box before enabling ART. This setting should be persistent, meaning it will last between flashes, so you can just set it and forget it.
Soon I'll get an FML-specific GApps package going, because I haven't found a GApps package that contains a decent amount of stuff without breaking DexOpt /system to /cache.


Known Issues
- The screenrecord command does not work directly, however it does work via the Power menu.
- There can be a slight (noticeable, but not huge) delay when pressing the Recents or Home button.


Thank Yous
AOSP (and all its contributors), because without them we wouldn't have an Android like we do.
OmniROM (and all its contributors), because without them we wouldn't have the awesome bacon-topped AOSP they grill.
steven676 for helping the Galaxy Nexus community with some important KitKat fixes.
koush for the now go-to standard open-source Superuser.
ChainsDD for the original/classic Superuser and for serving our country.
Linaro (and all its contributors), they've done a good job of improving Android and with CM-11.0 I used some of their code.
metalspring for providing helpful code, advice, ideas, and just generally being a good person and developer.
DevVorteX for resolving most if not all of the issues with the VZW Galaxy Nexus RIL on Android versions 4.3 and higher.
Rushead for his long-time use and support of FML.
dbt816 for donating.
bothgoodandbad for donating.
rice923 for donating.
JD 11 for donating.
ulnevrwalkalone for donating.
sickboyy for donating.
mastertech007 for donating.
Shadow Death for donating.
skebner for donating.
CYoung234 for donating.
horeabeni for donating.
IL2 for donating.
Loureiro for donating.
bmbst3alth1 for donating.
Graeme M. for donating.
putzmcgee for donating.
royalchameleon for donating.
T.J. for donating.
KShion619 for donating.
hortonew for donating.
Other donators who have (thus far) chosen to remain anonymous.
And anybody else I may have missed!
NOTE: I sent a PM/e-mail thanking any donor and asking for their permission to list their name here. Having their name listed is 'opt-in', meaning unless I explicitly receive a reply granting permission their name is not listed here.


Donations
I am now accepting donations. Previously I had felt that what I had done programming/code-wise with FML wasn't anything worthy of accepting donations as there's lots of people who could probably do that, however it has now come to a point where the time spent developing FML and the money I've spent on some hardware to help with developing FML is something that donations make sense for (along with some convincing from family and friends to accept donations).
To donate via PayPal, simply click the 'Donate To Me' button that appears on the left side of my posts.
UPDATE: If you can donate through Google Wallet, that would actually be better. PayPal takes some annoying fees with every donation, whereas Google Wallet does not. If you need help donating with Google Wallet, PM me and I'll guide you through it.

What the money received from donations will be used for is:
1. Hardware to help with FML development. Examples of what I have purchased for this are a nice internal Bluetooth 4.0 adapter to aid in testing and improving Bluetooth in FML, an MHL adapter, a USB OTG cable, micro USB cables (due to the locking mechanisms on them wearing out from constant use).
2. Saving for college. I'm not going to an expensive school, I'm being smart and trying to come out of college with as little debt as I can, e.x. currently I'm starting out at a 2 year technical college, so even a little bit of money puts a good dent into costs. Financial aid pays for almost all of my tuition, but it costs me $30/week in transportation.
3. Budgeting more time for FML. Let's be honest: money is a good motivator. It also helps to buy soda and snacks to give me the energy to keep going when I'm struggling figuring something out.
4. The cell phone bill. My dad has been extremely nice with paying for me to be on his plan for a number of years, and I'd like to be able to contribute towards the bill.
5. Whatever you would prefer. If you leave a note in the comment when donating stating how you'd like the money to be spent (e.x. '33% college, 33% cell bill, 33% soda/snacks') and I'll honor your request. You were nice enough to make a donation, the least I can do is spend it how you would most prefer.

XDA:DevDB Information
FML: Fork My Life, ROM for the Samsung Galaxy Nexus

Contributors
MWisBest
Source Code: https://github.com/MWisBest/

ROM OS Version: 5.0.x Lollipop
ROM Kernel: Linux 3.0.x
Based On: AOSP

Version Information
Status: Beta
Stable Release Date: 2014-07-05
Beta Release Date: 2015-01-08

Created 2014-05-27
Last Updated 2015-01-08
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2014-05-26-16-57-43.png
Views:	177773
Size:	243.2 KB
ID:	2764866   Click image for larger version

Name:	Screenshot_2014-05-26-17-07-41.png
Views:	175364
Size:	76.5 KB
ID:	2764867   Click image for larger version

Name:	Screenshot_2014-05-26-17-08-20.png
Views:	167570
Size:	68.5 KB
ID:	2764868   Click image for larger version

Name:	Screenshot_2014-05-26-17-08-29.png
Views:	164121
Size:	81.5 KB
ID:	2764869   Click image for larger version

Name:	Screenshot_2014-05-26-17-08-38.png
Views:	162264
Size:	79.8 KB
ID:	2764870   Click image for larger version

Name:	Screenshot_2014-05-26-17-09-04.png
Views:	164663
Size:	97.9 KB
ID:	2764871   Click image for larger version

Name:	Screenshot_2014-11-06-01-39-55.png
Views:	160091
Size:	90.4 KB
ID:	3001899  
The Following 232 Users Say Thank You to MWisBest For This Useful Post: [ View ]
 
 
27th May 2014, 12:00 AM |#2  
OP Recognized Developer
Flag Green Bay, WI
Thanks Meter: 5,547
 
Donate to Me
More
Changelog, News, Etc.

Lollipop Beta Changelogs:
2015/01/08
- Updated the camera HAL.
This is going to be a little... fragile, at first, but in the long run it's needed. Stock camera app saves pictures now at least.
You may also notice that there's a 5.1MP resolution now (clear your camera app's data if you don't see it), despite our camera supposedly being 5.0MP all these years. Turns out the sensor's native resolution is indeed a whopping 16 pixels taller and 16 pixels wider than we've been using.

2015/01/04
- Added back some of the classic FML optimizations and more.
Built with -fstrict-aliasing flag, C++11, and the Linaro GCC 4.9 toolchain.
- Updated to AOSP "android-5.0.2_r1" tag.
As usual, the only real change was them bumping the version number.
- Improved flashing.
The speed of flashing the ROM zip is now much faster.
- Superuser is now built-in.
There's no need to flash SuperSU. You can find Superuser in the Settings app. You may have to enable the "Development Settings" menu to see it.
Some apps are a little sketchy with this Superuser though, most notably Titanium Backup. If you have issues, try flashing SuperSU.
- Video playback should be fixed.
YouTube in particular seems OK. If you have some weird format you're playing back locally I cannot make any guarantees though.
- The camera situation has improved and also regressed.
The stock camera is kinda back to the point of where it was with the KitKat Beta builds:
---- Preview works. Saving photos does not work. Video recording kinda works.
--- However:
---- The camera calibration is a little messed up. Long story, but it'll be fixed soon. So your white balance may look kinda funky, among other things.
- Audio quality is improved, with support for 192kHz FLAC as well.
This is possible thanks to a new audio resampler, which doesn't impose the same sample rate restrictions of the stock Android ones. It also has far better quality than the stock Android resamplers.
- WiiMotes can now be paired via Bluetooth.
I used to be a bit of a Wii hacking enthusiast... I think I still need to add some more stuff to make it useable as a gamepad or something, but yeah.
- Fixed location services issues.
- (toro) Fixed switching between 4G/LTE and 3G/CDMA network settings.
- Kernel changes:
Reclaimed 38MB of RAM from the carveout stuff.
Removed HDMI's framebuffer, saving an additional ~16MB of RAM. With Lollipop, MHL/HDMI out isn't working with our old HWComposer, so might as well save some RAM in the mean time.
Added overclocking support, as well as adjusted the stock frequencies a little.
Added the GPU kernel driver back into the kernel, rather than building it as a separate module.
Switched to LZO compression for the kernel. It results in a slightly larger size to the kernel, but it boots faster.
Added the "purple tint fix".
Added compiler flag to tune code for Cortex-A9 CPU.
Built with Linaro GCC 4.9 toolchain.
(v3): Fixed VYL00M eMMC bootlooping.

Older Builds:
2014/11/16
- Fixed the RIL.
There were a few things that went into this, and I can't really take much credit for it other than being persistent in trying to fix it.
1. rild needed a little fix-up to somewhat return it to pre-Lollipop form. Basically Google is forcing Qualcomm's junk upon the world. @dhiru1602 pointed me in the direction of some commits from rmcc to hardware/ril that fixed this part of the problem.
2. The kernel needed a commit to support some new junk related to networking in Lollipop. @Ziyan linked me to the change in question.
- Updated to AOSP "android-5.0.0_r6" tag.
Really the only change is that the build number is bumped to LRX21T.
- Switched out a couple small proprietary binaries with a reverse-engineered open-source version.
Thanks to @stargo who has really been killin' it for the Motorola OMAP devices recently, we now have a reverse-engineered pvrsrvinit binary (the executable that fires up the GPU drivers on boot-up). This is especially important because the proprietary pvrsrvinit wasn't compiled as PIE (position-independent executable). With Lollipop, they're forcing everything to be PIE, which is good because PIE is better from a security stand-point. Previously I had been adding a workaround to enable support for non-PIE, which I now don't need.
- Built the ROM with "WITH_DEXPREOPT" set to true.
This basically just adds the ".odex" files to /system. With ART this is important because it cuts down on those lengthy boot-up times because instead of compiling the apps' code on the device, it now compiles it on my computer when I build the ROM instead.
- Changed the "Android is upgrading..." screen to prevent burn-in.
Rather than use Lollipop's eye-hurting bright white theme on this screen, I've switched it back to the classic, darker theme.

2014/11/09
- Switched back to the old OTA package format.
With Lollipop they're now, by default, flashing something similar to a system.img. I switched back to the old format. THIS IS CAUSING VERY LENGTHY FLASH TIMES NOW HOWEVER, I HOPE TO FIX THESE SOON.
- Changed the kernel to build with GCC 4.7.
With Lollipop, Google switched to GCC 4.8. GCC 4.8 has never been kind to the Galaxy Nexus kernel, I'm surprised it was booting at all in the first place... or not, for some people. I'm fairly confident this should fix the VYL00M eMMC issue.
- Added "Ambient Display".
Apparently I need to add a "pick-up" or "significant motion" sensor for it though, so it displays something when the phone is picked up.
- Fixed chromium crashing.
This fixes Browser crashing upon open, among other things. This fix has been in chromium itself for nearly 4 months now, I don't know what the heck Google is doing to AOSP to make it so FUBAR lately...
- Fixed lag in Recents menu.
Now it's smoother than KitKat's, in my opinion.
- Added back F2FS support.
F2FS is now supported again, HOWEVER, it is NOT supported on the /system partition. It really didn't do any good for /system anyway.
- Updated various icons.
The Dialer icon in particular was bothering me. Other things that aren't visible in the launcher, e.g. SettingsProvider, have been fixed as well.
- Fixed FLAC playback, among other media decoding issues.
Just needed a sync-up in the device tree with one thing that I think Google DID do a nice job of with Lollipop actually.


KitKat Beta Changelogs:
2014/10/15
- Cleaned up the kernel.
Ziyan went over all his work not long ago and cleaned up the commit history and whatnot. He's letting me do the task of merging in the GPU driver stuff, so I'm currently just getting the kernel to a "clean slate" of sorts for other kernel devs to fork and build off of. Basically this should hopefully be the new "stock" or "Google" kernel. As a result, there's some bells and whistles missing from this build. It does however include some new audio updates that weren't in the previous kernel, which leads me to this...
- Changed audio sampling rate to 48kHz.
Previously the sampling rate has been 44.1kHz. The Galaxy Nexus supports 48kHz though! Here's what mainly sparked this change: since KitKat, the UI audio effects (e.x. touch sounds) have been switching over to 48kHz. With the Galaxy Nexus still using 44.1kHz, UI sound playback became kinda sluggish, and this was a big contributor to it. The UI sounds use the "fast track" audio path (where it tries to do as little processing as it can to the audio in order to play it with a minimum amount of latency), however a requirement of using this is that no resampling (e.g. converting 48kHz to 44.1kHz, like it has been doing currently with KitKat) can be required on the audio being played. Therefore the UI sounds were taking the "deep buffer" audio path, which has a delay to it. In switching to 48kHz, the "fast track" path is actually even faster now than it has ever been previously, and the Galaxy Nexus was already TOP OF THE LINE when it comes to audio latency believe it or not!
Another thing about this is that there is now support for playback of 96kHz audio files.
- Some updates to the camera HAL.
This hasn't fixed the situation of stock and stock-based camera apps crashing when taking a picture, but it's a start on it though.

NOTICE: Poweramp (and probably most other media players that use their own native code for audio playback rather than straight-up using the built-in Android APIs) is being pissy about the sampling rate change. If you experience issues with music playing, especially things like popping or crackling, please try Play Music or Apollo and see if your issue is still present. I know the UIs for Play Music and Apollo are pretty awful, but I can't write my own media player because I'm dealing with this camera stuff! :(

KitKat Stable Changelogs:
2014/07/05 (Operation: Streamline)
ROM: Synced with OmniROM's latest changes as of around 6:30 AM 2014/07/05 UTC.
ROM/Build: Fully updated to AOSP 4.4.4 (specifically, the android-4.4.4_r1 tag), which really doesn't change much though...
ROM/Build: Stopped including the unused (as far as I can tell) dock.png in /system/vendor/res/images/dock/
ROM/Build: Leveraged a feature added to updater-script creation by OmniROM which coincidentally makes the ROM flashable on any format of /system partition, beit F2FS, EXT4, exFAT, whatever.
ROM/Build: Stopped including Voice Dialer. Voice Dialer is just an unpolished piece of junk which really isn't used ever since Google Now.
ROM/Build: Stopped including 0xBenchmark.
ROM/Core: A number of changes added for completely seamless and simultaneous F2FS and EXT4 support.
ROM/General: Switched to the Android KitKat boot animation, which takes up nearly 4MB less space than OmniROM's boot animation.
ROM/General: Used OptiPNG heavily on numerous things in an effort to save space.
ROM/Kernel: Added F2FS support, nearly 500 commits were merged in for this.
ROM/Kernel: Relaxed BIGMEM a bit to hopefully fix Camera crashing for some users. (Only a 4MB difference BTW)
ROM/Kernel: Optimized CPU L2 cache settings slightly.
TWRP: Added support for seamless and simultaneous F2FS and EXT4.

I'm forgetting a number of things and I'm not going into as much detail on some of this as I'd like to. Frankly, I'm exhausted. Maybe I'll expand on this tomorrow. Maybe.
Oh I also submitted 8 things to the OmniROM Gerrit. One has been merged so far, the others probably will probably be merged in the next day or two.


Older Builds:
2014/06/05 v2 (Operation: Chocoholic)
ROM: Synced with OmniROM's latest changes as of around 10:00 PM 2014/06/05 UTC.

V2 just fixes a bug where Dialer would crash upon entering the Call Log.

2014/06/05 (Operation: Chocoholic)
ROM: Synced with OmniROM's latest changes as of around 7:00 AM 2014/06/05 UTC.
ROM: Fully updated to AOSP 4.4.3 (specifically, the android-4.4.3_r1.1 tag).
ROM/Build: Removed some duplicate alarm and notification sounds in my never-ending effort to slim down the build size.
ROM/General: A few things were added to accommodate building for the Kindle Fire HD 7" that might spill over into the Galaxy Nexus builds (no harm, if anything an improvement).

Wanted to get an Android 4.4.3 build out ASAP, so this build doesn't have much in terms of changes/fixes from myself. This weekend I'll be going on vacation, and after I get back I'm planning on adding F2FS support finally. :good:
BTW, you might want to make sure you have the 4.4.3 GApps.

2014/05/31 (Operation: Jackpot)
ROM: Synced with OmniROM's latest changes as of around 11:30 PM 2014/05/31 UTC.
ROM/ART: Pulled in some things from AOSP's master branch to hopefully decrease initial boot-up time for ART.
ROM/Build: Fixed some more instances of code being compiled/optimized for a generic ARM CPU instead of the Cortex-A9 specifically.
ROM/Build: Included some requested translations.
ROM/Build: Found a fix by PrimeDirective to build frameworks/base/core with -fstrict-aliasing.
ROM/Dalvik: Pulled in some things from AOSP's master branch to increase overall speed for Dalvik.
ROM/General: Fixed a bug where overclocking would revert when the screen was turned off.
ROM/General: Added battery charging LED support.
ROM/General: Fixed notification LED flash interval being way too long by default.
ROM/General: Experimental improvements for GPS. (See: GitHub Commit)
ROM/Kernel: Added the "purple tint fix" commit.
ROM/Settings: Fixed Settings not being translated.

Quite the changelog here! ART is feeling a little snappier in this build but Dalvik might still be faster! :eek:

2014/05/26 (Operation: Maguro)
ROM: Initial maguro build.

After the great number of improvements I made in the most recent build I did for toro, I figured it was perfect timing to get maguro up and running.
If you'd like to have a look at the toro stuff, it's here: http://forum.xda-developers.com/devdb/project/?id=1098
Let me know if there's any issues!

To-Do.
Slim down the build by putting less used stock applications into a separate flashable .zip, such as Browser.


Experiments I'm Looking Into
Creating Black Holes with my phone's ridiculously awesome speed.
The Following 62 Users Say Thank You to MWisBest For This Useful Post: [ View ]
27th May 2014, 12:00 AM |#3  
OP Recognized Developer
Flag Green Bay, WI
Thanks Meter: 5,547
 
Donate to Me
More
Developer Info
This is a little section I'm gonna set up explaining things in more technicalish and "down-and-dirty" details of sorts for developers interested in this project and potentially incorporating it into their projects.

The only thing I ask is to make a little "Thank You" section in your main post like I have here and credit at least me and Linaro, and also credit anybody else's work I have used if you use it as well. I'd also appreciate it if you could maybe link my name to this thread or my user profile here on XDA, but that part isn't a requirement.


All of my work can be found on my GitHub. Please note that any commits on my GitHub that are after the most recent build of FML should be considered experimental and potentially not working at all. I develop on the fly and often times things on my GitHub aren't finished and fully tested unless they have made their way into an official build of FML.
Please pay no attention to where it says a repository was forked from. Often times I'll have forks that I just re-use to avoid duplicate and unnecessary extra repos. For example, in repos forked from CyanogenMod you might notice the default branch is actually something like "omni-4.4" indicating that branch is based from OmniROM and not CyanogenMod.
The best place to keep track of what parts of the Android source code that needs patches is the manifest.


All About Strict Aliasing!
One of the big things Linaro does with improving Android's performance is fixing violations of what's known as "the strict aliasing rule."
A pointer is said to alias another pointer when they both refer to the same location of memory. This is OK and not an uncommon thing to do. The strict aliasing rule is that pointers of different types should never refer to the same location of memory (aka alias each other). Things like this are just fine and dandy:
Code:
void pointlessFunction( uint32_t foo )
{
    uint32_t* const bar = (uint32_t*)&foo;
}
That's alright, as foo and bar are the same type. Note that it's also OK if the only difference between foo and bar is signedness (e.x. uint32_t and int32_t).
Now this...
Code:
void anotherPointlessFunction( uint32_t foo )
{
    uint16_t* const bar = (uint16_t*)&foo;
}
...this is a problem. foo and bar are NOT the same type. This is a violation of strict aliasing.
Strict aliasing allows a compiler to make some assumptions when compiling and optimizing code that it otherwise couldn't. This is a good read about the benefits of it.
Here's a few examples of fixing strict aliasing violations:
DSPManager
frameworks/av
bionic
Note that not everything is fixable, or worth fixing. Sometimes you'll just have to add -fno-strict-aliasing to the problematic section and call it a day:
frameworks/base


Of Unicorns and Compilers...
This section will delve into compilers and flags for them. The "Of Unicorns" part is in reference to the amount of false information, misconceptions, and mythical beliefs regarding these things. One thing in particular is the common belief that throwing every flag possible at the compiler results in better/faster binaries. That couldn't be further from the truth, and is something that actually took me quite some time to properly understand myself (in part because the misconceptions are more common than the actual truth!). In this section I will mainly be referencing the GCC compiler, as that's what is currently used for the majority of Android and most Linux systems as a whole. The other compiler that is making quite a run at GCC is Clang, so first I will talk about GCC vs Clang quickly:

GCC vs. Clang
GCC is currently (~May 2014) the most common compiler used for Linux and Linux-based systems (which includes Android). GCC was first released in 1987, as the "GNU C Compiler." Not long after its release, it was extended to support C++ as well, and over time many different languages and platforms became supported by GCC so it is now called the "GNU Compiler Collection." Over all this time, GCC became more and more difficult to maintain. As time passes on, fewer and fewer people have been able to get their foot in the door to work on GCC as it just became so... bloated.
Eventually, somebody finally got the guts (or resources, rather) to take on GCC and make a competing compiler. Clang was born.
Clang is a front-end for LLVM. Initially, LLVM was going to make use of GCC's front-end for making a C/C++/etc. compiler using LLVM's back-end, however this was just too cumbersome of a task due to GCC's difficult-to-work-with codebase, which was what sparked Clang instead.
Fun fact: Clang 1.0 was released in 2009. It was first open-sourced in 2007. That's 20 years after GCC's inception, but yet Clang has managed to tear GCC's usage apart. However to be fair, LLVM's initial release was 2003, but that's still a decade and a half head-start given to GCC!

As of GCC 4.8 vs. LLVM/Clang 3.4, it's kind of a toss-up between the two. In some cases GCC has better binary results and in other cases Clang has better binary results, however Clang outshines GCC in areas other than the resulting compiled code:
1. Clang is faster and uses fewer resources than GCC when compiling. It's usually a safe bet that Clang is going to be at least 50% (1.5x) faster than GCC when compiling, whilst also somehow using less RAM and disk space than GCC. For those of you that like being eco-friendly, just imagine the amount of energy this saves!
2. Clang has generally been ahead-of-the-game when it comes to supporting C++ standards. Current example: Clang has been C++14 feature-complete since the end of 2013, while GCC (even in 4.9!) is not.

Thanks to the competition from Clang, GCC has also been stepping up its game as well too. All-in-all this has been a win-win for everybody so far.


Flags.
Aaand here we go on compiler flags. For this I'll be referencing the GCC documentation on "GCC command options", here: https://gcc.gnu.org/onlinedocs/gcc/i...c_Invoking-GCC
Of particular interest in this section will be "Options That Control Optimization", but other sections are often overlooked which can be of use, I'll explain those later though.

The first thing you'll see in the "Options That Control Optimization" section are the -O options. These are general optimization levels that give you a sensible default to work with.
First off is -O0. This is the default, and doesn't turn on any optimization options. This is generally only used for debugging code, as some optimizations can interfere with that.
Next would be -O1. This enables some optimizations to reduce code size and improve speed, without increasing the time it takes to compile code significantly.
After that is -O2. This is what is generally used for most program compiling, as it enables plenty of optimizations and these ones generally don't cause problems/bugs with the resulting binaries whilst greatly improving speed.
Then there are some non-numbered ones which I'll go over:
-Os is somewhere between -O1 and -O2. It enables most of -O2's options, but disables some that can increase the size of the resulting binaries. This can be of great use when dealing with smaller embedded systems where space is generally preferred over speed. It's closer to -O2 than -O1...
-Og is useful for debugging purposes. It enables a few optimizations that generally don't effect ability to debug code, so devs don't have to deal with the slowness of -O0 as much as usual.
And then there's the almighty -O3...
-O3 enables some extra optimizations that -O2 does not. The drawbacks are increased compile time, increased binary size, and the possibility for some bugs. In many cases, -O3 might not improve speed over -O2 whatsoever. In other cases it can be helpful, but it is nothing compared to the differences between -O1 and -O2.
Android generally uses -O2 by default. It's safe and fast enough for most cases. -Os is also used for any Thumb instruction-set code for ARM, as Thumb is generally meant for reduced size and complexity from what I can tell.
There's also a flag kinda above -O3, which is -Ofast. The problem with -Ofast is that it can cause huge problems for any code that makes the (correct!) assumption about some math stuff, so it is generally avoided.

Then there are some flags that aren't enabled by any optimization level. This is not without reason: these flags are, generally, useless. They increase compile time by a ridiculous amount, and their effects on the resulting binaries might be absolutely nothing. Zilch. Nadda. Even for something as large as Android, these flags can still do nothing. If these flags can have a speed-up, it's generally not without risk, and they should be kept to specific use-cases rather than used on every single thing.
These flags can be considered about the equivalent of using the "placebo" profile for h264 video encoding. It has a less-than 1% improvement in the resulting quality, yet can take twice as long to render (or, in this case, compile). And they are pretty much exactly what the placebo profile for h264 encoding is, a placebo effect. You will not find a measurable increase in speed, and the risks associated with it are generally not worth it!

There is an exception to that though: -flto. This enables Link-Time Optimization, and can have huge impacts on both the speed of the binaries as well as even a reduction in their size! LTO can be viewed as this: when the compiler is truckin along compiling things, it generally only sees bits and pieces of the project at hand. LTO allows the compiler to view how everything works together rather than just each individual part, and in doing so it can find HUGE improvements! When LTO was in its infancy with GCC, it was pretty unstable, but with GCC 4.8 and above it can be used reliably. It's also advised to use the -fuse-linker-plugin flag when using LTO as well (read the docs on that).
Here is my work on using LTO with Android, it's more involved than simply adding it with all the other flags which is why you'll generally hear the people that are making use of the "unicorn flags" say it doesn't work...
https://github.com/MWisBest/android_...8c038c5e9fde1f
https://github.com/MWisBest/android_...724fb92ef35b5e
https://github.com/MWisBest/android_...b1c2631643eebc
Ignore the things in the last couple commits there that aren't related to LTO...
But like I said, it's more involved than just throwing the flags blindly at the compiler, there are a few other fixes required to get a successful build with LTO:
https://github.com/MWisBest/android_...6a99108ce08092
And then it also has to be disabled in ART, that fix courtesy of @metalspring : https://github.com/MWisBest/android_...d261b79bd9baa9

// To be continued.



Small but Helpful Things
I thought I'd put some simple little things here that can be immensely helpful to devs. Most of these they'll probably know already, but some won't and when I learned these things they had a profound impact on development. At the very least it can be a helpful reminder/reference sort of thing.
Properly Logging Builds
This is something I finally figured out not long ago that has had a huge impact on debugging problems...
I'm not all that great with bash but I generally understood redirecting the output of a program to a file. However, when I tried the usual:
Code:
make -jX otapackage > buildlog.txt
, not everything was going to the file. Eventually I learned that just using ">" only redirects stdout, and not stderr which was where all the warnings and errors went to. To get around that, there's a couple options. One, you can redirect stdout and stderr to separate files, like so:
Code:
make -jX otapackage 1> buildstdout.txt 2> buildstderr.txt
, or the other option is to just lump them all into a single file using:
Code:
make -jX otapackage > buildlog.txt 2>&1

This post is a WIP...
The Following 39 Users Say Thank You to MWisBest For This Useful Post: [ View ]
27th May 2014, 12:01 AM |#4  
OP Recognized Developer
Flag Green Bay, WI
Thanks Meter: 5,547
 
Donate to Me
More
As you may or may not have read in the OP, this ROM was built and tested on the Verizon Galaxy Nexus only for about 9 months. I don't own a GSM Galaxy Nexus, so I'm not able to fully test these GSM builds, however the differences between the two are minimal and everything should work OK.

As the Verizon Galaxy Nexus is pretty much only in the USA, one thing I did to reduce the size of the ROM was to cut back on some of the translations. I've kept what I thought were fairly common languages (including outside the USA). Since I've now expanded to the GSM Galaxy Nexus, which is more international, there's a chance that a language you need might be missing. Please just let me know what you need and I'll be more than happy to include it.
The Following 17 Users Say Thank You to MWisBest For This Useful Post: [ View ]
27th May 2014, 01:26 AM |#5  
pvkiniyan95's Avatar
Senior Member
Flag Chennai
Thanks Meter: 420
 
More
Downloading....perfect timing...i am rom hopping for a while and excited to try this, skimmed last few pages of your toro thread
why not take a look at the recent thumb flag optimisation commits that claimed 6x speeds recently...
The Following User Says Thank You to pvkiniyan95 For This Useful Post: [ View ] Gift pvkiniyan95 Ad-Free
27th May 2014, 01:27 AM |#6  
qtoo941's Avatar
Senior Member
Flag Sofia
Thanks Meter: 127
 
More
You have written that you have built CM 10.2 FML version. Is it compatible with maguro? Where can I find it and flash it over my phone just to see it?
The Following User Says Thank You to qtoo941 For This Useful Post: [ View ] Gift qtoo941 Ad-Free
27th May 2014, 02:16 AM |#7  
OP Recognized Developer
Flag Green Bay, WI
Thanks Meter: 5,547
 
Donate to Me
More
Quote:
Originally Posted by pvkiniyan95

Downloading....perfect timing...i am rom hopping for a while and excited to try this, skimmed last few pages of your toro thread
why not take a look at the recent thumb flag optimisation commits that claimed 6x speeds recently...

Yeah I replied to that thread... it's bogus, unsafe, and unprofessional. FML was far beyond that stuff since its inception and it has only gotten better since.


Quote:
Originally Posted by qtoo941

You have written that you have built CM 10.2 FML version. Is it compatible with maguro? Where can I find it and flash it over my phone just to see it?

This right here is the first build I've done that's maguro compatible, and there's been lots of improvements since when this ROM was based off of CM so even if it'd work on maguro it's not really worth trying at this point. Sorry!
The Following 2 Users Say Thank You to MWisBest For This Useful Post: [ View ]
27th May 2014, 06:33 AM |#8  
pianistaPL's Avatar
Senior Member
Flag Poznań - Poland
Thanks Meter: 1,107
 
More
Wow, amazing, i was waiting for this! OmniMetal is a wonderful ROM but we can't except that metalspring will be doing regulary updates since he has a new phone.
The Following 2 Users Say Thank You to pianistaPL For This Useful Post: [ View ] Gift pianistaPL Ad-Free
27th May 2014, 12:13 PM |#9  
osm0sis's Avatar
Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 20,070
 
Donate to Me
More
This might be the quickest ROM my maguro has ever seen. I can't even believe how fast Chrome opens.
The Following 5 Users Say Thank You to osm0sis For This Useful Post: [ View ]
27th May 2014, 12:32 PM |#10  
ahmadairfan's Avatar
Senior Member
Flag Bandung
Thanks Meter: 103
 
More
Downloading!
What do you recommend guys, Dalvik or ART?
I've been always using ART before and then I read replies in toro thread, most likely chooses Dalvik eh?

Thank you
The Following 3 Users Say Thank You to ahmadairfan For This Useful Post: [ View ] Gift ahmadairfan Ad-Free
27th May 2014, 12:53 PM |#11  
pianistaPL's Avatar
Senior Member
Flag Poznań - Poland
Thanks Meter: 1,107
 
More
Quote:
Originally Posted by ahmadairfan

Downloading!
What do you recommend guys, Dalvik or ART?
I've been always using ART before and then I read replies in toro thread, most likely chooses Dalvik eh?

Thank you

Only ART! Feel the smoothness
Post Reply Subscribe to Thread

Tags
5.0, aosp, linaro, maguro, omnirom, optimized

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes