Repository: Lanchon/REPIT Branch: master Commit: 8824c5af8c41 Files: 65 Total size: 184.5 KB Directory structure: gitextract_u1bj83mx/ ├── .gitignore ├── LOG.txt ├── README-CHEF-KOCH.md ├── README.md ├── _config.yml ├── device/ │ ├── .disabled/ │ │ ├── falcon/ │ │ │ ├── falcon_UNTESTED.sh │ │ │ └── falcon_gpe_UNTESTED.sh │ │ ├── galaxy-s4-mini/ │ │ │ └── serrano3gxx_UNTESTED.sh │ │ ├── galaxy-s5/ │ │ │ ├── common.sh │ │ │ └── klte_UNTESTED.sh │ │ ├── y560_UNTESTED.sh │ │ └── y560_test.sh │ ├── cherry.sh │ ├── dior.sh │ ├── galaxy-j5/ │ │ ├── common.sh │ │ └── j5lte.sh │ ├── galaxy-s2/ │ │ ├── common.sh │ │ ├── exynos-4210/ │ │ │ ├── d710.sh │ │ │ ├── i777.sh │ │ │ ├── i9100.sh │ │ │ ├── n7000.sh │ │ │ └── sc02c.sh │ │ └── omap-4430/ │ │ └── i9100g.sh │ ├── galaxy-s3/ │ │ ├── exynos/ │ │ │ ├── i9300.sh │ │ │ └── i9305.sh │ │ └── snapdragon/ │ │ ├── common.sh │ │ ├── d2tmo.sh │ │ └── d2usc.sh │ ├── janice.sh │ ├── nexus-7-2013/ │ │ ├── common.sh │ │ ├── deb.sh │ │ └── flo.sh │ ├── nook-hd/ │ │ ├── common.sh │ │ ├── hummingbird.sh │ │ └── ovation.sh │ └── tuna/ │ ├── common.sh │ ├── maguro.sh │ ├── toro.sh │ └── toroplus.sh ├── device-dump/ │ ├── .gitignore │ ├── README.md │ ├── dump.sh │ ├── make-zip │ ├── run-dump │ └── run-dump.bat ├── env/ │ └── extras-arm/ │ ├── no/ │ │ ├── blkid │ │ ├── fdisk │ │ ├── gdisk │ │ ├── lsblk │ │ ├── partx │ │ └── sfdisk │ ├── parted │ └── sgdisk ├── key/ │ ├── testkey.pk8 │ └── testkey.x509.pem ├── make ├── make-script ├── repit-fs-ext4.sh ├── repit-fs-f2fs.sh ├── repit-fs-raw.sh ├── repit-fs-swap.sh ├── repit-fs-vfat.sh ├── repit-par-tools.sh ├── repit.sh └── run ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ /build /run.conf ================================================ FILE: LOG.txt ================================================ #################################### Lanchon REPIT A Data-Sparing Repartitioning Tool Version: 2016-04-06 Device: i9100 Copyright 2016, Lanchon (GPLv3) #################################### ===== PRELIMINARY CHECKS ===== info: valid package names: [-(system|data|sdcard|preload)=]... info: valid partition values: [|same|min|max][+[keep|wipe][+[ext4|vfat|f2fs|swap|raw]]] ----- DEFAULTS ----- system = size:same + content:keep + fs:ext4 data = size:same + content:keep + fs:ext4 sdcard = size:same + content:keep + fs:vfat preload = size:same + content:keep + fs:ext4 info: parsing package name ----- CONFIGURATION ----- system = size:1.0 + content:keep + fs:ext4 data = size:6 + content:keep + fs:ext4 sdcard = size:max + content:keep + fs:vfat preload = size:min + content:wipe + fs:ext4 info: disabling swap info: unmounting all partitions info: rereading partition table ===== PREPARATION ===== info: determining usable sector range of block device info: checking existing partitions ##### processing heap 'main' info: checking existing partition layout info: current size: partition #9 'system' (FACTORYFS): 768 MiB info: current size: partition #10 'data' (DATAFS): 512 MiB info: current size: partition #11 'sdcard' (UMS): 13064 MiB info: current size: partition #12 'preload' (HIDDEN): 512 MiB info: checking new partition layout info: new size: partition #9 'system' (FACTORYFS): 1024 MiB info: new size: partition #10 'data' (DATAFS): 6144 MiB info: new size: partition #11 'sdcard' (UMS): 7680 MiB info: new size: partition #12 'preload' (HIDDEN): 8 MiB ===== DRY-RUN ===== ##### processing heap 'main' ----- analyzing partition #9 'system' (FACTORYFS) info: partition #9 'system' (FACTORYFS) will expand into storage area currently used by partition #10 'data' (DATAFS) info: deferring processing of partition #9 'system' (FACTORYFS) until required space is freed ----- analyzing partition #10 'data' (DATAFS) info: partition #10 'data' (DATAFS) will expand into storage area currently used by partition #11 'sdcard' (UMS) info: deferring processing of partition #10 'data' (DATAFS) until required space is freed ----- analyzing partition #11 'sdcard' (UMS) info: partition #11 'sdcard' (UMS) will expand into storage area currently used by partition #12 'preload' (HIDDEN) info: deferring processing of partition #11 'sdcard' (UMS) until required space is freed ----- analyzing partition #12 'preload' (HIDDEN) ***** processing partition #12 'preload' (HIDDEN) info: will format the partition in ext4 and trim it ***** processing partition #11 'sdcard' (UMS) info: will move/resize the vfat partition info: checking the file system fsck.fat 3.0.28 (2015-05-16) /dev/block/mmcblk0p11: 62 files, 286825/3337853 clusters ***** processing partition #10 'data' (DATAFS) info: will move the ext4 partition WARNING: moving a big ext4 partition can take a very long time; it requires copying the complete partition, including its free space info: will resize the ext4 partition info: checking and trimming the file system /dev/block/mmcblk0p10: 797/32768 files (10.7% non-contiguous), 90304/131068 blocks ***** processing partition #9 'system' (FACTORYFS) info: will resize the ext4 partition info: checking and trimming the file system system: 1833/49152 files (0.0% non-contiguous), 117150/196608 blocks ===== EXECUTION ===== ##### processing heap 'main' ----- analyzing partition #9 'system' (FACTORYFS) info: partition #9 'system' (FACTORYFS) will expand into storage area currently used by partition #10 'data' (DATAFS) info: deferring processing of partition #9 'system' (FACTORYFS) until required space is freed ----- analyzing partition #10 'data' (DATAFS) info: partition #10 'data' (DATAFS) will expand into storage area currently used by partition #11 'sdcard' (UMS) info: deferring processing of partition #10 'data' (DATAFS) until required space is freed ----- analyzing partition #11 'sdcard' (UMS) info: partition #11 'sdcard' (UMS) will expand into storage area currently used by partition #12 'preload' (HIDDEN) info: deferring processing of partition #11 'sdcard' (UMS) until required space is freed ----- analyzing partition #12 'preload' (HIDDEN) ***** processing partition #12 'preload' (HIDDEN) info: deleting current partition info: creating new partition info: naming the partition info: rereading partition table info: formatting the partition in ext4 and trimming it Warning: the fs_type small is not defined in mke2fs.conf ***** processing partition #11 'sdcard' (UMS) info: moving/resizing the vfat partition info: note that the error 'unable to satisfy all constraints on the partition' usually means that the new desired partition size would be too small to hold the files already stored in the partition. info: rereading partition table info: checking the file system fsck.fat 3.0.28 (2015-05-16) /dev/block/mmcblk0p11: 62 files, 286825/1962238 clusters ***** processing partition #10 'data' (DATAFS) info: moving the ext4 partition info: ensure that the destination partition can be created before starting the move info: deleting current partition info: creating new partition info: naming the partition info: rereading partition table info: deleting the partition to workaround dd's 4 GiB wraparound bug info: moving data towards the end of the disk ----- moving 256 MiB chunk: 1192 MiB -> 1448 MiB info: creating a temporary partition to read chunk at device offset 1192 MiB info: rereading partition table info: reading data 524288+0 records in 524288+0 records out 268435456 bytes (256.0MB) copied, 6.977768 seconds, 36.7MB/s info: deleting the temporary partition info: creating a temporary partition to write chunk at device offset 1448 MiB info: rereading partition table info: writing data 524288+0 records in 524288+0 records out 268435456 bytes (256.0MB) copied, 136.736488 seconds, 1.9MB/s info: deleting the temporary partition ----- moving 256 MiB chunk: 936 MiB -> 1192 MiB info: creating a temporary partition to read chunk at device offset 936 MiB info: rereading partition table info: reading data 524288+0 records in 524288+0 records out 268435456 bytes (256.0MB) copied, 7.215978 seconds, 35.5MB/s info: deleting the temporary partition info: creating a temporary partition to write chunk at device offset 1192 MiB info: rereading partition table info: writing data 524288+0 records in 524288+0 records out 268435456 bytes (256.0MB) copied, 134.066894 seconds, 1.9MB/s info: deleting the temporary partition info: creating the final partition info: naming the partition info: rereading partition table info: checking and trimming the file system /dev/block/mmcblk0p10: 797/32768 files (10.7% non-contiguous), 90304/131068 blocks info: enlarging the partition entry info: deleting current partition info: creating new partition info: naming the partition info: rereading partition table info: creating a temporary partition to wipe the crypto footer due to dd's 4 GiB wraparound bug info: deleting current partition info: creating new partition info: naming the partition info: rereading partition table info: wiping the crypto footer 32+0 records in 32+0 records out 16384 bytes (16.0KB) copied, 0.010336 seconds, 1.5MB/s info: recreating the original partition info: deleting current partition info: creating new partition info: naming the partition info: rereading partition table info: enlarging the ext4 file system resize2fs 1.42.9 (28-Dec-2013) Resizing the filesystem on /dev/block/mmcblk0p10 to 1572860 (4k) blocks. The filesystem on /dev/block/mmcblk0p10 is now 1572860 blocks long. info: checking and trimming the file system /dev/block/mmcblk0p10: Inode 7, i_size is 1610670080, should be 1610690560. FIXED. /dev/block/mmcblk0p10: 797/393216 files (10.7% non-contiguous), 114845/1572860 blocks info: file system errors in partition #10 'data' (DATAFS) were fixed ***** processing partition #9 'system' (FACTORYFS) info: enlarging the partition entry info: deleting current partition info: creating new partition info: naming the partition info: rereading partition table info: enlarging the ext4 file system resize2fs 1.42.9 (28-Dec-2013) Resizing the filesystem on /dev/block/mmcblk0p9 to 262144 (4k) blocks. The filesystem on /dev/block/mmcblk0p9 is now 262144 blocks long. info: checking and trimming the file system system: 1833/65536 files (0.0% non-contiguous), 118211/262144 blocks info: flushing buffers ===== SUCCESS ===== [OK] ================================================ FILE: README-CHEF-KOCH.md ================================================ ## The CHEF-KOCH Incident (And XDA's Response) the following information remains online because, to this date, CHEF-KOCH has not publicly acknowledged his act of plagiarism. our latest exchange can be found [here](https://github.com/Lanchon/REPIT/issues/37).
> **AND WHAT IS THIS?** > > what follows is text originally posted by me on XDA. the strange incident that was the subject of this post was investigated by moderators from both of the involved sites and found to be as i described it. as a result, proper corrective measures were implemented. > > unfortunately this post was later surreptitiously deleted by XDA moderator [The_Merovingian](http://forum.xda-developers.com/member.php?u=5302753), an action that precipitated my departure from the XDA community as a developer. i no longer consider XDA a viable medium for hosting my work. > > the post is now reproduced here for record keeping in the form in which it was when it was deleted from XDA by The_Merovingian on February 23, 2016. > **UPDATE:** as a sort of retaliation for my moving REPIT out of XDA, The_Merovingian closed down [the REPIT thread](http://forum.xda-developers.com/galaxy-s2/orig-development/tool-lanchon-repit-data-sparing-t3311747) ([via Wayback Machine](https://web.archive.org/web/20160226151111/http://forum.xda-developers.com/galaxy-s2/orig-development/tool-lanchon-repit-data-sparing-t3311747)). this was unfortunate because the thread got 30 pages of posts in its 2 weeks of existence, and probably was the second most active thread in the S2 forum. all this traffic then went on to spam the official i9100 CM13 thread, already drowning in off-topic noise; it was a mess. > > clearly XDA members needed a place to discuss REPIT but XDA did not really care about this. The_Merovingian told me that i needed to "remove [the rant](http://forum.xda-developers.com/galaxy-s2/orig-development/tool-lanchon-repit-data-sparing-t3311747/post65239832)" in order for the thread to be reopened. i reached out to the XDA moderation committee asking for the official position on whether "DUE TO IRRECONCILABLE DIFFERENCES" constituted an unacceptable rant on XDA. i am still waiting for a response... :) > > censorship attempts typically backfire on the internet. what was to be a post on a forum is now inextricably linked to the history of an open source project in its git repo, cloned by anyone needing the tool's tree. > > After all is said and done, all the trouble caused and the time lost, i have but one personal message to The_Merovingian, and it is this: the matrix is a silly franchise.
_we interrupt your regular programming to bring you this breaking news..._ ### _"CHEF-KOCH" IS A THIEF !!!_ > **UPDATE:** moderators from both [the german forum](http://www.android-hilfe.de/) and xda collaborated to resolve this issue. they were alerted by some forum members who are active in both communities (and again i thank you guys for that, you know who you are). after a swift investigation, and just two days after this silliness started, they removed all offending content from the german site and placed a link to this thread in its place. i am very grateful to all the parties that quickly put this issue to rest. > **2ND UPDATE:** i was told that this guy's account at the german site was terminated; the reasons for this are unknown to me. and user [the.gangster](http://forum.xda-developers.com/member.php?u=6560258) was put in charge of the repartition thread there. thank you for taking over! > **3RD UPDATE:** i privately told the.gangster a few days ago when this guy was banned from the german site that i wanted to remove the guy's contact details from this post and let bygones be bygones. unfortunately this guy is relentless: he can no longer post, but still he added text files on his MEGA instead accusing **me** of stealing and other nonsense. well, so be it: this info stays online forever, and so do his contact details. i removed the fowl language to comply with XDA requirements and the rest stays. _it is unbelievable!!! this_ [epithet removed] _took my just-published software, removed the license, removed my name, removed the copyright, added himself as the author, and republished it in a [german forum](http://www.android-hilfe.de/thema/how-to-vergroesserung-der-datenpartition-mittels-bearbeitetem-pit-file-teil-2.751812/) as his own work. (here is the same link [via Wayback Machine](https://web.archive.org/web/20160213014929/http://www.android-hilfe.de/thema/how-to-vergroesserung-der-datenpartition-mittels-bearbeitetem-pit-file-teil-2.751812/), in case the_ [epithet removed] _decides to delete his post.) when i dated one of my zips in its name, he copied that too, except that he rewinded the date by one day. but he forgot to fake the modification time of the files inside the zip; and of course the upload date in MEGA is the real one. he also republished the older v0.1 unfinished release i did to help people in a tight spot with CM13, even though that release **was not free software**. (it was specifically **not** licensed as free software to avoid copies of the unfinished work spreading around; however the current version is GPLv3.) he also stole [Flashize](http://forum.xda-developers.com/android/software-hacking/tool-flashize-shell-scripts-flashable-t3313605), another tool i published these days._ _the plagiarized files are currently published [here](https://mega.nz/#F!cMNShQLa!5lXzEuluHX9jd9Bv3B_h8Q), but might be removed anytime. a copy of all files was [uploaded to post #3](http://forum.xda-developers.com/galaxy-s2/orig-development/tool-lanchon-repit-data-sparing-t3311747/post65239837)_ [now also surreptitiously deleted from XDA! rehosted [here](https://www.androidfilehost.com/?w=files&flid=50817)] _for record keeping._ _i did delete my old published v0.1 files from xda, but fortunately i did not delete some customized versions of v0.1 that i produced on request that are still available [here](http://forum.xda-developers.com/galaxy-s2/orig-development/tool-lanchon-repit-data-sparing-t3311747/post65252583) and [here](http://forum.xda-developers.com/galaxy-s2/orig-development/tool-lanchon-repit-data-sparing-t3311747/post65252738). most importantly, i [announced](http://forum.xda-developers.com/galaxy-s2/development-derivatives/rom-cyanogenmod-13-t3223808/post65201096) that i was working on a partitioning tool and 6 hours later [published](http://forum.xda-developers.com/galaxy-s2/development-derivatives/rom-cyanogenmod-13-t3223808/post65206132) the full complex log of a working, pre-release version of the application. that was 3 full days before the_ [epithet removed] _published "his" software... lol._ #### _WHO IS THIS "CHEF-KOCH"_ [epithet removed] _THIEF ANYWAY ???_ [rant removed.] _it is very unlikely that this is the only time he has done this, and i can tell you this is very demotivating for a developer. so protect your developers by helping them expose this clown in case they happen to cross paths with him. also, his clients and/or employers better know what kind of "work" this guy does._ _android-hilfe.de: [CHEF-KOCH](http://www.android-hilfe.de/members/chef-koch.97407/)
xda-developers.com: [CHEF-KOCH](http://forum.xda-developers.com/member.php?u=4415879)
github.com: [CHEF-KOCH](https://github.com/CHEF-KOCH)
google.com: [Nvinside@gmail.com](mailto:Nvinside@gmail.com)_ _he has this info on GitHub:
InfoSec Institute/nVidia EU
http://www.infosecinstitute.com/
Lausanne_ ================================================ FILE: README.md ================================================ ## Lanchon REPIT ### A Device-Only Data-Sparing Repartitioning Tool For Android #### [CHANGELOG] - [DEVICES] - [DOWNLOADS] - [GALAXY S2] - [XDA THREAD] [CHANGELOG]: https://github.com/Lanchon/REPIT/releases [DEVICES]: #device-specific-information [DOWNLOADS]: https://www.androidfilehost.com/?w=files&flid=49911 [GALAXY S2]: #the-galaxy-s2-family [XDA THREAD]: http://forum.xda-developers.com/android/software-hacking/tool-lanchon-repit-data-sparing-t3358036 Powered by [Flashize](https://github.com/Lanchon/Flashize).
## General Information (All Devices) #### WHAT IS THE PROBLEM ? many older devices, especially the ones originally released before emulated storage was available, were partitioned by the OEM in ways that hinder the installation and use of newer Android versions. for example, the Galaxy S2 GT-I9100 comes with a 0.5 GiB /system partition that is unable to fit CM 13.0 and Open GApps, even if you choose the pico version. though its flash is typically a generous 16 GiB, the stock /data partition is only 2 GiB which means that with today's ART you run out of space to install applications in no time. it also comes with a 0.5 GiB /preload partition that goes unused on custom ROMs. people have typically solved this by repartitioning. on Samsung devices this is a tricky process that involves the use of download mode, a Windows PC, Windows device drivers that support the device's download mode, a 'pirated' proprietary PC software called Odin, the right PIT and other files, and correct configuration. (a free software alternative to Odin called Heimdall works on many devices and is cross platform and supports Linux PCs, but the rest of the hurdles remain.) the procedure has potential for hard-bricking if the wrong files are flashed. after repartitioning, all affected partitions must be reflashed or formatted anew, a procedure that many get wrong. and of course, all data in the affected partitions gets wiped (typically the complete device) making this an ultra-inconvenient affair. #### WHAT IS REPIT ? REPIT is a simple, safe, device-only, data-sparing, and easily portable repartitioning tool for Android devices: - device-only: just flash a zip file in recovery to repartition the device. - simple: rename the zip file before flashing to configure your choice of partition sizes, file systems, wipes, etc. - safe: - a correctly ported REPIT can never hard-brick your device. - before starting, REPIT checks for the existence of all the tools that will be needed for the task at hand, verifies that the current partition layout passes several sanity checks, checks and fixes all the involved file systems, and verifies that the new partition layout will meet its sanity checks too. REPIT performs a dry-run of the complete repartitioning process to detect possible problems early on. - if REPIT fails, it will nonetheless try to restore your device to a working in-between state. you can solve the blocking issue and REPIT again towards your goal, or otherwise REPIT back to your original configuration. (keeping the in-between state is not recommended as it usually involves 'wasted' unpartitioned space.) - my estimate is that between 500 to 1000 users already used REPIT for 'major' changes on the i9100 and no incidents of data loss were reported. (note: these are very stale numbers dating from March 2016, when REPIT was still in its infancy.) - easily portable: a simple configuration file is all that is needed to port REPIT to a new device. you can look at [the log of a demo run](https://raw.githubusercontent.com/Lanchon/REPIT/master/LOG.txt) to get a feel for what REPIT can do. in this run on a Galaxy S2 it grows the /system and /data ext4 partitions to 1 and 6 GiB respectively, it wipes and shrinks the unused /preload partition to a minimum size, and it adjusts the size of the internal /sdcard vfat partition to occupy whatever space is left. REPIT plans, orders and undertakes a safe series of partition resize and move operations to reach its goal, all the while keeping and eye on details such as alignments and retaining the data present in the /system, /data and /sdcard partitions. #### LIMITATIONS - REPIT **requires TWRP 2 or TWRP 3.** some recoveries unnecessarily hold device or partition locks during flashing, which prevents all repartitioning tools from working (parted, fdisk, gdisk, and of course REPIT). unfortunately the recoveries bundled with CM 11, 12.0, 12.1 and 13.0 display this issue and are incompatible. recent TWRP 2.8.7.* and 3.0.0.* recoveries comply with this requirement, but only when flashing zips from /tmp. (REPIT will automatically copy itself to /tmp if it detects locks, to help you relaunch from there.) - REPIT **does not support encrypted phones.** - REPIT **will cause data loss** if the repartitioning process is externally interrupted. **plug into a power source!** #### HOW TO REPIT 1. if you think your data is invaluable then treat it as such: **make a backup!** 2. get TWRP running on your device. 3. make sure your battery is mostly charged. 4. get the zip for your device from the link below. 5. **rename it to express your desired configuration** (see below). 6. **PLUG INTO A POWER SOURCE.** this operation might take a long time and **must not be interrupted.** 7. flash the zip locally on the phone. (if you want to sideload instead, please see the note below.) finally, go get a coffee or two. **do not, under any circumstance, interrupt this script !!!** in case the script fails to start: - if the script cannot unmount all partitions, it will copy itself to the /tmp directory and ask you to flash it a second time from there. - if it still fails to unmount all partitions, or if it fails to lock the eMMC ('unable to reread the partition table'), then unplug the device from USB hosts such as PCs, reboot TWRP, and reflash the script immediately after boot up. (you may actually need to reflash twice, the second time from '/tmp'.) do not do anything after booting up and before flashing! in particular, **do not connect the device to a PC or USB host** as this might auto-mount the sdcard via MTP, **and do not mount the sdcard as USB mass storage** via TWRP's UI. in some rare cases you might need to use TWRP's UI to disable MTP before rebooting and to manually unmount all partitions before flashing the script from '/tmp'. - if locking issues remain, your phone is probably encrypted; this script is not compatible with encrypted phones. if you want to sideload: - sideloading conceals the filename from the device, and thus filename-based configuration will not work. - to sideload you need to add a file called 'flashize/repit-settings' to the zip containing the full intended filename, or otherwise just the configuration part of it. for example, a file containing `-system=1G` is enough (the `-` is required). note that your recovery might require you to resign the zip after that change. - otherwise you can add the file directly to the device before sideloading, for example via adb push. in that case it must be named '/tmp/repit-settings'. #### HOW TO CONFIGURE configure the script by renaming the zip file before flashing it. valid zip names: `[-partition1=][-partition2=]...` valid partition `` values: `[(G|M)|same|min|max][+[keep|wipe][+[ext4|vfat|f2fs|swap|raw]]]` the defaults are device-dependent. please look inside your device's configuration file for more information. for configuration samples please see [the i9100 section](#galaxy-s2-samples) below. ##### Partition Data - `keep`: retain the data in the partition. if the partition needs to be moved or resized, this option usually makes the operation significantly slower, even if the partition is mostly empty. - `wipe`: wipe the partition. always wipe partitions that are empty or carry data that you do not care about: it will make REPIT faster and will result in less wear on the flash memory. ##### Partition Sizes - `same`: do not alter the size of this partition. - `min`: make this unused partition a minimum yet formattable size (typically 8 MiB, but device-dependent). - `max`: make this partition as big as possible (at most one partition per 'heap' can have its size set to 'max'). - `(G|M)`: fractional number followed by a size unit expressing the desired partition size. the unit is either `G` for GiB or `M` for MiB. this value gets rounded to the nearest acceptable discreet value. the size granularity is device-dependent, but typically set to match the device-dependent partition alignment (which typically is 1 or 4 MiB). ##### Partition Types - `ext4` and `vfat`: these partitions have full move, resize and wipe support. - `f2fs`: f2fs partitions can be moved and wiped, and can only be resized while wiping them.
(tools to resize f2fs file systems do not exist for now.) - `swap`: swap partitions can be wiped, and can only be moved or resized while wiping them.
(it makes no sense to retain their content.) - `raw`: raw partitions are treated as opaque blobs and can only be moved.
(neither resizing nor wiping is supported.) ##### Supported Features | | wipe | keep + move | keep + resize | keep + move + resize | crypto footer | |:--------:|:----:|:-----------------:|:---------------:|:--------------------:|:-------------:| | **ext4** | YES | YES (brute force) | YES (efficient) | YES (brute force) | YES | | **vfat** | YES | YES (efficient) | YES (efficient) | YES (efficient) | no | | **f2fs** | YES | YES (brute force) | no | no | YES | | **swap** | YES | no | no | no | no | | **raw** | no | YES | no | no | no | - **brute force:** the complete partition extent is operated upon. - **efficient:** only the stored data within the partition is operated upon. - **crypto footer:** support for encryption metadata at the end of the partition. #### IN CASE OF ISSUES if there are any problems, **read the log!** you can scroll it on TWRP. most likely it will tell you what is wrong and what to do about it. if not, make sure to somehow record the log. **REPIT logs to file '/tmp/lanchon-repit.log'.** otherwise, you can [obtain a copy of TWRP's log](http://rootzwiki.com/topic/24120-how-to-get-a-log-from-twrp/) (which includes REPIT's log), or if not at least take a picture of it with your camera. in TWRP 2.8.7.* you can see a full screen log by hitting the back button once, then the center button at the bottom of the screen that looks like a TV screen. after recording the log, you can try reflashing the script if you understand what happened and flashing it again makes sense. **PLEASE NOTE:** your _'did not work'_ report is useless unless you post info from your log.
## Device-Specific Information each supported device has a unique targeted build of REPIT in the [download](https://www.androidfilehost.com/?w=files&flid=49911) section. you can also find device-specific information in the [device tree](https://github.com/Lanchon/REPIT/tree/master/device); try searching by device codename using Github's [find file](https://github.com/Lanchon/REPIT/find/master/device). all configuration options for a specific device are defined in the corresponding `.sh` file and the `common.sh` files that might exist in the same directory and in directories above it. you might also find device-specific readme files with relevant information. #### IF YOUR DEVICE IS NOT SUPPORTED so your device is unsupported, tough luck... but porting REPIT to a new device is an easy job; you can either do it yourself or request that i do it for you. to request a new port, please [follow this steps](https://github.com/Lanchon/REPIT/blob/master/device-dump/README.md); port requests are welcome. if you want to get your hands dirty, check the configuration files for i9100 ([1](https://github.com/Lanchon/REPIT/blob/master/device/galaxy-s2/exynos-4210/i9100.sh), [2](https://github.com/Lanchon/REPIT/blob/master/device/galaxy-s2/common.sh)), they are the most complete and commented. but usually you can get away with much less, take a look at [i9300](https://github.com/Lanchon/REPIT/blob/master/device/i9300.sh). for an example of how to handle out-of-order partitions, check out [janice](https://github.com/Lanchon/REPIT/blob/master/device/janice.sh).
## The Galaxy S2 Family REPIT started its life as i9100-only tool and it inherits this doc section from the good old days. > **IMPORTANT NOTE:** this script will not work if your phone is encrypted. you need to decrypt your phone first. this was found and reported by XDA user **jer194** [here](http://forum.xda-developers.com/galaxy-s2/orig-development/tool-lanchon-repit-data-sparing-t3311747/post65307128). if you run the script on an encrypted phone anyway, no damage will come: it will just refuse to start, complaining that it cannot reread the partition table. #### IF... your stock-partitioned device cannot flash gapps after updating to CM 13.0 download and flash the file as it is. it will get most space from the unused /preload partition and only 8 MiB for the internal sdcard, and then make /system 1 GiB in size. it will keep you current /data size constant, whatever it is. it will retain all data except data in /preload, which is unused in custom roms (but some multi-boot setups use it). #### IF... your device is usable you can nonetheless use this script to do general repartitioning, file system fixing, wiping, and/or file system type changes. download the script, rename it to express your desired configuration (see below), and then flash it. #### Galaxy S2 HOW TO first get [official TWRP](https://twrp.me/samsung/samsunggalaxys2i9100.html) running on your device, then follow the generic how-to. valid zip names: `[-system=][-data=][-sdcard=][-preload=]` for this device, partition alignment is 4 MiB and partition sizes get rounded to the nearest 4 MiB boundary. (it is typical for all devices to use the same value for partition alignment and granularity.) ##### Galaxy S2 Defaults - `-system=same+keep+ext4` - `-data=same+keep+ext4` - `-sdcard=same+keep+vfat` <-- note `vfat` here - `-preload=same+keep+ext4` ##### Galaxy S2 Samples - repartition to stock, wiping preload (in case you used a very small preload before):
(**note:** in general it is not recommended to resize file systems by large factors.)
`lanchon-repit-XXXXXXXX-system=0.5G-data=2G-sdcard=max-preload=0.5G+wipe-i9100.zip` - repartition to stock (without wiping preload):
`-system=0.5G-data=2G-sdcard=max-preload=0.5G` - wipe data:
`-data=+wipe` - wipe/change internal sdcard to ext4 (not recommended):
`-sdcard=+wipe+ext4` - **repartition to 1 GiB system, 6 GiB data, no preload...** - ...keeping all other data:
`-system=1G-data=6G-sdcard=max-preload=min+wipe` - ...keeping all other data, **for phones with ext4-formatted internal sdcard:**
`-system=1G-data=6G-sdcard=max++ext4-preload=min+wipe` - ...keeping system and sdcard but **WIPING DATA:**
(**note:** wiping data is much faster than moving it around if system is being resized and data is large.)
`-system=1G-data=6G+wipe-sdcard=max-preload=min+wipe`
## Disclaimer i believe this software to be very safe and i exercised it a lot before posting it. but i accept no responsibility if your data is lost or your device is bricked.
----- for historical information regarding the CHEF-KOCH incident (and XDA's response), please follow [this link](https://github.com/Lanchon/REPIT/blob/master/README-CHEF-KOCH.md). ================================================ FILE: _config.yml ================================================ theme: jekyll-theme-cayman ================================================ FILE: device/.disabled/falcon/falcon_UNTESTED.sh ================================================ ##################################################### # 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. # ##################################################### ### falcon (non-GPE versions) # Disk /dev/block/mmcblk0: 15269888 sectors, 7.3 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 # Partition table holds up to 36 entries # First usable sector is 34, last usable sector is 15269854 # Total free space is 72203 sectors (35.3 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 256 131327 64.0 MiB 0700 modem # 2 131328 132351 512.0 KiB FFFF sbl1 # 3 132352 132415 32.0 KiB FFFF DDR # 4 132608 133631 512.0 KiB FFFF aboot # 5 135608 136007 200.0 KiB FFFF rpm # 6 136608 137407 400.0 KiB FFFF tz # 7 137608 137671 32.0 KiB FFFF sdi # 8 137672 138695 512.0 KiB FFFF utags # 9 138696 142791 2.0 MiB FFFF logs # 10 142792 147455 2.3 MiB 0700 padA # 11 147456 148479 512.0 KiB FFFF abootBackup # 12 150456 150855 200.0 KiB FFFF rpmBackup # 13 151456 152255 400.0 KiB FFFF tzBackup # 14 152456 152519 32.0 KiB 0700 sdiBackup # 15 152520 153543 512.0 KiB FFFF utagsBackup # 16 153544 155647 1.0 MiB 0700 padB # 17 155648 158719 1.5 MiB FFFF modemst1 # 18 158720 161791 1.5 MiB FFFF modemst2 # 19 161792 162815 512.0 KiB FFFF hob # 20 162816 162831 8.0 KiB FFFF dhob # 21 163072 166143 1.5 MiB FFFF fsg # 22 166144 166145 1024 bytes FFFF fsc # 23 166146 166161 8.0 KiB FFFF ssd # 24 166162 168209 1024.0 KiB FFFF sp # 25 168210 168465 128.0 KiB FFFF cid # 26 168466 174609 3.0 MiB FFFF pds # 27 174610 182801 4.0 MiB FFFF logo # 28 182802 190993 4.0 MiB FFFF clogo # 29 191232 207615 8.0 MiB 0700 persist # 30 207616 208639 512.0 KiB FFFF misc # 31 208640 229119 10.0 MiB FFFF boot # 32 229120 249599 10.0 MiB FFFF recovery # 33 249600 1605631 662.1 MiB 0700 cache # 34 1605632 3604479 976.0 MiB 0700 system # 35 3604480 3620863 8.0 MiB FFFF kpan # 36 3620864 15204095 5.5 GiB 0700 userdata device_makeFlashizeEnv="env/arm.zip" #device_makeFilenameConfig="cache=32M+wipe-system=same-data=max+wipe" device_makeFilenameConfig="cache=32M+wipe-system=same-data=max++ext4" device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:falcon:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/msm_sdcc.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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the crypto footer size: local footerSize=$(( 16384 / sectorSize )) # the set of partitions that can be modified by REPIT: # initPartition 33 cache cache "same keep ext4" 0 initPartition 34 system system "same keep ext4" 0 initPartition 35 kpan kpan "same keep raw" 0 initPartition 36 userdata data "same keep f2fs" $footerSize # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="33 34 36" } device_setup() { # the number of partitions that the device must have: partitionCount=36 # 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 size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: heapAlignment=$(( 4 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="$(seq 33 36)" # the disk area (as a sector range) to use for the heap partitions: heapStart=$(parOldEnd 32) # one past the end of a specific partition heapEnd=$deviceHeapEnd # one past the last usable sector of the device } ================================================ FILE: device/.disabled/falcon/falcon_gpe_UNTESTED.sh ================================================ ##################################################### # 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. # ##################################################### ### falcon_gpe (GPE version) # Disk /dev/block/mmcblk0: 30777344 sectors, 14.7 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 # Partition table holds up to 37 entries # First usable sector is 34, last usable sector is 30777310 # Total free space is 72203 sectors (35.3 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 256 131327 64.0 MiB 0700 modem # 2 131328 132351 512.0 KiB FFFF sbl1 # 3 132352 132415 32.0 KiB FFFF DDR # 4 132608 133631 512.0 KiB FFFF aboot # 5 135608 136007 200.0 KiB FFFF rpm # 6 136608 137407 400.0 KiB FFFF tz # 7 137608 137671 32.0 KiB FFFF sdi # 8 137672 138695 512.0 KiB FFFF utags # 9 138696 142791 2.0 MiB FFFF logs # 10 142792 147455 2.3 MiB 0700 metadata # 11 147456 148479 512.0 KiB FFFF abootBackup # 12 150456 150855 200.0 KiB FFFF rpmBackup # 13 151456 152255 400.0 KiB FFFF tzBackup # 14 152456 152519 32.0 KiB 0700 sdiBackup # 15 152520 153543 512.0 KiB FFFF utagsBackup # 16 153544 155647 1.0 MiB 0700 padB # 17 155648 158719 1.5 MiB FFFF modemst1 # 18 158720 161791 1.5 MiB FFFF modemst2 # 19 161792 162815 512.0 KiB FFFF hob # 20 162816 162831 8.0 KiB FFFF dhob # 21 163072 166143 1.5 MiB FFFF fsg # 22 166144 166145 1024 bytes FFFF fsc # 23 166146 166161 8.0 KiB FFFF ssd # 24 166162 168209 1024.0 KiB FFFF sp # 25 168210 168465 128.0 KiB FFFF cid # 26 168466 174609 3.0 MiB FFFF pds # 27 174610 182801 4.0 MiB FFFF logo # 28 182802 190993 4.0 MiB FFFF clogo # 29 191232 207615 8.0 MiB 0700 persist # 30 207616 208639 512.0 KiB FFFF misc # 31 208640 229119 10.0 MiB FFFF boot # 32 229120 249599 10.0 MiB FFFF recovery # 33 249600 262143 6.1 MiB 0700 padC # 34 262144 1409023 560.0 MiB 0700 cache # 35 1409024 3129343 840.0 MiB 0700 system # 36 3129344 3145727 8.0 MiB FFFF kpan # 37 3145728 30711551 13.1 GiB 0700 userdata device_makeFlashizeEnv="env/arm.zip" #device_makeFilenameConfig="cache=32M+wipe-system=same-data=max" #device_makeFilenameConfig="cache=32M+wipe-system=976M-data=max" device_makeFilenameConfig="cache=424M+wipe-system=976M-data=same" device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:falcon:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/msm_sdcc.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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the set of partitions that can be modified by REPIT: # initPartition 34 cache cache "same keep ext4" 0 initPartition 35 system system "same keep ext4" 0 initPartition 36 kpan kpan "same keep raw" 0 initPartition 37 userdata data "same keep ext4" 0 # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="34 35 37" } device_setup() { # the number of partitions that the device must have: partitionCount=37 # 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 size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: heapAlignment=$(( 4 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="$(seq 34 37)" # the disk area (as a sector range) to use for the heap partitions: heapStart=$(parOldEnd 33) # one past the end of a specific partition heapEnd=$deviceHeapEnd # one past the last usable sector of the device } ================================================ FILE: device/.disabled/galaxy-s4-mini/serrano3gxx_UNTESTED.sh ================================================ ##################################################### # 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. # ##################################################### ### serrano3gxx # This port was possible thanks to the invaluable help of vaedasti. # Disk /dev/block/mmcblk0: 15269888 sectors, 7.3 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 # Partition table holds up to 128 entries # First usable sector is 34, last usable sector is 15269854 # Total free space is 8158 sectors (4.0 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 8192 131071 60.0 MiB 0700 modem # 2 131072 131327 128.0 KiB FFFF sbl1 # 3 131328 131839 256.0 KiB FFFF sbl2 # 4 131840 132863 512.0 KiB FFFF sbl3 # 5 132864 136959 2.0 MiB FFFF aboot # 6 136960 137983 512.0 KiB FFFF rpm # 7 137984 139007 512.0 KiB FFFF tz # 8 139008 164607 12.5 MiB FFFF pad # 9 164608 180991 8.0 MiB 8300 param # 10 180992 208895 13.6 MiB 8300 efs # 11 208896 215039 3.0 MiB FFFF modemst1 # 12 215040 221183 3.0 MiB FFFF modemst2 # 13 221184 241663 10.0 MiB FFFF boot # 14 241664 262143 10.0 MiB FFFF recovery # 15 262144 282623 10.0 MiB FFFF fota # 16 282624 296943 7.0 MiB 8300 backup # 17 296944 303087 3.0 MiB FFFF fsg # 18 303088 303103 8.0 KiB FFFF ssd # 19 303104 319487 8.0 MiB 8300 persist # 20 319488 344063 12.0 MiB 8300 persdata # 21 344064 3416063 1.5 GiB 8300 system # 22 3416064 3825663 200.0 MiB 8300 cache # 23 3825664 4030463 100.0 MiB 8300 hidden # 24 4030464 15269854 5.4 GiB 8300 userdata device_makeFlashizeEnv="env/arm.zip" device_makeFilenameConfig="system=1G-cache=32M+wipe-preload=min+wipe-data=max" device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:serrano3g:*) ;; *:serrano3gxx:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/platform/msm_sdcc.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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the crypto footer size: local footerSize=$(( 16384 / sectorSize )) # the set of partitions that can be modified by REPIT: # initPartition 21 system system "same keep ext4" 0 initPartition 22 cache cache "same keep ext4" 0 initPartition 23 hidden preload "same keep ext4" 0 initPartition 24 userdata data "same keep ext4" $footerSize # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="$(seq 21 24)" } device_setup() { # the number of partitions that the device must have: partitionCount=24 # 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 size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: heapAlignment=$(( 1 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="$(seq 21 24)" # the disk area (as a sector range) to use for the heap partitions: heapStart=$(parOldEnd 20) # one past the end of a specific partition heapEnd=$deviceHeapEnd # one past the last usable sector of the device } ================================================ FILE: device/.disabled/galaxy-s5/common.sh ================================================ ##################################################### # 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-s5 # This port was possible thanks to the invaluable help of wecip. # Disk /dev/block/mmcblk0: 30777344 sectors, 14.7 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 # Partition table holds up to 128 entries # First usable sector is 34, last usable sector is 30777310 # Total free space is 8158 sectors (4.0 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 8192 38911 15.0 MiB 8300 apnhlos # 2 38912 156543 57.4 MiB 0700 modem # 3 156544 157567 512.0 KiB FFFF sbl1 # 4 157568 157695 64.0 KiB FFFF dbi # 5 157696 157759 32.0 KiB FFFF ddr # 6 157760 161855 2.0 MiB FFFF aboot # 7 161856 162879 512.0 KiB FFFF rpm # 8 162880 163903 512.0 KiB FFFF tz # 9 163904 170047 3.0 MiB FFFF fsg # 10 170048 184319 7.0 MiB FFFF pad # 11 184320 204799 10.0 MiB FFFF param # 12 204800 233471 14.0 MiB 8300 efs # 13 233472 239615 3.0 MiB FFFF modemst1 # 14 239616 245759 3.0 MiB FFFF modemst2 # 15 245760 272383 13.0 MiB FFFF boot # 16 272384 303103 15.0 MiB FFFF recovery # 17 303104 329727 13.0 MiB FFFF fota # 18 329728 344045 7.0 MiB 8300 backup # 19 344046 344047 1024 bytes FFFF fsc # 20 344048 344063 8.0 KiB FFFF ssd # 21 344064 360447 8.0 MiB 8300 persist # 22 360448 378879 9.0 MiB 8300 persdata # 23 378880 5498879 2.4 GiB 8300 system # 24 5498880 5908479 200.0 MiB 8300 cache # 25 5908480 6010879 50.0 MiB 8300 hidden # 26 6010880 30777310 11.8 GiB 8300 userdata device_makeFlashizeEnv="env/arm.zip" device_makeFilenameConfig="system=1G-cache=32M+wipe-preload=min+wipe-data=max" device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/msm_sdcc.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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the crypto footer size: local footerSize=$(( 16384 / sectorSize )) # the set of partitions that can be modified by REPIT: # initPartition 23 system system "same keep ext4" 0 initPartition 24 cache cache "same keep ext4" 0 initPartition 25 hidden preload "same keep ext4" 0 initPartition 26 userdata data "same keep ext4" $footerSize # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="$(seq 23 26)" } device_setup() { # the number of partitions that the device must have: partitionCount=26 # 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 size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: heapAlignment=$(( 1 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="$(seq 23 26)" # the disk area (as a sector range) to use for the heap partitions: heapStart=$(parOldEnd 22) # one past the end of a specific partition heapEnd=$deviceHeapEnd # one past the last usable sector of the device } ================================================ FILE: device/.disabled/galaxy-s5/klte_UNTESTED.sh ================================================ ##################################################### # 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. # ##################################################### ### klte # This port was possible thanks to the invaluable help of wecip. device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:kltexx:*) ;; *:kltelra:*) ;; *:kltetmo:*) ;; *:kltecan:*) ;; *:klteatt:*) ;; *:klteub:*) ;; *:klteacg:*) ;; *:klte:*) ;; *:kltekor:*) ;; *:klteskt:*) ;; *:kltektt:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device/.disabled/y560_UNTESTED.sh ================================================ ##################################################### # 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. # ##################################################### ### y560 # This port was possible thanks to the invaluable help of macio525. # Disk /dev/block/mmcblk0: 15269888 sectors, 7.3 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 # Partition table holds up to 32 entries # First usable sector is 34, last usable sector is 15269854 # Total free space is 332856 sectors (162.5 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 131072 262143 64.0 MiB 0700 modem # 2 262144 263167 512.0 KiB FFFF sbl1 # 3 263168 264191 512.0 KiB FFFF sbl1bak # 4 264192 266239 1024.0 KiB FFFF aboot # 5 266240 268287 1024.0 KiB FFFF abootbak # 6 268288 269311 512.0 KiB FFFF rpm # 7 269312 270335 512.0 KiB FFFF rpmbak # 8 270336 271871 768.0 KiB FFFF tz # 9 271872 273407 768.0 KiB FFFF tzbak # 10 273408 275455 1024.0 KiB 0700 pad # 11 275456 278527 1.5 MiB FFFF modemst1 # 12 278528 281599 1.5 MiB FFFF modemst2 # 13 281600 283647 1024.0 KiB FFFF misc # 14 283648 283649 1024 bytes FFFF fsc # 15 283650 283665 8.0 KiB FFFF ssd # 16 283666 304145 10.0 MiB FFFF splash # 17 393216 393279 32.0 KiB FFFF DDR # 18 393280 396351 1.5 MiB FFFF fsg # 19 396352 396383 16.0 KiB FFFF sec # 20 396384 461919 32.0 MiB FFFF boot # 21 461920 527455 32.0 MiB FFFF persist # 22 527456 4538259 1.9 GiB FFFF system # 23 4538260 5062547 256.0 MiB FFFF cache # 24 5062548 5128083 32.0 MiB FFFF recovery # 25 5128084 5130131 1024.0 KiB FFFF devinfo # 26 5242880 5243903 512.0 KiB FFFF keystore # 27 5243904 5374975 64.0 MiB FFFF oem # 28 5374976 5375999 512.0 KiB FFFF config # 29 5376000 15269854 4.7 GiB FFFF userdata device_makeFlashizeEnv="env/arm.zip" device_makeFilenameConfig="system=1G-cache=32M+wipe-data=max" device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:y560:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/soc.0/7824900.sdhci/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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the crypto footer size: local footerSize=$(( 16384 / sectorSize )) # the set of partitions that can be modified by REPIT: # initPartition 22 system system "same keep ext4" 0 initPartition 23 cache cache "same keep ext4" 0 initPartition 24 recovery recovery "same keep raw" 0 initPartition 25 devinfo devinfo "same keep raw" 0 initPartition 26 keystore keystore "same keep raw" 0 initPartition 27 oem oem "same keep raw" 0 initPartition 28 config config "same keep raw" 0 initPartition 29 userdata data "same keep ext4" $footerSize # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="22 23 29" } device_setup() { # the number of partitions that the device must have: partitionCount=29 # 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 size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: #heapAlignment=$(( 2 * 1024 / sectorSize )) # stock alignment of the heap partitions is 2 KiB !!! heapAlignment=$(( 1 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="$(seq 22 29)" # the disk area (as a sector range) to use for the heap partitions: heapStart=$(parOldEnd 21) # one past the end of a specific partition heapEnd=$deviceHeapEnd # one past the last usable sector of the device } ================================================ FILE: device/.disabled/y560_test.sh ================================================ ##################################################### # 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. # ##################################################### ### y560 # This port was possible thanks to the invaluable help of macio525. # Disk /dev/block/mmcblk0: 15269888 sectors, 7.3 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 # Partition table holds up to 32 entries # First usable sector is 34, last usable sector is 15269854 # Total free space is 332856 sectors (162.5 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 131072 262143 64.0 MiB 0700 modem # 2 262144 263167 512.0 KiB FFFF sbl1 # 3 263168 264191 512.0 KiB FFFF sbl1bak # 4 264192 266239 1024.0 KiB FFFF aboot # 5 266240 268287 1024.0 KiB FFFF abootbak # 6 268288 269311 512.0 KiB FFFF rpm # 7 269312 270335 512.0 KiB FFFF rpmbak # 8 270336 271871 768.0 KiB FFFF tz # 9 271872 273407 768.0 KiB FFFF tzbak # 10 273408 275455 1024.0 KiB 0700 pad # 11 275456 278527 1.5 MiB FFFF modemst1 # 12 278528 281599 1.5 MiB FFFF modemst2 # 13 281600 283647 1024.0 KiB FFFF misc # 14 283648 283649 1024 bytes FFFF fsc # 15 283650 283665 8.0 KiB FFFF ssd # 16 283666 304145 10.0 MiB FFFF splash # 17 393216 393279 32.0 KiB FFFF DDR # 18 393280 396351 1.5 MiB FFFF fsg # 19 396352 396383 16.0 KiB FFFF sec # 20 396384 461919 32.0 MiB FFFF boot # 21 461920 527455 32.0 MiB FFFF persist # 22 527456 4538259 1.9 GiB FFFF system # 23 4538260 5062547 256.0 MiB FFFF cache # 24 5062548 5128083 32.0 MiB FFFF recovery # 25 5128084 5130131 1024.0 KiB FFFF devinfo # 26 5242880 5243903 512.0 KiB FFFF keystore # 27 5243904 5374975 64.0 MiB FFFF oem # 28 5374976 5375999 512.0 KiB FFFF config # 29 5376000 15269854 4.7 GiB FFFF userdata device_makeFlashizeEnv="env/arm.zip" # device_makeFilenameConfig="system=1G-cache=32M+wipe-data=max" device_makeFilenameConfig="cache=255M+wipe" device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:y560:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/soc.0/7824900.sdhci/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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the crypto footer size: local footerSize=$(( 16384 / sectorSize )) # the set of partitions that can be modified by REPIT: # # initPartition 22 system system "same keep ext4" 0 initPartition 23 cache cache "same keep ext4" 0 initPartition 24 recovery recovery "same keep raw" 0 # initPartition 25 devinfo devinfo "same keep raw" 0 # initPartition 26 keystore keystore "same keep raw" 0 # initPartition 27 oem oem "same keep raw" 0 # initPartition 28 config config "same keep raw" 0 # initPartition 29 userdata data "same keep ext4" $footerSize # the set of modifiable partitions that can be configured by the user (overriding ): # configurablePartitions="22 23 29" configurablePartitions="23" } device_setup() { # the number of partitions that the device must have: partitionCount=29 # 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 size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: # heapAlignment=$(( 1 * MiB )) heapAlignment=$(( 2 * 1024 / sectorSize )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: # heapPartitions="$(seq 22 29)" heapPartitions="$(seq 23 24)" # the disk area (as a sector range) to use for the heap partitions: # heapStart=$(parOldEnd 21) # one past the end of a specific partition # heapEnd=$deviceHeapEnd # one past the last usable sector of the device heapStart=$(parOldEnd 22) # one past the end of a specific partition heapEnd=$(parOldStart 25) # or the start of a specific partition } ================================================ FILE: device/cherry.sh ================================================ ##################################################### # 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. # ##################################################### ### cherry # This port was possible thanks to the invaluable help of jerryhou85. # Disk /dev/block/mmcblk0: 15269888 sectors, 7.3 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 # Partition table holds up to 24 entries # First usable sector is 34, last usable sector is 15269854 # Partitions will be aligned on 1-sector boundaries # Total free space is 16350 sectors (8.0 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 34 1057 512.0 KiB FFFF sbl1 # 2 1058 2081 512.0 KiB FFFF hyp # 3 8192 8255 32.0 KiB FFFF sec # 4 8256 8319 32.0 KiB FFFF DDR # 5 16384 17407 512.0 KiB FFFF rpm # 6 17408 18431 512.0 KiB FFFF tz # 7 18432 28543 4.9 MiB FFFF aboot # 8 28544 30591 1024.0 KiB FFFF pad # 9 30592 161663 64.0 MiB FFFF oeminfo # 10 161664 169855 4.0 MiB FFFF modemst1 # 11 169856 178047 4.0 MiB FFFF modemst2 # 12 180224 376831 96.0 MiB FFFF modem # 13 376832 385023 4.0 MiB FFFF fsg # 14 385024 389119 2.0 MiB FFFF fsc # 15 389120 393215 2.0 MiB FFFF ssd # 16 393216 524287 64.0 MiB FFFF log # 17 524288 589823 32.0 MiB FFFF persist # 18 589824 630783 20.0 MiB FFFF boot # 19 630784 679935 24.0 MiB FFFF recovery # 20 679936 2252799 768.0 MiB FFFF cust # 21 2252800 2777087 256.0 MiB FFFF cache # 22 2777088 2785279 4.0 MiB FFFF misc # 23 2785280 6455295 1.8 GiB FFFF system # 24 6455296 15269854 4.2 GiB 0700 userdata device_makeFlashizeEnv="env/arm.zip" device_makeFilenameConfig="cust=min+wipe-cache=32M+wipe-system=1G-data=max" device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:cherry:*) ;; *:Che1-CL20:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/soc.0/7824900.sdhci/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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the crypto footer size: local footerSize=$(( 16384 / sectorSize )) # the set of partitions that can be modified by REPIT: # initPartition 20 cust cust "same keep ext4" 0 initPartition 21 cache cache "same keep ext4" 0 initPartition 22 misc misc "same keep raw" 0 initPartition 23 system system "same keep ext4" 0 initPartition 24 userdata data "same keep ext4" $footerSize # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="20 21 23 24" } device_setup() { # the number of partitions that the device must have: partitionCount=24 # the set of defined heaps: allHeaps="main" # the partition data move chunk size (must fit in memory): moveDataChunkSize=$(( 512 * MiB )) # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: detectBlockDeviceHeapRange # the size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: heapAlignment=$(( 4 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="$(seq 20 24)" # the disk area (as a sector range) to use for the heap partitions: heapStart=$(parOldEnd 19) # one past the end of a specific partition heapEnd=$deviceHeapEnd # one past the last usable sector of the device } ================================================ FILE: device/dior.sh ================================================ ##################################################### # 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. # ##################################################### ### dior # This port was possible thanks to the invaluable help of jerryhou85. # Caution: invalid backup GPT header, but valid main header; regenerating # backup header from main header. # # **************************************************************************** # Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk # verification and recovery are STRONGLY recommended. # **************************************************************************** # Disk /dev/block/mmcblk0: 15269888 sectors, 7.3 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 # Partition table holds up to 32 entries # First usable sector is 34, last usable sector is 15269854 # Total free space is 65546 sectors (32.0 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 34 4095 2.0 MiB FFFF sbl1 # 2 4096 8157 2.0 MiB 0700 sbl1bak # 3 8158 10205 1024.0 KiB FFFF rpm # 4 10206 12253 1024.0 KiB 0700 rpmbak # 5 12254 14301 1024.0 KiB FFFF tz # 6 14302 16349 1024.0 KiB 0700 tzbak # 7 16350 16365 8.0 KiB FFFF ssd # 8 16366 18413 1024.0 KiB FFFF sdi # 9 18414 20461 1024.0 KiB FFFF DDR # 10 20462 28653 4.0 MiB FFFF aboot # 11 28654 36845 4.0 MiB 0700 abootbak # 12 36846 47085 5.0 MiB 8300 bk1 # 13 47086 55277 4.0 MiB FFFF misc # 14 55278 71661 8.0 MiB 8300 logo # 15 71662 131061 29.0 MiB 8300 bk2 # 16 131062 134133 1.5 MiB FFFF modemst1 # 17 134134 137205 1.5 MiB FFFF modemst2 # 18 137206 137207 1024 bytes FFFF fsc # 19 137208 262133 61.0 MiB 8300 bk3 # 20 262134 265205 1.5 MiB FFFF fsg # 21 265206 327669 30.5 MiB 8300 bk4 # 22 327670 393205 32.0 MiB 8300 bk5 # 23 393206 524277 64.0 MiB 0700 modem # 24 524278 557045 16.0 MiB FFFF boot # 25 557046 589813 16.0 MiB FFFF recovery # 26 589814 655349 32.0 MiB 0700 persist # 27 655350 2293749 800.0 MiB 0700 system # 28 2293750 3080181 384.0 MiB 0700 cache # 29 3145728 15269854 5.8 GiB 0700 userdata device_makeFlashizeEnv="env/arm.zip" #device_makeFilenameConfig="system=1160M-cache=32M+wipe-data=same" #device_makeFilenameConfig="system=max-cache=32M+wipe-data=same" #device_makeFilenameConfig="system=1G-cache=168M+wipe-data=same" #device_makeFilenameConfig="system=1G-cache=max+wipe-data=same" device_makeFilenameConfig="system=same-cache=32M+wipe-data=max" device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:dior:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/msm_sdcc.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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the set of partitions that can be modified by REPIT: # initPartition 27 system system "same keep ext4" 0 initPartition 28 cache cache "same keep ext4" 0 initPartition 29 userdata data "same keep ext4" 0 # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="$(seq 27 29)" } device_setup() { # the number of partitions that the device must have: partitionCount=29 # 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 size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: heapAlignment=$(( 4 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="$(seq 27 29)" # the disk area (as a sector range) to use for the heap partitions: heapStart=$(parOldEnd 26) # one past the end of a specific partition heapEnd=$deviceHeapEnd # one past the last usable sector of the device } ================================================ FILE: device/galaxy-j5/common.sh ================================================ ##################################################### # 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-j5 # This port was possible thanks to the invaluable help of ajislav. # Disk /dev/block/mmcblk0: 15269888 sectors, 7.3 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 # Partition table holds up to 128 entries # First usable sector is 34, last usable sector is 15269854 # Total free space is 8165 sectors (4.0 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 8192 38911 15.0 MiB 0700 apnhlos # 2 38912 156543 57.4 MiB 0700 modem # 3 156544 157567 512.0 KiB FFFF sbl1 # 4 157568 157631 32.0 KiB FFFF ddr # 5 157632 161727 2.0 MiB FFFF aboot # 6 161728 162751 512.0 KiB FFFF rpm # 7 162752 163775 512.0 KiB FFFF qsee # 8 163776 164799 512.0 KiB FFFF qhee # 9 164800 170943 3.0 MiB FFFF fsg # 10 170944 170975 16.0 KiB FFFF sec # 11 170976 192511 10.5 MiB 0700 pad # 12 192512 212991 10.0 MiB FFFF param # 13 212992 241663 14.0 MiB 8300 efs # 14 241664 247807 3.0 MiB FFFF modemst1 # 15 247808 253951 3.0 MiB FFFF modemst2 # 16 253952 280575 13.0 MiB FFFF boot # 17 280576 311295 15.0 MiB FFFF recovery # 18 311296 336897 12.5 MiB FFFF fota # 19 336898 351215 7.0 MiB 8300 backup # 20 351216 357359 3.0 MiB FFFF fsc # 21 357360 357375 8.0 KiB FFFF ssd # 22 357376 373759 8.0 MiB 8300 persist # 23 373760 374783 512.0 KiB 8300 persistent # 24 374784 393215 9.0 MiB 8300 persdata # 25 393216 4653055 2.0 GiB 8300 system # 26 4653056 5062655 200.0 MiB 8300 cache # 27 5062656 5206015 70.0 MiB 8300 hidden # 28 5206016 15269847 4.8 GiB 8300 userdata device_makeFlashizeEnv="env/arm.zip" device_makeFilenameConfig="system=1G-cache=32M+wipe-preload=min+wipe-data=max" device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/soc.0/7824900.sdhci/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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the crypto footer size: local footerSize=$(( 16384 / sectorSize )) # the set of partitions that can be modified by REPIT: # initPartition 25 system system "same keep ext4" 0 initPartition 26 cache cache "same keep ext4" 0 initPartition 27 hidden preload "same keep ext4" 0 initPartition 28 userdata data "same keep ext4" $footerSize # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="$(seq 25 28)" } device_setup() { # the number of partitions that the device must have: partitionCount=28 # 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 size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: heapAlignment=$(( 1 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="$(seq 25 28)" # the disk area (as a sector range) to use for the heap partitions: heapStart=$(parOldEnd 24) # one past the end of a specific partition heapEnd=$deviceHeapEnd # one past the last usable sector of the device } ================================================ FILE: device/galaxy-j5/j5lte.sh ================================================ ##################################################### # 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. # ##################################################### ### j5lte # This port was possible thanks to the invaluable help of ajislav. device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:j5lte:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device/galaxy-s2/common.sh ================================================ ##################################################### # 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 device_makeFlashizeEnv="env/arm.zip" device_makeFilenameConfig="system=1G-data=same-sdcard=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: # #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 # 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 ): #configurablePartitions="7 $(seq 9 12)" configurablePartitions="$(seq 9 12)" # 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 # 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)" # 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=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 } ================================================ FILE: device/galaxy-s2/exynos-4210/d710.sh ================================================ ##################################################### # 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. # ##################################################### ### d710 device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:epic4gtouch:*) ;; *:SPH-D710:*) ;; *:d710:*) ;; *:smdk4210:*) ;; *:SPH-D710VMUB:*) ;; *:SPH-D710BST:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device/galaxy-s2/exynos-4210/i777.sh ================================================ ##################################################### # 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. # ##################################################### ### i777 device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:i777:*) ;; *:SGH-I777:*) ;; *:SGH-S959G:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device/galaxy-s2/exynos-4210/i9100.sh ================================================ ##################################################### # 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 } ### 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=0.5 data_size=2 #sdcard_size=11.5078 sdcard_size=max preload_size=0.5 system_fs=ext4 data_fs=ext4 sdcard_fs=vfat preload_fs=ext4 } ================================================ FILE: device/galaxy-s2/exynos-4210/n7000.sh ================================================ ##################################################### # 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. # ##################################################### ### n7000 device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:galaxynote:*) ;; *:n7000:*) ;; *:N7000:*) ;; *:GT-N7000:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device/galaxy-s2/exynos-4210/sc02c.sh ================================================ ##################################################### # 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. # ##################################################### ### sc02c 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 } ================================================ FILE: device/galaxy-s2/omap-4430/i9100g.sh ================================================ ##################################################### # 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. # ##################################################### ### i9100g # This port was possible thanks to the invaluable help of MalcolmMcConnor. device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:i9100g:*) ;; *:GT-I9100G:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device/galaxy-s3/exynos/i9300.sh ================================================ ##################################################### # 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. # ##################################################### ### i9300 # This port was possible thanks to the invaluable help of ElPumpo/Hawaii_Beach. # Disk /dev/block/mmcblk0: 30777344 sectors, 2740M # Logical sector size: 512 # Disk identifier (GUID): 52444e41-494f-2044-4d4d-43204449534b # Partition table holds up to 128 entries # First usable sector is 34, last usable sector is 30777310 # # Number Start (sector) End (sector) Size Code Name # 1 8192 16383 4096K 0700 BOTA0 # 2 16384 24575 4096K 0700 BOTA1 # 3 24576 65535 20.0M 0700 EFS # 4 65536 81919 8192K 0700 PARAM # 5 81920 98303 8192K 0700 BOOT # 6 98304 114687 8192K 0700 RECOVERY # 7 114688 180223 32.0M 0700 RADIO # 8 180224 2277375 1024M 0700 CACHE # 9 2277376 5423103 1536M 0700 SYSTEM # 10 5423104 6569983 560M 0700 HIDDEN # 11 6569984 6586367 8192K 0700 OTA # 12 6586368 30769151 11.5G 0700 USERDATA device_makeFlashizeEnv="env/arm.zip" device_makeFilenameConfig="cache=32M+wipe-system=same-preload=min+wipe-data=max" device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:m0:*) ;; *:i9300:*) ;; *:GT-I9300:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/platform/dw_mmc/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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the crypto footer size: local footerSize=$(( 16384 / sectorSize )) # the set of partitions that can be modified by REPIT: # initPartition 8 CACHE cache "same keep ext4" 0 initPartition 9 SYSTEM system "same keep ext4" 0 initPartition 10 HIDDEN preload "same keep ext4" 0 initPartition 11 OTA ota "same keep raw" 0 initPartition 12 USERDATA data "same keep ext4" $footerSize # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="$(seq 8 12)" } device_setup() { # the number of partitions that the device must have: partitionCount=12 # 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 size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: heapAlignment=$(( 4 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="$(seq 8 12)" # the disk area (as a sector range) to use for the heap partitions: heapStart=$(parOldEnd 7) # one past the end of a specific partition heapEnd=$deviceHeapEnd # one past the last usable sector of the device } ================================================ FILE: device/galaxy-s3/exynos/i9305.sh ================================================ ##################################################### # 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. # ##################################################### ### i9305 # This port was possible thanks to the invaluable help of nishimura-san. # Disk /dev/block/mmcblk0: 30777344 sectors, 14.7 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 52444E41-494F-2044-4D4D-43204449534B # Partition table holds up to 128 entries # First usable sector is 34, last usable sector is 30777310 # Total free space is 16317 sectors (8.0 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 8192 16383 4.0 MiB 0700 BOTA0 # 2 16384 24575 4.0 MiB 0700 BOTA1 # 3 24576 65535 20.0 MiB 0700 EFS # 4 65536 73727 4.0 MiB 0700 m9kefs1 # 5 73728 81919 4.0 MiB 0700 m9kefs2 # 6 81920 90111 4.0 MiB 0700 m9kefs3 # 7 90112 106495 8.0 MiB 0700 PARAM # 8 106496 122879 8.0 MiB 0700 BOOT # 9 122880 139263 8.0 MiB 0700 RECOVERY # 10 139264 319487 88.0 MiB 0700 RADIO # 11 319488 843775 256.0 MiB 0700 TOMBSTONES # 12 843776 2940927 1024.0 MiB 0700 CACHE # 13 2940928 6086655 1.5 GiB 0700 SYSTEM # 14 6086656 7233535 560.0 MiB 0700 HIDDEN # 15 7233536 7249919 8.0 MiB 0700 OTA # 16 7249920 30769151 11.2 GiB 0700 USERDATA device_makeFlashizeEnv="env/arm.zip" device_makeFilenameConfig="tombstones=same-cache=32M+wipe-system=1G-preload=min+wipe-data=max" device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:m3:*) ;; *:m3xx:*) ;; *:i9305:*) ;; *:GT-I9305:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/platform/dw_mmc/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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the crypto footer size: local footerSize=$(( 16384 / sectorSize )) # the set of partitions that can be modified by REPIT: # initPartition 11 TOMBSTONES tombstones "same keep ext4" 0 initPartition 12 CACHE cache "same keep ext4" 0 initPartition 13 SYSTEM system "same keep ext4" 0 initPartition 14 HIDDEN preload "same keep ext4" 0 initPartition 15 OTA ota "same keep raw" 0 initPartition 16 USERDATA data "same keep ext4" $footerSize # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="$(seq 11 16)" } device_setup() { # the number of partitions that the device must have: partitionCount=16 # 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 size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: heapAlignment=$(( 4 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="$(seq 11 16)" # the disk area (as a sector range) to use for the heap partitions: heapStart=$(parOldEnd 10) # one past the end of a specific partition heapEnd=$deviceHeapEnd # one past the last usable sector of the device } ================================================ FILE: device/galaxy-s3/snapdragon/common.sh ================================================ ##################################################### # Lanchon REPIT - Device Handler # # Copyright 2019, Lanchon # ##################################################### ##################################################### # Lanchon REPIT is free software licensed under # # the GNU General Public License (GPL) version 3 # # and any later version. # ##################################################### ### galaxy-s3/snapdragon device_makeFlashizeEnv="env/arm.zip" device_makeFilenameConfig="system=same-data=max-cache=32M+wipe" device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/platform/msm_sdcc.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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the crypto footer size: local footerSize=$(( 16384 / sectorSize )) # the set of partitions that can be modified by REPIT: # initPartition 14 system system "same keep ext4" 0 initPartition 15 userdata data "same keep ext4" $footerSize initPartition 16 persist persist "same keep raw" 0 initPartition 17 cache cache "same keep ext4" 0 # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="14 15 17" } device_setup() { # the number of partitions that the device must have: partitionCount=23 # 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 size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: heapAlignment=$(( 4 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="$(seq 14 17)" # the disk area (as a sector range) to use for the heap partitions: heapStart=$(parOldEnd 13) # one past the end of a specific partition heapEnd=$(parOldStart 18) # the start of a specific partition } ================================================ FILE: device/galaxy-s3/snapdragon/d2tmo.sh ================================================ ##################################################### # Lanchon REPIT - Device Handler # # Copyright 2019, Lanchon # ##################################################### ##################################################### # Lanchon REPIT is free software licensed under # # the GNU General Public License (GPL) version 3 # # and any later version. # ##################################################### ### d2tmo # This port was possible thanks to the invaluable help of mw-merickso. # Disk /dev/block/mmcblk0: 30777344 sectors, 14.7 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 # Partition table holds up to 128 entries # First usable sector is 34, last usable sector is 30765071 # Total free space is 8158 sectors (4.0 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 8192 131071 60.0 MiB 0700 modem # 2 131072 131327 128.0 KiB FFFF sbl1 # 3 131328 131839 256.0 KiB FFFF sbl2 # 4 131840 132863 512.0 KiB FFFF sbl3 # 5 132864 136959 2.0 MiB FFFF aboot # 6 136960 137983 512.0 KiB FFFF rpm # 7 137984 158463 10.0 MiB FFFF boot # 8 158464 159487 512.0 KiB FFFF tz # 9 159488 160511 512.0 KiB FFFF pad # 10 160512 180991 10.0 MiB 8300 param # 11 180992 208895 13.6 MiB 8300 efs # 12 208896 215039 3.0 MiB FFFF modemst1 # 13 215040 221183 3.0 MiB FFFF modemst2 # 14 221184 3293183 1.5 GiB 8300 system # 15 3293184 28958719 12.2 GiB 8300 userdata # 16 28958720 28975103 8.0 MiB 8300 persist # 17 28975104 30695423 840.0 MiB 8300 cache # 18 30695424 30715903 10.0 MiB FFFF recovery # 19 30715904 30736383 10.0 MiB FFFF fota # 20 30736384 30748671 6.0 MiB 8300 backup # 21 30748672 30754815 3.0 MiB FFFF fsg # 22 30754816 30754831 8.0 KiB FFFF ssd # 23 30754832 30765071 5.0 MiB 8300 grow device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:d2tmo:*) ;; *:d2lte:*) ;; *:SGH-T999:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device/galaxy-s3/snapdragon/d2usc.sh ================================================ ##################################################### # Lanchon REPIT - Device Handler # # Copyright 2019, Lanchon # ##################################################### ##################################################### # Lanchon REPIT is free software licensed under # # the GNU General Public License (GPL) version 3 # # and any later version. # ##################################################### ### d2usc # This port was possible thanks to the invaluable help of terracota/TeracottaShishi. # Disk /dev/block/mmcblk0: 61071360 sectors, 29.1 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 # Partition table holds up to 128 entries # First usable sector is 34, last usable sector is 61071326 # Total free space is 20397 sectors (10.0 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 8192 131071 60.0 MiB 0700 modem # 2 131072 131327 128.0 KiB FFFF sbl1 # 3 131328 131839 256.0 KiB FFFF sbl2 # 4 131840 132863 512.0 KiB FFFF sbl3 # 5 132864 136959 2.0 MiB FFFF aboot # 6 136960 137983 512.0 KiB FFFF rpm # 7 137984 158463 10.0 MiB FFFF boot # 8 158464 159487 512.0 KiB FFFF tz # 9 159488 160511 512.0 KiB FFFF pad # 10 160512 180991 10.0 MiB 8300 param # 11 180992 208895 13.6 MiB 8300 efs # 12 208896 215039 3.0 MiB FFFF modemst1 # 13 215040 221183 3.0 MiB FFFF modemst2 # 14 221184 3293183 1.5 GiB 8300 system # 15 3293184 59252735 26.7 GiB 8300 userdata # 16 59252736 59269119 8.0 MiB 8300 persist # 17 59269120 60989439 840.0 MiB 8300 cache # 18 60989440 61009919 10.0 MiB FFFF recovery # 19 61009920 61030399 10.0 MiB FFFF fota # 20 61030400 61042687 6.0 MiB 8300 backup # 21 61042688 61048831 3.0 MiB FFFF fsg # 22 61048832 61048847 8.0 KiB FFFF ssd # 23 61048848 61059087 5.0 MiB 8300 grow device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:d2usc:*) ;; *:d2lte:*) ;; *:SCH-R530U:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device/janice.sh ================================================ ##################################################### # 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. # ##################################################### ### janice # Disk /dev/block/mmcblk0: 15269888 sectors, 3360M # Logical sector size: 512 # Disk identifier (GUID): 52444e41-494f-2044-4d4d-43204449534b # Partition table holds up to 128 entries # First usable sector is 34, last usable sector is 15269854 # # Number Start (sector) End (sector) Size Code Name # 1 71680 104447 16.0M 0700 PARAM # 2 28672 61439 16.0M 0700 Modem FS # 3 206848 1460223 612M 0700 SYSTEM # 4 5654528 6281215 306M 0700 CACHEFS # 5 1460224 5654527 2048M 0700 DATAFS # 6 3072 6143 1536K 0700 CSPSA FS # 7 8192 28671 10.0M 0700 EFS # 8 7038976 15251455 4010M 0700 UMS # 9 6281216 6936575 320M 0700 HIDDEN # 10 1024 3071 1024K 0700 PIT # 11 6936576 7038975 50.0M 0700 Fota # 12 104448 108543 2048K 0700 IPL Modem # 13 108544 141311 16.0M 0700 Modem # 14 63488 67583 2048K 0700 SBL # 15 141312 174079 16.0M 0700 Kernel # 16 67584 71679 2048K 0700 SBL_2 # 17 174080 206847 16.0M 0700 Kernel2 # # Number Start (sector) End (sector) Size Code Name # 10 1024 3071 1024K 0700 PIT # 6 3072 6143 1536K 0700 CSPSA FS # 7 8192 28671 10.0M 0700 EFS # 2 28672 61439 16.0M 0700 Modem FS # 14 63488 67583 2048K 0700 SBL # 16 67584 71679 2048K 0700 SBL_2 # 1 71680 104447 16.0M 0700 PARAM # 12 104448 108543 2048K 0700 IPL Modem # 13 108544 141311 16.0M 0700 Modem # 15 141312 174079 16.0M 0700 Kernel # 17 174080 206847 16.0M 0700 Kernel2 # 3 206848 1460223 612M 0700 SYSTEM # 5 1460224 5654527 2048M 0700 DATAFS # 4 5654528 6281215 306M 0700 CACHEFS # 9 6281216 6936575 320M 0700 HIDDEN # 11 6936576 7038975 50.0M 0700 Fota # 8 7038976 15251455 4010M 0700 UMS device_makeFlashizeEnv="env/arm.zip" device_makeFilenameConfig="system=1G-data=3G-cache=32M+wipe-preload=min+wipe-fota=min+wipe+ext4-sdcard=max" device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:janice:*) ;; *:i9070:*) ;; *:GT-I9070:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/sdi2/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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the crypto footer size: local footerSize=$(( 16384 / sectorSize )) # the set of partitions that can be modified by REPIT: # initPartition 3 SYSTEM system "same keep ext4" 0 initPartition 5 DATAFS data "same keep ext4" $footerSize initPartition 4 CACHEFS cache "same keep ext4" 0 initPartition 9 HIDDEN preload "same keep ext4" 0 initPartition 11 Fota fota "same keep raw" 0 initPartition 8 UMS sdcard "same keep vfat" 0 # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="3 5 4 9 11 8" } device_setup() { # the number of partitions that the device must have: partitionCount=17 # the set of defined heaps: allHeaps="main" # the partition data move chunk size (must fit in memory): moveDataChunkSize=$(( 128 * MiB )) # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: detectBlockDeviceHeapRange # the size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: heapAlignment=$(( 1 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="3 5 4 9 11 8" # the disk area (as a sector range) to use for the heap partitions: heapStart=$(parOldEnd 17) # one past the end of a specific partition heapEnd=$deviceHeapEnd # one past the last usable sector of the device } ================================================ FILE: device/nexus-7-2013/common.sh ================================================ ##################################################### # Lanchon REPIT - Device Handler # # Copyright 2019, Lanchon # ##################################################### ##################################################### # Lanchon REPIT is free software licensed under # # the GNU General Public License (GPL) version 3 # # and any later version. # ##################################################### ### nexus-7-2013 # Disk /dev/block/mmcblk0: 61079552 sectors, 29.1 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 # Partition table holds up to 32 entries # First usable sector is 34, last usable sector is 61079518 # Total free space is 1526010 sectors (745.1 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 131072 306143 85.5 MiB 0700 radio # 2 393216 399359 3.0 MiB FFFF modemst1 # 3 399360 405503 3.0 MiB FFFF modemst2 # 4 524288 554287 14.6 MiB 8300 persist # 5 655360 656919 780.0 KiB FFFF m9kefs1 # 6 656920 658479 780.0 KiB FFFF m9kefs2 # 7 786432 787991 780.0 KiB FFFF m9kefs3 # 8 787992 794135 3.0 MiB FFFF fsg # 9 917504 920503 1.5 MiB FFFF sbl1 # 10 920504 923503 1.5 MiB FFFF sbl2 # 11 923504 927599 2.0 MiB FFFF sbl3 # 12 927600 937839 5.0 MiB FFFF aboot # 13 937840 938863 512.0 KiB FFFF rpm # 14 1048576 1081343 16.0 MiB FFFF boot # 15 1179648 1180671 512.0 KiB FFFF tz # 16 1180672 1180673 1024 bytes FFFF pad # 17 1180674 1183673 1.5 MiB FFFF sbl2b # 18 1183674 1187769 2.0 MiB FFFF sbl3b # 19 1187770 1198009 5.0 MiB FFFF abootb # 20 1198010 1199033 512.0 KiB FFFF rpmb # 21 1199034 1200057 512.0 KiB FFFF tzb # 22 1310720 3031039 840.0 MiB 8300 system # 23 3031040 4177919 560.0 MiB 8300 cache # 24 4194304 4196351 1024.0 KiB FFFF misc # 25 4325376 4345855 10.0 MiB FFFF recovery # 26 4456448 4456463 8.0 KiB FFFF DDR # 27 4456464 4456479 8.0 KiB FFFF ssd # 28 4456480 4456481 1024 bytes FFFF m9kefsc # 29 4587520 4587583 32.0 KiB FFFF metadata # 30 4718592 61079518 26.9 GiB 8300 userdata device_makeFlashizeEnv="env/arm.zip" device_makeFilenameConfig="system=max-cache=32M+wipe" device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/platform/msm_sdcc.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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the crypto footer size: local footerSize=$(( 16384 / sectorSize )) # the set of partitions that can be modified by REPIT: # initPartition 22 system system "same keep ext4" 0 initPartition 23 cache cache "same keep ext4" 0 # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="$(seq 22 23)" } device_setup() { # the number of partitions that the device must have: partitionCount=30 # 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 size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: heapAlignment=$(( 4 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="$(seq 22 23)" # the disk area (as a sector range) to use for the heap partitions: heapStart=1310720 heapEnd=4194304 } ================================================ FILE: device/nexus-7-2013/deb.sh ================================================ ##################################################### # Lanchon REPIT - Device Handler # # Copyright 2019, Lanchon # ##################################################### ##################################################### # Lanchon REPIT is free software licensed under # # the GNU General Public License (GPL) version 3 # # and any later version. # ##################################################### ### deb # This port was possible thanks to the invaluable help of ipdev99 and xxhoeckyxx. device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:deb:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device/nexus-7-2013/flo.sh ================================================ ##################################################### # Lanchon REPIT - Device Handler # # Copyright 2019, Lanchon # ##################################################### ##################################################### # Lanchon REPIT is free software licensed under # # the GNU General Public License (GPL) version 3 # # and any later version. # ##################################################### ### flo # This port was possible thanks to the invaluable help of ipdev99 and xxhoeckyxx. device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:flo:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device/nook-hd/common.sh ================================================ ##################################################### # 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. # ##################################################### ### nook-hd # Logical sector size: 512 bytes # # Number Start (sector) End (sector) Size Code Name # 1 256 511 128.0 KiB 8300 xloader # 2 512 1023 256.0 KiB 8300 bootloader # 3 1024 31743 15.0 MiB 8300 recovery # 4 32768 65535 16.0 MiB 8300 boot # 5 65536 163839 48.0 MiB 8300 rom # 6 163840 262143 48.0 MiB 8300 bootdata # 7 262144 1179647 448.0 MiB 8300 factory # 8 1179648 2555903 672.0 MiB 8300 system # 9 2555904 3506175 464.0 MiB 8300 cache # 10 3506176 30507007 12.9 GiB 8300 userdata device_makeFlashizeEnv="env/arm.zip" #device_makeFilenameConfig="factory=same-system=1104M-cache=32M+wipe-data=same" device_makeFilenameConfig="factory=same-system=1G-cache=112M+wipe-data=same" #device_makeFilenameConfig="factory=32M-system=1G-cache=32M+wipe-data=max" device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:ovation:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the crypto footer size: local footerSize=$(( 16384 / sectorSize )) # the set of partitions that can be modified by REPIT: # initPartition 7 factory factory "same keep ext4" 0 initPartition 8 system system "same keep ext4" 0 initPartition 9 cache cache "same keep ext4" 0 initPartition 10 userdata data "same keep ext4" $footerSize # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="$(seq 7 10)" } device_setup() { # the number of partitions that the device must have: partitionCount=10 # 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 size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: heapAlignment=$(( 4 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="$(seq 7 10)" # the disk area (as a sector range) to use for the heap partitions: heapStart=$(parOldEnd 6) # one past the end of a specific partition heapEnd=$deviceHeapEnd # one past the last usable sector of the device } ================================================ FILE: device/nook-hd/hummingbird.sh ================================================ ##################################################### # 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. # ##################################################### ### hummingbird # This port was possible thanks to the invaluable help of BultoPaco. # Caution: invalid backup GPT header, but valid main header; regenerating # backup header from main header. # # Warning! Main and backup partition tables differ! Use the 'c' and 'e' options # on the recovery & transformation menu to examine the two tables. # # Warning! One or more CRCs don't match. You should repair the disk! # # **************************************************************************** # Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk # verification and recovery are STRONGLY recommended. # **************************************************************************** # Disk /dev/block/mmcblk0: 31129600 sectors, 14.8 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 4F417C26-4505-4832-9F38-0F1A75E87AFC # Partition table holds up to 128 entries # First usable sector is 34, last usable sector is 31129566 # Total free space is 623805 sectors (304.6 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 256 511 128.0 KiB 8300 xloader # 2 512 1023 256.0 KiB 8300 bootloader # 3 1024 31743 15.0 MiB 8300 recovery # 4 32768 65535 16.0 MiB 8300 boot # 5 65536 163839 48.0 MiB 8300 rom # 6 163840 262143 48.0 MiB 8300 bootdata # 7 262144 1179647 448.0 MiB 8300 factory # 8 1179648 2555903 672.0 MiB 8300 system # 9 2555904 3506175 464.0 MiB 8300 cache # 10 3506176 30507007 12.9 GiB 8300 userdata device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:hummingbird:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device/nook-hd/ovation.sh ================================================ ##################################################### # 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. # ##################################################### ### ovation # This port was possible thanks to the invaluable help of 149113. # Caution: invalid backup GPT header, but valid main header; regenerating # backup header from main header. # # Warning! Main and backup partition tables differ! Use the 'c' and 'e' options # on the recovery & transformation menu to examine the two tables. # # Warning! One or more CRCs don't match. You should repair the disk! # # **************************************************************************** # Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk # verification and recovery are STRONGLY recommended. # **************************************************************************** # Disk /dev/block/mmcblk0: 30535680 sectors, 14.6 GiB # Logical sector size: 512 bytes # Disk identifier (GUID): 3290B191-5EED-4A94-BFD4-0ECCA08BCEF4 # Partition table holds up to 128 entries # First usable sector is 34, last usable sector is 30535646 # Total free space is 29885 sectors (14.6 MiB) # # Number Start (sector) End (sector) Size Code Name # 1 256 511 128.0 KiB 8300 xloader # 2 512 1023 256.0 KiB 8300 bootloader # 3 1024 31743 15.0 MiB 8300 recovery # 4 32768 65535 16.0 MiB 8300 boot # 5 65536 163839 48.0 MiB 8300 rom # 6 163840 262143 48.0 MiB 8300 bootdata # 7 262144 1179647 448.0 MiB 8300 factory # 8 1179648 2555903 672.0 MiB 8300 system # 9 2555904 3506175 464.0 MiB 8300 cache # 10 3506176 30507007 12.9 GiB 8300 userdata device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:ovation:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device/tuna/common.sh ================================================ ##################################################### # 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. # ##################################################### ### tuna # This port was possible thanks to the invaluable help of thagringo. # Disk /dev/block/mmcblk0: 30777344 sectors, 2740M # Logical sector size: 512 # Disk identifier (GUID): 52444e41-494f-2044-4d4d-43204449534b # Partition table holds up to 128 entries # First usable sector is 34, last usable sector is 30777310 # # Number Start (sector) End (sector) Size Code Name # 1 256 511 128K 0700 xloader # 2 1024 8191 3584K 0700 sbl # 3 8192 49151 20.0M 0700 efs # 4 49152 65535 8192K 0700 param # 5 65536 73727 4096K 0700 misc # 6 73728 81919 4096K 0700 dgs # 7 81920 98303 8192K 0700 boot # 8 98304 122751 11.9M 0700 recovery # * 13 122752 122879 65536 0700 metadata # 9 122880 155647 16.0M 0700 radio # 10 155648 1495039 654M 0700 system # 11 1495040 2379775 432M 0700 cache # 12 2379776 30777309 13.5G 0700 userdata device_makeFlashizeEnv="env/arm.zip" device_makeFilenameConfig="system=1G-cache=62M+wipe-data=same" device_init() { device_checkDevice # the block device on which REPIT will operate (only one device is supported): #sdev=/sys/devices/platform/omap/omap_hsmmc.0/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: #unmountPattern="${dpar}[0-9]\+" unmountPattern="/dev/block/mmcblk[^ ]*" } device_initPartitions() { # the set of partitions that can be modified by REPIT: # initPartition 10 system system "same keep ext4" 0 initPartition 11 cache cache "same keep ext4" 0 initPartition 12 userdata data "same keep ext4" 0 # the set of modifiable partitions that can be configured by the user (overriding ): configurablePartitions="$(seq 10 12)" } device_setup() { # the number of partitions that the device must have: partitionCount=13 # 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 size of partitions configured with the 'min' keyword: #heapMinSize=$(( 8 * MiB )) # the partition alignment: heapAlignment=$(( 1 * MiB )) } device_setupHeap_main() { # the set of contiguous partitions that form this heap, in order of ascending partition start address: heapPartitions="$(seq 10 12)" # the disk area (as a sector range) to use for the heap partitions: heapStart=$(parOldEnd 9) # one past the end of a specific partition heapEnd=$deviceHeapEnd # one past the last usable sector of the device } ================================================ FILE: device/tuna/maguro.sh ================================================ ##################################################### # 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. # ##################################################### ### maguro # This port was possible thanks to the invaluable help of thagringo. device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:maguro:*) ;; *:tuna:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device/tuna/toro.sh ================================================ ##################################################### # 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. # ##################################################### ### toro # This port was possible thanks to the invaluable help of thagringo and musical_chairs. device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:toro:*) ;; *:tuna:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device/tuna/toroplus.sh ================================================ ##################################################### # 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. # ##################################################### ### toroplus # This port was possible thanks to the invaluable help of thagringo and musical_chairs. device_checkDevice() { checkTool getprop case ":$(getprop ro.product.device):$(getprop ro.build.product):" in *:toroplus:*) ;; *:tuna:*) ;; *) fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" ;; esac } ================================================ FILE: device-dump/.gitignore ================================================ /repit-dump.log /repit-dump-out.txt /dumps ================================================ FILE: device-dump/README.md ================================================ #### How To Dump Your Device To Request A New Port - get a recent TWRP running on your device. - copy '[repit-dump.zip] (https://github.com/Lanchon/REPIT/raw/master/device-dump/repit-dump.zip)' to your device and flash it. - pull to your PC a file called 'repit-dump.log' that was generated in the same folder that holds 'repit-dump.zip'. - go [here] (https://github.com/Lanchon/REPIT/issues/new) and create a new issue: - attach the pulled 'repit-dump.log' file. - add the following information: - your exact device and device codename. - your recovery (version? official? if not where did you get it?). - your kernel. - your rom. - is your device running the stock partition layout or is it already modified? #### How To Dump Via Sideload - adb sideload repit-dump.zip - adb pull /tmp/repit-dump.log **thank you!** ================================================ FILE: device-dump/dump.sh ================================================ #!/sbin/sh ##################################################### # Lanchon REPIT # # Copyright 2016, Lanchon # ##################################################### ##################################################### # Lanchon REPIT is free software licensed under # # the GNU General Public License (GPL) version 3 # # and any later version. # ##################################################### run() { echo "==========================================================================================================" echo "$@" echo "----------------------------------------------------------------------------------------------------------" "$@" local code=$? echo return $code } run getprop ro.product.device run grep ro.product.device default.prop run getprop ro.build.product run grep ro.build.product default.prop checkTool() { echo "$1:" echo " $(which "$1")" } checkTools() { checkTool parted checkTool sort checkTool blockdev checkTool sed checkTool awk checkTool readlink checkTool basename checkTool dirname checkTool dd checkTool fdisk checkTool gdisk checkTool sfdisk checkTool sgdisk #checkTools_fs_ext4 #checkTools_fs_vfat #checkTools_fs_raw } checkTools_fs_ext4() { checkTool mke2fs checkTool e2fsck checkTool resize2fs } checkTools_fs_vfat() { checkTool mkdosfs checkTool mkfs.fat checkTool dosfsck checkTool fsck.fat } checkTools_fs_f2fs() { checkTool mkfs.f2fs checkTool fsck.f2fs } checkTools_fs_swap() { checkTool mkswap } checkTools_fs_raw() { : } run checkTools run checkTools_fs_ext4 run checkTools_fs_vfat run checkTools_fs_f2fs run checkTools_fs_swap run checkTools_fs_raw run ls -l /sys/block/mmcblk0 run parted -s /dev/block/mmcblk0 unit MiB print free unit s print free run sgdisk /dev/block/mmcblk0 --set-alignment 1 --print run getprop run cat /default.prop run env run set run ls -lR /sbin run ls -l /dev/block run ls -l /sys/block for device in /dev/block/*; do run parted -s "$device" unit MiB print free unit s print free && run sgdisk "$device" --set-alignment 1 --print done run ls -lR /dev/block run ls -lR /sys/block #run ls -lR /dev #run ls -lR /sys ================================================ FILE: device-dump/make-zip ================================================ #!/bin/bash set -e unsignedZip="repit-dump-unsigned.zip" signedZip="repit-dump.zip" rm -f "$unsignedZip" rm -f "$signedZip" flashize-env dump.sh ../env/arm.zip "$unsignedZip" repit-dump.log signapk -w ../key/testkey.x509.pem ../key/testkey.pk8 "$unsignedZip" "$signedZip" #rm "$unsignedZip" ================================================ FILE: device-dump/run-dump ================================================ #!/bin/bash set -e echo "pushing to device..." adb push dump.sh /tmp/ echo echo "running..." adb shell sh /tmp/dump.sh >repit-dump.log ================================================ FILE: device-dump/run-dump.bat ================================================ @echo off echo pushing to device... adb push dump.sh /tmp/ echo. echo running... adb shell sh /tmp/dump.sh >repit-dump.log ================================================ FILE: key/testkey.x509.pem ================================================ -----BEGIN CERTIFICATE----- MIIEqDCCA5CgAwIBAgIJAJNurL4H8gHfMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4g VmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UE AxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAe Fw0wODAyMjkwMTMzNDZaFw0zNTA3MTcwMTMzNDZaMIGUMQswCQYDVQQGEwJVUzET MBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4G A1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9p ZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZI hvcNAQEBBQADggENADCCAQgCggEBANaTGQTexgskse3HYuDZ2CU+Ps1s6x3i/waM qOi8qM1r03hupwqnbOYOuw+ZNVn/2T53qUPn6D1LZLjk/qLT5lbx4meoG7+yMLV4 wgRDvkxyGLhG9SEVhvA4oU6Jwr44f46+z4/Kw9oe4zDJ6pPQp8PcSvNQIg1QCAcy 4ICXF+5qBTNZ5qaU7Cyz8oSgpGbIepTYOzEJOmc3Li9kEsBubULxWBjf/gOBzAzU RNps3cO4JFgZSAGzJWQTT7/emMkod0jb9WdqVA2BVMi7yge54kdVMxHEa5r3b97s zI5p58ii0I54JiCUP5lyfTwE/nKZHZnfm644oLIXf6MdW2r+6R8CAQOjgfwwgfkw HQYDVR0OBBYEFEhZAFY9JyxGrhGGBaR0GawJyowRMIHJBgNVHSMEgcEwgb6AFEhZ AFY9JyxGrhGGBaR0GawJyowRoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UE CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMH QW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAG CSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJAJNurL4H8gHfMAwGA1Ud EwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAHqvlozrUMRBBVEY0NqrrwFbinZa J6cVosK0TyIUFf/azgMJWr+kLfcHCHJsIGnlw27drgQAvilFLAhLwn62oX6snb4Y LCBOsVMR9FXYJLZW2+TcIkCRLXWG/oiVHQGo/rWuWkJgU134NDEFJCJGjDbiLCpe +ZTWHdcwauTJ9pUbo8EvHRkU3cYfGmLaLfgn9gP+pWA7LFQNvXwBnDa6sppCccEX 31I828XzgXpJ4O+mDL1/dBd+ek8ZPUP0IgdyZm5MTYPhvVqGCHzzTy3sIeJFymwr sBbmg2OAUNLEMO6nwmocSdN2ClirfxqCzJOLSDE4QyS9BAH6EhY6UFcOaE0= -----END CERTIFICATE----- ================================================ FILE: make ================================================ #!/bin/bash set -e makeZip() { local device="$1" echo "device: $device" script="build/lanchon-repit-$device.sh" ./make-script "$device" "$script" makeFlashizeEnv="$(sed -n "s/^device_makeFlashizeEnv=\"\(.*\)\"$/\1/p" "$script")" if [ -z "$makeFlashizeEnv" ]; then >&2 echo "error: value not found: 'device_makeFlashizeEnv'" exit 1 fi makeFilenameConfig="$(sed -n "s/^device_makeFilenameConfig=\"\(.*\)\"$/\1/p" "$script")" if [ -z "$makeFilenameConfig" ]; then >&2 echo "error: value not found: 'device_makeFilenameConfig'" exit 1 fi unsignedZip="build/lanchon-repit-unsigned-$device.zip" signedZip="build/lanchon-repit-$versionShort-$makeFilenameConfig-$device.zip" flashize-env "$script" "$makeFlashizeEnv" "$unsignedZip" /tmp/lanchon-repit.log signapk -w key/testkey.x509.pem key/testkey.pk8 "$unsignedZip" "$signedZip" #rm "$script" rm "$unsignedZip" } makeOne() { local device="$1" rm -f build/lanchon-repit*-"$device".* makeZip "$device" } makeAll() { rm -f build/lanchon-repit* local f for file in $(find device -type f -not -path '*/\.*' -name "*.sh"); do local device="$(basename "$file" .sh)" if [ "$device" != "common" ]; then makeZip "$device" fi done } make() { versionLong="$(sed -n "s/^version=\"\(.*\)\"$/\1/p" repit.sh)" if [ -z "$versionLong" ]; then >&2 echo "error: value not found: 'version'" exit 1 fi versionShort="$(echo "$versionLong" | sed "s/-//g")" echo "version: $versionLong" mkdir -p build if [ $# -eq 0 ]; then makeAll else while [ $# -ne 0 ]; do makeOne "$1" shift done fi } make "$@" ================================================ FILE: make-script ================================================ #!/bin/bash set -e catCommonScripts() { local dir="$(dirname "$1")" if [ "$dir" != "." ]; then catCommonScripts "$dir" local commonScript="$dir/common.sh" if [ -f "$commonScript" ]; then >>"$out" cat "$commonScript" >>"$out" echo fi fi } makeScript() { device="$1" out="${2:-build/lanchon-repit-$device.sh}" deviceScript="$(find device -name "$device.sh")" if [ "$device" == "common" ] || [ ! -f "$deviceScript" ]; then >&2 echo "error: invalid device: '$device'" exit 1 fi rm -f "$out" >>"$out" cat repit.sh >>"$out" echo >>"$out" cat repit-par-tools.sh >>"$out" echo >>"$out" cat repit-fs-ext4.sh >>"$out" echo >>"$out" cat repit-fs-vfat.sh >>"$out" echo >>"$out" cat repit-fs-f2fs.sh >>"$out" echo >>"$out" cat repit-fs-swap.sh >>"$out" echo >>"$out" cat repit-fs-raw.sh >>"$out" echo catCommonScripts "$deviceScript" >>"$out" cat "$deviceScript" >>"$out" echo >>"$out" echo "#####################################################" >>"$out" echo >>"$out" printf 'deviceName=%q\n' "$device" >>"$out" echo >>"$out" echo 'main "$@"' } makeScript "$@" ================================================ FILE: repit-fs-ext4.sh ================================================ ##################################################### # Lanchon REPIT - File System Handler # # Copyright 2016, Lanchon # ##################################################### ##################################################### # Lanchon REPIT is free software licensed under # # the GNU General Public License (GPL) version 3 # # and any later version. # ##################################################### ### ext4 checkTools_fs_ext4() { # only require tools if actually needed #checkTool mke2fs #checkTool e2fsck #checkTool resize2fs : } processPar_ext4_wipe_dry() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 info "will format the partition in ext4 and trim it" checkTool mke2fs } processPar_ext4_wipe_wet() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 local footerSize=$(parFooterSize $n) local newFsSize=$(( newSize - footerSize )) processParRecreate $n $oldStart $oldSize $newStart $newSize processParWipeCryptoFooter $n $newStart $newSize $footerSize info "formatting the partition in ext4 and trimming it" mke2fs -q -t ext4 -E discard $dev ${newFsSize}s } checkFs_ext4() { local n=$1 local dev=$2 info "checking and trimming the file system" (set +e; e2fsck -fp -E discard $dev) case "$?" in 0) ;; 1) info "file system errors in $(parName $n) were fixed" ;; 2|3) info "file system errors in $(parName $n) were fixed, but a reboot is needed before continuing" fatal "reboot needed: please reboot and retry the process to continue" ;; *) fatal "file system errors in $(parName $n) could not be automatically fixed (try running 'e2fsck -f $dev')" ;; esac } checkParSize_ext4() { local n=$1 local dev=$2 local oldSize=$3 local newSize=$4 local footerSize=$(parFooterSize $n) local newFsSize=$(( newSize - footerSize )) #if [ $(( newSize < oldSize )) -ne 0 ]; then #if [ $(( newFsSize < oldSize )) -ne 0 ]; then if true; then info "validating the new partition size" local blockSize=$(tune2fs -l $dev 2>/dev/null | sed -n "s/^Block size:[ ]*\([0-9]*\)[ ]*$/\1/p") if [ -n "$blockSize" ]; then #info "file system block size: $blockSize bytes" local minBlocks=$(resize2fs -P $dev 2>/dev/null | sed -n "s/^Estimated minimum size of the filesystem:[ ]*\([0-9]*\)[ ]*$/\1/p") if [ -n "$minBlocks" ]; then local minSize=$(( ( blockSize / sectorSize ) * minBlocks )) info "estimated minimum file system size: $(printSizeMiB $minSize)" local newFsFree=$(( newFsSize - minSize )) if [ $(( newFsFree >= 0 )) -ne 0 ]; then info "estimated free space after resize: $(printSizeMiB $newFsFree)" else fatal "the new partition size is estimated to be too small to hold the current contents of the file system by $(printSizeMiB $(( -newFsFree )) )" fi else warning "partition size validation skipped: cannot estimate the minimum file system size" fi else warning "partition size validation skipped: cannot determine the file system block size" fi fi } processPar_ext4_keep_dry() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 if [ $(( newStart != oldStart )) -ne 0 ]; then info "will move the ext4 partition" warning "moving a big ext4 partition can take a very long time; it requires copying the complete partition, including its free space" fi if [ $(( newSize != oldSize )) -ne 0 ]; then info "will resize the ext4 partition" #checkTool resize2fs fi if [ $(( newSize == oldSize )) -ne 0 ]; then info "will resize the ext4 file system if needed to fit its partition" #checkTool resize2fs fi checkTool e2fsck checkTool resize2fs checkFs_ext4 $n $dev checkParSize_ext4 $n $dev $oldSize $newSize } processPar_ext4_keep_wet() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 local footerSize=$(parFooterSize $n) local newFsSize=$(( newSize - footerSize )) # note: REPIT should not be able to start on encrypted phones due to the block device being locked. local moveSize=$oldSize if [ $(( newSize < oldSize )) -ne 0 ]; then info "shrinking the ext4 file system" resize2fs -f $dev ${newFsSize}s info "shrinking the partition entry" processParRecreate $n $oldStart $oldSize $oldStart $newSize processParWipeCryptoFooter $n $oldStart $newSize $footerSize checkFs_ext4 $n $dev moveSize=$newSize fi if [ $(( newStart != oldStart )) -ne 0 ]; then info "moving the ext4 partition" processParMove $n $oldStart $newStart $moveSize checkFs_ext4 $n $dev fi if [ $(( newSize > oldSize )) -ne 0 ]; then info "enlarging the partition entry" processParRecreate $n $newStart $oldSize $newStart $newSize processParWipeCryptoFooter $n $newStart $newSize $footerSize info "enlarging the ext4 file system" resize2fs -f $dev ${newFsSize}s checkFs_ext4 $n $dev fi if [ $(( newSize == oldSize )) -ne 0 ]; then info "resizing the ext4 file system if needed to fit its partition" resize2fs -f $dev ${newFsSize}s checkFs_ext4 $n $dev fi } ================================================ FILE: repit-fs-f2fs.sh ================================================ ##################################################### # Lanchon REPIT - File System Handler # # Copyright 2016, Lanchon # ##################################################### ##################################################### # Lanchon REPIT is free software licensed under # # the GNU General Public License (GPL) version 3 # # and any later version. # ##################################################### ### f2fs checkTools_fs_f2fs() { # only require tools if actually needed #checkTool mkfs.f2fs #checkTool fsck.f2fs : } processPar_f2fs_wipe_dry() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 info "will format the partition in f2fs and trim it" checkTool mkfs.f2fs } processPar_f2fs_wipe_wet() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 local footerSize=$(parFooterSize $n) local newFsSize=$(( newSize - footerSize )) processParRecreate $n $oldStart $oldSize $newStart $newSize processParWipeCryptoFooter $n $newStart $newSize $footerSize info "formatting the partition in f2fs and trimming it" mkfs.f2fs -t 1 $dev ${newFsSize} } checkFs_f2fs() { local n=$1 local dev=$2 if [ -z "$(which fsck.f2fs)" ]; then warning "skipping file system check (tool 'fsck.f2fs' is not available)" else info "checking the file system" if ! fsck.f2fs -f $dev; then fatal "file system errors in $(parName $n) could not be fixed" fi fi } processPar_f2fs_keep_dry() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 if [ $(( newSize != oldSize )) -ne 0 ]; then fatal "cannot resize f2fs partitions" fi if [ $(( newStart != oldStart )) -ne 0 ]; then info "will move the f2fs partition" warning "moving a big f2fs partition can take a very long time; it requires copying the complete partition, including its free space" fi #checkTool fsck.f2fs checkFs_f2fs $n $dev } processPar_f2fs_keep_wet() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 if [ $(( newSize != oldSize )) -ne 0 ]; then fatal "assertion failed: cannot resize f2fs partitions" fi if [ $(( newStart != oldStart )) -ne 0 ]; then info "moving the f2fs partition" processParMove $n $oldStart $newStart $oldSize checkFs_f2fs $n $dev fi } ================================================ FILE: repit-fs-raw.sh ================================================ ##################################################### # Lanchon REPIT - File System Handler # # Copyright 2016, Lanchon # ##################################################### ##################################################### # Lanchon REPIT is free software licensed under # # the GNU General Public License (GPL) version 3 # # and any later version. # ##################################################### ### raw checkTools_fs_raw() { # only require tools if actually needed : } processPar_raw_wipe_dry() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 fatal "cannot wipe raw partitions" } processPar_raw_keep_dry() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 if [ $(( newSize != oldSize )) -ne 0 ]; then fatal "cannot resize raw partitions" fi if [ $(( newStart != oldStart )) -ne 0 ]; then info "will move the raw partition" fi } processPar_raw_keep_wet() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 if [ $(( newSize != oldSize )) -ne 0 ]; then fatal "assertion failed: cannot resize raw partitions" fi if [ $(( newStart != oldStart )) -ne 0 ]; then info "moving the raw partition" processParMove $n $oldStart $newStart $oldSize fi } ================================================ FILE: repit-fs-swap.sh ================================================ ##################################################### # Lanchon REPIT - File System Handler # # Copyright 2016, Lanchon # ##################################################### ##################################################### # Lanchon REPIT is free software licensed under # # the GNU General Public License (GPL) version 3 # # and any later version. # ##################################################### ### swap checkTools_fs_swap() { # only require tools if actually needed #checkTool mkswap : } processPar_swap_wipe_dry() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 info "will format the partition as swap area" checkTool mkswap } processPar_swap_wipe_wet() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 processParRecreate $n $oldStart $oldSize $newStart $newSize info "formatting the partition as swap area" mkswap $dev } processPar_swap_keep_dry() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 if [ $(( newStart != oldStart || newSize != oldSize )) -ne 0 ]; then fatal "cannot move or resize swap partitions "\ "(it makes no sense, please wipe the partition instead; note that you can still move the contents of any partition by using the 'raw' type)" fi } processPar_swap_keep_wet() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 if [ $(( newStart != oldStart || newSize != oldSize )) -ne 0 ]; then fatal "assertion failed: cannot move or resize swap partitions" fi } ================================================ FILE: repit-fs-vfat.sh ================================================ ##################################################### # Lanchon REPIT - File System Handler # # Copyright 2016, Lanchon # ##################################################### ##################################################### # Lanchon REPIT is free software licensed under # # the GNU General Public License (GPL) version 3 # # and any later version. # ##################################################### ### vfat checkTools_fs_vfat() { # only require tools if actually needed #mkfs_vfat=$(chooseTool mkdosfs mkfs.fat) #fsck_vfat=$(chooseTool dosfsck fsck.fat) : } processPar_vfat_wipe_dry() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 info "will format the partition in vfat" mkfs_vfat=$(chooseTool mkdosfs mkfs.fat) } processPar_vfat_wipe_wet() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 processParRecreate $n $oldStart $oldSize $newStart $newSize info "formatting the partition in vfat" $mkfs_vfat -I $dev } checkFs_vfat() { local n=$1 local dev=$2 info "checking the file system" # the -w flag is used here to bound memory use if ! $fsck_vfat -pw $dev; then info "errors detected, retrying the file system check" if ! $fsck_vfat -pw $dev; then fatal "file system errors in $(parName $n) could not be fixed" fi fi } processPar_vfat_keep_dry() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 if [ $(( newStart != oldStart || newSize != oldSize )) -ne 0 ]; then info "will move/resize the vfat partition" fi fsck_vfat=$(chooseTool dosfsck fsck.fat) checkFs_vfat $@ } processPar_vfat_keep_wet() { local n=$1 local dev=$2 local oldStart=$3 local oldSize=$4 local newStart=$5 local newSize=$6 if [ $(( newStart != oldStart || newSize != oldSize )) -ne 0 ]; then info "moving/resizing the vfat partition" info "note that the error 'unable to satisfy all constraints on the partition' usually means "\ "that the new desired partition size would be too small to hold the files already stored in the partition." runParted resize $n $newStart $(( newStart + newSize - 1 )) rereadParTable checkFs_vfat $@ fi } ================================================ FILE: repit-par-tools.sh ================================================ ##################################################### # Lanchon REPIT - Generic Partition Tools # # Copyright 2016, Lanchon # ##################################################### ##################################################### # Lanchon REPIT is free software licensed under # # the GNU General Public License (GPL) version 3 # # and any later version. # ##################################################### ### recreate partition processParRecreate() { local n=$1 local oldStart=$2 local oldSize=$3 local newStart=$4 local newSize=$5 if [ $(( newStart != oldStart || newSize != oldSize )) -ne 0 ]; then info "deleting current partition" runParted rm $n info "creating new partition" if ! runParted mkpart primary $newStart $(( newStart + newSize - 1 )); then info "attempting to restore previous partition" runParted mkpart primary $oldStart $(( oldStart + oldSize - 1 )) info "naming the partition" runParted name $n $(parGet $n pname) rereadParTable fatal "unable to create new partition (previous partition was successfully restored)" fi info "naming the partition" runParted name $n $(parGet $n pname) rereadParTable fi } processParWipeCryptoFooter() { local n=$1 local start=$2 local size=$3 local footerSize=$4 if [ $(( footerSize != 0 )) -ne 0 ]; then local footerStart=$(( start + size - footerSize )) info "creating a temporary partition to wipe the crypto footer due to dd's 4 GiB wraparound bug" processParRecreate $n $start $size $footerStart $footerSize info "wiping the crypto footer" dd if=/dev/zero of=${dpar}$n bs=$sectorSize count=$footerSize conv=noerror,sync info "recreating the original partition" processParRecreate $n 0 0 $start $size fi } ### move partition moveDataChunk() { local n=$1 local oldStart=$2 local newStart=$3 local size=$4 echo "----- moving $(printSizeMiB $size) chunk: $(printSizeMiB $oldStart) -> $(printSizeMiB $newStart)" # WARNING: dd has a dangerous 4 GiB wraparound bug!!! #dd if=$ddev of=$tchunk bs=$sectorSize skip=$oldStart count=$size conv=noerror,sync #dd if=$tchunk of=$ddev bs=$sectorSize seek=$newStart count=$size conv=noerror,sync info "creating a temporary partition to read chunk at device offset $(printSizeMiB $oldStart)" runParted mkpart primary $oldStart $(( oldStart + size - 1 )) rereadParTable info "reading data" dd if=${dpar}$n of=$tchunk bs=$sectorSize conv=noerror,sync info "deleting the temporary partition" runParted rm $n info "creating a temporary partition to write chunk at device offset $(printSizeMiB $newStart)" runParted mkpart primary $newStart $(( newStart + size - 1 )) rereadParTable info "writing data" dd if=$tchunk of=${dpar}$n bs=$sectorSize conv=noerror,sync info "deleting the temporary partition" runParted rm $n #rereadParTable rm -f $tchunk echo } moveData() { local pn=$1 local oldStart=$2 local newStart=$3 local size=$4 local chunk=$moveDataChunkSize local n local m if [ $(( newStart < oldStart )) -ne 0 ]; then info "moving data towards the beginning of the disk" echo m=0 for n in $(seq -- 0 $chunk $(( size - chunk - 1 )) ); do moveDataChunk $pn $(( oldStart + n )) $(( newStart + n )) $chunk m=$(( n + chunk )) done moveDataChunk $pn $(( oldStart + m )) $(( newStart + m )) $(( size - m )) fi if [ $(( newStart > oldStart )) -ne 0 ]; then info "moving data towards the end of the disk" echo m=$size for n in $(seq -- $(( size - chunk )) $(( - chunk )) 1); do moveDataChunk $pn $(( oldStart + n )) $(( newStart + n )) $chunk m=$n done moveDataChunk $pn $oldStart $newStart $m fi } processParMove() { local n=$1 local oldStart=$2 local newStart=$3 local size=$4 if [ $(( newStart != oldStart )) -ne 0 ]; then #rereadParTable #echo "##### calculating MD5 hash of partition" #md5sum ${dpar}$n # this does not work (so we manually dd data around instead) #runParted move $n $newStart $(( newStart + size - 1 )) #rereadParTable info "ensure that the destination partition can be created before starting the move" processParRecreate $n $oldStart $size $newStart $size #info "deleting the partition to ensure no access to partially moved data if move is interrupted" info "deleting the partition to workaround dd's 4 GiB wraparound bug" runParted rm $n #rereadParTable moveData $n $oldStart $newStart $size #info "recreating the partition" info "creating the final partition" runParted mkpart primary $newStart $(( newStart + size - 1 )) info "naming the partition" runParted name $n $(parGet $n pname) rereadParTable ##rereadParTable #echo "##### calculating MD5 hash of partition" #md5sum ${dpar}$n fi } ================================================ FILE: repit.sh ================================================ #!/sbin/sh ##################################################### # Lanchon REPIT # # Copyright 2016, Lanchon # ##################################################### ##################################################### # Lanchon REPIT is free software licensed under # # the GNU General Public License (GPL) version 3 # # and any later version. # ##################################################### set -e version="2017-01-15" ### logging fatal() { echo >&2 echo "FATAL:" "$@" exit 1 } warning() { >&2 echo "WARNING:" "$@" } info() { echo "info:" "$@" } ### helpers printSizeMiB() { local size="$1" echo "$(( (size) / $MiB )) MiB" } checkTool() { #info "checking tool: $1" if [ -z "$(which "$1")" ]; then fatal "required tool '$1' missing (please use a recent version of TWRP to run this package)" fi } chooseTool() { #info "choosing tool: $*" local tool for tool in "$@"; do if [ -n "$(which "$tool")" ]; then echo "$tool" return fi done fatal "all tool alternatives missing: $* (please use a recent version of TWRP to run this package)" } runParted() { parted -s $ddev unit s "$@" } rereadParTable() { local hint="$1" info "rereading partition table" sync blockdev --flushbufs $ddev if ! blockdev --rereadpt $ddev; then fatal "unable to reread the partition table${hint}" fi sleep 1 } detectBlockDeviceHeapRange() { info "determining usable sector range of block device" checkTool sgdisk local out="$(sgdisk "$ddev" --set-alignment 1 --print)" deviceHeapStart=$(echo "$out" | sed -n "s/^First usable sector is[ ]*\([0-9]*\)[, ]*last usable sector is[ ]*\([0-9]*\)[ ]*$/\1/p") deviceHeapEnd=$(echo "$out" | sed -n "s/^First usable sector is[ ]*\([0-9]*\)[, ]*last usable sector is[ ]*\([0-9]*\)[ ]*$/\2/p") if [ -z "$deviceHeapStart" ] || [ -z "$deviceHeapEnd" ]; then warning "unable to parse sgdisk output (dump of output follows)" >&2 echo >&2 echo "$out" >&2 echo fatal "unable to determine usable sector range of block device" fi deviceHeapEnd=$(( deviceHeapEnd + 1 )) } alignDown() { echo $(( ($1) / heapAlignment * heapAlignment )) } alignUp() { echo $(( (($1) + (heapAlignment - 1)) / heapAlignment * heapAlignment )) } ### data store parOldStart() { cat ${spar}$1/start } parNewStart() { cat ${tpar}$1/start } parOldSize() { cat ${spar}$1/size } parNewSize() { cat ${tpar}$1/size } parFooterSize() { cat ${tpar}$1/footerSize } parNewSizeMinusFooter() { echo $(( $(parNewSize $1) - $(parFooterSize $1) )) } parNewSizeAligned() { cat ${tpar}$1/sizeAligned } parOldEnd() { echo $(( $(parOldStart $1) + $(parOldSize $1) )) } parNewEnd() { echo $(( $(parNewStart $1) + $(parNewSize $1) )) } parNewEndAligned() { echo $(( $(parNewStart $1) + $(parNewSizeAligned $1) )) } parGet() { cat ${tpar}$1/$2 } parSet() { echo -n "$3" >${tpar}$1/$2 } parName() { echo -n "partition #$1 '$(parGet $1 fname)' ($(parGet $1 pname))" } ### initialization detectSideload() { local packageName="$1" # /tmp/update.zip: old sideload protocol # /sideload/package.zip: current sideload-host protocol if [ "$1" == "/tmp/update.zip" ] || [ "$1" == "/sideload/package.zip" ]; then fatal "adb sideload is not directly supported: it hides the package filename and thus filename-based configuration does not work "\ "(please adb push the package to '/tmp' and run it from there; or adb sideload it after adding a 'flashize/settings' file to the package containing the desired package filename override)" fi } checkTools() { checkTool parted checkTool sort checkTool blockdev checkTool sed checkTool awk checkTool readlink checkTool basename checkTool dirname checkTool dd checkTools_fs_ext4 checkTools_fs_vfat checkTools_fs_f2fs checkTools_fs_swap checkTools_fs_raw } initPartitionConf() { local n=$1 local size=$2 local content=$3 local fs=$4 $(parSet $n parsedSize $size) $(parSet $n parsedContent $content) $(parSet $n parsedFs $fs) } initPartition() { local n=$1 local pname=$2 local fname=$3 local conf=$4 local footerSize=$5 mkdir -p ${tpar}$n $(parSet $n pname $pname) $(parSet $n fname $fname) initPartitionConf $n $conf $(parSet $n footerSize $footerSize) initedPartitions="$initedPartitions $n" } initPartitions() { rm -rf $tdir initedPartitions="" device_initPartitions } parsePartitionConfiguration() { local n=$1 local packageName="$2" local parName=$(parGet $n fname) local conf="$(echo -n "$packageName" | sed -n "s/.*-${parName}=\([^-=]*\)\(-.*\|\)\$/\1/p")" if [ -n "$conf" ]; then local regex="^\(\|[0-9]\+[GgMm]\|[0-9]\+[.][0-9]*[GgMm]\|[.][0-9]\+[GgMm]\|same\|min\|max\)\(+\(\|keep\|wipe\)\(+\(\|ext4\|vfat\|f2fs\|swap\|raw\)\)\?\)\?$" if [ -n "$(echo -n "$conf" | sed "s/$regex//")" ]; then fatal "invalid partition configuration for '$parName': $parName=$conf" fi local val val="$(echo -n "$conf" | sed -n "s/$regex/\1/p")" if [ -n "$val" ]; then $(parSet $n parsedSize "$val"); fi val="$(echo -n "$conf" | sed -n "s/$regex/\3/p")" if [ -n "$val" ]; then $(parSet $n parsedContent "$val"); fi val="$(echo -n "$conf" | sed -n "s/$regex/\5/p")" if [ -n "$val" ]; then $(parSet $n parsedFs "$val"); fi fi } parsePackageName() { local packageName="$1" local parNames="" local n for n in $configurablePartitions; do if [ -n "$parNames" ]; then parNames="$parNames|" fi parNames="$parNames$(parGet $n fname)" done info "valid package names: [-($parNames)=]..." info "valid partition values: [(G|M)|same|min|max][+[keep|wipe][+[ext4|vfat|f2fs|swap|raw]]]" echo echo "----- DEFAULTS -----" for n in $configurablePartitions; do #echo "-$(parGet $n fname)=$(parGet $n parsedSize)+$(parGet $n parsedContent)+$(parGet $n parsedFs)" echo "$(parGet $n fname) = size:$(parGet $n parsedSize) + content:$(parGet $n parsedContent) + fs:$(parGet $n parsedFs)" done echo info "parsing package name" if [ -z "$packageName" ]; then fatal "unable to retrieve package name" fi packageName="$(basename "$packageName" .zip)" for n in $configurablePartitions; do parsePartitionConfiguration $n $packageName done echo echo "----- CONFIGURATION -----" for n in $initedPartitions; do #echo "-$(parGet $n fname)=$(parGet $n parsedSize)+$(parGet $n parsedContent)+$(parGet $n parsedFs)" echo "$(parGet $n fname) = size:$(parGet $n parsedSize) + content:$(parGet $n parsedContent) + fs:$(parGet $n parsedFs)" done echo } disableSwap() { #info "checking tool: swapoff" if [ -n "$(which swapoff)" ]; then info "disabling swap" swapoff -a fi } checkUnmount() { local packageName="$1" if [ ! -e $ddev ] || [ ! -e $sdev ]; then fatal "block device not found" fi local hint if [ -f "$packageName" ]; then local resolvedPackageName resolvedPackageName="$(readlink -f "$packageName")" if [ -z "$resolvedPackageName" ]; then resolvedPackageName="$packageName" fi if [ "$(dirname "$resolvedPackageName")" != "/tmp" ]; then info "copying package to '/tmp'" cp -f "$packageName" "/tmp/" hint="this package copied itself to '/tmp'; please run it again from there" else hint=\ "please disable MTP in TWRP's 'Mount' menu (or disconnect from PC), reboot TWRP and run this package again; "\ "run it immediately after boot up, do not enable USB mass storage; "\ "note that you might be told to run it yet again from '/tmp'; "\ "make sure your phone is not encrypted: encrypted phones are not supported" fi else hint="please use TWRP's file manager to copy this package to '/tmp' and run it again from there" fi info "unmounting all partitions" local dev for dev in $(grep -ow "^$unmountPattern" /proc/mounts | sort -u); do if ! umount $dev; then fatal "unable to unmount all partitions ($hint)" fi done # rereadParTable requires everything unmounted rereadParTable " ($hint)" } init() { local packageName="$1" detectSideload "$packageName" tdir=/tmp/lanchon-repit tchunk=$tdir/chunk.tmp tpar=$tdir/partition-info/p device_init MiB=$(( 1024 * 1024 / sectorSize )) # 1 MiB in sectors GiB=$(( 1024 * 1024 * 1024 / sectorSize )) # 1 GiB in sectors checkTools initPartitions parsePackageName "$packageName" disableSwap checkUnmount "$packageName" } ### setup setup() { checkTool parted checkTool sort checkTool blockdev checkTool awk #info "unmounting all partitions" #... #rereadParTable heapMinSize=$(( 8 * MiB )) device_setup info "checking existing partitions" local n for n in $(seq 1 $partitionCount); do if [ ! -e ${spar}$n ]; then fatal "partition #$n: not found" fi if [ $(( $(parOldStart $n) < 0 )) -ne 0 ]; then fatal "partition #$n: invalid start" fi if [ $(( $(parOldSize $n) <= 0 )) -ne 0 ]; then fatal "partition #$n: invalid size" fi done for n in $(seq $(( partitionCount + 1 )) $(( partitionCount + 100 )) ); do if [ -e ${spar}$n ]; then fatal "partition #$n: unexpected" fi done } setupHeapExisting() { info "checking existing partition layout" # TODO: verify that no partitions that are not members of the heap step into the heap area. # TODO: maybe verify that all partitions that are members of the heap are fully contained in the heap area. local nPrev="" local gap local n for n in $heapPartitions; do info "current size: $(parName $n): $(printSizeMiB $(parOldSize $n))" if [ -z "$nPrev" ]; then gap=$(( $(parOldStart $n) - heapStart )) if [ $(( gap < 0 )) -ne 0 ]; then warning "$(parName $n) starts $(printSizeMiB $(( -(gap) )) ) before the start of heap '$heapName'" fi gap=$(( $(parOldStart $n) - heapStartAligned )) if [ $(( gap > 0 )) -ne 0 ]; then warning "$(parName $n) starts $(printSizeMiB $gap) after the aligned start of heap '$heapName'" fi else gap=$(( $(parOldStart $n) - $(parOldEnd $nPrev) )) if [ $(( gap < 0 )) -ne 0 ]; then fatal "layout reversal between $(parName $nPrev) and $(parName $n) in heap '$heapName'" fi gap=$(( $(parOldStart $n) - $(alignUp $(parOldEnd $nPrev)) )) if [ $(( gap > 0 )) -ne 0 ]; then warning "$(parName $n) starts $(printSizeMiB $gap) after the aligned end of $(parName $nPrev)" fi fi nPrev=$n done gap=$(( heapEnd - $(parOldEnd $nPrev) )) if [ $(( gap < 0 )) -ne 0 ]; then warning "$(parName $nPrev) ends $(printSizeMiB $(( -(gap) )) ) after the end of heap '$heapName'" fi if [ $(( gap >= heapAlignment )) -ne 0 ]; then warning "$(parName $nPrev) ends $(printSizeMiB $gap) before the end of heap '$heapName'" fi } setupHeapPartition() { local n=$1 local size="$(parGet $n parsedSize)" local content="$(parGet $n parsedContent)" local fs="$(parGet $n parsedFs)" if [ -z "$size" ]; then fatal "$(parName $n): undefined new size" fi if [ -z "$content" ]; then fatal "$(parName $n): undefined content policy" fi if [ -z "$fs" ]; then fatal "$(parName $n): undefined file system type" fi case "$size" in same) size=$(parOldSize $n) ;; min) size=$heapMinSize ;; max) size=0 ;; *) local regex="^\([0-9.]*\)[ ]*\([GgMm]\)\?$" local sizeUnit="$(echo -n "$size" | sed -n "s/$regex/\2/p")" local size="$(echo -n "$size" | sed -n "s/$regex/\1/p")" case "$sizeUnit" in M|m) sizeUnit=$MiB ;; G|g|*) sizeUnit=$GiB ;; esac local sizeGranularity=$(( heapSizeGranularity )) size=$(awk "BEGIN { print int(($size) * $sizeUnit / $sizeGranularity + 0.5) * $sizeGranularity }") if [ $(( size < heapSizeGranularity )) -ne 0 ]; then fatal "$(parName $n): invalid new size" fi ;; esac case "$content" in keep) ;; wipe) ;; *) fatal "$(parName $n): invalid content policy" ;; esac case "$fs" in ext4) ;; vfat) ;; f2fs) ;; swap) ;; raw) ;; *) fatal "$(parName $n): invalid file system type" ;; esac $(parSet $n size $size) $(parSet $n content $content) $(parSet $n fs $fs) $(parSet $n sizeAligned $(alignUp $size)) } setupHeapNew() { info "checking new partition layout" local n for n in $heapPartitions; do setupHeapPartition $n done local sizeAligned=$(( heapEndAligned - heapStartAligned )) # correct $sizeAligned in case the size of last partition and the end of heap are both unaligned, # and their combination would lead to an unused area at heap end the size of $heapAlignment or larger. local lastPar=$n local lastParEnd=$(( heapEndAligned - $(parNewSizeAligned $lastPar) + $(parNewSize $lastPar) )) if [ $(( heapEnd - lastParEnd >= heapAlignment )) -ne 0 ]; then sizeAligned=$(( sizeAligned + heapAlignment )) fi for n in $heapPartitions; do sizeAligned=$(( sizeAligned - $(parNewSizeAligned $n) )) done local maxPar for n in $heapPartitions; do if [ $(( $(parNewSize $n) == 0 )) -ne 0 ]; then if [ -n "$maxPar" ]; then fatal "more than one partition in heap '$heapName' has its size set to 'max'" fi maxPar=$n local size=$(( sizeAligned / heapSizeGranularity * heapSizeGranularity )) if [ $(( size < heapSizeGranularity )) -ne 0 ]; then fatal "the new partition layout of heap '$heapName' requires more space than available" fi $(parSet $n size $size) $(parSet $n sizeAligned $sizeAligned) fi info "new size: $(parName $n): $(printSizeMiB $(parNewSize $n))" done local nextStart=$heapStartAligned for n in $heapPartitions; do $(parSet $n start $nextStart) nextStart=$(parNewEndAligned $n) done gap=$(( heapEnd - $(parNewEnd $lastPar) )) if [ $(( gap < 0 )) -ne 0 ]; then fatal "the new partition layout of heap '$heapName' requires more space than available" fi if [ $(( gap >= heapAlignment )) -ne 0 ]; then warning "there will be $(printSizeMiB $gap) of unused space at the end of heap '$heapName'" fi } setupHeap() { setupHeapExisting setupHeapNew } forEachHeap() { for heapName in $allHeaps; do echo "##### processing heap '$heapName'" device_setupHeap_$heapName heapStartAligned=$(alignUp $heapStart) heapEndAligned=$(alignDown $heapEnd) if [ -z "$heapSizeGranularity" ]; then heapSizeGranularity=$heapAlignment "$@" heapSizeGranularity="" else "$@" fi done } ### execution processPar() { local n=$1 echo "***** processing $(parName $n)" eval processPar_$(parGet $n fs)_$(parGet $n content)_$processMode $n ${dpar}$n $(parOldStart $n) $(parOldSize $n) $(parNewStart $n) $(parNewSize $n) } processParList() { local first=$1 local rest=${@:2} echo "----- analyzing $(parName $first)" if [ -z "$rest" ]; then processPar $first else local second=$2 if [ $(( $(parNewEnd $first) > $(parOldStart $second) )) -ne 0 ]; then info "$(parName $first) will expand into storage area currently used by $(parName $second)" info "deferring processing of $(parName $first) until required space is freed" processParList $rest processPar $first else processPar $first processParList $rest fi fi } processHeap() { processMode=$1 processParList $heapPartitions } flushBuffers() { info "flushing buffers" sync blockdev --flushbufs $ddev sleep 3 } ### main main() { local packageName="$1" echo " ####################################" echo " Lanchon REPIT" echo " A Data-Sparing Repartitioning Tool" echo " Version: $version" echo " Device: $deviceName" echo " Copyright 2016, Lanchon (GPLv3)" echo " ####################################" echo echo "===== PRELIMINARY CHECKS =====" if [ -f "/tmp/repit-settings" ]; then packageName="$(cat "/tmp/repit-settings")" info "overriding configuration via '/tmp/repit-settings' to '$packageName'" elif [ -n "$FLASHIZE_ENV_VERSION" ] && [ -f "/tmp/flashize/repit-settings" ]; then packageName="$(cat "/tmp/flashize/repit-settings")" info "overriding configuration via 'flashize/repit-settings' to '$packageName'" fi init "$packageName" echo echo "===== PREPARATION =====" setup forEachHeap setupHeap echo echo "===== DRY-RUN =====" forEachHeap processHeap dry echo echo "===== EXECUTION =====" forEachHeap processHeap wet flushBuffers echo echo "===== SUCCESS =====" #echo } ================================================ FILE: run ================================================ #!/bin/bash set -e device="$1" conf="$2" if [ -e run.conf ]; then source run.conf fi script="build/lanchon-repit-$device.sh" ./make-script "$device" "$script" adb push "$script" /tmp/repit.sh echo #adb shell sh -c ".\ /tmp/flashize/env/setup\ ;\ .\ /tmp/repit.sh\ /tmp/lanchon-repit-00000000-$conf-$device.zip" adb shell <