Galaxy S5 mini built kernel: Difference between revisions

From WickyWiki
Line 174: Line 174:
== Full nandroid-backup using custom recovery ==
== Full nandroid-backup using custom recovery ==


http://techbeasts.com/install-twrp-recovery-samsung-galaxy-s5-mini-g800f/
* http://techbeasts.com/install-twrp-recovery-samsung-galaxy-s5-mini-g800f/
http://cwm-twrp-androids.com/download/samsung-galaxy-s5-mini-duos.html
* http://cwm-twrp-androids.com/download/samsung-galaxy-s5-mini-duos.html
* http://teamw.in/project/twrp2/


http://teamw.in/project/twrp2/
dd Install Method (Requires Root):
 
dd Install Method (Requires Root):


Download the latest image file (.img) from the download link above. Place it in the root of your /sdcard folder and rename it to twrp.img. Run the following commands via adb shell or a terminal emulator app:
Download the latest image file (.img) from the download link above. Place it in the root of your /sdcard folder and rename it to twrp.img. Run the following commands via adb shell or a terminal emulator app:


su
su
 
dd if=/sdcard/twrp.img of=/dev/block/platform/13540000.dwmmc0/by-name/RECOVERY
dd if=/sdcard/twrp.img of=/dev/block/platform/13540000.dwmmc0/by-name/RECOVERY
 


== Unrooting? ==
== Unrooting? ==

Revision as of 22:08, 7 August 2016


TODO: this article needs cleanup

NB: I was trying to enable OTG support on the Galaxy S5 mini by setting some options and rebuilding the kernel from the sourcecode.

Device identification

  • Samsung Galaxy S5 mini
  • Android version LMY47X (lollipop 5.1.1)
  • Original Kernel version 3.4.39-5886751
  • PDA (Build): G800FXXU1BPC4, XX=europe
  • CSC (sales code): G800FPHN1BPD1, you can check your ROM CSC by dialling *#1234#

Official firmware

Add OTG support

Note: the provided boot.img is NOT WORKING, probably as it is based on kitkat (4.x)

based on: G800FXXU1ANG1

Samsung firmware sources

CONFIG_MUIC_SM5502_SUPPORT_OTG=y
CONFIG_MUIC_SM5502_SUPPORT_AUDIODOCK=y
CONFIG_MUIC_SM5502_SUPPORT_DESKDOCK=y

Compile Kernel - doing the same for 5.1.1

Download source code: SM-G800F_EUR_LL_Opensource G800FXXU1BOL4 (lollipop 5.1.1)

