wiki:SamsungGalaxyXcover2

Modify Internal SDcard storage to External SDcard

The Samsung Galaxy XCover2 (S7710) has only roughly 500MB left on emulated internal storage which is not enough these days if you like to install a lot of applications. There are many tricks around to move data/cache/applications to the external SD card, but all of them has it quirks. Since large SDcard these days are fast and cheap enough having I think this could be done better, by simply discarding the internal /data storage and use an sdcard partition instead.

Requirements

What I will do is modify the /fstab.samsungskomer to change the mount of the ext4 /data of the internal location /dev/block/mmcblk0p25 to the second partition of the external SDCard /dev/block/mmcblk1p2. Technically speaking you do not even need to root your device, but by flashing firmware you will need to do some pretty advanced stuff.

Steps

Format SD Card

Format 32GB class 10 or higher SDcard with two partitions:

  1. 20GB vfat partition, this will serve as the normal extSdCard
  2. 12GB ext4 partition, this will serve as the new /data partition (make sure it is the second and last partition)

Compile Android Tools

 $ git clone https://android.googlesource.com/platform/system/core
 $ cd core
 $ git checkout android-4.2.1_r1

 $ cd libmincrypt
 $ gcc -c *.c -I../include
 $ ar rcs libmincrypt.a *.o
 $ cd ../mkbootimg
 $ gcc mkbootimg.c -o mkbootimg -I../include ../libmincrypt/libmincrypt.a

 $ cd ../mkbootfs
 $ gcc mkbootfs.c  -o mkbootfs -I../include


 $ cd ../libsparse
 $ gcc -o simg2img -Iinclude -lz simg2img.c sparse_crc32.c backed_block.c output_file.c sparse.c sparse_err.c sparse_read.c

Modify stock kernel

I assume you have a stock kernel laying around if not download it from the links below.

 $ ./split_bootimg.pl boot.img

 $ mkdir ramdisk; cd ramdisk
 $ gzip -dc ../boot.img-ramdisk.gz | cpio -i

 # Alter {{{ fstab.samsungskomer }}} and change /data mountpoint from {{{/dev/block/mmcblk0p25}}} to {{{/dev/block/mmcblk1p2}}} 
 $ vim fstab.samsungskomer

 $ cd ..
 $ mkbootfs ./ramdisk | gzip > ramdisk-new.gz
 $ mkbootimg --cmdline 'no_console_suspend=1 console=null' \
  	    --kernel boot.img-kernel \
	    --ramdisk ramdisk-new.gz \
            -o boot-new.img

Upload kernel

  1. Put device in download mode (VolumeDown+Home+Power) on power-on.
  2. $ sudo heimdall flash --pit S7710.pit --Kernel ./boot-new.img # FYI: Pit file retrieval below

Enjoy your new device

The phone will need to be rebooted a few times and it will be complaining about corruption and encryption, just go will the flow and acknowledge the notifications. Ones completed enjoy your improved Samsung Galaxy XCover 2 (S7710).

Misc

Retrieve PIT file

  1. Put device in download mode (VolumeDown+Home+Power) on power-on.
  2. $ sudo heimdall download-pit --output S7710.pit
  3. Reboot device to perform other heimdall actions as other actions will fail after this.

Root Device

  1. Install recovery ROM found at http://forum.xda-developers.com/showthread.php?p=43294839#post43294839 some background at http://forum.xda-developers.com/showthread.php?t=2384015
  2. Install UPDATE-SuperSU-v2.46.zip (or latest) http://forum.xda-developers.com/showthread.php?t=1538053 via recovery mode (Hold VolumeUp+Home+Power on boot).
  3. Enjoy your rooted phone

Reset to factory defaults

$ unzip XEN-S7710XWAOB1-20150206063723.zip $ tar -xf S7710XWAOB1_S7710XENAOA2_HOME.tar.md5 $ ls *.img

 boot.img  cache.img  hidden.img  recovery.img  STE_boot1.img  STE_boot2.img  system.img

