Samsung Galaxy S2 Plus (I9105) - Repartitioning with REPIT successful - Android Q&A, Help & Troubleshooting

This post is an information for other users who want to repartition their Samsung Galaxy S2 Plus (i9105 or i9105p).
After reading this post:
[TOOL] Lanchon REPIT: The Data-Sparing Repartitioning Tool For Android
and some modifications to the repit template zip for i9100 provided by Lanchon I have successfully repartitioned my i9105.
Now i have 1 GB system and 5,25 GB data partition size.
Here are the changed parts of the file /env/script which I rezipped into the repit template zip named lanchon-repit-20170115-system=1G-data=max-preload=min+wipe-i9105.zip (now for i9105):
Code:
...
#####################################################
# Lanchon REPIT - Device Handler #
# Copyright 2016, Lanchon #
#####################################################
#####################################################
# Lanchon REPIT is free software licensed under #
# the GNU General Public License (GPL) version 3 #
# and any later version. #
#####################################################
### galaxy-s2-plus
device_makeFlashizeEnv="env/arm.zip"
#device_makeFilenameConfig="system=1G-data=same-sdcard=max-preload=min+wipe"
device_makeFilenameConfig="system=1G-data=max-preload=min+wipe"
device_init() {
device_checkDevice
# the block device on which REPIT will operate (only one device is supported):
# exynos 4210:
#sdev=/sys/devices/platform/dw_mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0
# omap 4430:
#sdev=/sys/devices/platform/omap/omap_hsmmc.1/mmc_host/mmc0/mmc0:0001/block/mmcblk0
sdev=/sys/block/mmcblk0
spar=$sdev/mmcblk0p
ddev=/dev/block/mmcblk0
dpar=/dev/block/mmcblk0p
sectorSize=512 # in bytes
# a grep pattern matching the partitions that must be unmounted before REPIT can start:
# unmounting the partitions of the selected block device seems to be enough:
#unmountPattern="${dpar}[0-9]\+"
# but we will unmount the external sdcard too (due to some reports that i was so far unable to reproduce):
#unmountPattern="/dev/block/mmcblk\(0\|1\)\(p[0-9]\+\)\?"
unmountPattern="/dev/block/mmcblk[^ ]*"
}
device_initPartitions() {
# the crypto footer size:
local footerSize=$(( 16384 / sectorSize ))
# not all partition types support crypto footers; those that do not will ignore the value passed to initPartition.
# also, not all devices use crypto footers; on those devices, pass a value of zero to initPartition for all partitions.
# the set of partitions that can be modified by REPIT:
# <gpt-number> <gpt-name> <friendly-name> <conf-defaults> <crypto-footer>
#initPartition 7 CACHE cache "same keep ext4" 0
#initPartition 8 MODEM modem "same keep raw" 0
#initPartition 9 FACTORYFS system "same keep ext4" 0
#initPartition 10 DATAFS data "same keep ext4" $footerSize
#initPartition 11 UMS sdcard "same keep vfat" 0
#initPartition 12 HIDDEN preload "same keep ext4" 0
initPartition 19 system system "same keep ext4" 0
initPartition 21 userdata data "same keep ext4" $footerSize
initPartition 20 HIDDEN preload "same keep ext4" 0
# resizing cache is disabled for now since i am not sure that the modem partition can be safely moved simply by updating
# the GPT and not changing the PIT. it is possible that whatever code boots up the modem might read the partition offset
# from the PIT and not the GPT. it is also possible that the device might brick if the modem cannot be brought up.
# the set of modifiable partitions that can be configured by the user (overriding <conf-defaults>):
#configurablePartitions="7 $(seq 9 12)"
#configurablePartitions="$(seq 9 12)"
configurablePartitions="$(seq 19 21)"
# for some partitions it may be unsafe to do anything besides moving them around; those should be left out of this set.
}
device_setup() {
### this is the first function that can access block devices and/or their metadata.
# the number of partitions that the device must have:
#partitionCount=12
partitionCount=21
# the set of defined heaps:
allHeaps="main"
# the partition data move chunk size (must fit in memory):
moveDataChunkSize=$(( 256 * MiB ))
# only call this if you will later use $deviceHeapStart or $deviceHeapEnd:
detectBlockDeviceHeapRange
### the following settings are actually per-heap, but can be defined here instead if their values are constant.
# the size of partitions configured with the 'min' keyword:
#heapMinSize=$(( 8 * MiB ))
# this defaults to 8 MiB, the smallest power-of-2 size that will fit a standard ext4 file system.
# note: this setting only applies to the 'min' keyword; partition sizes all the way down to $heapSizeGranularity
# can still be manually defined even if they are smaller than $heapMinSize.
# the partition alignment:
heapAlignment=$(( 4 * MiB ))
# for best results it is recommended that you use the same alignment chosen by the device OEM.
# you can determine its value by analyzing the stock partitioning, for example with this command:
# > parted /dev/block/whatever -s unit MiB print free
# if in doubt, use 1 or 4 MiB.
# user-configured partition sizes will be rounded (to nearest) to multiples of this value:
#heapSizeGranularity=$heapAlignment
# this defaults to $heapAlignment and should normally not be changed.
}
device_setupHeap_main() {
# each heap is a set of partitions that are physically contiguous in the block device.
# all partition manipulation works exclusively within a heap.
# the set of contiguous partitions that form this heap, in order of ascending partition start address:
#heapPartitions="$(seq 7 12)"
#heapPartitions="$(seq 9 12)"
heapPartitions="$(seq 19 21)"
# the disk area (as a sector range) to use for the heap partitions:
# (the sector range is from heapStart to heapEnd-1 inclusive.)
#heapStart=$deviceHeapStart # the first usable sector of the device
#heapStart=$(parOldEnd 6) # or one past the end of a specific partition
#heapStart=$(parOldEnd 8) # or one past the end of a specific partition
heapStart=$(parOldEnd 18) # or one past the end of a specific partition
#heapStart=344064 # or a fixed sector number
heapEnd=$deviceHeapEnd # one past the last usable sector of the device
#heapEnd=$(parOldStart 13) # or the start of a specific partition
#heapEnd=30769152 # or a fixed sector number
}
#####################################################
# Lanchon REPIT - Device Handler #
# Copyright 2016, Lanchon #
#####################################################
#####################################################
# Lanchon REPIT is free software licensed under #
# the GNU General Public License (GPL) version 3 #
# and any later version. #
#####################################################
### i9100
#
#device_checkDevice() {
#
# checkTool getprop
#
# case ":$(getprop ro.product.device):$(getprop ro.build.product):" in
# *:galaxys2:*) ;;
# *:i9100:*) ;;
# *:GT-I9100:*) ;;
# *:GT-I9100M:*) ;;
# *:GT-I9100P:*) ;;
# *:GT-I9100T:*) ;;
# *:SC-02C:*) ;;
# *)
# fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'"
# ;;
# esac
#
#}
### i9105
device_checkDevice() {
checkTool getprop
case ":$(getprop ro.product.device):$(getprop ro.build.product):" in
*:s2ve:*) ;;
*:s2vep:*) ;;
*)
fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'"
;;
esac
}
### code after this comment is old and no longer used. it is here for documentation purposes only.
device_detectBlockDeviceSize_i9100() {
# this is unused code from when detectBlockDeviceHeapRange had not yet been implemented.
# it is here for documentation purposes only, ports to other devices should delete this function.
info "detecting eMMC size"
local deviceSize=$(cat $sdev/size)
local heapEnd8GB=15261696
local heapEnd16GB=30769152
local heapEnd32GB=62513152
if [ $(( deviceSize < heapEnd8GB )) -ne 0 ]; then
fatal "eMMC size too small"
elif [ $(( deviceSize < heapEnd16GB )) -ne 0 ]; then
heapEnd=$heapEnd8GB
info "eMMC size is 8 GB"
elif [ $(( deviceSize < heapEnd32GB )) -ne 0 ]; then
heapEnd=$heapEnd16GB
info "eMMC size is 16 GB"
else
heapEnd=$heapEnd32GB
info "eMMC size is 32 GB"
fi
}
device_configureStockLayout_i9100() {
# this is unused code from when the configuration parser had not yet been implemented.
# it is here for documentation purposes only, ports to other devices should delete this function.
# stock partition layout for i9100:
system_size=1
data_size=4
#sdcard_size=11.5078
sdcard_size=max
preload_size=0.5
system_fs=ext4
data_fs=ext4
sdcard_fs=vfat
preload_fs=ext4
}
#####################################################
#deviceName=i9100
deviceName=i9105
main "[email protected]"
Hope this is useful for anyone.

