[Galaxy S III I9305 (4G LTE + 2GB RAM) Android Deve] p.a.n:
Disclaimer (partially borrowed from MIT license) - WARNING:

THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. If you loose your data, brick your device, any other damage or anything else happens (e.g. your cat eats your dog), it is YOUR PROBLEM and YOUR RESPONSIBILITY. Your device warranty is most probably void after installing this.

Although my original intention was just to help with porting CM 13 to i9305, I ended up with my build :)

To avoid any confusion a because I still have a felling that some people don`t understand this, I have to explain one more detail. I didn`t create this, I only built it. It is a big difference, similar to buying versus building a house. Buying a house is not a simple thing (at least in my country) and you`d probably need to do some changes and repairs before you can start living in it. But building a house is something completely different and much more difficult. The work I`ve done on this CM build is more like buying a house. The see the list of people who "built the house" go into Settings on your phone, section About phone and then Contributors. It is a really long list. Thanks to all of them :)

Also, please, keep in mind, that I am only sharing results of my hobby.

It is build mostly directly from CyanogenMod 13.0 sources. I only added support for i9305 and cm12 chroot for RIL support. See the original thread for some details. Anyway my work on this is really small, I fixed some problems a put all of this together.

You can download here:

cm-13.0-20160907-UNOFFICIAL-i9305.zip

There is also another builds from [MENTION=5197763]evilracer123[/MENTION]. (EDIT 31.3. 2016)

If you want you can also download unofficial build of TWRP with f2fs support TWRP-UNOFFICAIL-3.0.1.img

Changelog:

EDIT (17.1. 2016) - new build with bluetooth fixed

EDIT (19.1. 2016) - new build with bluetooth for non owner fixed, the code for this build downloaded yesterday

EDIT (22.1. 2016) - new build

EDIT (25.1. 2016) - new build - there is some bug in FileManager - see http://xdaforums.com/showpost.php?p=64980000&postcount=150

EDIT (27.1. 2016) - new buld - FileManager bug fixed, Answer call with hardware HOME button commit included

EDIT (29.1. 2016) - new build

EDIT (1.2. 2016) - new build - attempt to fix bluetooth audio problem

EDIT (8.2. 2016) - new build - clock overflow fix (details)

EDIT (17.2. 2016) - new build - I added the SlimISP_PH.bin file, fixed the crashing gallery for non-owner (I added the INTERACT_ACROSS_USERS permission, I hope that it is a correct fix) and added rules for selinux denies [MENTION=4396089]BMP007[/MENTION] reported for logcat.

EDIT (25.2. 2016) - new build with multiple RIL implementations, diff attached

EDIT (19.3. 2016) - new build, f2fs support (some hints here). I attached 2016-03-18_16-49-21-cm-13.0-20160318-UNOFFICIAL-i9305.tar.gz, which contains diff file, roomservice.xml and list of used commits.

EDIT (31.3. 2016) - new build

EDIT (18.4. 2016) - new build

EDIT (25.4. 2016) - new build

EDIT (20.5. 2016) - new build

EDIT (23.6. 2016) - new build

EDIT (7.9. 2016) - new build

EDIT (10.4. 2016) - new build, compiled with ArchiDriod optimizations (thanks to [MENTION=5161352]JustArchi[/MENTION]), fixed mDNIe settings

This ROM supports F2FS - you can find some hints, how to use it here. (EDIT 31.3. 2016)

If you want world writable sdcard, set property persist.world_writable_sdcard to true (search the thread to see how) , but be aware that this is not standard behavior.

Multiple RIL implementation

In this ROM, there are more then one RIL implementations. None of them is perfect, but you can choose, which one of them works better for you. The first RIL implementation is the usual CM 12.1 based one (this is the default one), the second one is based on proprietary files extracted from stock 4.4.4 ROM downloaded from sammobile.com (I9305XXUFOB2_I9305PHNFOB2_I9305XXUFOA1_HOME.tar.md5), the third is based on proprietary files from TheMuppets, with one small change (see here for details). To switch between them open shell (over adb, or using the build in app, or whatever you like) and execute command ril. You will see something like this:

Select RIL implementation:
* 1 - CM 12.1 based
2 - Stock 4.4.4 based
3 - TheMuppets based
x - quit
?

Type 1,2,3 or x and hit enter. The requires root, so be sure it is enabled. After switching, reboot the phone. If you don`t want bother with this, don`t. The default one is, based on my experience, the best:)

If you want gapps, use http://opengapps.org/. As mentioned several times elsewhere flash it RIGHT AFTER the ROM. I tried the nano version and it works fine.

As far as I know all hardware and RIL is working without problems (even barometer is correctly detected).