Use the PIT file to find out the mapping between image files and partition name to use: $ heimdall print-pit --file ./S7710.pit | grep -e '---' -e 'Partition Name' -e 'Flash Filename'

--- Entry #0 ---
Partition Name: MBR,GPT
Flash Filename: 
--- Entry #1 ---
Partition Name: MasterTOC
Flash Filename: STE_boot.bin
--- Entry #2 ---
Partition Name: PIT
Flash Filename: skomerxx.pit
--- Entry #3 ---
Partition Name: MD5HDR
Flash Filename: md5.img
--- Entry #4 ---
Partition Name: STEboot1
Flash Filename: STE_boot1.img
--- Entry #5 ---
Partition Name: STEboot2
Flash Filename: STE_boot2.img
--- Entry #6 ---
Partition Name: Dnt
Flash Filename: dnt.ssw
--- Entry #7 ---
Partition Name: reserved
Flash Filename: 
--- Entry #8 ---
Partition Name: CSPSAFS
Flash Filename: cspsa.img
--- Entry #9 ---
Partition Name: CSPSAFS2
Flash Filename: cspsa2.img
--- Entry #10 ---
Partition Name: EFS
Flash Filename: EFS.img
--- Entry #11 ---
Partition Name: ModemFS
Flash Filename: modemfs.img
--- Entry #12 ---
Partition Name: ModemFS2
Flash Filename: modemfs2.img
--- Entry #13 ---
Partition Name: Fota
Flash Filename: ssgtest.img
--- Entry #14 ---
Partition Name: IPL Modem
Flash Filename: ipl.bin
--- Entry #15 ---
Partition Name: Modem
Flash Filename: modem.bin
--- Entry #16 ---
Partition Name: Loke4
Flash Filename: normal.bin
--- Entry #17 ---
Partition Name: 2ndLoke4
Flash Filename: normal2.bin
--- Entry #18 ---
Partition Name: PARAM
Flash Filename: param.lfs
--- Entry #19 ---
Partition Name: Kernel
Flash Filename: boot.img
--- Entry #20 ---
Partition Name: Kernel2
Flash Filename: recovery.img
--- Entry #21 ---
Partition Name: SYSTEM
Flash Filename: system.img
--- Entry #22 ---
Partition Name: CACHEFS
Flash Filename: cache.img
--- Entry #23 ---
Partition Name: HIDDEN
Flash Filename: hidden.img
--- Entry #24 ---
Partition Name: DATAFS
Flash Filename: userdata.img

Ensure device is connected using a good quality USB cable, battery is changed and turn it on to download mode using simultaneous press of Volume Down + Home + Power.

Now flash the device:

$ sudo /usr/local/bin/heimdall flash --pit ~/S7710.pit --STEboot1 ./STE_boot1.img --STEboot2 ./STE_boot2.img --Modem ./modem.bin --Kernel ./boot.img --Kernel2 ./recovery.img --SYSTEM ./system.img --CACHEFS ./cache.img --HIDDEN ./hidden.img

Heimdall v1.4.2

Copyright (c) 2010-2017 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
Claiming interface...
Setting up interface...

Initialising protocol...
Protocol initialisation successful.

Beginning session...

Some devices may take up to 2 minutes to respond.
Please be patient!

Session begun.

Downloading device's PIT file...
PIT file download successful.

Uploading STEboot1
100%
STEboot1 upload successful

Uploading STEboot2
100%
STEboot2 upload successful

Uploading Modem
100%
Modem upload successful

Uploading Kernel
100%
Kernel upload successful

Uploading Kernel2
100%
Kernel2 upload successful

Uploading SYSTEM
100%
SYSTEM upload successful

Uploading CACHEFS
100%
CACHEFS upload successful

Uploading HIDDEN
100%
HIDDEN upload successful

Ending session...
Rebooting device...
Releasing device interface...

References

Last modified 7 years ago Last modified on Dec 28, 2017, 1:07:24 PM

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.