you are the first person ever other than me that ported REPIT to a device, congrats!!!
if you want an official port however, you still have to follow the docs and post a repit-dump of your stock phone... which unfortunately you can't do because you already repartitioned...
anyway, thanks so much!!!

Lanchon said:
you are the first person ever other than me that ported REPIT to a device, congrats!!!
if you want an official port however, you still have to follow the docs and post a repit-dump of your stock phone... which unfortunately you can't do because you already repartitioned...
anyway, thanks so much!!!
Click to expand...
Click to collapse
Hi, I've got the same device, I'm attaching the LOG here. I've raised an issue in GitHub, but I was unable to attach the file (unspecified error).
I'll monitor Github and this post, if nothing happens I'll implement the code from the OP; looking at the cat proc/partitions the numbers do match. :good:

As a sidenote, I think it could be possible to reduce the partition 18 too, 1GB is too much for CSC.
Code:
18 138MB 1212MB 1074MB ext4 CSC
On my s2 (i9100) is already 100MB - what do you think?

Hi!
Small update, I correctly resized my CACHE partition down to 100Mb, from 1Gb (!).
Attached to this post is the "script" file you need to replace in the Lanchon Repit zip file, this will work for the Galaxy i9105/p.
Relevant changes are these ones:
Code:
initPartition 18 CSC cache "same keep ext4" 0
initPartition 19 system system "same keep ext4" 0
initPartition 20 HIDDEN preload "same keep ext4" 0
initPartition 21 userdata data "same keep ext4" $footerSize
and
Code:
configurablePartitions="$(seq 18 21)"
..and a couple more just to work on this partitions ordering (just replace entierly the original file with this one attached).
Naturally, rename the Lanchon script to:
Code:
lanchon-repit-20170115-cache=100M+wipe-system=1.1G+wipe-data=max+wipe-preload=min+wipe-i9105.zip
This will give you a system partition of 1.1G, max Data partition and minimal 100Mb Cache. I think it's possible to downsize to 50Mb or less, might do it later. The phone works well, I'm using the RR 5.84 (7.1.2).
FULL credit to Lanchon original Repit and the OP of this post.

Related

[Q] Nanddump MTD Devices and mount in Ubuntu don't work