Modify 5 lines, look for "SM5502":

 ${KERNLOC}/arch/arm/configs/*
   CONFIG_MUIC_SM5502_SUPPORT*=y

Need arm compiler (toolchain) using 4_9-2015q3:

Note: in README_Kernel.txt it said to use 4.8 but an 'asm' error and some googling made me try other versions.

On Ubuntu 14.04 we seem to need these:

sudo apt-get -y install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32ncurses5

Compile

KERNLOC=/some/path/to/where/you/work
KERNLOC=/media/wilbert/Data/data_nobackup/mobile_galaxy_s5_mini_g800f/BuildingKernel/Kernel

Take Kernel.zip from the sourcecode G800FXXU1BOL4 and extract to ${KERNLOC}

Extract compiler software to ${KERNLOC}/..

cd ${KERNLOC}/..
tar xjf gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2
cd ${KERNLOC}
export ARCH=arm
export CROSS_COMPILE=../gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-
make clean
make xyref5260_evt0_defconfig
make zImage

Note: in README_Kernel.txt it said to use "make -j64" but it does not show any errors in the output so I used "make zImage".

Tried to solve these ERRORS:

  • function __show_regs, process.c, invalid asm: operand number out of range
    • switched to 4_9-2015q3 compiler
  • function sys_mount, namespace.c, kernel_dev may be used uninitialized
    • add "-Wno-maybe-uninitialized" to KBUILD_CFLAGS in Makefile
  1. function show_target_loads, cpufreq_interactive.c, operation on ret may be undefined
    • add "-Wno-sequence-point" to KBUILD_CFLAGS in Makefile (should not be ignored but I was not about to rewrite the sourcecode)

Success (after the passing of time and lines of text):

...
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready

Create boot.img using new zImage

Using Android Image Kitchen tools:

Find and download the original firmware:

Read/unpack the original firmware with kitchen:

  • extract the kitchen to a folder, for example ${KERNLOC}/..
  • extract .tar.md5 from your firmware zip
  • place .tar.md5 in the "kitchen/original_update" folder
  • rename .tar.md5 to .tar, otherwise the kitchen won't recognize. No need to remove the md5 within the file
  • run the kitchen with ./menu, pick option 1, read and pick defaults
  • you now have a working directory such as "WORKING_nnddyy_hhmmss"
  • go to ADVANCED OPTIONS and pick 12, write boot.img (w) contents to a new folder "BOOT-EXTRACTED"
  • you can now change files there, replace zImage in "BOOT-EXTRACTED" with the compiled one arch/arm/boot/zImage
  • built a new boot.img (b) from the contents of "BOOT-EXTRACTED", the resulting boot.img will replace the original boot.img in de working folder "WORKING_nnddyy_hhmmss"

Flashing boot.img (to replace the kernel)

sudo add-apt-repository ppa:modycz/heimdall
sudo apt-get update
sudo apt-get install heimdall
  • disconnect USB cable
  • boot device in download mode: hold home, volume DOWN & power
  • connect USB with a original cable
  • sudo heimdall flash --BOOT boot.img --no-reboot
  • to power off the device, hold hold home, volume DOWN & power for some time
  • you will see a text telling the kernel is 'not seandroid enforcing'

Flashing TWRP recovery

  • disconnect USB cable
  • boot device in download mode: hold home, volume DOWN & power
  • connect USB with a original cable
  • sudo heimdall flash --RECOVERY recovery.img --no-reboot
  • to power off the device, hold hold home, volume DOWN & power for some time

Boot into recovery:

  • power off the device, then hold hold home, volume UP & power for some time
  • Note: if you do not boot into recovery immediately it might be disabled

Restore original recovery to get rid of the message 'not seandroid enforcing'

  • can be extracted from the stock ROM

Extract/create boot.img.tar.md5

Some tools allow an md5 check appended to a tar archive (like Odin).

extract boot.img

tar -xf boot.tar.md5

re-create

tar -c -H ustar boot.img > boot.tar
cp boot.tar boot.tar.md5.tmp
md5sum -t boot.tar >> boot.tar.md5.tmp
mv boot.tar.md5.tmp boot.tar.md5

Other stuff

CWM 13 for G800F

Rooting G800FXXU1BPC4

http://forum.xda-developers.com/galaxy-s5-mini/general/s5-mini-lollipop-5-1-1-t3164021/page17heimdall

  • Reboot your device into Odin mode: turn off your device, then press Volume-Down + Home + Power button at the same time and release them. Confirm the following message with the Volume-Up button.
  • Connect your device to your PC via USB
  • Make sure the device driver's are installed on your PC
  • Start Odin
  • Select PDA and select the kernel image (boot.tar.md5)
  • Check that only "Auto Reboot" and "F. Reset Time" is set
  • Click on "Start": the kernel image should be flashed now and the device should reboot afterwards

Full nandroid-backup using custom recovery

dd Install Method (Requires Root):

Download the latest image file (.img) from the download link above. Place it in the root of your /sdcard folder and rename it to twrp.img. Run the following commands via adb shell or a terminal emulator app:

su
dd if=/sdcard/twrp.img of=/dev/block/platform/13540000.dwmmc0/by-name/RECOVERY

Unrooting?

You can perform a clean unroot after you root, and Chainfire's 'Triangle Away' app might be of some help here

Does it reset KNOX void counter?