[ROM][SM-G313HN] Cyanogenmod 11 for Galaxy Trend 2 (Updated 14th December 2015)

Search This thread

Nikiz

Senior Member
Feb 14, 2014
221
74
27
Kauhajoki
Code:
#include 
/*
* Your warranty is now void.
*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this ROM
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*/
General:
CyanogenMod 11 for Samsung Galaxy Trend 2. (SM-G313HN) This is not 100% completed, so bugs can be expected. There are some bugs listed on this post and if you find more, report them to me. (Either to this thread or via private messages) It will help alot to fix them.

Note: Google apps are not included. Get them here. I recommend using Mini or smaller, because when installing a OTA update, the bigger packages don't fit on RAM if the internal storage is full. You can install the rest from Play store. It is also kinda pointless to have for example, Youtube and Google Maps on /system, because when they are updated, the updated versions go to /data anyway.

Screenshots:


Downloads:
* Latest build
* All builds

Installation:
* Install a custom recovery. (Get CWM here)
* Download the latest version to your SD-card.
* Boot into the recovery mode by pressing <Vol. Up> + <Home> + <Power>
* You can navigate on the recovery mode with the volume keys. <Power> opens the selection and <Back> goes to the previous menu.
* Backup your stock ROM by going to the SD card by going to "backup and restore" -> "backup to /storage/extSdCard". You need about 3-4 gigabytes of free space on the card, depending how full your internal storage is. You can go back to stock if you don't like this ROM, by going to "backup and restore" -> "restore from /storage/extSdCard".
* You need to do a factory reset before installing this. You can do this by selecting "wipe data/factory reset". The installation won't let you install the ROM without doing this.
* Select "install zip" -> "install from /storage/extSdCard" and then select the zip you downloaded.
* Optionally install the OpenGApps-package while you are in the recovery the same way. (Doesn't need a data wipe)
* When it is done installing, go back to the main menu and select "reboot system now" and that should be pretty much it. The first startup takes a while.

Updating:
CyanogenMod checks for updates weekly by default. You can update the phone manually by going to Settings -> About phone -> CyanogenMod-updates, tapping the refresh button and selecting the latest one. After it is downloaded, you can install it.

What works?
* Audio
* Bluetooth (At least file transfer between 2 devices is confirmed, no other devices tested. (For example. headsets, keyboards, etc.)
* Calls
* Camera
* Data connection
* DSP Manager
* GPS
* NFC
* Offline-charging
* OTA updates
* Text messages
* USB (Adb, MTP, PTP, UMS, Tethering, etc)
* Video playback/recording (Mostly.. Front camera video recording doesn't work and some codecs don't work.)
* WiFi
* Wired headsets (Audio, microphone, button)

Bugs:
* First startup might is laggy. The best way is to just skip everything, change the language and set up the accounts, etc. from the Settings app.
* Some videos don't play, because there are some codec issues. (For example on Facebook. YouTube seems to work fine.)
* Some have reported about higher battery drain when using WiFi compared to stock ROM.
* Reported that when calling or sending messages, the phone causes more interference to TV/radio signals than stock. (Excessive transmitting power?) Not too noticeable unless you are very close to the antenna, so it shouldn't cause too much problems. Possibly uses more battery.
* When USB debugging enabled and the phone is restarted, turning USB tethering on too quickly doesn't turn it on completely and removing the USB cable the phone causes the phone to freeze. (This happens when using Linux, the computer shows that it is trying to connect to the internet but the phone shows that USB tethering is not enabled) When this happens, it can be fixed (When the cable is not removed) by going to the settings -> developer settings and disabling ADB, then re-enabling it and finally then turning on USB tethering. Yes, Linux + ADB + turning on USB tethering within 10-20 seconds after rebooting. I know this doesn't affect many people, but happens to me frequently.
* Front camera video recording doesn't work.

Changelog:
Code:
===================================
Build 20151214
===================================
 * Fix libskia. (Updated sources)
 * Remove unused or otherwise useless binary blobs. List of blobs:
	/system/bin/at_distributor
	/system/bin/atx
	/system/bin/atxd
	/system/bin/usb_portd
	/system/bin/usbdev_mode
	/system/etc/apanic_rename.sh
	/system/etc/copy_cp_imgs.sh
	/system/etc/show_navi.sh
	/system/etc/usb_portd.conf
	/system/lib/lib_SA_GoogleFX_ver124b.so
	/system/lib/libatlog.so
	/system/lib/libatparser.so
	/system/lib/libaudiosa.so
 * Rework /system/etc/media_profiles.xml. (Doesn't seem to fix or break anything..)
 * Change kernel compression from XZ to GZip. (Speeds up booting by few seconds)
 * Disable CONFIG_KSWAPD_NOSWAP from kernel. (Enable better swapping)
 * Remove unused services from /init.hawaii_ss_vivaltonfc3g_base.rc.

===================================
Build 20151209
===================================
 * Android security patch December 1, 2015.
 * Removed the a2dp_audio_hw patch, because it did not do anything.

===================================
Build 20151207
===================================
 * Fixed libstagefrighthw. (Caused some app crashes, for example YouTube and Facebook)
 * Enabled zRam. (This should speed up the phone nicely, when there are alot of apps running in the background.)
 * Patched a2dp_audio_hw. I don't know if it changed anything.
 * Cleaned the init scripts a bit.

===================================
Build 20151128
===================================
 * Fixed bluetooth
 * Fixed NFC
 * This build now uses CyanogenMod /init instead of the stock one
 * Now uses OTA updates (yay!)
 
===================================
Build 20151119
===================================
 * Fixed the "WiFi amnesia" bug
 * Fixed offline charger
 
===================================
Build 20151118
===================================
 * Fixed the codec issues
 * Built with newer sources, now shows "Android security patch level"

===================================
Build 20150829
===================================
 * First release.

Source code:
* Device tree
* Kernel

Thanks to itigr for helping me alot in this project!
 
Last edited:

adeii

Senior Member
Nov 11, 2013
414
93
Sajlent Hil
Best wishes with very first custom rom for Trend 2! Keep going!
I prefer pico or nano GApp build. This one should works on CM-11.

update:
I've found that this is very stable and fast ROM, not bugged as I had experience with CM11 on Huawei.
It even works with microG (GApp replacement) very nice! I only use Play Store and YouTube app.
New Pipe (Youtube replacement) have problem only for WebM format video is blue/pink filtered, but smooth playing. For MPEG-4 format, play normal.
Samsung S6 CM11 theme and S Launcher 6 made Trend 2 looks similar to stock touchwiz environment :)
 
Last edited:

Edwin Hamal

Senior Member
Feb 21, 2014
234
62
I found more bugs. Bluetooth isn't working and device forgets wifi password with every reboot.
 
Last edited:

Nikiz

Senior Member
Feb 14, 2014
221
74
27
Kauhajoki
New build coming soon! Changes:
- Most of the hardware codecs work now. (Tested: video recording/playback, Youtube, DSP Manager)
- When I updated the CM sources, there was "Android security patch level" in "About phone". Not sure if these will update automatically or what.
EDIT: New build is available!
EDIT2: Fixed the "WiFi amnesia". Quick patch: https://www.androidfilehost.com/?fid=24269982086999294.
EDIT3: New build uploaded. Fixed the WiFi bug and the offline charger now works.
EDIT4: Accidentally uploaded the eng-build. (Red flashes around the screen and insecure ADB) >.< Rebuilding..
EDIT5: Re-uploaded the build.
 
Last edited:
  • Like
Reactions: adeii and TokRa

Nikiz

Senior Member
Feb 14, 2014
221
74
27
Kauhajoki
Small teaser: :)
QRWuJNZ.png
 
  • Like
Reactions: adeii

Nikiz

Senior Member
Feb 14, 2014
221
74
27
Kauhajoki
Well, the CM12.0 is not usable yet. The base system works pretty well, but RIL/WiFi/Bluetooth are not working yet. Well, it is the first build that actually boots. Also logcat shows alot errors. It is strange, the RIL and WiFi works for about 30 seconds after the first boot, then suddently stops working.. Also, I found out why the stock /init works and CM one doesn't. ueventd tries to load < 32 characters long ueventd.{hardware}.rc and "ueventd.hawaii_ss_vivaltonfc3g.rc" is too long. It needs to be renamed (or patch the init) "ueventd.hawaii_ss_vivaltonfc3g.r" or sometimes "ueventd.hawaii_ss_vivaltonfc3g". (I have absolutely no idea why it varies..)
 

itigr

Senior Member
Oct 21, 2014
188
260
25
Lahdenpohja
Well, the CM12.0 is not usable yet. The base system works pretty well, but RIL/WiFi/Bluetooth are not working yet. Well, it is the first build that actually boots. Also logcat shows alot errors. It is strange, the RIL and WiFi works for about 30 seconds after the first boot, then suddently stops working.. Also, I found out why the stock /init works and CM one doesn't. ueventd tries to load < 32 characters long ueventd.{hardware}.rc and "ueventd.hawaii_ss_vivaltonfc3g.rc" is too long. It needs to be renamed (or patch the init) "ueventd.hawaii_ss_vivaltonfc3g.r" or sometimes "ueventd.hawaii_ss_vivaltonfc3g". (I have absolutely no idea why it varies..)

Great job anyway.

Btw bluetooth should work if you'll use the stock libs (on cm11).
and thanks for pushing patches :D.
 

Nikiz

Senior Member
Feb 14, 2014
221
74
27
Kauhajoki
Great job anyway.

Btw bluetooth should work if you'll use the stock libs (on cm11).
and thanks for pushing patches :D.

Thanks. Btw, here are the DS-versions of the patches: https://github.com/ZIM555/android_device_logands/tree/master/patch Just add the external/tinyalsa to it. Btw, could you try to boot HU with HN kernel and show what "cat /proc/cpuinfo" and "cat /proc/simslot_count" shows with it? It might be possible to make one ROM for both devices. Just need to change "ro.telephony.ril" on init. I just need a way to detect which device it is regardless of what kernel/ROM it is running.
EDIT: Well, I need to figure out a way to disable NFC, preferably without deleting files.
 
Last edited:

Nikiz

Senior Member
Feb 14, 2014
221
74
27
Kauhajoki
Well, the Cyanogenmod Updater is not working.. The OTA server seems to be working though.
EDIT: Oh, it works. Had to add "/api" to the url.
 
Last edited:

Nikiz

Senior Member
Feb 14, 2014
221
74
27
Kauhajoki
Btw bluetooth should work if you'll use the stock libs (on cm11).

Got Bluetooth working on CM libs! Well, atleast file transfer works between two devices. I have no headsets to test though. Just add bt_vendor.conf to /system/etc/bluetooth-
Code:
# UART device port where Bluetooth controller is attached
UartPort = /dev/ttyS0

# Firmware patch file location
FwPatchFilePath=/system/vendor/firmware/

#Firmware Patchfile name
FwPatchFileName=BCM4343A0_001.001.034.0044.0127_ORC_Vivalto-3G_5MC.hcd
(SM-G313HU seems to use a newer patch file, just rename it)

Also made some changes regarding NFC, but I have no way to test it.

The OTA server seems to just dump all builds, regardless of what version is in use so the phone will show older builds as updates as well..
 
Last edited:
  • Like
Reactions: adeii

Nikiz

Senior Member
Feb 14, 2014
221
74
27
Kauhajoki
New build! Changes:
* Bluetooth is now working. (At least file stransfer)
* Small changes to NFC, might not work though. I have no way to test this.
* Uses now the Cyanogenmod /init, no longer using the stock one.
* OTA updates enabled!
 
  • Like
Reactions: adeii

itigr

Senior Member
Oct 21, 2014
188
260
25
Lahdenpohja
Great. One more question, does your kernel compile while building CM? I can only compile it by going to kernel dir and running make here, then defining TARGET_KERNEL_PREBUILT, eitherway it ****s about "zconf.hash.c" .


UPD0: Just started compiling and sata connection died -_-, dammit.

UPD1: one guy reported couple months ago that headset (bluetooth or wired, no idea) button doesn't work
 
Last edited:

Nikiz

Senior Member
Feb 14, 2014
221
74
27
Kauhajoki
Great. One more question, does your kernel compile while building CM? I can only compile it by going to kernel dir and running make here, then defining TARGET_KERNEL_PREBUILT, eitherway it ****s about "zconf.hash.c" .


UPD0: Just started compiling and sata connection died -_-, dammit.

UPD1: one guy reported couple months ago that headset (bluetooth or wired, no idea) button doesn't work
I am compiling the kernel while building CM. It just works for me. I use ArchLinux. Try to use my kernel sources. One thing though, the build might fail, because the new glib. Use "export LANG=C" before building, or add it to "~/.bashrc". For some reason linking libwebviewchromium.so takes for me about 12-48 hours when I reinstalled Arch, normally it took about 6 hours for the whole build..

I just tested the wired headset with the "Okay Google"-thingamajig and it is working perfectly.
 
Last edited:
  • Like
Reactions: adeii

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    Code:
    #include 
    /*
    * Your warranty is now void.
    *
    * I am not responsible for bricked devices, dead SD cards,
    * thermonuclear war, or you getting fired because the alarm app failed. Please
    * do some research if you have any concerns about features included in this ROM
    * before flashing it! YOU are choosing to make these modifications, and if
    * you point the finger at me for messing up your device, I will laugh at you.
    */
    General:
    CyanogenMod 11 for Samsung Galaxy Trend 2. (SM-G313HN) This is not 100% completed, so bugs can be expected. There are some bugs listed on this post and if you find more, report them to me. (Either to this thread or via private messages) It will help alot to fix them.

    Note: Google apps are not included. Get them here. I recommend using Mini or smaller, because when installing a OTA update, the bigger packages don't fit on RAM if the internal storage is full. You can install the rest from Play store. It is also kinda pointless to have for example, Youtube and Google Maps on /system, because when they are updated, the updated versions go to /data anyway.

    Screenshots:


    Downloads:
    * Latest build
    * All builds

    Installation:
    * Install a custom recovery. (Get CWM here)
    * Download the latest version to your SD-card.
    * Boot into the recovery mode by pressing <Vol. Up> + <Home> + <Power>
    * You can navigate on the recovery mode with the volume keys. <Power> opens the selection and <Back> goes to the previous menu.
    * Backup your stock ROM by going to the SD card by going to "backup and restore" -> "backup to /storage/extSdCard". You need about 3-4 gigabytes of free space on the card, depending how full your internal storage is. You can go back to stock if you don't like this ROM, by going to "backup and restore" -> "restore from /storage/extSdCard".
    * You need to do a factory reset before installing this. You can do this by selecting "wipe data/factory reset". The installation won't let you install the ROM without doing this.
    * Select "install zip" -> "install from /storage/extSdCard" and then select the zip you downloaded.
    * Optionally install the OpenGApps-package while you are in the recovery the same way. (Doesn't need a data wipe)
    * When it is done installing, go back to the main menu and select "reboot system now" and that should be pretty much it. The first startup takes a while.

    Updating:
    CyanogenMod checks for updates weekly by default. You can update the phone manually by going to Settings -> About phone -> CyanogenMod-updates, tapping the refresh button and selecting the latest one. After it is downloaded, you can install it.

    What works?
    * Audio
    * Bluetooth (At least file transfer between 2 devices is confirmed, no other devices tested. (For example. headsets, keyboards, etc.)
    * Calls
    * Camera
    * Data connection
    * DSP Manager
    * GPS
    * NFC
    * Offline-charging
    * OTA updates
    * Text messages
    * USB (Adb, MTP, PTP, UMS, Tethering, etc)
    * Video playback/recording (Mostly.. Front camera video recording doesn't work and some codecs don't work.)
    * WiFi
    * Wired headsets (Audio, microphone, button)

    Bugs:
    * First startup might is laggy. The best way is to just skip everything, change the language and set up the accounts, etc. from the Settings app.
    * Some videos don't play, because there are some codec issues. (For example on Facebook. YouTube seems to work fine.)
    * Some have reported about higher battery drain when using WiFi compared to stock ROM.
    * Reported that when calling or sending messages, the phone causes more interference to TV/radio signals than stock. (Excessive transmitting power?) Not too noticeable unless you are very close to the antenna, so it shouldn't cause too much problems. Possibly uses more battery.
    * When USB debugging enabled and the phone is restarted, turning USB tethering on too quickly doesn't turn it on completely and removing the USB cable the phone causes the phone to freeze. (This happens when using Linux, the computer shows that it is trying to connect to the internet but the phone shows that USB tethering is not enabled) When this happens, it can be fixed (When the cable is not removed) by going to the settings -> developer settings and disabling ADB, then re-enabling it and finally then turning on USB tethering. Yes, Linux + ADB + turning on USB tethering within 10-20 seconds after rebooting. I know this doesn't affect many people, but happens to me frequently.
    * Front camera video recording doesn't work.

    Changelog:
    Code:
    ===================================
    Build 20151214
    ===================================
     * Fix libskia. (Updated sources)
     * Remove unused or otherwise useless binary blobs. List of blobs:
    	/system/bin/at_distributor
    	/system/bin/atx
    	/system/bin/atxd
    	/system/bin/usb_portd
    	/system/bin/usbdev_mode
    	/system/etc/apanic_rename.sh
    	/system/etc/copy_cp_imgs.sh
    	/system/etc/show_navi.sh
    	/system/etc/usb_portd.conf
    	/system/lib/lib_SA_GoogleFX_ver124b.so
    	/system/lib/libatlog.so
    	/system/lib/libatparser.so
    	/system/lib/libaudiosa.so
     * Rework /system/etc/media_profiles.xml. (Doesn't seem to fix or break anything..)
     * Change kernel compression from XZ to GZip. (Speeds up booting by few seconds)
     * Disable CONFIG_KSWAPD_NOSWAP from kernel. (Enable better swapping)
     * Remove unused services from /init.hawaii_ss_vivaltonfc3g_base.rc.
    
    ===================================
    Build 20151209
    ===================================
     * Android security patch December 1, 2015.
     * Removed the a2dp_audio_hw patch, because it did not do anything.
    
    ===================================
    Build 20151207
    ===================================
     * Fixed libstagefrighthw. (Caused some app crashes, for example YouTube and Facebook)
     * Enabled zRam. (This should speed up the phone nicely, when there are alot of apps running in the background.)
     * Patched a2dp_audio_hw. I don't know if it changed anything.
     * Cleaned the init scripts a bit.
    
    ===================================
    Build 20151128
    ===================================
     * Fixed bluetooth
     * Fixed NFC
     * This build now uses CyanogenMod /init instead of the stock one
     * Now uses OTA updates (yay!)
     
    ===================================
    Build 20151119
    ===================================
     * Fixed the "WiFi amnesia" bug
     * Fixed offline charger
     
    ===================================
    Build 20151118
    ===================================
     * Fixed the codec issues
     * Built with newer sources, now shows "Android security patch level"
    
    ===================================
    Build 20150829
    ===================================
     * First release.

    Source code:
    * Device tree
    * Kernel

    Thanks to itigr for helping me alot in this project!
    2
    New build coming soon! Changes:
    - Most of the hardware codecs work now. (Tested: video recording/playback, Youtube, DSP Manager)
    - When I updated the CM sources, there was "Android security patch level" in "About phone". Not sure if these will update automatically or what.
    EDIT: New build is available!
    EDIT2: Fixed the "WiFi amnesia". Quick patch: https://www.androidfilehost.com/?fid=24269982086999294.
    EDIT3: New build uploaded. Fixed the WiFi bug and the offline charger now works.
    EDIT4: Accidentally uploaded the eng-build. (Red flashes around the screen and insecure ADB) >.< Rebuilding..
    EDIT5: Re-uploaded the build.
    2
    Offtopic:
    LOL, I literally had this phone for under 24 hours and I managed to get a working custom recovery for this.
    2
    Huh, the problem really was the NTFS partition. Downloaded AND built CM12 overnight. :)
    1
    Now it works with microg. I can find about device by searching it from settings. Can we modify it for sm g313hn? Battery life on AOSP is amazing