Hi, i want to dump the MTD Devices from my rooted HTC Desire (Android 2.2) and mount the yaffs2 images in my Ubuntu 11.04 (Guest in VirtualBox).
I compiled nandump/nandwrite (mtd-utils 1.4.5) with the arm-none-linux-gnueabi-gcc compiler. After that i push it with ADB on the sdcard and remount the sdcard to allow to execute binaries.
Code:
# su
# cd sdcard
# mount -o remount,rw -t vfat /dev/block/vold/179:1 /mnt/sdcard
# ./nanddump -f mtd5.yaffs /dev/mtd/mtd5
nanddump: warning!: you did not specify a default bad-block handling
method. In future versions, the default will change to
--bb=skipbad. Use "nanddump --help" for more information.
nanddump: warning!: in next release, nanddump will not dump OOB
by default. Use `nanddump --oob' explicitly to ensure
it is dumped.
ECC failed: 0
ECC corrected: 0
Number of bad blocks: 1
Number of bbt blocks: 0
Block size 131072, page size 2048, OOB size 64
Dumping data starting at 0x00000000 and ending at 0x093a0000...
The dump has a size of 152 mb.
Now i copy the dump to my Ubuntu System and mount it in Ubuntu.
Code:
# modprobe mtd
# modprobe mtdchar
# modprobe mtdblock
# ./tools/mtd-utils/load_nandsim.sh 256 128 2048
# insmod ./tools/yaffs2/yaffs2multi.ko
# nandwrite -a -p /dev/mtd0 /home/af/mtd5.yaffs2
...
Writing data to block 8691 at offset 0x87cc000
# mount -t yaffs2 /dev/mtdblock0 /home/af/mnt
# cd /home/af/mnt
~/mnt# ls
lost+found
The mount point only has a lost+found folder.
Why?
I hope you can help me.
Hi, i have your same problem.
Have you solved it?
Thanks
Please use the Q&A Forum for questions Thanks
Moving to Q&A

[Q] GT-P7320T custom rom creation with rom kitchen

Hi guys,
After years of using this site to read up on how-tos for my g1 and desire hd, I have finally hit a brick wall and need to post a question.
My mum won this GT-P7320T branded to telstra ( Australia) and overall, the hardware specs werent too bad, but before the ics update came out finally in january it was terribe to use.
The update has actually been a massive improvement, but being branded and all that junk is as annoying as hell, so i have decided to build my own rom. this is my first time building a rom. ive flashed plenty, but its a different kettle of fish.
i am using the telstra branded stock ics rom with rom kitchen to try to build something acceptable, but first things first, the compiled rom must boot.
because the device isnt supported i have to create i file in the /directory_to_kitchen/tools/edify_defs named GT-P7320T defining all the mount points.
this is where it gets tricky,
here is the contents of the /directory_to_kitchen/tools/edify_defs named GT-P7320T that i have created
#
# The values below should be set in each file in this folder.
#
# Each file represents a device name (set in ro.product.device of
# build.prop)
#
# If yes, then this device requires changing the mount point
# names in the new updater-script or update-script
# DO NOT SET TO 'yes' IF DEVICE IS BY DELL
change_mnt=yes
# If yes, the device is by Dell and requires changing the mount
# point names in the new updater-script or update-script
change_mnt_dell=no
#
# NOTE: The update-script will be converted to updater-script if the
# definition file for the device exists. If 'change_mnt' or
# 'change_mnt_dell' are set to 'yes' then the mount names will
# also be changed.
#
# Mention the mount point names if change_mnt=yes
# Use '\/' instead of '/'
# e.g. sys_mnt=\/dev\/block\/mcblk0p25
#extract from recovery.fstab
#/boot emmc /dev/block/mmcblk0p8
#/efs ext4 /dev/block/mmcblk0p21
#/cache ext4 /dev/block/mmcblk0p25
#/data ext4 /dev/block/mmcblk0p26 length=-16384
#/misc mtd misc
#/recovery emmc /dev/block/mmcblk0p22
#/sdcard vfat /dev/block/mmcblk0p28 /dev/block/mmcblk0
#/system ext4 /dev/block/mmcblk0p24
#
# If unknown, set to: ???
sys_mnt=\/dev\/block\/mmcblk0p24
cache_mnt=\/dev\/block\/mmcblk0p25
boot_mnt=\/dev\/block\/mmcblk0p8
data_mnt=\/dev\/block\/mmcblk0p26 #length=-16384
sdcard_mnt=\/dev\/block\/mmcblk0p28 #\/dev\/block\/mmcblk0
# Set this mount point for the modem.bin in Samsung devices like the Galaxy S2
modem_mnt=
# Set this mount point for the preload partition on some Samsung devices like the Galaxy S2
preload_mnt=
# Set this mount point if you know what it is (e.g. on Motorola Atrix)
webtop_mnt=
# Filesystem info for SYSTEM/DATA/CACHE/etc.
# e.g. param1=ext3, param2=EMMC
param1=ext4
param2=EMMC
# If SDCARD filesystem is different from above, then mention it
# e.g. param1_sdcard=vfat, param2_sdcard=MTD
param1_sdcard=vfat
param2_sdcard=
# If CACHE filesystem is different from above, then mention it
param1_cache=
param2_cache=
# If yes, the device does not require using a 'tmp' folder when
# flashing the boot.img in the updater-script
#
# e.g. package_extract_file("boot.img", "/dev/block/blah1");
fix_boot=no
# If yes, the device requires a 'tmp' folder when flashing the
# boot.img in the updater-script, PLUS the boot partition name
# needs to be used, rather than just 'boot'
#
# e.g. Replace: write_raw_image("/tmp/boot.img", "boot")
# with: write_raw_image("/tmp/boot.img", "/dev/block/blah1")
fix_boot2=no
# If yes, the device requires a 'dd' command to write the boot.img
#
# e.g. Replace: write_raw_image("/tmp/boot.img", "boot")
# with: run_program("/sbin/busybox", "dd", "if=/tmp/boot.img", "of=/dev/block/blah")
fix_boot3=no
# Device uses /cache instead of /tmp, e.g. when writing boot.img
use_cache_not_tmp=no
as you can see,
i have copied and pasted the contets of my recovery.fstab and commented it out as a reference.
this should be quite straight foward, but the mount points for data and sdcard hve additional parameters, which i dont know what to do with.
the parameters are currently commented out and i cannot get it to flash i've tried lots of different combinations but to no avail.
During flashing attempts it is giving me error 7, which to me seems to indicate a problem with setting the mount points.
could sombody please at least point me in the right direction? there is only one other custom rom for this device and i personally don't like it.
many thanks in advnce and i hope i have posted this in the right spot. im all new to this posting stuff and i cant post in any development forums yet
all good i sussed it. it just didnt like a few comments for some reason. ended up writing it by hand.
i am an engineering student and i would really like to look into this rom development a little further.
im thinking of porting cyanogenmod to it, would it be do-able? or is there a reason it hasnt been ported to it before?

Please review new device edify_defs file for DSIXDA kitchen

Can someone assist with reviewing my file? (below)
I am following the instructions listed over here for how to add new devices
http://forum.xda-developers.com/showthread.php?t=633246
I have copied the template file into my own file and named the file the same as ro.product.device in build.prop. I have some questions about the configuration needed. My device is a BLU Studio C 5+5 LTE.
Here are the contents of my recovery.fstab
Code:
/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1 wait
/dev/block/bootdevice/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1,data=ordered wait,check
/dev/block/bootdevice/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc wait,check,length=-16384
/dev/block/mmcblk1p1 /sdcard vfat nosuid,nodev,barrier=1,data=ordered,nodelalloc wait
/dev/block/bootdevice/by-name/boot /boot emmc defaults defaults
/dev/block/bootdevice/by-name/recovery /recovery emmc defaults defaults
/dev/block/bootdevice/by-name/misc /misc emmc defaults defaults
My defs file looks like this so far. In places where I have questions I marked the section with leading >>>
Code:
#
# The values below should be set in each file in this folder.
#
# Each file represents a device name (set in ro.product.device of
# build.prop)
#
# If yes, then this device requires changing the mount point
# names in the new updater-script or update-script
# DO NOT SET TO 'yes' IF DEVICE IS BY DELL
change_mnt=yes
>>> Do I change this value or comment it out by adding a pound sign?
# If yes, the device is by Dell and requires changing the mount
# point names in the new updater-script or update-script
change_mnt_dell=no
#
# NOTE: The update-script will be converted to updater-script if the
# definition file for the device exists. If 'change_mnt' or
# 'change_mnt_dell' are set to 'yes' then the mount names will
# also be changed.
#
# Mention the mount point names if change_mnt=yes
# Use '\/' instead of '/'
# e.g. sys_mnt=\/dev\/block\/mcblk0p25
#
# If unknown, set to: ???
sys_mnt=\/dev\/block\/bootdevice\/by-name\/system
cache_mnt=\/dev\/block\/bootdevice\/by-name\/cache
boot_mnt=\/dev/block\/bootdevice\/by-name\/boot
data_mnt=\/dev\/block\/bootdevice\/by-name\/userdata
sdcard_mnt=\/dev\/block\/mmcblk1p1
>>> Comment this out?
# Set this mount point for the modem.bin in Samsung devices like the Galaxy S2
modem_mnt=
>>> Comment this out?
# Set this mount point for the preload partition on some Samsung devices like the Galaxy S2
preload_mnt=
>>> Comment this out?
# Set this mount point if you know what it is (e.g. on Motorola Atrix)
webtop_mnt=
# Filesystem info for SYSTEM/DATA/CACHE/etc.
# e.g. param1=ext3, param2=EMMC
param1=ext4
param2=EMMC
>>> DO I have the correct value for pram2?
# If SDCARD filesystem is different from above, then mention it
# e.g. param1_sdcard=vfat, param2_sdcard=MTD
param1_sdcard=vfat
param2_sdcard=EMMC
>>> Do I have the correct values here? I'm not sure...
# If CACHE filesystem is different from above, then mention it
param1_cache=ext4
param2_cache=EMMC
>>> How can I find out from my device?
# If yes, the device does not require using a 'tmp' folder when
# flashing the boot.img in the updater-script
#
# e.g. package_extract_file("boot.img", "/dev/block/blah1");
fix_boot=no
>>> How can I find out from my device?
# If yes, the device requires a 'tmp' folder when flashing the
# boot.img in the updater-script, PLUS the boot partition name
# needs to be used, rather than just 'boot'
#
# e.g. Replace: write_raw_image("/tmp/boot.img", "boot")
# with: write_raw_image("/tmp/boot.img", "/dev/block/blah1")
fix_boot2=no
>>> How can I find out from my device?
# If yes, the device requires a 'dd' command to write the boot.img
#
# e.g. Replace: write_raw_image("/tmp/boot.img", "boot")
# with: run_program("/sbin/busybox", "dd", "if=/tmp/boot.img", "of=/dev/block/blah")
fix_boot3=no
>>> How can I find out from my device?
# Device uses /cache instead of /tmp, e.g. when writing boot.img
use_cache_not_tmp=no
Many thanks in advance for your advice!!!

Need help with Android Kitchen (Unsupported device)

Im trying to make my Samsung Galaxy Tab S SMt-700 (klimtwifi) compatible with android kitchen. I would like to if i am doing everything right so far
My devices Fstab
Code:
"# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
# data partition must be located at the bottom for supporting device encryption
/dev/block/platform/dw_mmc.0/by-name/BOOT /boot emmc defaults defaults
/dev/block/platform/dw_mmc.0/by-name/RECOVERY /recovery emmc defaults defaults
/dev/block/platform/dw_mmc.0/by-name/SYSTEM /system ext4 ro,errors=panic wait
/dev/block/platform/dw_mmc.0/by-name/EFS /efs ext4 nosuid,nodev,noatime,noauto_da_alloc,discard,journal_async_commit,errors=panic wait,check
/dev/block/platform/dw_mmc.0/by-name/CACHE /cache f2fs noatime,nosuid,nodev,discard,nodiratime,inline_xattr,inline_data,flush_merge wait,check
/dev/block/platform/dw_mmc.0/by-name/CACHE /cache ext4 nosuid,nodev,noatime,noauto_da_alloc,discard,journal_async_commit,errors=panic wait,check
/dev/block/platform/dw_mmc.0/by-name/USERDATA /data f2fs noatime,nosuid,nodev,discard,nodiratime,inline_xattr,inline_data,flush_merge wait,check,encryptable=footer,length=-16384
/dev/block/platform/dw_mmc.0/by-name/USERDATA /data ext4 nosuid,nodev,noatime,noauto_da_alloc,discard,journal_async_commit,errors=panic wait,check,encryptable=footer,length=-16384
# VOLD
/devices/platform/dw_mmc.2/mmc_host/mmc2* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata
/devices/platform/exynos-dwc3.0/exynos-xhci.0* auto auto defaults voldmanaged=usbdisk:auto
"
What I have in my klimtwifi file
Code:
"change_mnt=yes
use_cache_not_tmp=no
param1_cache=ext4
param2_cache=f2fs
sys_mnt=\/dev\/block\/mmcblk0p18
cache_mnt=\/dev\/block\/mmcblk0p19
boot_mnt=\/dev\/block\/mmcblk0p9
data_mnt=\/dev\/block\/mmcblk0p21
sdcard_mnt=???
"
the template im using
Code:
"#
# The values below should be set in each file in this folder.
#
# Each file represents a device name (set in ro.product.device of
# build.prop)
#
# If yes, then this device requires changing the mount point
# names in the new updater-script or update-script
# DO NOT SET TO 'yes' IF DEVICE IS BY DELL
change_mnt=no
# If yes, the device is by Dell and requires changing the mount
# point names in the new updater-script or update-script
change_mnt_dell=no
#
# NOTE: The update-script will be converted to updater-script if the
# definition file for the device exists. If 'change_mnt' or
# 'change_mnt_dell' are set to 'yes' then the mount names will
# also be changed.
#
# Mention the mount point names if change_mnt=yes
# Use '\/' instead of '/'
# e.g. sys_mnt=\/dev\/block\/mcblk0p25
#
# If unknown, set to: ???
sys_mnt=???
cache_mnt=???
boot_mnt=???
data_mnt=???
sdcard_mnt=???
# Set this mount point for the modem.bin in Samsung devices like the Galaxy S2
modem_mnt=
# Set this mount point for the preload partition on some Samsung devices like the Galaxy S2
preload_mnt=
# Set this mount point if you know what it is (e.g. on Motorola Atrix)
webtop_mnt=
# Filesystem info for SYSTEM/DATA/CACHE/etc.
# e.g. param1=ext3, param2=EMMC
param1=
param2=
# If SDCARD filesystem is different from above, then mention it
# e.g. param1_sdcard=vfat, param2_sdcard=MTD
param1_sdcard=
param2_sdcard=
# If CACHE filesystem is different from above, then mention it
param1_cache=
param2_cache=
# If yes, the device does not require using a 'tmp' folder when
# flashing the boot.img in the updater-script
#
# e.g. package_extract_file("boot.img", "/dev/block/blah1");
fix_boot=no
# If yes, the device requires a 'tmp' folder when flashing the
# boot.img in the updater-script, PLUS the boot partition name
# needs to be used, rather than just 'boot'
#
# e.g. Replace: write_raw_image("/tmp/boot.img", "boot")
# with: write_raw_image("/tmp/boot.img", "/dev/block/blah1")
fix_boot2=no
# If yes, the device requires a 'dd' command to write the boot.img
#
# e.g. Replace: write_raw_image("/tmp/boot.img", "boot")
# with: run_program("/sbin/busybox", "dd", "if=/tmp/boot.img", "of=/dev/block/blah")
fix_boot3=no
# Device uses /cache instead of /tmp, e.g. when writing boot.img
use_cache_not_tmp=no
"[/CODE]
and a picture of my mount points : http://imgur.com/a/c3d8h
help will be very much appreciated

Resize Partitions

Hello,
my phone is an E2303. The only problem for me with this phone is the limited memory.
I have rooted the phone the way explained in http://forum.xda-developers.com/m4-a.../root-t3421932
With Root Explorer, i removed a lot of stuff in /system. Now 1,66 GB are used and 810 MB are free.
usderdata and system partitions ( sgdisk --print /dev/block/mmcblk0 )
Nr Name Start Stop Size type
29 userdata 1449984 10043391 4.1 GIB 8300
30 system 10043392 15269375 2.5 GIB 8300
My idea:
- use TWRP to backup userdata and system partions
- delete both partitions
- create userdata with 4.6 GIB
- create system with 2 GIB
- format both partitions with make_extfs4
- restore both partitions with TWRP
I know that as a consequence, i'm not able to flash updates.
Do you think, that this would work ?
===[ Update 5.12.2016 ]===
Yes !
I've attatched my scripts to this initial post. Howto follows ...
i can tell you that something similar worked on lg g2 mini (d610/d618)
that phone have a cache partition with 1gb of unused storage, so a developer resized to reduce this to 100mb, you can find this on L90 or g2 mini forum
did you try it yet?
try and give info
resize partitions Script
Hello,
i've startet coding a shell script:
------------------------------------------------------------
#!/bin/bash
MMC=/dev/block/mmcblk0
NEW_FREE_SEC=65536 # 32 mbyte in sectors
if [ $(id -u) -ne 0 ]; then
echo "Only root is allowed"
exit
fi
mount | grep "$MMC" > /dev/null
RC=$?
if [ $RC -eq 1 ]; then
echo "system not mounted. mounting now"
mount /system
RC=$?
echo $RC
fi
FREE_MB=$(df -P -m /system/ | grep 'mmcblk0p30' | awk '{print $4}')
FREE_KB=$(df -Pk /system/ | grep 'mmcblk0p30' | awk '{print $4}')
FREE_SEC=$(df -P -B 512 /system/ | grep 'mmcblk0p30' | awk '{print $4}')
echo "Your system partion has $FREE_MB mbyte free ( kbyte = $FREE_KB ; sectors = $FREE_SEC)"
DATA_FS=$(sgdisk --print $MMC | awk ' $1 == "29" { print $2}')
DATA_LS=$(sgdisk --print $MMC | awk ' $1 == "29" { print $3}')
SYS_FS=$(sgdisk --print $MMC | awk ' $1 == "30" { print $2}')
SYS_LS=$(sgdisk --print $MMC | awk ' $1 == "30" { print $3}')
echo "Data partition first sector: $DATA_FS"
echo "Data partition last sector: $DATA_LS"
echo "System partition first sector: $SYS_FS"
echo "System partition last sector: $SYS_LS"
let NEW_DATA_LS=$DATA_LS+$FREE_SEC-$NEW_FREE_SEC
let NEW_SYS_FS=$NEW_DATA_LS+1
echo "Data partion NEW last sector: $NEW_DATA_LS"
echo "System partion NEW first sector: $NEW_SYS_FS"
-------------------------------
Output:
/external_sd # . resize_partions
Your system partion has 839 mbyte free ( kbyte = 859392 ; sectors = 1718784)
Data partition first sector: 1449984
Data partition last sector: 10043391
System partition first sector: 10043392
System partition last sector: 15269375
Data partion NEW last sector: 11696639
System partion NEW first sector: 11696640
-------------------------------
Next things to code would be:
- Backup both partitions to SD-card using "tar" ( tar cpf ...)
- unmount partitions
- delete partitions ( sdisk $MMC --delete 30 )
- create partitions with new sector boundaries ( sgdisk $MMC --new 30:11696640:15269375 )
- change partition type ( sgdisk $MMC -t 30:8300)
- change name ( sgdisk $MMC --change-name 30:"system")
- create ext4 partion ( make_ext4fs -L system /dev/block/mmcblk0p30)
- mount
- restore partions ( tar xpf ..)
Do i need special options for make_ext4fs ?
But the question is: would this work ??? What, if i bootloop my device ?
klarseher said:
Hello,
i've startet coding a shell script:
------------------------------------------------------------
#!/bin/bash
MMC=/dev/block/mmcblk0
NEW_FREE_SEC=65536 # 32 mbyte in sectors
if [ $(id -u) -ne 0 ]; then
echo "Only root is allowed"
exit
fi
mount | grep "$MMC" > /dev/null
RC=$?
if [ $RC -eq 1 ]; then
echo "system not mounted. mounting now"
mount /system
RC=$?
echo $RC
fi
FREE_MB=$(df -P -m /system/ | grep 'mmcblk0p30' | awk '{print $4}')
FREE_KB=$(df -Pk /system/ | grep 'mmcblk0p30' | awk '{print $4}')
FREE_SEC=$(df -P -B 512 /system/ | grep 'mmcblk0p30' | awk '{print $4}')
echo "Your system partion has $FREE_MB mbyte free ( kbyte = $FREE_KB ; sectors = $FREE_SEC)"
DATA_FS=$(sgdisk --print $MMC | awk ' $1 == "29" { print $2}')
DATA_LS=$(sgdisk --print $MMC | awk ' $1 == "29" { print $3}')
SYS_FS=$(sgdisk --print $MMC | awk ' $1 == "30" { print $2}')
SYS_LS=$(sgdisk --print $MMC | awk ' $1 == "30" { print $3}')
echo "Data partition first sector: $DATA_FS"
echo "Data partition last sector: $DATA_LS"
echo "System partition first sector: $SYS_FS"
echo "System partition last sector: $SYS_LS"
let NEW_DATA_LS=$DATA_LS+$FREE_SEC-$NEW_FREE_SEC
let NEW_SYS_FS=$NEW_DATA_LS+1
echo "Data partion NEW last sector: $NEW_DATA_LS"
echo "System partion NEW first sector: $NEW_SYS_FS"
-------------------------------
Output:
/external_sd # . resize_partions
Your system partion has 839 mbyte free ( kbyte = 859392 ; sectors = 1718784)
Data partition first sector: 1449984
Data partition last sector: 10043391
System partition first sector: 10043392
System partition last sector: 15269375
Data partion NEW last sector: 11696639
System partion NEW first sector: 11696640
-------------------------------
Next things to code would be:
- Backup both partitions to SD-card using "tar" ( tar cpf ...)
- unmount partitions
- delete partitions ( sdisk $MMC --delete 30 )
- create partitions with new sector boundaries ( sgdisk $MMC --new 30:11696640:15269375 )
- change partition type ( sgdisk $MMC -t 30:8300)
- change name ( sgdisk $MMC --change-name 30:"system")
- create ext4 partion ( make_ext4fs -L system /dev/block/mmcblk0p30)
- mount
- restore partions ( tar xpf ..)
Do i need special options for make_ext4fs ?
But the question is: would this work ??? What, if i bootloop my device ?
Click to expand...
Click to collapse
try and give info
Flashing stock with Flashtool should restore official partition table.
bootloop now ...
ch3mn3y said:
Flashing stock with Flashtool should restore official partition table.
Click to expand...
Click to collapse
As a first step, I have only risized the system partition. The files were backuped with "tar cpf" and restored with "tar xpf" in the recreated partition.
I could see the files in the partion, but the phone does not startup "normal".
I had to use the hidden off button near the SD-slot to power off the phone. Flashing didn't resolved the problem. There is an error while writing system.sin - probably because the partition is to small.
Maybe i have to downgrade flashtool, as mentioned in http://forum.xda-developers.com/showpost.php?p=62751375&postcount=3 ???
Next step would be to "unbrick" my phone. With original system partition, i will only backup and restore the content, to see, if "tar" is able to do the job. Second try with TWRP Backup.
Hello,
I could be wrong, but I think your bootloop problem would probably comes from some sort of SONY extra protection layer.
This additional security system is called RIC and prevents you from freely modifying the system partition at runtime by blocking r/w mount of the system partition.
There is also a default Android security that checks the system partition against a hardcoded hash on boot, to prevent system partition modification (maybe partition size is part of the check operation...).
So you may try to disable the first protection (look at Z5 tutorial) and/or look for a way to bypass the boot check (not sure if possible).
Regards.
system parttion successfull shrinked
Okay, i finally shrinked my system partition and the phone will boot up normal.
The process is a little bit complicated.
You have to create a TWRP backup of your debloated system partition.
Check, if this backup is working ! So rm -rf everything in system and restore from backup.
Next, delete partition with sgdisk and create smaler one ( my script from 1st post will do the calculation for 1st sector )
Change name of partion to "system".
Create ext4 fileystem on parttion ( TWRP will also format - don't know if realy needed )
Reboot into TWRP an try to restore - maybe reboot some times into TWRP and check parttions
To recover with flashtool in case you didn't manage to get it to work - delete system partition and flash "partition.sin" and "system.sin"
In the next step, i will increase data partition
Code:
/system # df -h .
Filesystem Size Used Available Use% Mounted on
/dev/block/mmcblk0p30
1.6G 1.6G 4.9M 100% /system
/system # sgdisk --print /dev/block/mmcblk0 | tail -10
21 393216 475135 40.0 MiB FFFF FOTAKernel
22 475136 475151 8.0 KiB FFFF ssd
23 475152 475215 32.0 KiB FFFF DDR
24 475216 476239 512.0 KiB FFFF config
25 476240 509007 16.0 MiB 8300 LTALabel
26 516096 532479 8.0 MiB 8300 apps_log
27 532480 1040383 248.0 MiB 8300 oem
28 1040384 1449983 200.0 MiB 8300 cache
29 1449984 10043391 4.1 GiB 8300 userdata
30 11702880 15269375 1.7 GiB 8300 system
/system #
klarseher said:
Okay, i finally shrinked my system partition and the phone will boot up normal.
The process is a little bit complicated.
You have to create a TWRP backup of your debloated system partition.
Check, if this backup is working ! So rm -rf everything in system and restore from backup.
Next, delete partition with sgdisk and create smaler one ( my script from 1st post will do the calculation for 1st sector )
Change name of partion to "system".
Create ext4 fileystem on parttion ( TWRP will also format - don't know if realy needed )
Reboot into TWRP an try to restore - maybe reboot some times into TWRP and check parttions
To recover with flashtool in case you didn't manage to get it to work - delete system partition and flash "partition.sin" and "system.sin"
In the next step, i will increase data partition
Code:
/system # df -h .
Filesystem Size Used Available Use% Mounted on
/dev/block/mmcblk0p30
1.6G 1.6G 4.9M 100% /system
/system # sgdisk --print /dev/block/mmcblk0 | tail -10
21 393216 475135 40.0 MiB FFFF FOTAKernel
22 475136 475151 8.0 KiB FFFF ssd
23 475152 475215 32.0 KiB FFFF DDR
24 475216 476239 512.0 KiB FFFF config
25 476240 509007 16.0 MiB 8300 LTALabel
26 516096 532479 8.0 MiB 8300 apps_log
27 532480 1040383 248.0 MiB 8300 oem
28 1040384 1449983 200.0 MiB 8300 cache
29 1449984 10043391 4.1 GiB 8300 userdata
30 11702880 15269375 1.7 GiB 8300 system
/system #
Click to expand...
Click to collapse
give flashable zip
Increasing userdata worked the same way. Backup userdata with TWRP, delete partition 29, create partition 29 with new last sector. Restore with TWRP.
( I've lost adoptive storage in this step - but this is okay, because adoptive storage is to slow for me )
Now userdata on my phone has 4.9 GIB.
To do the same, you have to read and understand.
There is no flashable zip - you will resize your partitions after removing unused stuff from system partition. You have to deal with sgdisk on the TWRP cmdline ( adb shell)
klarseher said:
Hello,
my phone is an E2303. The only problem for me with this phone is the limited memory.
I have rooted the phone the way explained in http://forum.xda-developers.com/m4-a.../root-t3421932
With Root Explorer, i removed a lot of stuff in /system. Now 1,66 GB are used and 810 MB are free.
usderdata and system partitions ( sgdisk --print /dev/block/mmcblk0 )
Nr Name Start Stop Size type
29 userdata 1449984 10043391 4.1 GIB 8300
30 system 10043392 15269375 2.5 GIB 8300
My idea:
- use TWRP to backup userdata and system partions
- delete both partitions
- create userdata with 4.6 GIB
- create system with 2 GIB
- format both partitions with make_extfs4
- restore both partitions with TWRP
I know that as a consequence, i'm not able to flash updates.
Do you think, that this would work ?
Click to expand...
Click to collapse
When you remove or delete any system app the folder & ink may get deleted but odex file of original stock rom remains in odex folder as squashed this way you can free up at least 200 to 300 mb.
I have tested it on LP.
& As per my assumption the squashed odexes got nothing to do with selinux as it only load images from squashed folder.
rebuild odex.system.sqsh
Hello,
I rebuild odex.system.sqsh - the size has been reduced from 275MByte to 151MByte.
but, my current linux distribution does not support selinux
So, i have to repeat with another linux distribution and replace odex.system.sqsh in /system folder.
maybe next weekend ...
howto
klarseher said:
Hello,
I rebuild odex.system.sqsh - the size has been reduced from 275MByte to 151MByte.
but, my current linux distribution does not support selinux
So, i have to repeat with another linux distribution and replace odex.system.sqsh in /system folder.
maybe next weekend ...
Click to expand...
Click to collapse
The solution:
- install CentOS 7 in VirtualBox
Get odex.system.sqsh from phone ( Phone in TWRP Mode):
adb pull /system/odex.system.sqsh .
Copy odex.system.sqsh to CentOS ( via shared folder)
As root:
- yum install squashfs-tools
- unsquashfs odex.system.sqsh # you got a lot of warnings, because unsquashfs is not allowed to access selinux attributes
- rm -rf squashfs-root # remove for next try
- grep unsquashfs /var/log/audit/audit.log | audit2allow -M mypol
- semodule -i mypol.pp
- unsquashfs odex.system.sqsh
Now, remove unused stuff inside squashfs-root folder
mksquashfs squashfs-root/ odex.system-new.sqsh -comp xz -noI -noF -noX -no-fragments -no-duplicates
---
In TWRP -adb shell:
cd /system
touch dummy
chcon --reference=system.odex.sqsh dummy
rm system.odex.sqsh
# Copy from pc with
adb put odex.system-new.sqh /system/
Back in adb shell:
mv odex.system-new.sqh odex.system.sqh
chcon --reference=dummy system.odex.sqsh
---
The cleanaup in squashfs-root depends on you debloating. I have build my delete script on file lists from /system before and after removing unwanted apps. ( diff before/after | grep '\.odex$')
As a final step, i shrinked my system partion to 1.5 GB ( from original 2.5) and increased /data to 5.1 GB.
Very cool and great job! Maybe try making a step by step tutorial during your free time? Could benefit us all
partitions in DiskInfo
See layout of /data and /system partitions on my phone
klarseher said:
See layout of /data and /system partitions on my phone
Click to expand...
Click to collapse
Very cool and great job!
Please making a step by step tutorial for all !!! Thanks !
manhquyet90 said:
Very cool and great job!
Please making a step by step tutorial for all !!! Thanks !
Click to expand...
Click to collapse
Thanks !
Boot phone into TWRP
1. create a backup of your system partition with TWRP
2. "adb shell" to your phone (still booted in TWRP) and create a filelist from system partion on your SD card ( "mount /system ; find /system -type f > /external_sd/system_filelist.lst" - unsure about path to your SD-card )
( we need filelist later for odex "cleanup" )
3. "debloat" your system partition - there are some threads in this forum about removing stuff from /system - i could not help you with this task !
Boot phone into TWRP
4. "adb shell" to your phone. Come back with the output of "mount /system ; df -k /system" and "sgdisk --print /dev/block/mmcblk0"
( I will calculate the new first sector for the system partition depending on your free space )
Then, we do the next step together !
Kind regards
klarseher said:
Thanks !
Boot phone into TWRP
1. create a backup of your system partition with TWRP
2. "adb shell" to your phone (still booted in TWRP) and create a filelist from system partion on your SD card ( "mount /system ; find /system -type f > /external_sd/system_filelist.lst" - unsure about path to your SD-card )
( we need filelist later for odex "cleanup" )
3. "debloat" your system partition - there are some threads in this forum about removing stuff from /system - i could not help you with this task !
Boot phone into TWRP
4. "adb shell" to your phone. Come back with the output of "mount /system ; df -k /system" and "sgdisk --print /dev/block/mmcblk0"
( I will calculate the new first sector for the system partition depending on your free space )
Then, we do the next step together !
Kind regards
Click to expand...
Click to collapse
Code:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\MQ>adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
YT911B19A1 recovery
C:\Users\MQ>adb shell
~ # ←[6nmount /system
~ # ←[6nfind /system -type f > /external_sd/system_filelist.lst
~ # ←[6nmount /system
mount: mounting /dev/block/mmcblk0p30 on /system failed: Device or resource busy
~ # ←[6ndf -k /system
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/mmcblk0p30
2531076 2448068 66624 97% /system
~ # ←[6nsgdisk --print /dev/block/mmcblk0
CANNOT LINK EXECUTABLE: cannot locate symbol "__register_atfork" referenced by "
sgdisk"...
page record for 0x7f91ab0010 was not found (block_size=64)
~ # ←[6n

Categories

Resources