Know BUGs:

- sometimes after boot RIL is not started correctly (http://xdaforums.com/galaxy-s3/development-i9305/rom-t3252492/post64740417#post64740417) - data connection (and maybe something else) is not working. In that case turn on and of flight mode (or go somewhere without signal). I trying to fix this, but it is difficult.

- the led flash light used as a torch goes off together with the display (http://xdaforums.com/galaxy-s3/development-i9305/rom-t3252492/post64699946#post64699946)(fixed http://review.cyanogenmod.org/#/c/132783/)

- I suppose there is still msm_hsic_host wakelock bug (https://jira.cyanogenmod.org/browse/CYAN-2266). Supposedly unplugging the charger with display on should prevent this. EDIT (13.2. 2016) Some people are reporting that is fixed. I didn`t anyting specific to fix it, so I am not sure. One possibility is that this was also caused by the clock bug.

- if you have non FAT partition on you sdcard, you get a message that sdcard is corrupted. I`ll try to fix this one, it should not be difficult and it is annoying for me.

- gallery app is crashing for non owner (EDIT 19.1. 2016) (EDIT 17.2. 2016)

- there a problem with bluetooth audio - it occasionally stops for few seconds may be fixed in the today`s build (EDIT 1.2. 2016)

- on the first boot (after /data wipe) the SIM may not be found. Reboot should fix this. (EDIT 31.3. 2016)

Selinux is enforcing. If you used some of my previous builds from the original thread and there is something broken, what worked before, this may be the reason. In that case output of dmesg | grep 'avc.*denied' from the moment the problem happens, is a big help to solve it.

Code related to this can be found here:

https://github.com/p-an/i9305-cm13-device

https://github.com/p-an/android_system_core/tree/cm-13.0

https://github.com/p-an/android_build/

and some smaller changes in attached diffs (part of attached tar.gz archives as code.diff since 2016-3-18)

Build instructions:

This is definitely not the only way how to build CM13 for i9305, but it is the procedure, which I, more or less, use.

First of all read (and understand) the original guide. My build process is modified version of it. The modification is necessary, because there is no official CM13 for i9305, so the breakfast command won`t work. It is replaced by creating .repo/local_manifests/roomservice.xml file. Another change is that proprietary file are part of my github repo, so you don`t have to connect the phone.

Followe the guide mentioned above till the repo command setup. The next step is to initialize the CyanogenMod source repository - use the cm-13.0 branch:

$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0

Now before you do repo sync, you have to create the roomservice.xml file (note the actual command is old, download the latest .tar.gz archive attached to this post and extract roomservice.xml from it):

$ mkdir .repo/local_manifests
$ wget "http://xdaforums.com/attachment.php?attachmentid=3657032&d=1456237857" -O .repo/local_manifests/roomservice.xml

Now is time for downloading the code (it takes some time):

$ repo sync

After this is done you will probably need to sync the code from my github with upstream. It may up to date, but i can`t guarantee it. First add the upstream repo:

$ cd ~/android/system/system/core/
$ git remote add upstream https://github.com/CyanogenMod/android_system_core.git

And now sync the code:

$ cd ~/android/system/system/core/
$ git checkout cm-13.0
$ git fetch upstream
$ git merge upstream/cm-13.0 -m 'sync with upstream'

The checkout is necessary to have cm-13.0 branch active. Following two commands download the code from upstream and merge it. They can be replaced with one pull command. Now apply patches. I usually attach them either to this post, or the post, where I announce something new (like a fix). The reason why I share some changes this way, is that I don`t wan`t to fork whole big repository because of a small change. In the latest (cm-13.0-20160217-UNOFFICIAL-i9305.diff) diff there is only one change bigger than one line - delete 5 lines (2 of them are comments). This is usually easy to change manually, if patch fails. You can use this https://groups.google.com/forum/#!topic/repo-discuss/43juvD1qGIQ to apply the patch (store the script into ~/bin/repo_patch and make executable).

$ cd ~/android/system/
$ repo_patch cm-13.0-20160217-UNOFFICIAL-i9305.diff

Now proceed to the Extract proprietary blobs step. The commands are the same, but you don`t have to connect the phone to the computer:

$ cd ~/android/system/device/samsung/i9305
$ ./extract-files.sh

Since you skipped the breakfast step, you should now return to the ~/android/system/ directory and setup the environment:

$ cd ~/android/system/
$ source build/envsetup.sh

Now setup the ccache, if you want. See Turn on caching to speed up build in the original guide.

Start the build:

$ brunch i9305

If you find some problem let me know, I can try to fix it. But I can`t promise anything, this is only hobby for me and my original intention was just to help with porting CM 13 to i9305.

pAn