├── .gitignore ├── LOG.txt ├── README-CHEF-KOCH.md ├── README.md ├── _config.yml ├── device-dump ├── .gitignore ├── README.md ├── dump.sh ├── make-zip ├── repit-dump-unsigned.zip ├── repit-dump.zip ├── run-dump └── run-dump.bat ├── 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 ├── env ├── arm.zip └── 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 /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /run.conf 3 | -------------------------------------------------------------------------------- /LOG.txt: -------------------------------------------------------------------------------- 1 | #################################### 2 | Lanchon REPIT 3 | A Data-Sparing Repartitioning Tool 4 | Version: 2016-04-06 5 | Device: i9100 6 | Copyright 2016, Lanchon (GPLv3) 7 | #################################### 8 | 9 | ===== PRELIMINARY CHECKS ===== 10 | info: valid package names: [-(system|data|sdcard|preload)=]... 11 | info: valid partition values: [|same|min|max][+[keep|wipe][+[ext4|vfat|f2fs|swap|raw]]] 12 | 13 | ----- DEFAULTS ----- 14 | system = size:same + content:keep + fs:ext4 15 | data = size:same + content:keep + fs:ext4 16 | sdcard = size:same + content:keep + fs:vfat 17 | preload = size:same + content:keep + fs:ext4 18 | 19 | info: parsing package name 20 | 21 | ----- CONFIGURATION ----- 22 | system = size:1.0 + content:keep + fs:ext4 23 | data = size:6 + content:keep + fs:ext4 24 | sdcard = size:max + content:keep + fs:vfat 25 | preload = size:min + content:wipe + fs:ext4 26 | 27 | info: disabling swap 28 | info: unmounting all partitions 29 | info: rereading partition table 30 | 31 | ===== PREPARATION ===== 32 | info: determining usable sector range of block device 33 | info: checking existing partitions 34 | ##### processing heap 'main' 35 | info: checking existing partition layout 36 | info: current size: partition #9 'system' (FACTORYFS): 768 MiB 37 | info: current size: partition #10 'data' (DATAFS): 512 MiB 38 | info: current size: partition #11 'sdcard' (UMS): 13064 MiB 39 | info: current size: partition #12 'preload' (HIDDEN): 512 MiB 40 | info: checking new partition layout 41 | info: new size: partition #9 'system' (FACTORYFS): 1024 MiB 42 | info: new size: partition #10 'data' (DATAFS): 6144 MiB 43 | info: new size: partition #11 'sdcard' (UMS): 7680 MiB 44 | info: new size: partition #12 'preload' (HIDDEN): 8 MiB 45 | 46 | ===== DRY-RUN ===== 47 | ##### processing heap 'main' 48 | ----- analyzing partition #9 'system' (FACTORYFS) 49 | info: partition #9 'system' (FACTORYFS) will expand into storage area currently used by partition #10 'data' (DATAFS) 50 | info: deferring processing of partition #9 'system' (FACTORYFS) until required space is freed 51 | ----- analyzing partition #10 'data' (DATAFS) 52 | info: partition #10 'data' (DATAFS) will expand into storage area currently used by partition #11 'sdcard' (UMS) 53 | info: deferring processing of partition #10 'data' (DATAFS) until required space is freed 54 | ----- analyzing partition #11 'sdcard' (UMS) 55 | info: partition #11 'sdcard' (UMS) will expand into storage area currently used by partition #12 'preload' (HIDDEN) 56 | info: deferring processing of partition #11 'sdcard' (UMS) until required space is freed 57 | ----- analyzing partition #12 'preload' (HIDDEN) 58 | ***** processing partition #12 'preload' (HIDDEN) 59 | info: will format the partition in ext4 and trim it 60 | ***** processing partition #11 'sdcard' (UMS) 61 | info: will move/resize the vfat partition 62 | info: checking the file system 63 | fsck.fat 3.0.28 (2015-05-16) 64 | /dev/block/mmcblk0p11: 62 files, 286825/3337853 clusters 65 | ***** processing partition #10 'data' (DATAFS) 66 | info: will move the ext4 partition 67 | WARNING: moving a big ext4 partition can take a very long time; it requires copying the complete partition, including its free space 68 | info: will resize the ext4 partition 69 | info: checking and trimming the file system 70 | /dev/block/mmcblk0p10: 797/32768 files (10.7% non-contiguous), 90304/131068 blocks 71 | ***** processing partition #9 'system' (FACTORYFS) 72 | info: will resize the ext4 partition 73 | info: checking and trimming the file system 74 | system: 1833/49152 files (0.0% non-contiguous), 117150/196608 blocks 75 | 76 | ===== EXECUTION ===== 77 | ##### processing heap 'main' 78 | ----- analyzing partition #9 'system' (FACTORYFS) 79 | info: partition #9 'system' (FACTORYFS) will expand into storage area currently used by partition #10 'data' (DATAFS) 80 | info: deferring processing of partition #9 'system' (FACTORYFS) until required space is freed 81 | ----- analyzing partition #10 'data' (DATAFS) 82 | info: partition #10 'data' (DATAFS) will expand into storage area currently used by partition #11 'sdcard' (UMS) 83 | info: deferring processing of partition #10 'data' (DATAFS) until required space is freed 84 | ----- analyzing partition #11 'sdcard' (UMS) 85 | info: partition #11 'sdcard' (UMS) will expand into storage area currently used by partition #12 'preload' (HIDDEN) 86 | info: deferring processing of partition #11 'sdcard' (UMS) until required space is freed 87 | ----- analyzing partition #12 'preload' (HIDDEN) 88 | ***** processing partition #12 'preload' (HIDDEN) 89 | info: deleting current partition 90 | info: creating new partition 91 | info: naming the partition 92 | info: rereading partition table 93 | info: formatting the partition in ext4 and trimming it 94 | 95 | Warning: the fs_type small is not defined in mke2fs.conf 96 | 97 | ***** processing partition #11 'sdcard' (UMS) 98 | info: moving/resizing the vfat partition 99 | 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. 100 | info: rereading partition table 101 | info: checking the file system 102 | fsck.fat 3.0.28 (2015-05-16) 103 | /dev/block/mmcblk0p11: 62 files, 286825/1962238 clusters 104 | ***** processing partition #10 'data' (DATAFS) 105 | info: moving the ext4 partition 106 | info: ensure that the destination partition can be created before starting the move 107 | info: deleting current partition 108 | info: creating new partition 109 | info: naming the partition 110 | info: rereading partition table 111 | info: deleting the partition to workaround dd's 4 GiB wraparound bug 112 | info: moving data towards the end of the disk 113 | 114 | ----- moving 256 MiB chunk: 1192 MiB -> 1448 MiB 115 | info: creating a temporary partition to read chunk at device offset 1192 MiB 116 | info: rereading partition table 117 | info: reading data 118 | 524288+0 records in 119 | 524288+0 records out 120 | 268435456 bytes (256.0MB) copied, 6.977768 seconds, 36.7MB/s 121 | info: deleting the temporary partition 122 | info: creating a temporary partition to write chunk at device offset 1448 MiB 123 | info: rereading partition table 124 | info: writing data 125 | 524288+0 records in 126 | 524288+0 records out 127 | 268435456 bytes (256.0MB) copied, 136.736488 seconds, 1.9MB/s 128 | info: deleting the temporary partition 129 | 130 | ----- moving 256 MiB chunk: 936 MiB -> 1192 MiB 131 | info: creating a temporary partition to read chunk at device offset 936 MiB 132 | info: rereading partition table 133 | info: reading data 134 | 524288+0 records in 135 | 524288+0 records out 136 | 268435456 bytes (256.0MB) copied, 7.215978 seconds, 35.5MB/s 137 | info: deleting the temporary partition 138 | info: creating a temporary partition to write chunk at device offset 1192 MiB 139 | info: rereading partition table 140 | info: writing data 141 | 524288+0 records in 142 | 524288+0 records out 143 | 268435456 bytes (256.0MB) copied, 134.066894 seconds, 1.9MB/s 144 | info: deleting the temporary partition 145 | 146 | info: creating the final partition 147 | info: naming the partition 148 | info: rereading partition table 149 | info: checking and trimming the file system 150 | /dev/block/mmcblk0p10: 797/32768 files (10.7% non-contiguous), 90304/131068 blocks 151 | info: enlarging the partition entry 152 | info: deleting current partition 153 | info: creating new partition 154 | info: naming the partition 155 | info: rereading partition table 156 | info: creating a temporary partition to wipe the crypto footer due to dd's 4 GiB wraparound bug 157 | info: deleting current partition 158 | info: creating new partition 159 | info: naming the partition 160 | info: rereading partition table 161 | info: wiping the crypto footer 162 | 32+0 records in 163 | 32+0 records out 164 | 16384 bytes (16.0KB) copied, 0.010336 seconds, 1.5MB/s 165 | info: recreating the original partition 166 | info: deleting current partition 167 | info: creating new partition 168 | info: naming the partition 169 | info: rereading partition table 170 | info: enlarging the ext4 file system 171 | resize2fs 1.42.9 (28-Dec-2013) 172 | Resizing the filesystem on /dev/block/mmcblk0p10 to 1572860 (4k) blocks. 173 | The filesystem on /dev/block/mmcblk0p10 is now 1572860 blocks long. 174 | 175 | info: checking and trimming the file system 176 | /dev/block/mmcblk0p10: Inode 7, i_size is 1610670080, should be 1610690560. FIXED. 177 | /dev/block/mmcblk0p10: 797/393216 files (10.7% non-contiguous), 114845/1572860 blocks 178 | info: file system errors in partition #10 'data' (DATAFS) were fixed 179 | ***** processing partition #9 'system' (FACTORYFS) 180 | info: enlarging the partition entry 181 | info: deleting current partition 182 | info: creating new partition 183 | info: naming the partition 184 | info: rereading partition table 185 | info: enlarging the ext4 file system 186 | resize2fs 1.42.9 (28-Dec-2013) 187 | Resizing the filesystem on /dev/block/mmcblk0p9 to 262144 (4k) blocks. 188 | The filesystem on /dev/block/mmcblk0p9 is now 262144 blocks long. 189 | 190 | info: checking and trimming the file system 191 | system: 1833/65536 files (0.0% non-contiguous), 118211/262144 blocks 192 | info: flushing buffers 193 | 194 | ===== SUCCESS ===== 195 | 196 | [OK] 197 | -------------------------------------------------------------------------------- /README-CHEF-KOCH.md: -------------------------------------------------------------------------------- 1 | ## The CHEF-KOCH Incident (And XDA's Response) 2 | 3 | the following information remains online because, to this date, CHEF-KOCH has not publicly acknowledged his act 4 | of plagiarism. our latest exchange can be found [here](https://github.com/Lanchon/REPIT/issues/37). 5 | 6 |
7 | 8 | > **AND WHAT IS THIS?** 9 | > 10 | > what follows is text originally posted by me on XDA. the strange incident that was the subject of this post was 11 | investigated by moderators from both of the involved sites and found to be as i described it. as a result, proper 12 | corrective measures were implemented. 13 | > 14 | > unfortunately this post was later surreptitiously deleted by XDA moderator 15 | [The_Merovingian](http://forum.xda-developers.com/member.php?u=5302753), an action that precipitated my departure 16 | from the XDA community as a developer. i no longer consider XDA a viable medium for hosting my work. 17 | > 18 | > the post is now reproduced here for record keeping in the form in which it was when it was deleted from XDA by 19 | The_Merovingian on February 23, 2016. 20 | 21 | > **UPDATE:** as a sort of retaliation for my moving REPIT out of XDA, The_Merovingian closed down 22 | [the REPIT thread](http://forum.xda-developers.com/galaxy-s2/orig-development/tool-lanchon-repit-data-sparing-t3311747) 23 | ([via Wayback Machine](https://web.archive.org/web/20160226151111/http://forum.xda-developers.com/galaxy-s2/orig-development/tool-lanchon-repit-data-sparing-t3311747)). 24 | this was unfortunate because the thread got 30 pages of posts in its 2 weeks of existence, and probably was 25 | the second most active thread in the S2 forum. all this traffic then went on to spam the official i9100 CM13 thread, 26 | already drowning in off-topic noise; it was a mess. 27 | > 28 | > clearly XDA members needed a place to discuss REPIT but XDA did not really care about this. 29 | The_Merovingian told me that i needed to "remove 30 | [the rant](http://forum.xda-developers.com/galaxy-s2/orig-development/tool-lanchon-repit-data-sparing-t3311747/post65239832)" 31 | in order for the thread to be reopened. i reached out to the XDA moderation committee asking for the 32 | official position on whether "DUE TO IRRECONCILABLE DIFFERENCES" constituted an unacceptable rant on XDA. 33 | i am still waiting for a response... :) 34 | > 35 | > censorship attempts typically backfire on the internet. what was to be a post on a forum is now inextricably 36 | linked to the history of an open source project in its git repo, cloned by anyone needing the tool's tree. 37 | > 38 | > After all is said and done, all the trouble caused and the time lost, i have but one personal message 39 | to The_Merovingian, and it is this: the matrix is a silly franchise. 40 | 41 |
42 | 43 | _we interrupt your regular programming to bring you this breaking news..._ 44 | 45 | ### _"CHEF-KOCH" IS A THIEF !!!_ 46 | 47 | > **UPDATE:** moderators from both [the german forum](http://www.android-hilfe.de/) and xda collaborated to resolve this 48 | issue. they were alerted by some forum members who are active in both communities (and again i thank you guys for 49 | that, you know who you are). after a swift investigation, and just two days after this silliness started, they 50 | removed all offending content from the german site and placed a link to this thread in its place. i am very grateful 51 | to all the parties that quickly put this issue to rest. 52 | 53 | > **2ND UPDATE:** i was told that this guy's account at the german site was terminated; the reasons for this are unknown 54 | to me. and user [the.gangster](http://forum.xda-developers.com/member.php?u=6560258) was put in charge of the 55 | repartition thread there. thank you for taking over! 56 | 57 | > **3RD UPDATE:** i privately told the.gangster a few days ago when this guy was banned from the german site that i 58 | wanted to remove the guy's contact details from this post and let bygones be bygones. unfortunately this guy is 59 | relentless: he can no longer post, but still he added text files on his MEGA instead accusing **me** of stealing 60 | and other nonsense. well, so be it: this info stays online forever, and so do his contact details. i removed the 61 | fowl language to comply with XDA requirements and the rest stays. 62 | 63 | _it is unbelievable!!! this_ [epithet removed] _took my just-published software, removed the license, removed my 64 | name, removed the copyright, added himself as the author, and republished it in a 65 | [german forum](http://www.android-hilfe.de/thema/how-to-vergroesserung-der-datenpartition-mittels-bearbeitetem-pit-file-teil-2.751812/) 66 | as his own work. (here is the same link 67 | [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/), 68 | in case the_ [epithet removed] _decides to delete his post.) when i dated one of my zips in its name, he copied 69 | that too, except that he rewinded the date by one day. but he forgot to fake the modification time of the files 70 | inside the zip; and of course the upload date in MEGA is the real one. he also republished the older v0.1 unfinished 71 | release i did to help people in a tight spot with CM13, even though that release **was not free software**. (it was 72 | specifically **not** licensed as free software to avoid copies of the unfinished work spreading around; however the 73 | current version is GPLv3.) he also stole 74 | [Flashize](http://forum.xda-developers.com/android/software-hacking/tool-flashize-shell-scripts-flashable-t3313605), 75 | another tool i published these days._ 76 | 77 | _the plagiarized files are currently published [here](https://mega.nz/#F!cMNShQLa!5lXzEuluHX9jd9Bv3B_h8Q), but might 78 | be removed anytime. a copy of all files was 79 | [uploaded to post #3](http://forum.xda-developers.com/galaxy-s2/orig-development/tool-lanchon-repit-data-sparing-t3311747/post65239837)_ 80 | [now also surreptitiously deleted from XDA! rehosted [here](https://www.androidfilehost.com/?w=files&flid=50817)] 81 | _for record keeping._ 82 | 83 | _i did delete my old published v0.1 files from xda, but fortunately i did not delete some customized versions of 84 | v0.1 that i produced on request that are still available 85 | [here](http://forum.xda-developers.com/galaxy-s2/orig-development/tool-lanchon-repit-data-sparing-t3311747/post65252583) 86 | and [here](http://forum.xda-developers.com/galaxy-s2/orig-development/tool-lanchon-repit-data-sparing-t3311747/post65252738). 87 | most importantly, i 88 | [announced](http://forum.xda-developers.com/galaxy-s2/development-derivatives/rom-cyanogenmod-13-t3223808/post65201096) 89 | that i was working on a partitioning tool and 6 hours later 90 | [published](http://forum.xda-developers.com/galaxy-s2/development-derivatives/rom-cyanogenmod-13-t3223808/post65206132) 91 | the full complex log of a working, pre-release version of the application. that was 3 full days before the_ 92 | [epithet removed] _published "his" software... lol._ 93 | 94 | #### _WHO IS THIS "CHEF-KOCH"_ [epithet removed] _THIEF ANYWAY ???_ 95 | 96 | [rant removed.] 97 | 98 | _it is very unlikely that this is the only time he has done this, and i can tell you this is very demotivating for 99 | a developer. so protect your developers by helping them expose this clown in case they happen to cross paths with him. 100 | also, his clients and/or employers better know what kind of "work" this guy does._ 101 | 102 | _android-hilfe.de: [CHEF-KOCH](http://www.android-hilfe.de/members/chef-koch.97407/) 103 |
xda-developers.com: [CHEF-KOCH](http://forum.xda-developers.com/member.php?u=4415879) 104 |
github.com: [CHEF-KOCH](https://github.com/CHEF-KOCH) 105 |
google.com: [Nvinside@gmail.com](mailto:Nvinside@gmail.com)_ 106 | 107 | _he has this info on GitHub: 108 |
InfoSec Institute/nVidia EU 109 |
http://www.infosecinstitute.com/ 110 |
Lausanne_ 111 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Lanchon REPIT 2 | ### A Device-Only Data-Sparing Repartitioning Tool For Android 3 | 4 | #### [CHANGELOG] - [DEVICES] - [DOWNLOADS] - [GALAXY S2] - [XDA THREAD] 5 | 6 | [CHANGELOG]: https://github.com/Lanchon/REPIT/releases 7 | [DEVICES]: #device-specific-information 8 | [DOWNLOADS]: https://www.androidfilehost.com/?w=files&flid=49911 9 | [GALAXY S2]: #the-galaxy-s2-family 10 | [XDA THREAD]: http://forum.xda-developers.com/android/software-hacking/tool-lanchon-repit-data-sparing-t3358036 11 | 12 | Powered by [Flashize](https://github.com/Lanchon/Flashize). 13 | 14 |
15 | 16 | ## General Information (All Devices) 17 | 18 | #### WHAT IS THE PROBLEM ? 19 | 20 | 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. 21 | 22 | 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. 23 | 24 | #### WHAT IS REPIT ? 25 | 26 | REPIT is a simple, safe, device-only, data-sparing, and easily portable repartitioning tool for Android devices: 27 | 28 | - device-only: just flash a zip file in recovery to repartition the device. 29 | - simple: rename the zip file before flashing to configure your choice of partition sizes, file systems, wipes, etc. 30 | - safe: 31 | - a correctly ported REPIT can never hard-brick your device. 32 | - 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. 33 | - 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.) 34 | - 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.) 35 | - easily portable: a simple configuration file is all that is needed to port REPIT to a new device. 36 | 37 | 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. 38 | 39 | #### LIMITATIONS 40 | 41 | - 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.) 42 | - REPIT **does not support encrypted phones.** 43 | - REPIT **will cause data loss** if the repartitioning process is externally interrupted. **plug into a power source!** 44 | 45 | #### HOW TO REPIT 46 | 47 | 1. if you think your data is invaluable then treat it as such: **make a backup!** 48 | 2. get TWRP running on your device. 49 | 3. make sure your battery is mostly charged. 50 | 4. get the zip for your device from the link below. 51 | 5. **rename it to express your desired configuration** (see below). 52 | 6. **PLUG INTO A POWER SOURCE.** this operation might take a long time and **must not be interrupted.** 53 | 7. flash the zip locally on the phone. (if you want to sideload instead, please see the note below.) 54 | 55 | finally, go get a coffee or two. **do not, under any circumstance, interrupt this script !!!** 56 | 57 | in case the script fails to start: 58 | - 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. 59 | - 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'. 60 | - if locking issues remain, your phone is probably encrypted; this script is not compatible with encrypted phones. 61 | 62 | if you want to sideload: 63 | - sideloading conceals the filename from the device, and thus filename-based configuration will not work. 64 | - 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. 65 | - 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'. 66 | 67 | #### HOW TO CONFIGURE 68 | 69 | configure the script by renaming the zip file before flashing it. 70 | 71 | valid zip names: `[-partition1=][-partition2=]...` 72 | 73 | valid partition `` values: `[(G|M)|same|min|max][+[keep|wipe][+[ext4|vfat|f2fs|swap|raw]]]` 74 | 75 | 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. 76 | 77 | ##### Partition Data 78 | - `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. 79 | - `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. 80 | 81 | ##### Partition Sizes 82 | - `same`: do not alter the size of this partition. 83 | - `min`: make this unused partition a minimum yet formattable size (typically 8 MiB, but device-dependent). 84 | - `max`: make this partition as big as possible (at most one partition per 'heap' can have its size set to 'max'). 85 | - `(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). 86 | 87 | ##### Partition Types 88 | - `ext4` and `vfat`: these partitions have full move, resize and wipe support. 89 | - `f2fs`: f2fs partitions can be moved and wiped, and can only be resized while wiping them. 90 |
(tools to resize f2fs file systems do not exist for now.) 91 | - `swap`: swap partitions can be wiped, and can only be moved or resized while wiping them. 92 |
(it makes no sense to retain their content.) 93 | - `raw`: raw partitions are treated as opaque blobs and can only be moved. 94 |
(neither resizing nor wiping is supported.) 95 | 96 | ##### Supported Features 97 | 98 | | | wipe | keep + move | keep + resize | keep + move + resize | crypto footer | 99 | |:--------:|:----:|:-----------------:|:---------------:|:--------------------:|:-------------:| 100 | | **ext4** | YES | YES (brute force) | YES (efficient) | YES (brute force) | YES | 101 | | **vfat** | YES | YES (efficient) | YES (efficient) | YES (efficient) | no | 102 | | **f2fs** | YES | YES (brute force) | no | no | YES | 103 | | **swap** | YES | no | no | no | no | 104 | | **raw** | no | YES | no | no | no | 105 | 106 | - **brute force:** the complete partition extent is operated upon. 107 | - **efficient:** only the stored data within the partition is operated upon. 108 | - **crypto footer:** support for encryption metadata at the end of the partition. 109 | 110 | #### IN CASE OF ISSUES 111 | 112 | 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. 113 | 114 | **PLEASE NOTE:** your _'did not work'_ report is useless unless you post info from your log. 115 | 116 |
117 | 118 | ## Device-Specific Information 119 | 120 | 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. 121 | 122 | #### IF YOUR DEVICE IS NOT SUPPORTED 123 | 124 | 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). 125 | 126 |
127 | 128 | ## The Galaxy S2 Family 129 | 130 | REPIT started its life as i9100-only tool and it inherits this doc section from the good old days. 131 | 132 | > **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. 133 | 134 | #### IF... your stock-partitioned device cannot flash gapps after updating to CM 13.0 135 | 136 | 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). 137 | 138 | #### IF... your device is usable 139 | 140 | 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. 141 | 142 | #### Galaxy S2 HOW TO 143 | 144 | first get [official TWRP](https://twrp.me/samsung/samsunggalaxys2i9100.html) running on your device, then follow the generic how-to. 145 | 146 | valid zip names: `[-system=][-data=][-sdcard=][-preload=]` 147 | 148 | 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.) 149 | 150 | ##### Galaxy S2 Defaults 151 | - `-system=same+keep+ext4` 152 | - `-data=same+keep+ext4` 153 | - `-sdcard=same+keep+vfat` <-- note `vfat` here 154 | - `-preload=same+keep+ext4` 155 | 156 | ##### Galaxy S2 Samples 157 | - repartition to stock, wiping preload (in case you used a very small preload before): 158 |
(**note:** in general it is not recommended to resize file systems by large factors.) 159 |
`lanchon-repit-XXXXXXXX-system=0.5G-data=2G-sdcard=max-preload=0.5G+wipe-i9100.zip` 160 | - repartition to stock (without wiping preload): 161 |
`-system=0.5G-data=2G-sdcard=max-preload=0.5G` 162 | - wipe data: 163 |
`-data=+wipe` 164 | - wipe/change internal sdcard to ext4 (not recommended): 165 |
`-sdcard=+wipe+ext4` 166 | - **repartition to 1 GiB system, 6 GiB data, no preload...** 167 | - ...keeping all other data: 168 |
`-system=1G-data=6G-sdcard=max-preload=min+wipe` 169 | - ...keeping all other data, **for phones with ext4-formatted internal sdcard:** 170 |
`-system=1G-data=6G-sdcard=max++ext4-preload=min+wipe` 171 | - ...keeping system and sdcard but **WIPING DATA:** 172 |
(**note:** wiping data is much faster than moving it around if system is being resized and data is large.) 173 |
`-system=1G-data=6G+wipe-sdcard=max-preload=min+wipe` 174 | 175 |
176 | 177 | ## Disclaimer 178 | 179 | 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. 180 | 181 |
182 | 183 | ----- 184 | 185 | 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). 186 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /device-dump/.gitignore: -------------------------------------------------------------------------------- 1 | /repit-dump.log 2 | /repit-dump-out.txt 3 | /dumps 4 | -------------------------------------------------------------------------------- /device-dump/README.md: -------------------------------------------------------------------------------- 1 | #### How To Dump Your Device To Request A New Port 2 | 3 | - get a recent TWRP running on your device. 4 | - copy '[repit-dump.zip] (https://github.com/Lanchon/REPIT/raw/master/device-dump/repit-dump.zip)' to your device and flash it. 5 | - pull to your PC a file called 'repit-dump.log' that was generated in the same folder that holds 'repit-dump.zip'. 6 | - go [here] (https://github.com/Lanchon/REPIT/issues/new) and create a new issue: 7 | - attach the pulled 'repit-dump.log' file. 8 | - add the following information: 9 | - your exact device and device codename. 10 | - your recovery (version? official? if not where did you get it?). 11 | - your kernel. 12 | - your rom. 13 | - is your device running the stock partition layout or is it already modified? 14 | 15 | #### How To Dump Via Sideload 16 | 17 | - adb sideload repit-dump.zip 18 | - adb pull /tmp/repit-dump.log 19 | 20 | **thank you!** 21 | -------------------------------------------------------------------------------- /device-dump/dump.sh: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | ##################################################### 4 | # Lanchon REPIT # 5 | # Copyright 2016, Lanchon # 6 | ##################################################### 7 | 8 | ##################################################### 9 | # Lanchon REPIT is free software licensed under # 10 | # the GNU General Public License (GPL) version 3 # 11 | # and any later version. # 12 | ##################################################### 13 | 14 | run() { 15 | echo "==========================================================================================================" 16 | echo "$@" 17 | echo "----------------------------------------------------------------------------------------------------------" 18 | "$@" 19 | local code=$? 20 | echo 21 | return $code 22 | } 23 | 24 | run getprop ro.product.device 25 | run grep ro.product.device default.prop 26 | 27 | run getprop ro.build.product 28 | run grep ro.build.product default.prop 29 | 30 | checkTool() { 31 | echo "$1:" 32 | echo " $(which "$1")" 33 | } 34 | 35 | checkTools() { 36 | 37 | checkTool parted 38 | checkTool sort 39 | checkTool blockdev 40 | checkTool sed 41 | checkTool awk 42 | checkTool readlink 43 | checkTool basename 44 | checkTool dirname 45 | checkTool dd 46 | 47 | checkTool fdisk 48 | checkTool gdisk 49 | checkTool sfdisk 50 | checkTool sgdisk 51 | 52 | #checkTools_fs_ext4 53 | #checkTools_fs_vfat 54 | #checkTools_fs_raw 55 | 56 | } 57 | 58 | checkTools_fs_ext4() { 59 | checkTool mke2fs 60 | checkTool e2fsck 61 | checkTool resize2fs 62 | } 63 | 64 | checkTools_fs_vfat() { 65 | checkTool mkdosfs 66 | checkTool mkfs.fat 67 | checkTool dosfsck 68 | checkTool fsck.fat 69 | } 70 | 71 | checkTools_fs_f2fs() { 72 | checkTool mkfs.f2fs 73 | checkTool fsck.f2fs 74 | } 75 | 76 | checkTools_fs_swap() { 77 | checkTool mkswap 78 | } 79 | 80 | checkTools_fs_raw() { 81 | : 82 | } 83 | 84 | run checkTools 85 | 86 | run checkTools_fs_ext4 87 | run checkTools_fs_vfat 88 | run checkTools_fs_f2fs 89 | run checkTools_fs_swap 90 | run checkTools_fs_raw 91 | 92 | run ls -l /sys/block/mmcblk0 93 | 94 | run parted -s /dev/block/mmcblk0 unit MiB print free unit s print free 95 | run sgdisk /dev/block/mmcblk0 --set-alignment 1 --print 96 | 97 | run getprop 98 | run cat /default.prop 99 | 100 | run env 101 | run set 102 | 103 | run ls -lR /sbin 104 | 105 | run ls -l /dev/block 106 | run ls -l /sys/block 107 | 108 | for device in /dev/block/*; do 109 | run parted -s "$device" unit MiB print free unit s print free && 110 | run sgdisk "$device" --set-alignment 1 --print 111 | done 112 | 113 | run ls -lR /dev/block 114 | run ls -lR /sys/block 115 | 116 | #run ls -lR /dev 117 | #run ls -lR /sys 118 | -------------------------------------------------------------------------------- /device-dump/make-zip: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | unsignedZip="repit-dump-unsigned.zip" 6 | signedZip="repit-dump.zip" 7 | 8 | rm -f "$unsignedZip" 9 | rm -f "$signedZip" 10 | 11 | flashize-env dump.sh ../env/arm.zip "$unsignedZip" repit-dump.log 12 | signapk -w ../key/testkey.x509.pem ../key/testkey.pk8 "$unsignedZip" "$signedZip" 13 | 14 | #rm "$unsignedZip" 15 | -------------------------------------------------------------------------------- /device-dump/repit-dump-unsigned.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanchon/REPIT/8824c5af8c41924a0b22251fbb745ec30748e368/device-dump/repit-dump-unsigned.zip -------------------------------------------------------------------------------- /device-dump/repit-dump.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanchon/REPIT/8824c5af8c41924a0b22251fbb745ec30748e368/device-dump/repit-dump.zip -------------------------------------------------------------------------------- /device-dump/run-dump: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | echo "pushing to device..." 6 | adb push dump.sh /tmp/ 7 | echo 8 | 9 | echo "running..." 10 | adb shell sh /tmp/dump.sh >repit-dump.log 11 | -------------------------------------------------------------------------------- /device-dump/run-dump.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo pushing to device... 4 | adb push dump.sh /tmp/ 5 | echo. 6 | 7 | echo running... 8 | adb shell sh /tmp/dump.sh >repit-dump.log 9 | -------------------------------------------------------------------------------- /device/.disabled/falcon/falcon_UNTESTED.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### falcon (non-GPE versions) 13 | 14 | # Disk /dev/block/mmcblk0: 15269888 sectors, 7.3 GiB 15 | # Logical sector size: 512 bytes 16 | # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 17 | # Partition table holds up to 36 entries 18 | # First usable sector is 34, last usable sector is 15269854 19 | # Total free space is 72203 sectors (35.3 MiB) 20 | # 21 | # Number Start (sector) End (sector) Size Code Name 22 | # 1 256 131327 64.0 MiB 0700 modem 23 | # 2 131328 132351 512.0 KiB FFFF sbl1 24 | # 3 132352 132415 32.0 KiB FFFF DDR 25 | # 4 132608 133631 512.0 KiB FFFF aboot 26 | # 5 135608 136007 200.0 KiB FFFF rpm 27 | # 6 136608 137407 400.0 KiB FFFF tz 28 | # 7 137608 137671 32.0 KiB FFFF sdi 29 | # 8 137672 138695 512.0 KiB FFFF utags 30 | # 9 138696 142791 2.0 MiB FFFF logs 31 | # 10 142792 147455 2.3 MiB 0700 padA 32 | # 11 147456 148479 512.0 KiB FFFF abootBackup 33 | # 12 150456 150855 200.0 KiB FFFF rpmBackup 34 | # 13 151456 152255 400.0 KiB FFFF tzBackup 35 | # 14 152456 152519 32.0 KiB 0700 sdiBackup 36 | # 15 152520 153543 512.0 KiB FFFF utagsBackup 37 | # 16 153544 155647 1.0 MiB 0700 padB 38 | # 17 155648 158719 1.5 MiB FFFF modemst1 39 | # 18 158720 161791 1.5 MiB FFFF modemst2 40 | # 19 161792 162815 512.0 KiB FFFF hob 41 | # 20 162816 162831 8.0 KiB FFFF dhob 42 | # 21 163072 166143 1.5 MiB FFFF fsg 43 | # 22 166144 166145 1024 bytes FFFF fsc 44 | # 23 166146 166161 8.0 KiB FFFF ssd 45 | # 24 166162 168209 1024.0 KiB FFFF sp 46 | # 25 168210 168465 128.0 KiB FFFF cid 47 | # 26 168466 174609 3.0 MiB FFFF pds 48 | # 27 174610 182801 4.0 MiB FFFF logo 49 | # 28 182802 190993 4.0 MiB FFFF clogo 50 | # 29 191232 207615 8.0 MiB 0700 persist 51 | # 30 207616 208639 512.0 KiB FFFF misc 52 | # 31 208640 229119 10.0 MiB FFFF boot 53 | # 32 229120 249599 10.0 MiB FFFF recovery 54 | # 33 249600 1605631 662.1 MiB 0700 cache 55 | # 34 1605632 3604479 976.0 MiB 0700 system 56 | # 35 3604480 3620863 8.0 MiB FFFF kpan 57 | # 36 3620864 15204095 5.5 GiB 0700 userdata 58 | 59 | device_makeFlashizeEnv="env/arm.zip" 60 | 61 | #device_makeFilenameConfig="cache=32M+wipe-system=same-data=max+wipe" 62 | device_makeFilenameConfig="cache=32M+wipe-system=same-data=max++ext4" 63 | 64 | device_checkDevice() { 65 | 66 | checkTool getprop 67 | 68 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 69 | *:falcon:*) ;; 70 | *) 71 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 72 | ;; 73 | esac 74 | 75 | } 76 | 77 | device_init() { 78 | 79 | device_checkDevice 80 | 81 | # the block device on which REPIT will operate (only one device is supported): 82 | 83 | #sdev=/sys/devices/msm_sdcc.1/mmc_host/mmc0/mmc0:0001/block/mmcblk0 84 | sdev=/sys/block/mmcblk0 85 | spar=$sdev/mmcblk0p 86 | 87 | ddev=/dev/block/mmcblk0 88 | dpar=/dev/block/mmcblk0p 89 | 90 | sectorSize=512 # in bytes 91 | 92 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 93 | #unmountPattern="${dpar}[0-9]\+" 94 | unmountPattern="/dev/block/mmcblk[^ ]*" 95 | 96 | } 97 | 98 | device_initPartitions() { 99 | 100 | # the crypto footer size: 101 | local footerSize=$(( 16384 / sectorSize )) 102 | 103 | # the set of partitions that can be modified by REPIT: 104 | # 105 | initPartition 33 cache cache "same keep ext4" 0 106 | initPartition 34 system system "same keep ext4" 0 107 | initPartition 35 kpan kpan "same keep raw" 0 108 | initPartition 36 userdata data "same keep f2fs" $footerSize 109 | 110 | # the set of modifiable partitions that can be configured by the user (overriding ): 111 | configurablePartitions="33 34 36" 112 | 113 | } 114 | 115 | device_setup() { 116 | 117 | # the number of partitions that the device must have: 118 | partitionCount=36 119 | 120 | # the set of defined heaps: 121 | allHeaps="main" 122 | 123 | # the partition data move chunk size (must fit in memory): 124 | moveDataChunkSize=$(( 256 * MiB )) 125 | 126 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 127 | detectBlockDeviceHeapRange 128 | 129 | # the size of partitions configured with the 'min' keyword: 130 | #heapMinSize=$(( 8 * MiB )) 131 | 132 | # the partition alignment: 133 | heapAlignment=$(( 4 * MiB )) 134 | 135 | } 136 | 137 | device_setupHeap_main() { 138 | 139 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 140 | heapPartitions="$(seq 33 36)" 141 | 142 | # the disk area (as a sector range) to use for the heap partitions: 143 | heapStart=$(parOldEnd 32) # one past the end of a specific partition 144 | heapEnd=$deviceHeapEnd # one past the last usable sector of the device 145 | 146 | } 147 | -------------------------------------------------------------------------------- /device/.disabled/falcon/falcon_gpe_UNTESTED.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### falcon_gpe (GPE version) 13 | 14 | # Disk /dev/block/mmcblk0: 30777344 sectors, 14.7 GiB 15 | # Logical sector size: 512 bytes 16 | # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 17 | # Partition table holds up to 37 entries 18 | # First usable sector is 34, last usable sector is 30777310 19 | # Total free space is 72203 sectors (35.3 MiB) 20 | # 21 | # Number Start (sector) End (sector) Size Code Name 22 | # 1 256 131327 64.0 MiB 0700 modem 23 | # 2 131328 132351 512.0 KiB FFFF sbl1 24 | # 3 132352 132415 32.0 KiB FFFF DDR 25 | # 4 132608 133631 512.0 KiB FFFF aboot 26 | # 5 135608 136007 200.0 KiB FFFF rpm 27 | # 6 136608 137407 400.0 KiB FFFF tz 28 | # 7 137608 137671 32.0 KiB FFFF sdi 29 | # 8 137672 138695 512.0 KiB FFFF utags 30 | # 9 138696 142791 2.0 MiB FFFF logs 31 | # 10 142792 147455 2.3 MiB 0700 metadata 32 | # 11 147456 148479 512.0 KiB FFFF abootBackup 33 | # 12 150456 150855 200.0 KiB FFFF rpmBackup 34 | # 13 151456 152255 400.0 KiB FFFF tzBackup 35 | # 14 152456 152519 32.0 KiB 0700 sdiBackup 36 | # 15 152520 153543 512.0 KiB FFFF utagsBackup 37 | # 16 153544 155647 1.0 MiB 0700 padB 38 | # 17 155648 158719 1.5 MiB FFFF modemst1 39 | # 18 158720 161791 1.5 MiB FFFF modemst2 40 | # 19 161792 162815 512.0 KiB FFFF hob 41 | # 20 162816 162831 8.0 KiB FFFF dhob 42 | # 21 163072 166143 1.5 MiB FFFF fsg 43 | # 22 166144 166145 1024 bytes FFFF fsc 44 | # 23 166146 166161 8.0 KiB FFFF ssd 45 | # 24 166162 168209 1024.0 KiB FFFF sp 46 | # 25 168210 168465 128.0 KiB FFFF cid 47 | # 26 168466 174609 3.0 MiB FFFF pds 48 | # 27 174610 182801 4.0 MiB FFFF logo 49 | # 28 182802 190993 4.0 MiB FFFF clogo 50 | # 29 191232 207615 8.0 MiB 0700 persist 51 | # 30 207616 208639 512.0 KiB FFFF misc 52 | # 31 208640 229119 10.0 MiB FFFF boot 53 | # 32 229120 249599 10.0 MiB FFFF recovery 54 | # 33 249600 262143 6.1 MiB 0700 padC 55 | # 34 262144 1409023 560.0 MiB 0700 cache 56 | # 35 1409024 3129343 840.0 MiB 0700 system 57 | # 36 3129344 3145727 8.0 MiB FFFF kpan 58 | # 37 3145728 30711551 13.1 GiB 0700 userdata 59 | 60 | device_makeFlashizeEnv="env/arm.zip" 61 | 62 | #device_makeFilenameConfig="cache=32M+wipe-system=same-data=max" 63 | #device_makeFilenameConfig="cache=32M+wipe-system=976M-data=max" 64 | 65 | device_makeFilenameConfig="cache=424M+wipe-system=976M-data=same" 66 | 67 | device_checkDevice() { 68 | 69 | checkTool getprop 70 | 71 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 72 | *:falcon:*) ;; 73 | *) 74 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 75 | ;; 76 | esac 77 | 78 | } 79 | 80 | device_init() { 81 | 82 | device_checkDevice 83 | 84 | # the block device on which REPIT will operate (only one device is supported): 85 | 86 | #sdev=/sys/devices/msm_sdcc.1/mmc_host/mmc0/mmc0:0001/block/mmcblk0 87 | sdev=/sys/block/mmcblk0 88 | spar=$sdev/mmcblk0p 89 | 90 | ddev=/dev/block/mmcblk0 91 | dpar=/dev/block/mmcblk0p 92 | 93 | sectorSize=512 # in bytes 94 | 95 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 96 | #unmountPattern="${dpar}[0-9]\+" 97 | unmountPattern="/dev/block/mmcblk[^ ]*" 98 | 99 | } 100 | 101 | device_initPartitions() { 102 | 103 | # the set of partitions that can be modified by REPIT: 104 | # 105 | initPartition 34 cache cache "same keep ext4" 0 106 | initPartition 35 system system "same keep ext4" 0 107 | initPartition 36 kpan kpan "same keep raw" 0 108 | initPartition 37 userdata data "same keep ext4" 0 109 | 110 | # the set of modifiable partitions that can be configured by the user (overriding ): 111 | configurablePartitions="34 35 37" 112 | 113 | } 114 | 115 | device_setup() { 116 | 117 | # the number of partitions that the device must have: 118 | partitionCount=37 119 | 120 | # the set of defined heaps: 121 | allHeaps="main" 122 | 123 | # the partition data move chunk size (must fit in memory): 124 | moveDataChunkSize=$(( 256 * MiB )) 125 | 126 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 127 | detectBlockDeviceHeapRange 128 | 129 | # the size of partitions configured with the 'min' keyword: 130 | #heapMinSize=$(( 8 * MiB )) 131 | 132 | # the partition alignment: 133 | heapAlignment=$(( 4 * MiB )) 134 | 135 | } 136 | 137 | device_setupHeap_main() { 138 | 139 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 140 | heapPartitions="$(seq 34 37)" 141 | 142 | # the disk area (as a sector range) to use for the heap partitions: 143 | heapStart=$(parOldEnd 33) # one past the end of a specific partition 144 | heapEnd=$deviceHeapEnd # one past the last usable sector of the device 145 | 146 | } 147 | -------------------------------------------------------------------------------- /device/.disabled/galaxy-s4-mini/serrano3gxx_UNTESTED.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### serrano3gxx 13 | 14 | # This port was possible thanks to the invaluable help of vaedasti. 15 | 16 | # Disk /dev/block/mmcblk0: 15269888 sectors, 7.3 GiB 17 | # Logical sector size: 512 bytes 18 | # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 19 | # Partition table holds up to 128 entries 20 | # First usable sector is 34, last usable sector is 15269854 21 | # Total free space is 8158 sectors (4.0 MiB) 22 | # 23 | # Number Start (sector) End (sector) Size Code Name 24 | # 1 8192 131071 60.0 MiB 0700 modem 25 | # 2 131072 131327 128.0 KiB FFFF sbl1 26 | # 3 131328 131839 256.0 KiB FFFF sbl2 27 | # 4 131840 132863 512.0 KiB FFFF sbl3 28 | # 5 132864 136959 2.0 MiB FFFF aboot 29 | # 6 136960 137983 512.0 KiB FFFF rpm 30 | # 7 137984 139007 512.0 KiB FFFF tz 31 | # 8 139008 164607 12.5 MiB FFFF pad 32 | # 9 164608 180991 8.0 MiB 8300 param 33 | # 10 180992 208895 13.6 MiB 8300 efs 34 | # 11 208896 215039 3.0 MiB FFFF modemst1 35 | # 12 215040 221183 3.0 MiB FFFF modemst2 36 | # 13 221184 241663 10.0 MiB FFFF boot 37 | # 14 241664 262143 10.0 MiB FFFF recovery 38 | # 15 262144 282623 10.0 MiB FFFF fota 39 | # 16 282624 296943 7.0 MiB 8300 backup 40 | # 17 296944 303087 3.0 MiB FFFF fsg 41 | # 18 303088 303103 8.0 KiB FFFF ssd 42 | # 19 303104 319487 8.0 MiB 8300 persist 43 | # 20 319488 344063 12.0 MiB 8300 persdata 44 | # 21 344064 3416063 1.5 GiB 8300 system 45 | # 22 3416064 3825663 200.0 MiB 8300 cache 46 | # 23 3825664 4030463 100.0 MiB 8300 hidden 47 | # 24 4030464 15269854 5.4 GiB 8300 userdata 48 | 49 | device_makeFlashizeEnv="env/arm.zip" 50 | 51 | device_makeFilenameConfig="system=1G-cache=32M+wipe-preload=min+wipe-data=max" 52 | 53 | device_checkDevice() { 54 | 55 | checkTool getprop 56 | 57 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 58 | *:serrano3g:*) ;; 59 | *:serrano3gxx:*) ;; 60 | *) 61 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 62 | ;; 63 | esac 64 | 65 | } 66 | 67 | device_init() { 68 | 69 | device_checkDevice 70 | 71 | # the block device on which REPIT will operate (only one device is supported): 72 | 73 | #sdev=/sys/devices/platform/msm_sdcc.1/mmc_host/mmc0/mmc0:0001/block/mmcblk0 74 | sdev=/sys/block/mmcblk0 75 | spar=$sdev/mmcblk0p 76 | 77 | ddev=/dev/block/mmcblk0 78 | dpar=/dev/block/mmcblk0p 79 | 80 | sectorSize=512 # in bytes 81 | 82 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 83 | #unmountPattern="${dpar}[0-9]\+" 84 | unmountPattern="/dev/block/mmcblk[^ ]*" 85 | 86 | } 87 | 88 | device_initPartitions() { 89 | 90 | # the crypto footer size: 91 | local footerSize=$(( 16384 / sectorSize )) 92 | 93 | # the set of partitions that can be modified by REPIT: 94 | # 95 | initPartition 21 system system "same keep ext4" 0 96 | initPartition 22 cache cache "same keep ext4" 0 97 | initPartition 23 hidden preload "same keep ext4" 0 98 | initPartition 24 userdata data "same keep ext4" $footerSize 99 | 100 | # the set of modifiable partitions that can be configured by the user (overriding ): 101 | configurablePartitions="$(seq 21 24)" 102 | 103 | } 104 | 105 | device_setup() { 106 | 107 | # the number of partitions that the device must have: 108 | partitionCount=24 109 | 110 | # the set of defined heaps: 111 | allHeaps="main" 112 | 113 | # the partition data move chunk size (must fit in memory): 114 | moveDataChunkSize=$(( 256 * MiB )) 115 | 116 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 117 | detectBlockDeviceHeapRange 118 | 119 | # the size of partitions configured with the 'min' keyword: 120 | #heapMinSize=$(( 8 * MiB )) 121 | 122 | # the partition alignment: 123 | heapAlignment=$(( 1 * MiB )) 124 | 125 | } 126 | 127 | device_setupHeap_main() { 128 | 129 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 130 | heapPartitions="$(seq 21 24)" 131 | 132 | # the disk area (as a sector range) to use for the heap partitions: 133 | heapStart=$(parOldEnd 20) # one past the end of a specific partition 134 | heapEnd=$deviceHeapEnd # one past the last usable sector of the device 135 | 136 | } 137 | -------------------------------------------------------------------------------- /device/.disabled/galaxy-s5/common.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### galaxy-s5 13 | 14 | # This port was possible thanks to the invaluable help of wecip. 15 | 16 | # Disk /dev/block/mmcblk0: 30777344 sectors, 14.7 GiB 17 | # Logical sector size: 512 bytes 18 | # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 19 | # Partition table holds up to 128 entries 20 | # First usable sector is 34, last usable sector is 30777310 21 | # Total free space is 8158 sectors (4.0 MiB) 22 | # 23 | # Number Start (sector) End (sector) Size Code Name 24 | # 1 8192 38911 15.0 MiB 8300 apnhlos 25 | # 2 38912 156543 57.4 MiB 0700 modem 26 | # 3 156544 157567 512.0 KiB FFFF sbl1 27 | # 4 157568 157695 64.0 KiB FFFF dbi 28 | # 5 157696 157759 32.0 KiB FFFF ddr 29 | # 6 157760 161855 2.0 MiB FFFF aboot 30 | # 7 161856 162879 512.0 KiB FFFF rpm 31 | # 8 162880 163903 512.0 KiB FFFF tz 32 | # 9 163904 170047 3.0 MiB FFFF fsg 33 | # 10 170048 184319 7.0 MiB FFFF pad 34 | # 11 184320 204799 10.0 MiB FFFF param 35 | # 12 204800 233471 14.0 MiB 8300 efs 36 | # 13 233472 239615 3.0 MiB FFFF modemst1 37 | # 14 239616 245759 3.0 MiB FFFF modemst2 38 | # 15 245760 272383 13.0 MiB FFFF boot 39 | # 16 272384 303103 15.0 MiB FFFF recovery 40 | # 17 303104 329727 13.0 MiB FFFF fota 41 | # 18 329728 344045 7.0 MiB 8300 backup 42 | # 19 344046 344047 1024 bytes FFFF fsc 43 | # 20 344048 344063 8.0 KiB FFFF ssd 44 | # 21 344064 360447 8.0 MiB 8300 persist 45 | # 22 360448 378879 9.0 MiB 8300 persdata 46 | # 23 378880 5498879 2.4 GiB 8300 system 47 | # 24 5498880 5908479 200.0 MiB 8300 cache 48 | # 25 5908480 6010879 50.0 MiB 8300 hidden 49 | # 26 6010880 30777310 11.8 GiB 8300 userdata 50 | 51 | device_makeFlashizeEnv="env/arm.zip" 52 | 53 | device_makeFilenameConfig="system=1G-cache=32M+wipe-preload=min+wipe-data=max" 54 | 55 | device_init() { 56 | 57 | device_checkDevice 58 | 59 | # the block device on which REPIT will operate (only one device is supported): 60 | 61 | #sdev=/sys/devices/msm_sdcc.1/mmc_host/mmc0/mmc0:0001/block/mmcblk0 62 | sdev=/sys/block/mmcblk0 63 | spar=$sdev/mmcblk0p 64 | 65 | ddev=/dev/block/mmcblk0 66 | dpar=/dev/block/mmcblk0p 67 | 68 | sectorSize=512 # in bytes 69 | 70 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 71 | #unmountPattern="${dpar}[0-9]\+" 72 | unmountPattern="/dev/block/mmcblk[^ ]*" 73 | 74 | } 75 | 76 | device_initPartitions() { 77 | 78 | # the crypto footer size: 79 | local footerSize=$(( 16384 / sectorSize )) 80 | 81 | # the set of partitions that can be modified by REPIT: 82 | # 83 | initPartition 23 system system "same keep ext4" 0 84 | initPartition 24 cache cache "same keep ext4" 0 85 | initPartition 25 hidden preload "same keep ext4" 0 86 | initPartition 26 userdata data "same keep ext4" $footerSize 87 | 88 | # the set of modifiable partitions that can be configured by the user (overriding ): 89 | configurablePartitions="$(seq 23 26)" 90 | 91 | } 92 | 93 | device_setup() { 94 | 95 | # the number of partitions that the device must have: 96 | partitionCount=26 97 | 98 | # the set of defined heaps: 99 | allHeaps="main" 100 | 101 | # the partition data move chunk size (must fit in memory): 102 | moveDataChunkSize=$(( 256 * MiB )) 103 | 104 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 105 | detectBlockDeviceHeapRange 106 | 107 | # the size of partitions configured with the 'min' keyword: 108 | #heapMinSize=$(( 8 * MiB )) 109 | 110 | # the partition alignment: 111 | heapAlignment=$(( 1 * MiB )) 112 | 113 | } 114 | 115 | device_setupHeap_main() { 116 | 117 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 118 | heapPartitions="$(seq 23 26)" 119 | 120 | # the disk area (as a sector range) to use for the heap partitions: 121 | heapStart=$(parOldEnd 22) # one past the end of a specific partition 122 | heapEnd=$deviceHeapEnd # one past the last usable sector of the device 123 | 124 | } 125 | -------------------------------------------------------------------------------- /device/.disabled/galaxy-s5/klte_UNTESTED.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### klte 13 | 14 | # This port was possible thanks to the invaluable help of wecip. 15 | 16 | device_checkDevice() { 17 | 18 | checkTool getprop 19 | 20 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 21 | *:kltexx:*) ;; 22 | *:kltelra:*) ;; 23 | *:kltetmo:*) ;; 24 | *:kltecan:*) ;; 25 | *:klteatt:*) ;; 26 | *:klteub:*) ;; 27 | *:klteacg:*) ;; 28 | *:klte:*) ;; 29 | *:kltekor:*) ;; 30 | *:klteskt:*) ;; 31 | *:kltektt:*) ;; 32 | *) 33 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 34 | ;; 35 | esac 36 | 37 | } 38 | -------------------------------------------------------------------------------- /device/.disabled/y560_UNTESTED.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### y560 13 | 14 | # This port was possible thanks to the invaluable help of macio525. 15 | 16 | # Disk /dev/block/mmcblk0: 15269888 sectors, 7.3 GiB 17 | # Logical sector size: 512 bytes 18 | # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 19 | # Partition table holds up to 32 entries 20 | # First usable sector is 34, last usable sector is 15269854 21 | # Total free space is 332856 sectors (162.5 MiB) 22 | # 23 | # Number Start (sector) End (sector) Size Code Name 24 | # 1 131072 262143 64.0 MiB 0700 modem 25 | # 2 262144 263167 512.0 KiB FFFF sbl1 26 | # 3 263168 264191 512.0 KiB FFFF sbl1bak 27 | # 4 264192 266239 1024.0 KiB FFFF aboot 28 | # 5 266240 268287 1024.0 KiB FFFF abootbak 29 | # 6 268288 269311 512.0 KiB FFFF rpm 30 | # 7 269312 270335 512.0 KiB FFFF rpmbak 31 | # 8 270336 271871 768.0 KiB FFFF tz 32 | # 9 271872 273407 768.0 KiB FFFF tzbak 33 | # 10 273408 275455 1024.0 KiB 0700 pad 34 | # 11 275456 278527 1.5 MiB FFFF modemst1 35 | # 12 278528 281599 1.5 MiB FFFF modemst2 36 | # 13 281600 283647 1024.0 KiB FFFF misc 37 | # 14 283648 283649 1024 bytes FFFF fsc 38 | # 15 283650 283665 8.0 KiB FFFF ssd 39 | # 16 283666 304145 10.0 MiB FFFF splash 40 | # 17 393216 393279 32.0 KiB FFFF DDR 41 | # 18 393280 396351 1.5 MiB FFFF fsg 42 | # 19 396352 396383 16.0 KiB FFFF sec 43 | # 20 396384 461919 32.0 MiB FFFF boot 44 | # 21 461920 527455 32.0 MiB FFFF persist 45 | # 22 527456 4538259 1.9 GiB FFFF system 46 | # 23 4538260 5062547 256.0 MiB FFFF cache 47 | # 24 5062548 5128083 32.0 MiB FFFF recovery 48 | # 25 5128084 5130131 1024.0 KiB FFFF devinfo 49 | # 26 5242880 5243903 512.0 KiB FFFF keystore 50 | # 27 5243904 5374975 64.0 MiB FFFF oem 51 | # 28 5374976 5375999 512.0 KiB FFFF config 52 | # 29 5376000 15269854 4.7 GiB FFFF userdata 53 | 54 | device_makeFlashizeEnv="env/arm.zip" 55 | 56 | device_makeFilenameConfig="system=1G-cache=32M+wipe-data=max" 57 | 58 | device_checkDevice() { 59 | 60 | checkTool getprop 61 | 62 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 63 | *:y560:*) ;; 64 | *) 65 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 66 | ;; 67 | esac 68 | 69 | } 70 | 71 | device_init() { 72 | 73 | device_checkDevice 74 | 75 | # the block device on which REPIT will operate (only one device is supported): 76 | 77 | #sdev=/sys/devices/soc.0/7824900.sdhci/mmc_host/mmc0/mmc0:0001/block/mmcblk0 78 | sdev=/sys/block/mmcblk0 79 | spar=$sdev/mmcblk0p 80 | 81 | ddev=/dev/block/mmcblk0 82 | dpar=/dev/block/mmcblk0p 83 | 84 | sectorSize=512 # in bytes 85 | 86 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 87 | #unmountPattern="${dpar}[0-9]\+" 88 | unmountPattern="/dev/block/mmcblk[^ ]*" 89 | 90 | } 91 | 92 | device_initPartitions() { 93 | 94 | # the crypto footer size: 95 | local footerSize=$(( 16384 / sectorSize )) 96 | 97 | # the set of partitions that can be modified by REPIT: 98 | # 99 | initPartition 22 system system "same keep ext4" 0 100 | initPartition 23 cache cache "same keep ext4" 0 101 | initPartition 24 recovery recovery "same keep raw" 0 102 | initPartition 25 devinfo devinfo "same keep raw" 0 103 | initPartition 26 keystore keystore "same keep raw" 0 104 | initPartition 27 oem oem "same keep raw" 0 105 | initPartition 28 config config "same keep raw" 0 106 | initPartition 29 userdata data "same keep ext4" $footerSize 107 | 108 | # the set of modifiable partitions that can be configured by the user (overriding ): 109 | configurablePartitions="22 23 29" 110 | 111 | } 112 | 113 | device_setup() { 114 | 115 | # the number of partitions that the device must have: 116 | partitionCount=29 117 | 118 | # the set of defined heaps: 119 | allHeaps="main" 120 | 121 | # the partition data move chunk size (must fit in memory): 122 | moveDataChunkSize=$(( 256 * MiB )) 123 | 124 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 125 | detectBlockDeviceHeapRange 126 | 127 | # the size of partitions configured with the 'min' keyword: 128 | #heapMinSize=$(( 8 * MiB )) 129 | 130 | # the partition alignment: 131 | #heapAlignment=$(( 2 * 1024 / sectorSize )) # stock alignment of the heap partitions is 2 KiB !!! 132 | heapAlignment=$(( 1 * MiB )) 133 | 134 | } 135 | 136 | device_setupHeap_main() { 137 | 138 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 139 | heapPartitions="$(seq 22 29)" 140 | 141 | # the disk area (as a sector range) to use for the heap partitions: 142 | heapStart=$(parOldEnd 21) # one past the end of a specific partition 143 | heapEnd=$deviceHeapEnd # one past the last usable sector of the device 144 | 145 | } 146 | -------------------------------------------------------------------------------- /device/.disabled/y560_test.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### y560 13 | 14 | # This port was possible thanks to the invaluable help of macio525. 15 | 16 | # Disk /dev/block/mmcblk0: 15269888 sectors, 7.3 GiB 17 | # Logical sector size: 512 bytes 18 | # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 19 | # Partition table holds up to 32 entries 20 | # First usable sector is 34, last usable sector is 15269854 21 | # Total free space is 332856 sectors (162.5 MiB) 22 | # 23 | # Number Start (sector) End (sector) Size Code Name 24 | # 1 131072 262143 64.0 MiB 0700 modem 25 | # 2 262144 263167 512.0 KiB FFFF sbl1 26 | # 3 263168 264191 512.0 KiB FFFF sbl1bak 27 | # 4 264192 266239 1024.0 KiB FFFF aboot 28 | # 5 266240 268287 1024.0 KiB FFFF abootbak 29 | # 6 268288 269311 512.0 KiB FFFF rpm 30 | # 7 269312 270335 512.0 KiB FFFF rpmbak 31 | # 8 270336 271871 768.0 KiB FFFF tz 32 | # 9 271872 273407 768.0 KiB FFFF tzbak 33 | # 10 273408 275455 1024.0 KiB 0700 pad 34 | # 11 275456 278527 1.5 MiB FFFF modemst1 35 | # 12 278528 281599 1.5 MiB FFFF modemst2 36 | # 13 281600 283647 1024.0 KiB FFFF misc 37 | # 14 283648 283649 1024 bytes FFFF fsc 38 | # 15 283650 283665 8.0 KiB FFFF ssd 39 | # 16 283666 304145 10.0 MiB FFFF splash 40 | # 17 393216 393279 32.0 KiB FFFF DDR 41 | # 18 393280 396351 1.5 MiB FFFF fsg 42 | # 19 396352 396383 16.0 KiB FFFF sec 43 | # 20 396384 461919 32.0 MiB FFFF boot 44 | # 21 461920 527455 32.0 MiB FFFF persist 45 | # 22 527456 4538259 1.9 GiB FFFF system 46 | # 23 4538260 5062547 256.0 MiB FFFF cache 47 | # 24 5062548 5128083 32.0 MiB FFFF recovery 48 | # 25 5128084 5130131 1024.0 KiB FFFF devinfo 49 | # 26 5242880 5243903 512.0 KiB FFFF keystore 50 | # 27 5243904 5374975 64.0 MiB FFFF oem 51 | # 28 5374976 5375999 512.0 KiB FFFF config 52 | # 29 5376000 15269854 4.7 GiB FFFF userdata 53 | 54 | device_makeFlashizeEnv="env/arm.zip" 55 | 56 | # device_makeFilenameConfig="system=1G-cache=32M+wipe-data=max" 57 | device_makeFilenameConfig="cache=255M+wipe" 58 | 59 | device_checkDevice() { 60 | 61 | checkTool getprop 62 | 63 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 64 | *:y560:*) ;; 65 | *) 66 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 67 | ;; 68 | esac 69 | 70 | } 71 | 72 | device_init() { 73 | 74 | device_checkDevice 75 | 76 | # the block device on which REPIT will operate (only one device is supported): 77 | 78 | #sdev=/sys/devices/soc.0/7824900.sdhci/mmc_host/mmc0/mmc0:0001/block/mmcblk0 79 | sdev=/sys/block/mmcblk0 80 | spar=$sdev/mmcblk0p 81 | 82 | ddev=/dev/block/mmcblk0 83 | dpar=/dev/block/mmcblk0p 84 | 85 | sectorSize=512 # in bytes 86 | 87 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 88 | #unmountPattern="${dpar}[0-9]\+" 89 | unmountPattern="/dev/block/mmcblk[^ ]*" 90 | 91 | } 92 | 93 | device_initPartitions() { 94 | 95 | # the crypto footer size: 96 | local footerSize=$(( 16384 / sectorSize )) 97 | 98 | # the set of partitions that can be modified by REPIT: 99 | # 100 | # initPartition 22 system system "same keep ext4" 0 101 | initPartition 23 cache cache "same keep ext4" 0 102 | initPartition 24 recovery recovery "same keep raw" 0 103 | # initPartition 25 devinfo devinfo "same keep raw" 0 104 | # initPartition 26 keystore keystore "same keep raw" 0 105 | # initPartition 27 oem oem "same keep raw" 0 106 | # initPartition 28 config config "same keep raw" 0 107 | # initPartition 29 userdata data "same keep ext4" $footerSize 108 | 109 | # the set of modifiable partitions that can be configured by the user (overriding ): 110 | # configurablePartitions="22 23 29" 111 | configurablePartitions="23" 112 | 113 | } 114 | 115 | device_setup() { 116 | 117 | # the number of partitions that the device must have: 118 | partitionCount=29 119 | 120 | # the set of defined heaps: 121 | allHeaps="main" 122 | 123 | # the partition data move chunk size (must fit in memory): 124 | moveDataChunkSize=$(( 256 * MiB )) 125 | 126 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 127 | detectBlockDeviceHeapRange 128 | 129 | # the size of partitions configured with the 'min' keyword: 130 | #heapMinSize=$(( 8 * MiB )) 131 | 132 | # the partition alignment: 133 | # heapAlignment=$(( 1 * MiB )) 134 | heapAlignment=$(( 2 * 1024 / sectorSize )) 135 | 136 | } 137 | 138 | device_setupHeap_main() { 139 | 140 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 141 | # heapPartitions="$(seq 22 29)" 142 | heapPartitions="$(seq 23 24)" 143 | 144 | # the disk area (as a sector range) to use for the heap partitions: 145 | # heapStart=$(parOldEnd 21) # one past the end of a specific partition 146 | # heapEnd=$deviceHeapEnd # one past the last usable sector of the device 147 | heapStart=$(parOldEnd 22) # one past the end of a specific partition 148 | heapEnd=$(parOldStart 25) # or the start of a specific partition 149 | 150 | } 151 | -------------------------------------------------------------------------------- /device/cherry.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### cherry 13 | 14 | # This port was possible thanks to the invaluable help of jerryhou85. 15 | 16 | # Disk /dev/block/mmcblk0: 15269888 sectors, 7.3 GiB 17 | # Logical sector size: 512 bytes 18 | # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 19 | # Partition table holds up to 24 entries 20 | # First usable sector is 34, last usable sector is 15269854 21 | # Partitions will be aligned on 1-sector boundaries 22 | # Total free space is 16350 sectors (8.0 MiB) 23 | # 24 | # Number Start (sector) End (sector) Size Code Name 25 | # 1 34 1057 512.0 KiB FFFF sbl1 26 | # 2 1058 2081 512.0 KiB FFFF hyp 27 | # 3 8192 8255 32.0 KiB FFFF sec 28 | # 4 8256 8319 32.0 KiB FFFF DDR 29 | # 5 16384 17407 512.0 KiB FFFF rpm 30 | # 6 17408 18431 512.0 KiB FFFF tz 31 | # 7 18432 28543 4.9 MiB FFFF aboot 32 | # 8 28544 30591 1024.0 KiB FFFF pad 33 | # 9 30592 161663 64.0 MiB FFFF oeminfo 34 | # 10 161664 169855 4.0 MiB FFFF modemst1 35 | # 11 169856 178047 4.0 MiB FFFF modemst2 36 | # 12 180224 376831 96.0 MiB FFFF modem 37 | # 13 376832 385023 4.0 MiB FFFF fsg 38 | # 14 385024 389119 2.0 MiB FFFF fsc 39 | # 15 389120 393215 2.0 MiB FFFF ssd 40 | # 16 393216 524287 64.0 MiB FFFF log 41 | # 17 524288 589823 32.0 MiB FFFF persist 42 | # 18 589824 630783 20.0 MiB FFFF boot 43 | # 19 630784 679935 24.0 MiB FFFF recovery 44 | # 20 679936 2252799 768.0 MiB FFFF cust 45 | # 21 2252800 2777087 256.0 MiB FFFF cache 46 | # 22 2777088 2785279 4.0 MiB FFFF misc 47 | # 23 2785280 6455295 1.8 GiB FFFF system 48 | # 24 6455296 15269854 4.2 GiB 0700 userdata 49 | 50 | device_makeFlashizeEnv="env/arm.zip" 51 | 52 | device_makeFilenameConfig="cust=min+wipe-cache=32M+wipe-system=1G-data=max" 53 | 54 | device_checkDevice() { 55 | 56 | checkTool getprop 57 | 58 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 59 | *:cherry:*) ;; 60 | *:Che1-CL20:*) ;; 61 | *) 62 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 63 | ;; 64 | esac 65 | 66 | } 67 | 68 | device_init() { 69 | 70 | device_checkDevice 71 | 72 | # the block device on which REPIT will operate (only one device is supported): 73 | 74 | #sdev=/sys/devices/soc.0/7824900.sdhci/mmc_host/mmc0/mmc0:0001/block/mmcblk0 75 | sdev=/sys/block/mmcblk0 76 | spar=$sdev/mmcblk0p 77 | 78 | ddev=/dev/block/mmcblk0 79 | dpar=/dev/block/mmcblk0p 80 | 81 | sectorSize=512 # in bytes 82 | 83 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 84 | #unmountPattern="${dpar}[0-9]\+" 85 | unmountPattern="/dev/block/mmcblk[^ ]*" 86 | 87 | } 88 | 89 | device_initPartitions() { 90 | 91 | # the crypto footer size: 92 | local footerSize=$(( 16384 / sectorSize )) 93 | 94 | # the set of partitions that can be modified by REPIT: 95 | # 96 | initPartition 20 cust cust "same keep ext4" 0 97 | initPartition 21 cache cache "same keep ext4" 0 98 | initPartition 22 misc misc "same keep raw" 0 99 | initPartition 23 system system "same keep ext4" 0 100 | initPartition 24 userdata data "same keep ext4" $footerSize 101 | 102 | # the set of modifiable partitions that can be configured by the user (overriding ): 103 | configurablePartitions="20 21 23 24" 104 | 105 | } 106 | 107 | device_setup() { 108 | 109 | # the number of partitions that the device must have: 110 | partitionCount=24 111 | 112 | # the set of defined heaps: 113 | allHeaps="main" 114 | 115 | # the partition data move chunk size (must fit in memory): 116 | moveDataChunkSize=$(( 512 * MiB )) 117 | 118 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 119 | detectBlockDeviceHeapRange 120 | 121 | # the size of partitions configured with the 'min' keyword: 122 | #heapMinSize=$(( 8 * MiB )) 123 | 124 | # the partition alignment: 125 | heapAlignment=$(( 4 * MiB )) 126 | 127 | } 128 | 129 | device_setupHeap_main() { 130 | 131 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 132 | heapPartitions="$(seq 20 24)" 133 | 134 | # the disk area (as a sector range) to use for the heap partitions: 135 | heapStart=$(parOldEnd 19) # one past the end of a specific partition 136 | heapEnd=$deviceHeapEnd # one past the last usable sector of the device 137 | 138 | } 139 | -------------------------------------------------------------------------------- /device/dior.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### dior 13 | 14 | # This port was possible thanks to the invaluable help of jerryhou85. 15 | 16 | # Caution: invalid backup GPT header, but valid main header; regenerating 17 | # backup header from main header. 18 | # 19 | # **************************************************************************** 20 | # Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk 21 | # verification and recovery are STRONGLY recommended. 22 | # **************************************************************************** 23 | # Disk /dev/block/mmcblk0: 15269888 sectors, 7.3 GiB 24 | # Logical sector size: 512 bytes 25 | # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 26 | # Partition table holds up to 32 entries 27 | # First usable sector is 34, last usable sector is 15269854 28 | # Total free space is 65546 sectors (32.0 MiB) 29 | # 30 | # Number Start (sector) End (sector) Size Code Name 31 | # 1 34 4095 2.0 MiB FFFF sbl1 32 | # 2 4096 8157 2.0 MiB 0700 sbl1bak 33 | # 3 8158 10205 1024.0 KiB FFFF rpm 34 | # 4 10206 12253 1024.0 KiB 0700 rpmbak 35 | # 5 12254 14301 1024.0 KiB FFFF tz 36 | # 6 14302 16349 1024.0 KiB 0700 tzbak 37 | # 7 16350 16365 8.0 KiB FFFF ssd 38 | # 8 16366 18413 1024.0 KiB FFFF sdi 39 | # 9 18414 20461 1024.0 KiB FFFF DDR 40 | # 10 20462 28653 4.0 MiB FFFF aboot 41 | # 11 28654 36845 4.0 MiB 0700 abootbak 42 | # 12 36846 47085 5.0 MiB 8300 bk1 43 | # 13 47086 55277 4.0 MiB FFFF misc 44 | # 14 55278 71661 8.0 MiB 8300 logo 45 | # 15 71662 131061 29.0 MiB 8300 bk2 46 | # 16 131062 134133 1.5 MiB FFFF modemst1 47 | # 17 134134 137205 1.5 MiB FFFF modemst2 48 | # 18 137206 137207 1024 bytes FFFF fsc 49 | # 19 137208 262133 61.0 MiB 8300 bk3 50 | # 20 262134 265205 1.5 MiB FFFF fsg 51 | # 21 265206 327669 30.5 MiB 8300 bk4 52 | # 22 327670 393205 32.0 MiB 8300 bk5 53 | # 23 393206 524277 64.0 MiB 0700 modem 54 | # 24 524278 557045 16.0 MiB FFFF boot 55 | # 25 557046 589813 16.0 MiB FFFF recovery 56 | # 26 589814 655349 32.0 MiB 0700 persist 57 | # 27 655350 2293749 800.0 MiB 0700 system 58 | # 28 2293750 3080181 384.0 MiB 0700 cache 59 | # 29 3145728 15269854 5.8 GiB 0700 userdata 60 | 61 | device_makeFlashizeEnv="env/arm.zip" 62 | 63 | #device_makeFilenameConfig="system=1160M-cache=32M+wipe-data=same" 64 | #device_makeFilenameConfig="system=max-cache=32M+wipe-data=same" 65 | 66 | #device_makeFilenameConfig="system=1G-cache=168M+wipe-data=same" 67 | #device_makeFilenameConfig="system=1G-cache=max+wipe-data=same" 68 | 69 | device_makeFilenameConfig="system=same-cache=32M+wipe-data=max" 70 | 71 | device_checkDevice() { 72 | 73 | checkTool getprop 74 | 75 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 76 | *:dior:*) ;; 77 | *) 78 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 79 | ;; 80 | esac 81 | 82 | } 83 | 84 | device_init() { 85 | 86 | device_checkDevice 87 | 88 | # the block device on which REPIT will operate (only one device is supported): 89 | 90 | #sdev=/sys/devices/msm_sdcc.1/mmc_host/mmc0/mmc0:0001/block/mmcblk0 91 | sdev=/sys/block/mmcblk0 92 | spar=$sdev/mmcblk0p 93 | 94 | ddev=/dev/block/mmcblk0 95 | dpar=/dev/block/mmcblk0p 96 | 97 | sectorSize=512 # in bytes 98 | 99 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 100 | #unmountPattern="${dpar}[0-9]\+" 101 | unmountPattern="/dev/block/mmcblk[^ ]*" 102 | 103 | } 104 | 105 | device_initPartitions() { 106 | 107 | # the set of partitions that can be modified by REPIT: 108 | # 109 | initPartition 27 system system "same keep ext4" 0 110 | initPartition 28 cache cache "same keep ext4" 0 111 | initPartition 29 userdata data "same keep ext4" 0 112 | 113 | # the set of modifiable partitions that can be configured by the user (overriding ): 114 | configurablePartitions="$(seq 27 29)" 115 | 116 | } 117 | 118 | device_setup() { 119 | 120 | # the number of partitions that the device must have: 121 | partitionCount=29 122 | 123 | # the set of defined heaps: 124 | allHeaps="main" 125 | 126 | # the partition data move chunk size (must fit in memory): 127 | moveDataChunkSize=$(( 256 * MiB )) 128 | 129 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 130 | detectBlockDeviceHeapRange 131 | 132 | # the size of partitions configured with the 'min' keyword: 133 | #heapMinSize=$(( 8 * MiB )) 134 | 135 | # the partition alignment: 136 | heapAlignment=$(( 4 * MiB )) 137 | 138 | } 139 | 140 | device_setupHeap_main() { 141 | 142 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 143 | heapPartitions="$(seq 27 29)" 144 | 145 | # the disk area (as a sector range) to use for the heap partitions: 146 | heapStart=$(parOldEnd 26) # one past the end of a specific partition 147 | heapEnd=$deviceHeapEnd # one past the last usable sector of the device 148 | 149 | } 150 | -------------------------------------------------------------------------------- /device/galaxy-j5/common.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### galaxy-j5 13 | 14 | # This port was possible thanks to the invaluable help of ajislav. 15 | 16 | # Disk /dev/block/mmcblk0: 15269888 sectors, 7.3 GiB 17 | # Logical sector size: 512 bytes 18 | # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 19 | # Partition table holds up to 128 entries 20 | # First usable sector is 34, last usable sector is 15269854 21 | # Total free space is 8165 sectors (4.0 MiB) 22 | # 23 | # Number Start (sector) End (sector) Size Code Name 24 | # 1 8192 38911 15.0 MiB 0700 apnhlos 25 | # 2 38912 156543 57.4 MiB 0700 modem 26 | # 3 156544 157567 512.0 KiB FFFF sbl1 27 | # 4 157568 157631 32.0 KiB FFFF ddr 28 | # 5 157632 161727 2.0 MiB FFFF aboot 29 | # 6 161728 162751 512.0 KiB FFFF rpm 30 | # 7 162752 163775 512.0 KiB FFFF qsee 31 | # 8 163776 164799 512.0 KiB FFFF qhee 32 | # 9 164800 170943 3.0 MiB FFFF fsg 33 | # 10 170944 170975 16.0 KiB FFFF sec 34 | # 11 170976 192511 10.5 MiB 0700 pad 35 | # 12 192512 212991 10.0 MiB FFFF param 36 | # 13 212992 241663 14.0 MiB 8300 efs 37 | # 14 241664 247807 3.0 MiB FFFF modemst1 38 | # 15 247808 253951 3.0 MiB FFFF modemst2 39 | # 16 253952 280575 13.0 MiB FFFF boot 40 | # 17 280576 311295 15.0 MiB FFFF recovery 41 | # 18 311296 336897 12.5 MiB FFFF fota 42 | # 19 336898 351215 7.0 MiB 8300 backup 43 | # 20 351216 357359 3.0 MiB FFFF fsc 44 | # 21 357360 357375 8.0 KiB FFFF ssd 45 | # 22 357376 373759 8.0 MiB 8300 persist 46 | # 23 373760 374783 512.0 KiB 8300 persistent 47 | # 24 374784 393215 9.0 MiB 8300 persdata 48 | # 25 393216 4653055 2.0 GiB 8300 system 49 | # 26 4653056 5062655 200.0 MiB 8300 cache 50 | # 27 5062656 5206015 70.0 MiB 8300 hidden 51 | # 28 5206016 15269847 4.8 GiB 8300 userdata 52 | 53 | device_makeFlashizeEnv="env/arm.zip" 54 | 55 | device_makeFilenameConfig="system=1G-cache=32M+wipe-preload=min+wipe-data=max" 56 | 57 | device_init() { 58 | 59 | device_checkDevice 60 | 61 | # the block device on which REPIT will operate (only one device is supported): 62 | 63 | #sdev=/sys/devices/soc.0/7824900.sdhci/mmc_host/mmc0/mmc0:0001/block/mmcblk0 64 | sdev=/sys/block/mmcblk0 65 | spar=$sdev/mmcblk0p 66 | 67 | ddev=/dev/block/mmcblk0 68 | dpar=/dev/block/mmcblk0p 69 | 70 | sectorSize=512 # in bytes 71 | 72 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 73 | #unmountPattern="${dpar}[0-9]\+" 74 | unmountPattern="/dev/block/mmcblk[^ ]*" 75 | 76 | } 77 | 78 | device_initPartitions() { 79 | 80 | # the crypto footer size: 81 | local footerSize=$(( 16384 / sectorSize )) 82 | 83 | # the set of partitions that can be modified by REPIT: 84 | # 85 | initPartition 25 system system "same keep ext4" 0 86 | initPartition 26 cache cache "same keep ext4" 0 87 | initPartition 27 hidden preload "same keep ext4" 0 88 | initPartition 28 userdata data "same keep ext4" $footerSize 89 | 90 | # the set of modifiable partitions that can be configured by the user (overriding ): 91 | configurablePartitions="$(seq 25 28)" 92 | 93 | } 94 | 95 | device_setup() { 96 | 97 | # the number of partitions that the device must have: 98 | partitionCount=28 99 | 100 | # the set of defined heaps: 101 | allHeaps="main" 102 | 103 | # the partition data move chunk size (must fit in memory): 104 | moveDataChunkSize=$(( 256 * MiB )) 105 | 106 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 107 | detectBlockDeviceHeapRange 108 | 109 | # the size of partitions configured with the 'min' keyword: 110 | #heapMinSize=$(( 8 * MiB )) 111 | 112 | # the partition alignment: 113 | heapAlignment=$(( 1 * MiB )) 114 | 115 | } 116 | 117 | device_setupHeap_main() { 118 | 119 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 120 | heapPartitions="$(seq 25 28)" 121 | 122 | # the disk area (as a sector range) to use for the heap partitions: 123 | heapStart=$(parOldEnd 24) # one past the end of a specific partition 124 | heapEnd=$deviceHeapEnd # one past the last usable sector of the device 125 | 126 | } 127 | -------------------------------------------------------------------------------- /device/galaxy-j5/j5lte.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### j5lte 13 | 14 | # This port was possible thanks to the invaluable help of ajislav. 15 | 16 | device_checkDevice() { 17 | 18 | checkTool getprop 19 | 20 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 21 | *:j5lte:*) ;; 22 | *) 23 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 24 | ;; 25 | esac 26 | 27 | } 28 | -------------------------------------------------------------------------------- /device/galaxy-s2/common.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### galaxy-s2 13 | 14 | device_makeFlashizeEnv="env/arm.zip" 15 | 16 | device_makeFilenameConfig="system=1G-data=same-sdcard=max-preload=min+wipe" 17 | 18 | device_init() { 19 | 20 | device_checkDevice 21 | 22 | # the block device on which REPIT will operate (only one device is supported): 23 | 24 | # exynos 4210: 25 | #sdev=/sys/devices/platform/dw_mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0 26 | # omap 4430: 27 | #sdev=/sys/devices/platform/omap/omap_hsmmc.1/mmc_host/mmc0/mmc0:0001/block/mmcblk0 28 | sdev=/sys/block/mmcblk0 29 | spar=$sdev/mmcblk0p 30 | 31 | ddev=/dev/block/mmcblk0 32 | dpar=/dev/block/mmcblk0p 33 | 34 | sectorSize=512 # in bytes 35 | 36 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 37 | 38 | # unmounting the partitions of the selected block device seems to be enough: 39 | #unmountPattern="${dpar}[0-9]\+" 40 | 41 | # but we will unmount the external sdcard too (due to some reports that i was so far unable to reproduce): 42 | #unmountPattern="/dev/block/mmcblk\(0\|1\)\(p[0-9]\+\)\?" 43 | unmountPattern="/dev/block/mmcblk[^ ]*" 44 | 45 | } 46 | 47 | device_initPartitions() { 48 | 49 | # the crypto footer size: 50 | local footerSize=$(( 16384 / sectorSize )) 51 | # not all partition types support crypto footers; those that do not will ignore the value passed to initPartition. 52 | # also, not all devices use crypto footers; on those devices, pass a value of zero to initPartition for all partitions. 53 | 54 | # the set of partitions that can be modified by REPIT: 55 | # 56 | #initPartition 7 CACHE cache "same keep ext4" 0 57 | #initPartition 8 MODEM modem "same keep raw" 0 58 | initPartition 9 FACTORYFS system "same keep ext4" 0 59 | initPartition 10 DATAFS data "same keep ext4" $footerSize 60 | initPartition 11 UMS sdcard "same keep vfat" 0 61 | initPartition 12 HIDDEN preload "same keep ext4" 0 62 | 63 | # resizing cache is disabled for now since i am not sure that the modem partition can be safely moved simply by updating 64 | # the GPT and not changing the PIT. it is possible that whatever code boots up the modem might read the partition offset 65 | # from the PIT and not the GPT. it is also possible that the device might brick if the modem cannot be brought up. 66 | 67 | # the set of modifiable partitions that can be configured by the user (overriding ): 68 | #configurablePartitions="7 $(seq 9 12)" 69 | configurablePartitions="$(seq 9 12)" 70 | # for some partitions it may be unsafe to do anything besides moving them around; those should be left out of this set. 71 | 72 | } 73 | 74 | device_setup() { 75 | 76 | ### this is the first function that can access block devices and/or their metadata. 77 | 78 | # the number of partitions that the device must have: 79 | partitionCount=12 80 | 81 | # the set of defined heaps: 82 | allHeaps="main" 83 | 84 | # the partition data move chunk size (must fit in memory): 85 | moveDataChunkSize=$(( 256 * MiB )) 86 | 87 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 88 | detectBlockDeviceHeapRange 89 | 90 | ### the following settings are actually per-heap, but can be defined here instead if their values are constant. 91 | 92 | # the size of partitions configured with the 'min' keyword: 93 | #heapMinSize=$(( 8 * MiB )) 94 | # this defaults to 8 MiB, the smallest power-of-2 size that will fit a standard ext4 file system. 95 | # note: this setting only applies to the 'min' keyword; partition sizes all the way down to $heapSizeGranularity 96 | # can still be manually defined even if they are smaller than $heapMinSize. 97 | 98 | # the partition alignment: 99 | heapAlignment=$(( 4 * MiB )) 100 | # for best results it is recommended that you use the same alignment chosen by the device OEM. 101 | # you can determine its value by analyzing the stock partitioning, for example with this command: 102 | # > parted /dev/block/whatever -s unit MiB print free 103 | # if in doubt, use 1 or 4 MiB. 104 | 105 | # user-configured partition sizes will be rounded (to nearest) to multiples of this value: 106 | #heapSizeGranularity=$heapAlignment 107 | # this defaults to $heapAlignment and should normally not be changed. 108 | 109 | } 110 | 111 | device_setupHeap_main() { 112 | 113 | # each heap is a set of partitions that are physically contiguous in the block device. 114 | # all partition manipulation works exclusively within a heap. 115 | 116 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 117 | #heapPartitions="$(seq 7 12)" 118 | heapPartitions="$(seq 9 12)" 119 | 120 | # the disk area (as a sector range) to use for the heap partitions: 121 | # (the sector range is from heapStart to heapEnd-1 inclusive.) 122 | 123 | #heapStart=$deviceHeapStart # the first usable sector of the device 124 | #heapStart=$(parOldEnd 6) # or one past the end of a specific partition 125 | heapStart=$(parOldEnd 8) # or one past the end of a specific partition 126 | #heapStart=344064 # or a fixed sector number 127 | 128 | heapEnd=$deviceHeapEnd # one past the last usable sector of the device 129 | #heapEnd=$(parOldStart 13) # or the start of a specific partition 130 | #heapEnd=30769152 # or a fixed sector number 131 | 132 | } 133 | -------------------------------------------------------------------------------- /device/galaxy-s2/exynos-4210/d710.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### d710 13 | 14 | device_checkDevice() { 15 | 16 | checkTool getprop 17 | 18 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 19 | *:epic4gtouch:*) ;; 20 | *:SPH-D710:*) ;; 21 | *:d710:*) ;; 22 | *:smdk4210:*) ;; 23 | *:SPH-D710VMUB:*) ;; 24 | *:SPH-D710BST:*) ;; 25 | *) 26 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 27 | ;; 28 | esac 29 | 30 | } 31 | -------------------------------------------------------------------------------- /device/galaxy-s2/exynos-4210/i777.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### i777 13 | 14 | device_checkDevice() { 15 | 16 | checkTool getprop 17 | 18 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 19 | *:i777:*) ;; 20 | *:SGH-I777:*) ;; 21 | *:SGH-S959G:*) ;; 22 | *) 23 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 24 | ;; 25 | esac 26 | 27 | } 28 | -------------------------------------------------------------------------------- /device/galaxy-s2/exynos-4210/i9100.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### i9100 13 | 14 | device_checkDevice() { 15 | 16 | checkTool getprop 17 | 18 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 19 | *:galaxys2:*) ;; 20 | *:i9100:*) ;; 21 | *:GT-I9100:*) ;; 22 | *:GT-I9100M:*) ;; 23 | *:GT-I9100P:*) ;; 24 | *:GT-I9100T:*) ;; 25 | *:SC-02C:*) ;; 26 | *) 27 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 28 | ;; 29 | esac 30 | 31 | } 32 | 33 | ### code after this comment is old and no longer used. it is here for documentation purposes only. 34 | 35 | device_detectBlockDeviceSize_i9100() { 36 | 37 | # this is unused code from when detectBlockDeviceHeapRange had not yet been implemented. 38 | # it is here for documentation purposes only, ports to other devices should delete this function. 39 | 40 | info "detecting eMMC size" 41 | 42 | local deviceSize=$(cat $sdev/size) 43 | local heapEnd8GB=15261696 44 | local heapEnd16GB=30769152 45 | local heapEnd32GB=62513152 46 | if [ $(( deviceSize < heapEnd8GB )) -ne 0 ]; then 47 | fatal "eMMC size too small" 48 | elif [ $(( deviceSize < heapEnd16GB )) -ne 0 ]; then 49 | heapEnd=$heapEnd8GB 50 | info "eMMC size is 8 GB" 51 | elif [ $(( deviceSize < heapEnd32GB )) -ne 0 ]; then 52 | heapEnd=$heapEnd16GB 53 | info "eMMC size is 16 GB" 54 | else 55 | heapEnd=$heapEnd32GB 56 | info "eMMC size is 32 GB" 57 | fi 58 | 59 | } 60 | 61 | device_configureStockLayout_i9100() { 62 | 63 | # this is unused code from when the configuration parser had not yet been implemented. 64 | # it is here for documentation purposes only, ports to other devices should delete this function. 65 | 66 | # stock partition layout for i9100: 67 | 68 | system_size=0.5 69 | data_size=2 70 | #sdcard_size=11.5078 71 | sdcard_size=max 72 | preload_size=0.5 73 | 74 | system_fs=ext4 75 | data_fs=ext4 76 | sdcard_fs=vfat 77 | preload_fs=ext4 78 | 79 | } 80 | -------------------------------------------------------------------------------- /device/galaxy-s2/exynos-4210/n7000.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### n7000 13 | 14 | device_checkDevice() { 15 | 16 | checkTool getprop 17 | 18 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 19 | *:galaxynote:*) ;; 20 | *:n7000:*) ;; 21 | *:N7000:*) ;; 22 | *:GT-N7000:*) ;; 23 | *) 24 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 25 | ;; 26 | esac 27 | 28 | } 29 | -------------------------------------------------------------------------------- /device/galaxy-s2/exynos-4210/sc02c.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### sc02c 13 | 14 | device_checkDevice() { 15 | 16 | checkTool getprop 17 | 18 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 19 | *:galaxys2:*) ;; 20 | *:i9100:*) ;; 21 | *:GT-I9100:*) ;; 22 | *:GT-I9100M:*) ;; 23 | *:GT-I9100P:*) ;; 24 | *:GT-I9100T:*) ;; 25 | *:SC-02C:*) ;; 26 | *) 27 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 28 | ;; 29 | esac 30 | 31 | } 32 | -------------------------------------------------------------------------------- /device/galaxy-s2/omap-4430/i9100g.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### i9100g 13 | 14 | # This port was possible thanks to the invaluable help of MalcolmMcConnor. 15 | 16 | device_checkDevice() { 17 | 18 | checkTool getprop 19 | 20 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 21 | *:i9100g:*) ;; 22 | *:GT-I9100G:*) ;; 23 | *) 24 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 25 | ;; 26 | esac 27 | 28 | } 29 | -------------------------------------------------------------------------------- /device/galaxy-s3/exynos/i9300.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### i9300 13 | 14 | # This port was possible thanks to the invaluable help of ElPumpo/Hawaii_Beach. 15 | 16 | # Disk /dev/block/mmcblk0: 30777344 sectors, 2740M 17 | # Logical sector size: 512 18 | # Disk identifier (GUID): 52444e41-494f-2044-4d4d-43204449534b 19 | # Partition table holds up to 128 entries 20 | # First usable sector is 34, last usable sector is 30777310 21 | # 22 | # Number Start (sector) End (sector) Size Code Name 23 | # 1 8192 16383 4096K 0700 BOTA0 24 | # 2 16384 24575 4096K 0700 BOTA1 25 | # 3 24576 65535 20.0M 0700 EFS 26 | # 4 65536 81919 8192K 0700 PARAM 27 | # 5 81920 98303 8192K 0700 BOOT 28 | # 6 98304 114687 8192K 0700 RECOVERY 29 | # 7 114688 180223 32.0M 0700 RADIO 30 | # 8 180224 2277375 1024M 0700 CACHE 31 | # 9 2277376 5423103 1536M 0700 SYSTEM 32 | # 10 5423104 6569983 560M 0700 HIDDEN 33 | # 11 6569984 6586367 8192K 0700 OTA 34 | # 12 6586368 30769151 11.5G 0700 USERDATA 35 | 36 | device_makeFlashizeEnv="env/arm.zip" 37 | 38 | device_makeFilenameConfig="cache=32M+wipe-system=same-preload=min+wipe-data=max" 39 | 40 | device_checkDevice() { 41 | 42 | checkTool getprop 43 | 44 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 45 | *:m0:*) ;; 46 | *:i9300:*) ;; 47 | *:GT-I9300:*) ;; 48 | *) 49 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 50 | ;; 51 | esac 52 | 53 | } 54 | 55 | device_init() { 56 | 57 | device_checkDevice 58 | 59 | # the block device on which REPIT will operate (only one device is supported): 60 | 61 | #sdev=/sys/devices/platform/dw_mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0 62 | sdev=/sys/block/mmcblk0 63 | spar=$sdev/mmcblk0p 64 | 65 | ddev=/dev/block/mmcblk0 66 | dpar=/dev/block/mmcblk0p 67 | 68 | sectorSize=512 # in bytes 69 | 70 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 71 | #unmountPattern="${dpar}[0-9]\+" 72 | unmountPattern="/dev/block/mmcblk[^ ]*" 73 | 74 | } 75 | 76 | device_initPartitions() { 77 | 78 | # the crypto footer size: 79 | local footerSize=$(( 16384 / sectorSize )) 80 | 81 | # the set of partitions that can be modified by REPIT: 82 | # 83 | initPartition 8 CACHE cache "same keep ext4" 0 84 | initPartition 9 SYSTEM system "same keep ext4" 0 85 | initPartition 10 HIDDEN preload "same keep ext4" 0 86 | initPartition 11 OTA ota "same keep raw" 0 87 | initPartition 12 USERDATA data "same keep ext4" $footerSize 88 | 89 | # the set of modifiable partitions that can be configured by the user (overriding ): 90 | configurablePartitions="$(seq 8 12)" 91 | 92 | } 93 | 94 | device_setup() { 95 | 96 | # the number of partitions that the device must have: 97 | partitionCount=12 98 | 99 | # the set of defined heaps: 100 | allHeaps="main" 101 | 102 | # the partition data move chunk size (must fit in memory): 103 | moveDataChunkSize=$(( 256 * MiB )) 104 | 105 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 106 | detectBlockDeviceHeapRange 107 | 108 | # the size of partitions configured with the 'min' keyword: 109 | #heapMinSize=$(( 8 * MiB )) 110 | 111 | # the partition alignment: 112 | heapAlignment=$(( 4 * MiB )) 113 | 114 | } 115 | 116 | device_setupHeap_main() { 117 | 118 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 119 | heapPartitions="$(seq 8 12)" 120 | 121 | # the disk area (as a sector range) to use for the heap partitions: 122 | heapStart=$(parOldEnd 7) # one past the end of a specific partition 123 | heapEnd=$deviceHeapEnd # one past the last usable sector of the device 124 | 125 | } 126 | -------------------------------------------------------------------------------- /device/galaxy-s3/exynos/i9305.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### i9305 13 | 14 | # This port was possible thanks to the invaluable help of nishimura-san. 15 | 16 | # Disk /dev/block/mmcblk0: 30777344 sectors, 14.7 GiB 17 | # Logical sector size: 512 bytes 18 | # Disk identifier (GUID): 52444E41-494F-2044-4D4D-43204449534B 19 | # Partition table holds up to 128 entries 20 | # First usable sector is 34, last usable sector is 30777310 21 | # Total free space is 16317 sectors (8.0 MiB) 22 | # 23 | # Number Start (sector) End (sector) Size Code Name 24 | # 1 8192 16383 4.0 MiB 0700 BOTA0 25 | # 2 16384 24575 4.0 MiB 0700 BOTA1 26 | # 3 24576 65535 20.0 MiB 0700 EFS 27 | # 4 65536 73727 4.0 MiB 0700 m9kefs1 28 | # 5 73728 81919 4.0 MiB 0700 m9kefs2 29 | # 6 81920 90111 4.0 MiB 0700 m9kefs3 30 | # 7 90112 106495 8.0 MiB 0700 PARAM 31 | # 8 106496 122879 8.0 MiB 0700 BOOT 32 | # 9 122880 139263 8.0 MiB 0700 RECOVERY 33 | # 10 139264 319487 88.0 MiB 0700 RADIO 34 | # 11 319488 843775 256.0 MiB 0700 TOMBSTONES 35 | # 12 843776 2940927 1024.0 MiB 0700 CACHE 36 | # 13 2940928 6086655 1.5 GiB 0700 SYSTEM 37 | # 14 6086656 7233535 560.0 MiB 0700 HIDDEN 38 | # 15 7233536 7249919 8.0 MiB 0700 OTA 39 | # 16 7249920 30769151 11.2 GiB 0700 USERDATA 40 | 41 | device_makeFlashizeEnv="env/arm.zip" 42 | 43 | device_makeFilenameConfig="tombstones=same-cache=32M+wipe-system=1G-preload=min+wipe-data=max" 44 | 45 | device_checkDevice() { 46 | 47 | checkTool getprop 48 | 49 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 50 | *:m3:*) ;; 51 | *:m3xx:*) ;; 52 | *:i9305:*) ;; 53 | *:GT-I9305:*) ;; 54 | *) 55 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 56 | ;; 57 | esac 58 | 59 | } 60 | 61 | device_init() { 62 | 63 | device_checkDevice 64 | 65 | # the block device on which REPIT will operate (only one device is supported): 66 | 67 | #sdev=/sys/devices/platform/dw_mmc/mmc_host/mmc0/mmc0:0001/block/mmcblk0 68 | sdev=/sys/block/mmcblk0 69 | spar=$sdev/mmcblk0p 70 | 71 | ddev=/dev/block/mmcblk0 72 | dpar=/dev/block/mmcblk0p 73 | 74 | sectorSize=512 # in bytes 75 | 76 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 77 | #unmountPattern="${dpar}[0-9]\+" 78 | unmountPattern="/dev/block/mmcblk[^ ]*" 79 | 80 | } 81 | 82 | device_initPartitions() { 83 | 84 | # the crypto footer size: 85 | local footerSize=$(( 16384 / sectorSize )) 86 | 87 | # the set of partitions that can be modified by REPIT: 88 | # 89 | initPartition 11 TOMBSTONES tombstones "same keep ext4" 0 90 | initPartition 12 CACHE cache "same keep ext4" 0 91 | initPartition 13 SYSTEM system "same keep ext4" 0 92 | initPartition 14 HIDDEN preload "same keep ext4" 0 93 | initPartition 15 OTA ota "same keep raw" 0 94 | initPartition 16 USERDATA data "same keep ext4" $footerSize 95 | 96 | # the set of modifiable partitions that can be configured by the user (overriding ): 97 | configurablePartitions="$(seq 11 16)" 98 | 99 | } 100 | 101 | device_setup() { 102 | 103 | # the number of partitions that the device must have: 104 | partitionCount=16 105 | 106 | # the set of defined heaps: 107 | allHeaps="main" 108 | 109 | # the partition data move chunk size (must fit in memory): 110 | moveDataChunkSize=$(( 256 * MiB )) 111 | 112 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 113 | detectBlockDeviceHeapRange 114 | 115 | # the size of partitions configured with the 'min' keyword: 116 | #heapMinSize=$(( 8 * MiB )) 117 | 118 | # the partition alignment: 119 | heapAlignment=$(( 4 * MiB )) 120 | 121 | } 122 | 123 | device_setupHeap_main() { 124 | 125 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 126 | heapPartitions="$(seq 11 16)" 127 | 128 | # the disk area (as a sector range) to use for the heap partitions: 129 | heapStart=$(parOldEnd 10) # one past the end of a specific partition 130 | heapEnd=$deviceHeapEnd # one past the last usable sector of the device 131 | 132 | } 133 | -------------------------------------------------------------------------------- /device/galaxy-s3/snapdragon/common.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2019, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### galaxy-s3/snapdragon 13 | 14 | device_makeFlashizeEnv="env/arm.zip" 15 | 16 | device_makeFilenameConfig="system=same-data=max-cache=32M+wipe" 17 | 18 | device_init() { 19 | 20 | device_checkDevice 21 | 22 | # the block device on which REPIT will operate (only one device is supported): 23 | 24 | #sdev=/sys/devices/platform/msm_sdcc.1/mmc_host/mmc0/mmc0:0001/block/mmcblk0 25 | sdev=/sys/block/mmcblk0 26 | spar=$sdev/mmcblk0p 27 | 28 | ddev=/dev/block/mmcblk0 29 | dpar=/dev/block/mmcblk0p 30 | 31 | sectorSize=512 # in bytes 32 | 33 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 34 | #unmountPattern="${dpar}[0-9]\+" 35 | unmountPattern="/dev/block/mmcblk[^ ]*" 36 | 37 | } 38 | 39 | device_initPartitions() { 40 | 41 | # the crypto footer size: 42 | local footerSize=$(( 16384 / sectorSize )) 43 | 44 | # the set of partitions that can be modified by REPIT: 45 | # 46 | initPartition 14 system system "same keep ext4" 0 47 | initPartition 15 userdata data "same keep ext4" $footerSize 48 | initPartition 16 persist persist "same keep raw" 0 49 | initPartition 17 cache cache "same keep ext4" 0 50 | 51 | # the set of modifiable partitions that can be configured by the user (overriding ): 52 | configurablePartitions="14 15 17" 53 | 54 | } 55 | 56 | device_setup() { 57 | 58 | # the number of partitions that the device must have: 59 | partitionCount=23 60 | 61 | # the set of defined heaps: 62 | allHeaps="main" 63 | 64 | # the partition data move chunk size (must fit in memory): 65 | moveDataChunkSize=$(( 256 * MiB )) 66 | 67 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 68 | #detectBlockDeviceHeapRange 69 | 70 | # the size of partitions configured with the 'min' keyword: 71 | #heapMinSize=$(( 8 * MiB )) 72 | 73 | # the partition alignment: 74 | heapAlignment=$(( 4 * MiB )) 75 | 76 | } 77 | 78 | device_setupHeap_main() { 79 | 80 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 81 | heapPartitions="$(seq 14 17)" 82 | 83 | # the disk area (as a sector range) to use for the heap partitions: 84 | heapStart=$(parOldEnd 13) # one past the end of a specific partition 85 | heapEnd=$(parOldStart 18) # the start of a specific partition 86 | 87 | } 88 | -------------------------------------------------------------------------------- /device/galaxy-s3/snapdragon/d2tmo.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2019, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### d2tmo 13 | 14 | # This port was possible thanks to the invaluable help of mw-merickso. 15 | 16 | # Disk /dev/block/mmcblk0: 30777344 sectors, 14.7 GiB 17 | # Logical sector size: 512 bytes 18 | # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 19 | # Partition table holds up to 128 entries 20 | # First usable sector is 34, last usable sector is 30765071 21 | # Total free space is 8158 sectors (4.0 MiB) 22 | # 23 | # Number Start (sector) End (sector) Size Code Name 24 | # 1 8192 131071 60.0 MiB 0700 modem 25 | # 2 131072 131327 128.0 KiB FFFF sbl1 26 | # 3 131328 131839 256.0 KiB FFFF sbl2 27 | # 4 131840 132863 512.0 KiB FFFF sbl3 28 | # 5 132864 136959 2.0 MiB FFFF aboot 29 | # 6 136960 137983 512.0 KiB FFFF rpm 30 | # 7 137984 158463 10.0 MiB FFFF boot 31 | # 8 158464 159487 512.0 KiB FFFF tz 32 | # 9 159488 160511 512.0 KiB FFFF pad 33 | # 10 160512 180991 10.0 MiB 8300 param 34 | # 11 180992 208895 13.6 MiB 8300 efs 35 | # 12 208896 215039 3.0 MiB FFFF modemst1 36 | # 13 215040 221183 3.0 MiB FFFF modemst2 37 | # 14 221184 3293183 1.5 GiB 8300 system 38 | # 15 3293184 28958719 12.2 GiB 8300 userdata 39 | # 16 28958720 28975103 8.0 MiB 8300 persist 40 | # 17 28975104 30695423 840.0 MiB 8300 cache 41 | # 18 30695424 30715903 10.0 MiB FFFF recovery 42 | # 19 30715904 30736383 10.0 MiB FFFF fota 43 | # 20 30736384 30748671 6.0 MiB 8300 backup 44 | # 21 30748672 30754815 3.0 MiB FFFF fsg 45 | # 22 30754816 30754831 8.0 KiB FFFF ssd 46 | # 23 30754832 30765071 5.0 MiB 8300 grow 47 | 48 | device_checkDevice() { 49 | 50 | checkTool getprop 51 | 52 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 53 | *:d2tmo:*) ;; 54 | *:d2lte:*) ;; 55 | *:SGH-T999:*) ;; 56 | *) 57 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 58 | ;; 59 | esac 60 | 61 | } 62 | -------------------------------------------------------------------------------- /device/galaxy-s3/snapdragon/d2usc.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2019, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### d2usc 13 | 14 | # This port was possible thanks to the invaluable help of terracota/TeracottaShishi. 15 | 16 | # Disk /dev/block/mmcblk0: 61071360 sectors, 29.1 GiB 17 | # Logical sector size: 512 bytes 18 | # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 19 | # Partition table holds up to 128 entries 20 | # First usable sector is 34, last usable sector is 61071326 21 | # Total free space is 20397 sectors (10.0 MiB) 22 | # 23 | # Number Start (sector) End (sector) Size Code Name 24 | # 1 8192 131071 60.0 MiB 0700 modem 25 | # 2 131072 131327 128.0 KiB FFFF sbl1 26 | # 3 131328 131839 256.0 KiB FFFF sbl2 27 | # 4 131840 132863 512.0 KiB FFFF sbl3 28 | # 5 132864 136959 2.0 MiB FFFF aboot 29 | # 6 136960 137983 512.0 KiB FFFF rpm 30 | # 7 137984 158463 10.0 MiB FFFF boot 31 | # 8 158464 159487 512.0 KiB FFFF tz 32 | # 9 159488 160511 512.0 KiB FFFF pad 33 | # 10 160512 180991 10.0 MiB 8300 param 34 | # 11 180992 208895 13.6 MiB 8300 efs 35 | # 12 208896 215039 3.0 MiB FFFF modemst1 36 | # 13 215040 221183 3.0 MiB FFFF modemst2 37 | # 14 221184 3293183 1.5 GiB 8300 system 38 | # 15 3293184 59252735 26.7 GiB 8300 userdata 39 | # 16 59252736 59269119 8.0 MiB 8300 persist 40 | # 17 59269120 60989439 840.0 MiB 8300 cache 41 | # 18 60989440 61009919 10.0 MiB FFFF recovery 42 | # 19 61009920 61030399 10.0 MiB FFFF fota 43 | # 20 61030400 61042687 6.0 MiB 8300 backup 44 | # 21 61042688 61048831 3.0 MiB FFFF fsg 45 | # 22 61048832 61048847 8.0 KiB FFFF ssd 46 | # 23 61048848 61059087 5.0 MiB 8300 grow 47 | 48 | device_checkDevice() { 49 | 50 | checkTool getprop 51 | 52 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 53 | *:d2usc:*) ;; 54 | *:d2lte:*) ;; 55 | *:SCH-R530U:*) ;; 56 | *) 57 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 58 | ;; 59 | esac 60 | 61 | } 62 | -------------------------------------------------------------------------------- /device/janice.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### janice 13 | 14 | # Disk /dev/block/mmcblk0: 15269888 sectors, 3360M 15 | # Logical sector size: 512 16 | # Disk identifier (GUID): 52444e41-494f-2044-4d4d-43204449534b 17 | # Partition table holds up to 128 entries 18 | # First usable sector is 34, last usable sector is 15269854 19 | # 20 | # Number Start (sector) End (sector) Size Code Name 21 | # 1 71680 104447 16.0M 0700 PARAM 22 | # 2 28672 61439 16.0M 0700 Modem FS 23 | # 3 206848 1460223 612M 0700 SYSTEM 24 | # 4 5654528 6281215 306M 0700 CACHEFS 25 | # 5 1460224 5654527 2048M 0700 DATAFS 26 | # 6 3072 6143 1536K 0700 CSPSA FS 27 | # 7 8192 28671 10.0M 0700 EFS 28 | # 8 7038976 15251455 4010M 0700 UMS 29 | # 9 6281216 6936575 320M 0700 HIDDEN 30 | # 10 1024 3071 1024K 0700 PIT 31 | # 11 6936576 7038975 50.0M 0700 Fota 32 | # 12 104448 108543 2048K 0700 IPL Modem 33 | # 13 108544 141311 16.0M 0700 Modem 34 | # 14 63488 67583 2048K 0700 SBL 35 | # 15 141312 174079 16.0M 0700 Kernel 36 | # 16 67584 71679 2048K 0700 SBL_2 37 | # 17 174080 206847 16.0M 0700 Kernel2 38 | # 39 | # Number Start (sector) End (sector) Size Code Name 40 | # 10 1024 3071 1024K 0700 PIT 41 | # 6 3072 6143 1536K 0700 CSPSA FS 42 | # 7 8192 28671 10.0M 0700 EFS 43 | # 2 28672 61439 16.0M 0700 Modem FS 44 | # 14 63488 67583 2048K 0700 SBL 45 | # 16 67584 71679 2048K 0700 SBL_2 46 | # 1 71680 104447 16.0M 0700 PARAM 47 | # 12 104448 108543 2048K 0700 IPL Modem 48 | # 13 108544 141311 16.0M 0700 Modem 49 | # 15 141312 174079 16.0M 0700 Kernel 50 | # 17 174080 206847 16.0M 0700 Kernel2 51 | # 3 206848 1460223 612M 0700 SYSTEM 52 | # 5 1460224 5654527 2048M 0700 DATAFS 53 | # 4 5654528 6281215 306M 0700 CACHEFS 54 | # 9 6281216 6936575 320M 0700 HIDDEN 55 | # 11 6936576 7038975 50.0M 0700 Fota 56 | # 8 7038976 15251455 4010M 0700 UMS 57 | 58 | device_makeFlashizeEnv="env/arm.zip" 59 | 60 | device_makeFilenameConfig="system=1G-data=3G-cache=32M+wipe-preload=min+wipe-fota=min+wipe+ext4-sdcard=max" 61 | 62 | device_checkDevice() { 63 | 64 | checkTool getprop 65 | 66 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 67 | *:janice:*) ;; 68 | *:i9070:*) ;; 69 | *:GT-I9070:*) ;; 70 | *) 71 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 72 | ;; 73 | esac 74 | 75 | } 76 | 77 | device_init() { 78 | 79 | device_checkDevice 80 | 81 | # the block device on which REPIT will operate (only one device is supported): 82 | 83 | #sdev=/sys/devices/sdi2/mmc_host/mmc0/mmc0:0001/block/mmcblk0 84 | sdev=/sys/block/mmcblk0 85 | spar=$sdev/mmcblk0p 86 | 87 | ddev=/dev/block/mmcblk0 88 | dpar=/dev/block/mmcblk0p 89 | 90 | sectorSize=512 # in bytes 91 | 92 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 93 | #unmountPattern="${dpar}[0-9]\+" 94 | unmountPattern="/dev/block/mmcblk[^ ]*" 95 | 96 | } 97 | 98 | device_initPartitions() { 99 | 100 | # the crypto footer size: 101 | local footerSize=$(( 16384 / sectorSize )) 102 | 103 | # the set of partitions that can be modified by REPIT: 104 | # 105 | initPartition 3 SYSTEM system "same keep ext4" 0 106 | initPartition 5 DATAFS data "same keep ext4" $footerSize 107 | initPartition 4 CACHEFS cache "same keep ext4" 0 108 | initPartition 9 HIDDEN preload "same keep ext4" 0 109 | initPartition 11 Fota fota "same keep raw" 0 110 | initPartition 8 UMS sdcard "same keep vfat" 0 111 | 112 | # the set of modifiable partitions that can be configured by the user (overriding ): 113 | configurablePartitions="3 5 4 9 11 8" 114 | 115 | } 116 | 117 | device_setup() { 118 | 119 | # the number of partitions that the device must have: 120 | partitionCount=17 121 | 122 | # the set of defined heaps: 123 | allHeaps="main" 124 | 125 | # the partition data move chunk size (must fit in memory): 126 | moveDataChunkSize=$(( 128 * MiB )) 127 | 128 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 129 | detectBlockDeviceHeapRange 130 | 131 | # the size of partitions configured with the 'min' keyword: 132 | #heapMinSize=$(( 8 * MiB )) 133 | 134 | # the partition alignment: 135 | heapAlignment=$(( 1 * MiB )) 136 | 137 | } 138 | 139 | device_setupHeap_main() { 140 | 141 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 142 | heapPartitions="3 5 4 9 11 8" 143 | 144 | # the disk area (as a sector range) to use for the heap partitions: 145 | heapStart=$(parOldEnd 17) # one past the end of a specific partition 146 | heapEnd=$deviceHeapEnd # one past the last usable sector of the device 147 | 148 | } 149 | -------------------------------------------------------------------------------- /device/nexus-7-2013/common.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2019, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### nexus-7-2013 13 | 14 | # Disk /dev/block/mmcblk0: 61079552 sectors, 29.1 GiB 15 | # Logical sector size: 512 bytes 16 | # Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20 17 | # Partition table holds up to 32 entries 18 | # First usable sector is 34, last usable sector is 61079518 19 | # Total free space is 1526010 sectors (745.1 MiB) 20 | # 21 | # Number Start (sector) End (sector) Size Code Name 22 | # 1 131072 306143 85.5 MiB 0700 radio 23 | # 2 393216 399359 3.0 MiB FFFF modemst1 24 | # 3 399360 405503 3.0 MiB FFFF modemst2 25 | # 4 524288 554287 14.6 MiB 8300 persist 26 | # 5 655360 656919 780.0 KiB FFFF m9kefs1 27 | # 6 656920 658479 780.0 KiB FFFF m9kefs2 28 | # 7 786432 787991 780.0 KiB FFFF m9kefs3 29 | # 8 787992 794135 3.0 MiB FFFF fsg 30 | # 9 917504 920503 1.5 MiB FFFF sbl1 31 | # 10 920504 923503 1.5 MiB FFFF sbl2 32 | # 11 923504 927599 2.0 MiB FFFF sbl3 33 | # 12 927600 937839 5.0 MiB FFFF aboot 34 | # 13 937840 938863 512.0 KiB FFFF rpm 35 | # 14 1048576 1081343 16.0 MiB FFFF boot 36 | # 15 1179648 1180671 512.0 KiB FFFF tz 37 | # 16 1180672 1180673 1024 bytes FFFF pad 38 | # 17 1180674 1183673 1.5 MiB FFFF sbl2b 39 | # 18 1183674 1187769 2.0 MiB FFFF sbl3b 40 | # 19 1187770 1198009 5.0 MiB FFFF abootb 41 | # 20 1198010 1199033 512.0 KiB FFFF rpmb 42 | # 21 1199034 1200057 512.0 KiB FFFF tzb 43 | # 22 1310720 3031039 840.0 MiB 8300 system 44 | # 23 3031040 4177919 560.0 MiB 8300 cache 45 | # 24 4194304 4196351 1024.0 KiB FFFF misc 46 | # 25 4325376 4345855 10.0 MiB FFFF recovery 47 | # 26 4456448 4456463 8.0 KiB FFFF DDR 48 | # 27 4456464 4456479 8.0 KiB FFFF ssd 49 | # 28 4456480 4456481 1024 bytes FFFF m9kefsc 50 | # 29 4587520 4587583 32.0 KiB FFFF metadata 51 | # 30 4718592 61079518 26.9 GiB 8300 userdata 52 | 53 | device_makeFlashizeEnv="env/arm.zip" 54 | 55 | device_makeFilenameConfig="system=max-cache=32M+wipe" 56 | 57 | device_init() { 58 | 59 | device_checkDevice 60 | 61 | # the block device on which REPIT will operate (only one device is supported): 62 | 63 | #sdev=/sys/devices/platform/msm_sdcc.1/mmc_host/mmc0/mmc0:0001/block/mmcblk0 64 | sdev=/sys/block/mmcblk0 65 | spar=$sdev/mmcblk0p 66 | 67 | ddev=/dev/block/mmcblk0 68 | dpar=/dev/block/mmcblk0p 69 | 70 | sectorSize=512 # in bytes 71 | 72 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 73 | #unmountPattern="${dpar}[0-9]\+" 74 | unmountPattern="/dev/block/mmcblk[^ ]*" 75 | 76 | } 77 | 78 | device_initPartitions() { 79 | 80 | # the crypto footer size: 81 | local footerSize=$(( 16384 / sectorSize )) 82 | 83 | # the set of partitions that can be modified by REPIT: 84 | # 85 | initPartition 22 system system "same keep ext4" 0 86 | initPartition 23 cache cache "same keep ext4" 0 87 | 88 | # the set of modifiable partitions that can be configured by the user (overriding ): 89 | configurablePartitions="$(seq 22 23)" 90 | 91 | } 92 | 93 | device_setup() { 94 | 95 | # the number of partitions that the device must have: 96 | partitionCount=30 97 | 98 | # the set of defined heaps: 99 | allHeaps="main" 100 | 101 | # the partition data move chunk size (must fit in memory): 102 | moveDataChunkSize=$(( 256 * MiB )) 103 | 104 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 105 | #detectBlockDeviceHeapRange 106 | 107 | # the size of partitions configured with the 'min' keyword: 108 | #heapMinSize=$(( 8 * MiB )) 109 | 110 | # the partition alignment: 111 | heapAlignment=$(( 4 * MiB )) 112 | 113 | } 114 | 115 | device_setupHeap_main() { 116 | 117 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 118 | heapPartitions="$(seq 22 23)" 119 | 120 | # the disk area (as a sector range) to use for the heap partitions: 121 | heapStart=1310720 122 | heapEnd=4194304 123 | 124 | } 125 | -------------------------------------------------------------------------------- /device/nexus-7-2013/deb.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2019, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### deb 13 | 14 | # This port was possible thanks to the invaluable help of ipdev99 and xxhoeckyxx. 15 | 16 | device_checkDevice() { 17 | 18 | checkTool getprop 19 | 20 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 21 | *:deb:*) ;; 22 | *) 23 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 24 | ;; 25 | esac 26 | 27 | } 28 | -------------------------------------------------------------------------------- /device/nexus-7-2013/flo.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2019, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### flo 13 | 14 | # This port was possible thanks to the invaluable help of ipdev99 and xxhoeckyxx. 15 | 16 | device_checkDevice() { 17 | 18 | checkTool getprop 19 | 20 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 21 | *:flo:*) ;; 22 | *) 23 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 24 | ;; 25 | esac 26 | 27 | } 28 | -------------------------------------------------------------------------------- /device/nook-hd/common.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### nook-hd 13 | 14 | # Logical sector size: 512 bytes 15 | # 16 | # Number Start (sector) End (sector) Size Code Name 17 | # 1 256 511 128.0 KiB 8300 xloader 18 | # 2 512 1023 256.0 KiB 8300 bootloader 19 | # 3 1024 31743 15.0 MiB 8300 recovery 20 | # 4 32768 65535 16.0 MiB 8300 boot 21 | # 5 65536 163839 48.0 MiB 8300 rom 22 | # 6 163840 262143 48.0 MiB 8300 bootdata 23 | # 7 262144 1179647 448.0 MiB 8300 factory 24 | # 8 1179648 2555903 672.0 MiB 8300 system 25 | # 9 2555904 3506175 464.0 MiB 8300 cache 26 | # 10 3506176 30507007 12.9 GiB 8300 userdata 27 | 28 | device_makeFlashizeEnv="env/arm.zip" 29 | 30 | #device_makeFilenameConfig="factory=same-system=1104M-cache=32M+wipe-data=same" 31 | device_makeFilenameConfig="factory=same-system=1G-cache=112M+wipe-data=same" 32 | #device_makeFilenameConfig="factory=32M-system=1G-cache=32M+wipe-data=max" 33 | 34 | device_checkDevice() { 35 | 36 | checkTool getprop 37 | 38 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 39 | *:ovation:*) ;; 40 | *) 41 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 42 | ;; 43 | esac 44 | 45 | } 46 | 47 | device_init() { 48 | 49 | device_checkDevice 50 | 51 | # the block device on which REPIT will operate (only one device is supported): 52 | 53 | #sdev=/sys/devices/platform/omap/omap_hsmmc.1/mmc_host/mmc0/mmc0:0001/block/mmcblk0 54 | sdev=/sys/block/mmcblk0 55 | spar=$sdev/mmcblk0p 56 | 57 | ddev=/dev/block/mmcblk0 58 | dpar=/dev/block/mmcblk0p 59 | 60 | sectorSize=512 # in bytes 61 | 62 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 63 | #unmountPattern="${dpar}[0-9]\+" 64 | unmountPattern="/dev/block/mmcblk[^ ]*" 65 | 66 | } 67 | 68 | device_initPartitions() { 69 | 70 | # the crypto footer size: 71 | local footerSize=$(( 16384 / sectorSize )) 72 | 73 | # the set of partitions that can be modified by REPIT: 74 | # 75 | initPartition 7 factory factory "same keep ext4" 0 76 | initPartition 8 system system "same keep ext4" 0 77 | initPartition 9 cache cache "same keep ext4" 0 78 | initPartition 10 userdata data "same keep ext4" $footerSize 79 | 80 | # the set of modifiable partitions that can be configured by the user (overriding ): 81 | configurablePartitions="$(seq 7 10)" 82 | 83 | } 84 | 85 | device_setup() { 86 | 87 | # the number of partitions that the device must have: 88 | partitionCount=10 89 | 90 | # the set of defined heaps: 91 | allHeaps="main" 92 | 93 | # the partition data move chunk size (must fit in memory): 94 | moveDataChunkSize=$(( 256 * MiB )) 95 | 96 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 97 | detectBlockDeviceHeapRange 98 | 99 | # the size of partitions configured with the 'min' keyword: 100 | #heapMinSize=$(( 8 * MiB )) 101 | 102 | # the partition alignment: 103 | heapAlignment=$(( 4 * MiB )) 104 | 105 | } 106 | 107 | device_setupHeap_main() { 108 | 109 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 110 | heapPartitions="$(seq 7 10)" 111 | 112 | # the disk area (as a sector range) to use for the heap partitions: 113 | heapStart=$(parOldEnd 6) # one past the end of a specific partition 114 | heapEnd=$deviceHeapEnd # one past the last usable sector of the device 115 | 116 | } 117 | -------------------------------------------------------------------------------- /device/nook-hd/hummingbird.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### hummingbird 13 | 14 | # This port was possible thanks to the invaluable help of BultoPaco. 15 | 16 | # Caution: invalid backup GPT header, but valid main header; regenerating 17 | # backup header from main header. 18 | # 19 | # Warning! Main and backup partition tables differ! Use the 'c' and 'e' options 20 | # on the recovery & transformation menu to examine the two tables. 21 | # 22 | # Warning! One or more CRCs don't match. You should repair the disk! 23 | # 24 | # **************************************************************************** 25 | # Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk 26 | # verification and recovery are STRONGLY recommended. 27 | # **************************************************************************** 28 | # Disk /dev/block/mmcblk0: 31129600 sectors, 14.8 GiB 29 | # Logical sector size: 512 bytes 30 | # Disk identifier (GUID): 4F417C26-4505-4832-9F38-0F1A75E87AFC 31 | # Partition table holds up to 128 entries 32 | # First usable sector is 34, last usable sector is 31129566 33 | # Total free space is 623805 sectors (304.6 MiB) 34 | # 35 | # Number Start (sector) End (sector) Size Code Name 36 | # 1 256 511 128.0 KiB 8300 xloader 37 | # 2 512 1023 256.0 KiB 8300 bootloader 38 | # 3 1024 31743 15.0 MiB 8300 recovery 39 | # 4 32768 65535 16.0 MiB 8300 boot 40 | # 5 65536 163839 48.0 MiB 8300 rom 41 | # 6 163840 262143 48.0 MiB 8300 bootdata 42 | # 7 262144 1179647 448.0 MiB 8300 factory 43 | # 8 1179648 2555903 672.0 MiB 8300 system 44 | # 9 2555904 3506175 464.0 MiB 8300 cache 45 | # 10 3506176 30507007 12.9 GiB 8300 userdata 46 | 47 | device_checkDevice() { 48 | 49 | checkTool getprop 50 | 51 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 52 | *:hummingbird:*) ;; 53 | *) 54 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 55 | ;; 56 | esac 57 | 58 | } 59 | -------------------------------------------------------------------------------- /device/nook-hd/ovation.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### ovation 13 | 14 | # This port was possible thanks to the invaluable help of 149113. 15 | 16 | # Caution: invalid backup GPT header, but valid main header; regenerating 17 | # backup header from main header. 18 | # 19 | # Warning! Main and backup partition tables differ! Use the 'c' and 'e' options 20 | # on the recovery & transformation menu to examine the two tables. 21 | # 22 | # Warning! One or more CRCs don't match. You should repair the disk! 23 | # 24 | # **************************************************************************** 25 | # Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk 26 | # verification and recovery are STRONGLY recommended. 27 | # **************************************************************************** 28 | # Disk /dev/block/mmcblk0: 30535680 sectors, 14.6 GiB 29 | # Logical sector size: 512 bytes 30 | # Disk identifier (GUID): 3290B191-5EED-4A94-BFD4-0ECCA08BCEF4 31 | # Partition table holds up to 128 entries 32 | # First usable sector is 34, last usable sector is 30535646 33 | # Total free space is 29885 sectors (14.6 MiB) 34 | # 35 | # Number Start (sector) End (sector) Size Code Name 36 | # 1 256 511 128.0 KiB 8300 xloader 37 | # 2 512 1023 256.0 KiB 8300 bootloader 38 | # 3 1024 31743 15.0 MiB 8300 recovery 39 | # 4 32768 65535 16.0 MiB 8300 boot 40 | # 5 65536 163839 48.0 MiB 8300 rom 41 | # 6 163840 262143 48.0 MiB 8300 bootdata 42 | # 7 262144 1179647 448.0 MiB 8300 factory 43 | # 8 1179648 2555903 672.0 MiB 8300 system 44 | # 9 2555904 3506175 464.0 MiB 8300 cache 45 | # 10 3506176 30507007 12.9 GiB 8300 userdata 46 | 47 | device_checkDevice() { 48 | 49 | checkTool getprop 50 | 51 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 52 | *:ovation:*) ;; 53 | *) 54 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 55 | ;; 56 | esac 57 | 58 | } 59 | -------------------------------------------------------------------------------- /device/tuna/common.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### tuna 13 | 14 | # This port was possible thanks to the invaluable help of thagringo. 15 | 16 | # Disk /dev/block/mmcblk0: 30777344 sectors, 2740M 17 | # Logical sector size: 512 18 | # Disk identifier (GUID): 52444e41-494f-2044-4d4d-43204449534b 19 | # Partition table holds up to 128 entries 20 | # First usable sector is 34, last usable sector is 30777310 21 | # 22 | # Number Start (sector) End (sector) Size Code Name 23 | # 1 256 511 128K 0700 xloader 24 | # 2 1024 8191 3584K 0700 sbl 25 | # 3 8192 49151 20.0M 0700 efs 26 | # 4 49152 65535 8192K 0700 param 27 | # 5 65536 73727 4096K 0700 misc 28 | # 6 73728 81919 4096K 0700 dgs 29 | # 7 81920 98303 8192K 0700 boot 30 | # 8 98304 122751 11.9M 0700 recovery 31 | # * 13 122752 122879 65536 0700 metadata 32 | # 9 122880 155647 16.0M 0700 radio 33 | # 10 155648 1495039 654M 0700 system 34 | # 11 1495040 2379775 432M 0700 cache 35 | # 12 2379776 30777309 13.5G 0700 userdata 36 | 37 | device_makeFlashizeEnv="env/arm.zip" 38 | 39 | device_makeFilenameConfig="system=1G-cache=62M+wipe-data=same" 40 | 41 | device_init() { 42 | 43 | device_checkDevice 44 | 45 | # the block device on which REPIT will operate (only one device is supported): 46 | 47 | #sdev=/sys/devices/platform/omap/omap_hsmmc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0 48 | sdev=/sys/block/mmcblk0 49 | spar=$sdev/mmcblk0p 50 | 51 | ddev=/dev/block/mmcblk0 52 | dpar=/dev/block/mmcblk0p 53 | 54 | sectorSize=512 # in bytes 55 | 56 | # a grep pattern matching the partitions that must be unmounted before REPIT can start: 57 | #unmountPattern="${dpar}[0-9]\+" 58 | unmountPattern="/dev/block/mmcblk[^ ]*" 59 | 60 | } 61 | 62 | device_initPartitions() { 63 | 64 | # the set of partitions that can be modified by REPIT: 65 | # 66 | initPartition 10 system system "same keep ext4" 0 67 | initPartition 11 cache cache "same keep ext4" 0 68 | initPartition 12 userdata data "same keep ext4" 0 69 | 70 | # the set of modifiable partitions that can be configured by the user (overriding ): 71 | configurablePartitions="$(seq 10 12)" 72 | 73 | } 74 | 75 | device_setup() { 76 | 77 | # the number of partitions that the device must have: 78 | partitionCount=13 79 | 80 | # the set of defined heaps: 81 | allHeaps="main" 82 | 83 | # the partition data move chunk size (must fit in memory): 84 | moveDataChunkSize=$(( 256 * MiB )) 85 | 86 | # only call this if you will later use $deviceHeapStart or $deviceHeapEnd: 87 | detectBlockDeviceHeapRange 88 | 89 | # the size of partitions configured with the 'min' keyword: 90 | #heapMinSize=$(( 8 * MiB )) 91 | 92 | # the partition alignment: 93 | heapAlignment=$(( 1 * MiB )) 94 | 95 | } 96 | 97 | device_setupHeap_main() { 98 | 99 | # the set of contiguous partitions that form this heap, in order of ascending partition start address: 100 | heapPartitions="$(seq 10 12)" 101 | 102 | # the disk area (as a sector range) to use for the heap partitions: 103 | heapStart=$(parOldEnd 9) # one past the end of a specific partition 104 | heapEnd=$deviceHeapEnd # one past the last usable sector of the device 105 | 106 | } 107 | -------------------------------------------------------------------------------- /device/tuna/maguro.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### maguro 13 | 14 | # This port was possible thanks to the invaluable help of thagringo. 15 | 16 | device_checkDevice() { 17 | 18 | checkTool getprop 19 | 20 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 21 | *:maguro:*) ;; 22 | *:tuna:*) ;; 23 | *) 24 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 25 | ;; 26 | esac 27 | 28 | } 29 | -------------------------------------------------------------------------------- /device/tuna/toro.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### toro 13 | 14 | # This port was possible thanks to the invaluable help of thagringo and musical_chairs. 15 | 16 | device_checkDevice() { 17 | 18 | checkTool getprop 19 | 20 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 21 | *:toro:*) ;; 22 | *:tuna:*) ;; 23 | *) 24 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 25 | ;; 26 | esac 27 | 28 | } 29 | -------------------------------------------------------------------------------- /device/tuna/toroplus.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Device Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### toroplus 13 | 14 | # This port was possible thanks to the invaluable help of thagringo and musical_chairs. 15 | 16 | device_checkDevice() { 17 | 18 | checkTool getprop 19 | 20 | case ":$(getprop ro.product.device):$(getprop ro.build.product):" in 21 | *:toroplus:*) ;; 22 | *:tuna:*) ;; 23 | *) 24 | fatal "this package is for '$deviceName' devices; this device is '$(getprop ro.product.device)'" 25 | ;; 26 | esac 27 | 28 | } 29 | -------------------------------------------------------------------------------- /env/arm.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanchon/REPIT/8824c5af8c41924a0b22251fbb745ec30748e368/env/arm.zip -------------------------------------------------------------------------------- /env/extras-arm/no/blkid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanchon/REPIT/8824c5af8c41924a0b22251fbb745ec30748e368/env/extras-arm/no/blkid -------------------------------------------------------------------------------- /env/extras-arm/no/fdisk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanchon/REPIT/8824c5af8c41924a0b22251fbb745ec30748e368/env/extras-arm/no/fdisk -------------------------------------------------------------------------------- /env/extras-arm/no/gdisk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanchon/REPIT/8824c5af8c41924a0b22251fbb745ec30748e368/env/extras-arm/no/gdisk -------------------------------------------------------------------------------- /env/extras-arm/no/lsblk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanchon/REPIT/8824c5af8c41924a0b22251fbb745ec30748e368/env/extras-arm/no/lsblk -------------------------------------------------------------------------------- /env/extras-arm/no/partx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanchon/REPIT/8824c5af8c41924a0b22251fbb745ec30748e368/env/extras-arm/no/partx -------------------------------------------------------------------------------- /env/extras-arm/no/sfdisk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanchon/REPIT/8824c5af8c41924a0b22251fbb745ec30748e368/env/extras-arm/no/sfdisk -------------------------------------------------------------------------------- /env/extras-arm/parted: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanchon/REPIT/8824c5af8c41924a0b22251fbb745ec30748e368/env/extras-arm/parted -------------------------------------------------------------------------------- /env/extras-arm/sgdisk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanchon/REPIT/8824c5af8c41924a0b22251fbb745ec30748e368/env/extras-arm/sgdisk -------------------------------------------------------------------------------- /key/testkey.pk8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanchon/REPIT/8824c5af8c41924a0b22251fbb745ec30748e368/key/testkey.pk8 -------------------------------------------------------------------------------- /key/testkey.x509.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEqDCCA5CgAwIBAgIJAJNurL4H8gHfMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD 3 | VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4g 4 | VmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UE 5 | AxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAe 6 | Fw0wODAyMjkwMTMzNDZaFw0zNTA3MTcwMTMzNDZaMIGUMQswCQYDVQQGEwJVUzET 7 | MBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4G 8 | A1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9p 9 | ZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZI 10 | hvcNAQEBBQADggENADCCAQgCggEBANaTGQTexgskse3HYuDZ2CU+Ps1s6x3i/waM 11 | qOi8qM1r03hupwqnbOYOuw+ZNVn/2T53qUPn6D1LZLjk/qLT5lbx4meoG7+yMLV4 12 | wgRDvkxyGLhG9SEVhvA4oU6Jwr44f46+z4/Kw9oe4zDJ6pPQp8PcSvNQIg1QCAcy 13 | 4ICXF+5qBTNZ5qaU7Cyz8oSgpGbIepTYOzEJOmc3Li9kEsBubULxWBjf/gOBzAzU 14 | RNps3cO4JFgZSAGzJWQTT7/emMkod0jb9WdqVA2BVMi7yge54kdVMxHEa5r3b97s 15 | zI5p58ii0I54JiCUP5lyfTwE/nKZHZnfm644oLIXf6MdW2r+6R8CAQOjgfwwgfkw 16 | HQYDVR0OBBYEFEhZAFY9JyxGrhGGBaR0GawJyowRMIHJBgNVHSMEgcEwgb6AFEhZ 17 | AFY9JyxGrhGGBaR0GawJyowRoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UE 18 | CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMH 19 | QW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAG 20 | CSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJAJNurL4H8gHfMAwGA1Ud 21 | EwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAHqvlozrUMRBBVEY0NqrrwFbinZa 22 | J6cVosK0TyIUFf/azgMJWr+kLfcHCHJsIGnlw27drgQAvilFLAhLwn62oX6snb4Y 23 | LCBOsVMR9FXYJLZW2+TcIkCRLXWG/oiVHQGo/rWuWkJgU134NDEFJCJGjDbiLCpe 24 | +ZTWHdcwauTJ9pUbo8EvHRkU3cYfGmLaLfgn9gP+pWA7LFQNvXwBnDa6sppCccEX 25 | 31I828XzgXpJ4O+mDL1/dBd+ek8ZPUP0IgdyZm5MTYPhvVqGCHzzTy3sIeJFymwr 26 | sBbmg2OAUNLEMO6nwmocSdN2ClirfxqCzJOLSDE4QyS9BAH6EhY6UFcOaE0= 27 | -----END CERTIFICATE----- 28 | -------------------------------------------------------------------------------- /make: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | makeZip() { 6 | 7 | local device="$1" 8 | 9 | echo "device: $device" 10 | 11 | script="build/lanchon-repit-$device.sh" 12 | ./make-script "$device" "$script" 13 | 14 | makeFlashizeEnv="$(sed -n "s/^device_makeFlashizeEnv=\"\(.*\)\"$/\1/p" "$script")" 15 | if [ -z "$makeFlashizeEnv" ]; then 16 | >&2 echo "error: value not found: 'device_makeFlashizeEnv'" 17 | exit 1 18 | fi 19 | 20 | makeFilenameConfig="$(sed -n "s/^device_makeFilenameConfig=\"\(.*\)\"$/\1/p" "$script")" 21 | if [ -z "$makeFilenameConfig" ]; then 22 | >&2 echo "error: value not found: 'device_makeFilenameConfig'" 23 | exit 1 24 | fi 25 | 26 | unsignedZip="build/lanchon-repit-unsigned-$device.zip" 27 | signedZip="build/lanchon-repit-$versionShort-$makeFilenameConfig-$device.zip" 28 | 29 | flashize-env "$script" "$makeFlashizeEnv" "$unsignedZip" /tmp/lanchon-repit.log 30 | signapk -w key/testkey.x509.pem key/testkey.pk8 "$unsignedZip" "$signedZip" 31 | 32 | #rm "$script" 33 | rm "$unsignedZip" 34 | 35 | } 36 | 37 | makeOne() { 38 | 39 | local device="$1" 40 | 41 | rm -f build/lanchon-repit*-"$device".* 42 | makeZip "$device" 43 | 44 | } 45 | 46 | makeAll() { 47 | 48 | rm -f build/lanchon-repit* 49 | local f 50 | for file in $(find device -type f -not -path '*/\.*' -name "*.sh"); do 51 | local device="$(basename "$file" .sh)" 52 | if [ "$device" != "common" ]; then 53 | makeZip "$device" 54 | fi 55 | done 56 | 57 | } 58 | 59 | make() { 60 | 61 | versionLong="$(sed -n "s/^version=\"\(.*\)\"$/\1/p" repit.sh)" 62 | if [ -z "$versionLong" ]; then 63 | >&2 echo "error: value not found: 'version'" 64 | exit 1 65 | fi 66 | versionShort="$(echo "$versionLong" | sed "s/-//g")" 67 | 68 | echo "version: $versionLong" 69 | 70 | mkdir -p build 71 | if [ $# -eq 0 ]; then 72 | makeAll 73 | else 74 | while [ $# -ne 0 ]; do 75 | makeOne "$1" 76 | shift 77 | done 78 | fi 79 | 80 | } 81 | 82 | make "$@" 83 | -------------------------------------------------------------------------------- /make-script: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | catCommonScripts() { 6 | 7 | local dir="$(dirname "$1")" 8 | 9 | if [ "$dir" != "." ]; then 10 | 11 | catCommonScripts "$dir" 12 | 13 | local commonScript="$dir/common.sh" 14 | if [ -f "$commonScript" ]; then 15 | >>"$out" cat "$commonScript" 16 | >>"$out" echo 17 | fi 18 | 19 | fi 20 | 21 | } 22 | 23 | makeScript() { 24 | 25 | device="$1" 26 | out="${2:-build/lanchon-repit-$device.sh}" 27 | 28 | deviceScript="$(find device -name "$device.sh")" 29 | 30 | if [ "$device" == "common" ] || [ ! -f "$deviceScript" ]; then 31 | >&2 echo "error: invalid device: '$device'" 32 | exit 1 33 | fi 34 | 35 | rm -f "$out" 36 | 37 | >>"$out" cat repit.sh 38 | >>"$out" echo 39 | >>"$out" cat repit-par-tools.sh 40 | >>"$out" echo 41 | 42 | >>"$out" cat repit-fs-ext4.sh 43 | >>"$out" echo 44 | >>"$out" cat repit-fs-vfat.sh 45 | >>"$out" echo 46 | >>"$out" cat repit-fs-f2fs.sh 47 | >>"$out" echo 48 | >>"$out" cat repit-fs-swap.sh 49 | >>"$out" echo 50 | >>"$out" cat repit-fs-raw.sh 51 | >>"$out" echo 52 | 53 | catCommonScripts "$deviceScript" 54 | >>"$out" cat "$deviceScript" 55 | >>"$out" echo 56 | 57 | >>"$out" echo "#####################################################" 58 | >>"$out" echo 59 | >>"$out" printf 'deviceName=%q\n' "$device" 60 | >>"$out" echo 61 | >>"$out" echo 'main "$@"' 62 | 63 | } 64 | 65 | makeScript "$@" 66 | -------------------------------------------------------------------------------- /repit-fs-ext4.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - File System Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### ext4 13 | 14 | checkTools_fs_ext4() { 15 | # only require tools if actually needed 16 | #checkTool mke2fs 17 | #checkTool e2fsck 18 | #checkTool resize2fs 19 | : 20 | } 21 | 22 | processPar_ext4_wipe_dry() { 23 | 24 | local n=$1 25 | local dev=$2 26 | local oldStart=$3 27 | local oldSize=$4 28 | local newStart=$5 29 | local newSize=$6 30 | 31 | info "will format the partition in ext4 and trim it" 32 | checkTool mke2fs 33 | 34 | } 35 | 36 | processPar_ext4_wipe_wet() { 37 | 38 | local n=$1 39 | local dev=$2 40 | local oldStart=$3 41 | local oldSize=$4 42 | local newStart=$5 43 | local newSize=$6 44 | 45 | local footerSize=$(parFooterSize $n) 46 | local newFsSize=$(( newSize - footerSize )) 47 | 48 | processParRecreate $n $oldStart $oldSize $newStart $newSize 49 | processParWipeCryptoFooter $n $newStart $newSize $footerSize 50 | info "formatting the partition in ext4 and trimming it" 51 | mke2fs -q -t ext4 -E discard $dev ${newFsSize}s 52 | 53 | } 54 | 55 | checkFs_ext4() { 56 | 57 | local n=$1 58 | local dev=$2 59 | 60 | info "checking and trimming the file system" 61 | (set +e; e2fsck -fp -E discard $dev) 62 | case "$?" in 63 | 0) 64 | ;; 65 | 1) 66 | info "file system errors in $(parName $n) were fixed" 67 | ;; 68 | 2|3) 69 | info "file system errors in $(parName $n) were fixed, but a reboot is needed before continuing" 70 | fatal "reboot needed: please reboot and retry the process to continue" 71 | ;; 72 | *) 73 | fatal "file system errors in $(parName $n) could not be automatically fixed (try running 'e2fsck -f $dev')" 74 | ;; 75 | esac 76 | 77 | } 78 | 79 | checkParSize_ext4() { 80 | 81 | local n=$1 82 | local dev=$2 83 | local oldSize=$3 84 | local newSize=$4 85 | 86 | local footerSize=$(parFooterSize $n) 87 | local newFsSize=$(( newSize - footerSize )) 88 | 89 | #if [ $(( newSize < oldSize )) -ne 0 ]; then 90 | #if [ $(( newFsSize < oldSize )) -ne 0 ]; then 91 | if true; then 92 | info "validating the new partition size" 93 | local blockSize=$(tune2fs -l $dev 2>/dev/null | sed -n "s/^Block size:[ ]*\([0-9]*\)[ ]*$/\1/p") 94 | if [ -n "$blockSize" ]; then 95 | #info "file system block size: $blockSize bytes" 96 | local minBlocks=$(resize2fs -P $dev 2>/dev/null | sed -n "s/^Estimated minimum size of the filesystem:[ ]*\([0-9]*\)[ ]*$/\1/p") 97 | if [ -n "$minBlocks" ]; then 98 | local minSize=$(( ( blockSize / sectorSize ) * minBlocks )) 99 | info "estimated minimum file system size: $(printSizeMiB $minSize)" 100 | local newFsFree=$(( newFsSize - minSize )) 101 | if [ $(( newFsFree >= 0 )) -ne 0 ]; then 102 | info "estimated free space after resize: $(printSizeMiB $newFsFree)" 103 | else 104 | fatal "the new partition size is estimated to be too small to hold the current contents of the file system by $(printSizeMiB $(( -newFsFree )) )" 105 | fi 106 | else 107 | warning "partition size validation skipped: cannot estimate the minimum file system size" 108 | fi 109 | else 110 | warning "partition size validation skipped: cannot determine the file system block size" 111 | fi 112 | fi 113 | 114 | } 115 | 116 | processPar_ext4_keep_dry() { 117 | 118 | local n=$1 119 | local dev=$2 120 | local oldStart=$3 121 | local oldSize=$4 122 | local newStart=$5 123 | local newSize=$6 124 | 125 | if [ $(( newStart != oldStart )) -ne 0 ]; then 126 | info "will move the ext4 partition" 127 | warning "moving a big ext4 partition can take a very long time; it requires copying the complete partition, including its free space" 128 | fi 129 | if [ $(( newSize != oldSize )) -ne 0 ]; then 130 | info "will resize the ext4 partition" 131 | #checkTool resize2fs 132 | fi 133 | if [ $(( newSize == oldSize )) -ne 0 ]; then 134 | info "will resize the ext4 file system if needed to fit its partition" 135 | #checkTool resize2fs 136 | fi 137 | checkTool e2fsck 138 | checkTool resize2fs 139 | checkFs_ext4 $n $dev 140 | checkParSize_ext4 $n $dev $oldSize $newSize 141 | 142 | } 143 | 144 | processPar_ext4_keep_wet() { 145 | 146 | local n=$1 147 | local dev=$2 148 | local oldStart=$3 149 | local oldSize=$4 150 | local newStart=$5 151 | local newSize=$6 152 | 153 | local footerSize=$(parFooterSize $n) 154 | local newFsSize=$(( newSize - footerSize )) 155 | 156 | # note: REPIT should not be able to start on encrypted phones due to the block device being locked. 157 | 158 | local moveSize=$oldSize 159 | if [ $(( newSize < oldSize )) -ne 0 ]; then 160 | info "shrinking the ext4 file system" 161 | resize2fs -f $dev ${newFsSize}s 162 | info "shrinking the partition entry" 163 | processParRecreate $n $oldStart $oldSize $oldStart $newSize 164 | processParWipeCryptoFooter $n $oldStart $newSize $footerSize 165 | checkFs_ext4 $n $dev 166 | moveSize=$newSize 167 | fi 168 | if [ $(( newStart != oldStart )) -ne 0 ]; then 169 | info "moving the ext4 partition" 170 | processParMove $n $oldStart $newStart $moveSize 171 | checkFs_ext4 $n $dev 172 | fi 173 | if [ $(( newSize > oldSize )) -ne 0 ]; then 174 | info "enlarging the partition entry" 175 | processParRecreate $n $newStart $oldSize $newStart $newSize 176 | processParWipeCryptoFooter $n $newStart $newSize $footerSize 177 | info "enlarging the ext4 file system" 178 | resize2fs -f $dev ${newFsSize}s 179 | checkFs_ext4 $n $dev 180 | fi 181 | if [ $(( newSize == oldSize )) -ne 0 ]; then 182 | info "resizing the ext4 file system if needed to fit its partition" 183 | resize2fs -f $dev ${newFsSize}s 184 | checkFs_ext4 $n $dev 185 | fi 186 | 187 | } 188 | -------------------------------------------------------------------------------- /repit-fs-f2fs.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - File System Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### f2fs 13 | 14 | checkTools_fs_f2fs() { 15 | # only require tools if actually needed 16 | #checkTool mkfs.f2fs 17 | #checkTool fsck.f2fs 18 | : 19 | } 20 | 21 | processPar_f2fs_wipe_dry() { 22 | 23 | local n=$1 24 | local dev=$2 25 | local oldStart=$3 26 | local oldSize=$4 27 | local newStart=$5 28 | local newSize=$6 29 | 30 | info "will format the partition in f2fs and trim it" 31 | checkTool mkfs.f2fs 32 | 33 | } 34 | 35 | processPar_f2fs_wipe_wet() { 36 | 37 | local n=$1 38 | local dev=$2 39 | local oldStart=$3 40 | local oldSize=$4 41 | local newStart=$5 42 | local newSize=$6 43 | 44 | local footerSize=$(parFooterSize $n) 45 | local newFsSize=$(( newSize - footerSize )) 46 | 47 | processParRecreate $n $oldStart $oldSize $newStart $newSize 48 | processParWipeCryptoFooter $n $newStart $newSize $footerSize 49 | info "formatting the partition in f2fs and trimming it" 50 | mkfs.f2fs -t 1 $dev ${newFsSize} 51 | 52 | } 53 | 54 | checkFs_f2fs() { 55 | 56 | local n=$1 57 | local dev=$2 58 | 59 | if [ -z "$(which fsck.f2fs)" ]; then 60 | 61 | warning "skipping file system check (tool 'fsck.f2fs' is not available)" 62 | 63 | else 64 | 65 | info "checking the file system" 66 | if ! fsck.f2fs -f $dev; then 67 | fatal "file system errors in $(parName $n) could not be fixed" 68 | fi 69 | 70 | fi 71 | 72 | } 73 | 74 | processPar_f2fs_keep_dry() { 75 | 76 | local n=$1 77 | local dev=$2 78 | local oldStart=$3 79 | local oldSize=$4 80 | local newStart=$5 81 | local newSize=$6 82 | 83 | if [ $(( newSize != oldSize )) -ne 0 ]; then 84 | fatal "cannot resize f2fs partitions" 85 | fi 86 | if [ $(( newStart != oldStart )) -ne 0 ]; then 87 | info "will move the f2fs partition" 88 | warning "moving a big f2fs partition can take a very long time; it requires copying the complete partition, including its free space" 89 | fi 90 | 91 | #checkTool fsck.f2fs 92 | checkFs_f2fs $n $dev 93 | 94 | } 95 | 96 | processPar_f2fs_keep_wet() { 97 | 98 | local n=$1 99 | local dev=$2 100 | local oldStart=$3 101 | local oldSize=$4 102 | local newStart=$5 103 | local newSize=$6 104 | 105 | if [ $(( newSize != oldSize )) -ne 0 ]; then 106 | fatal "assertion failed: cannot resize f2fs partitions" 107 | fi 108 | if [ $(( newStart != oldStart )) -ne 0 ]; then 109 | info "moving the f2fs partition" 110 | processParMove $n $oldStart $newStart $oldSize 111 | checkFs_f2fs $n $dev 112 | fi 113 | 114 | } 115 | -------------------------------------------------------------------------------- /repit-fs-raw.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - File System Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### raw 13 | 14 | checkTools_fs_raw() { 15 | # only require tools if actually needed 16 | : 17 | } 18 | 19 | processPar_raw_wipe_dry() { 20 | 21 | local n=$1 22 | local dev=$2 23 | local oldStart=$3 24 | local oldSize=$4 25 | local newStart=$5 26 | local newSize=$6 27 | 28 | fatal "cannot wipe raw partitions" 29 | 30 | } 31 | 32 | processPar_raw_keep_dry() { 33 | 34 | local n=$1 35 | local dev=$2 36 | local oldStart=$3 37 | local oldSize=$4 38 | local newStart=$5 39 | local newSize=$6 40 | 41 | if [ $(( newSize != oldSize )) -ne 0 ]; then 42 | fatal "cannot resize raw partitions" 43 | fi 44 | if [ $(( newStart != oldStart )) -ne 0 ]; then 45 | info "will move the raw partition" 46 | fi 47 | 48 | } 49 | 50 | processPar_raw_keep_wet() { 51 | 52 | local n=$1 53 | local dev=$2 54 | local oldStart=$3 55 | local oldSize=$4 56 | local newStart=$5 57 | local newSize=$6 58 | 59 | if [ $(( newSize != oldSize )) -ne 0 ]; then 60 | fatal "assertion failed: cannot resize raw partitions" 61 | fi 62 | if [ $(( newStart != oldStart )) -ne 0 ]; then 63 | info "moving the raw partition" 64 | processParMove $n $oldStart $newStart $oldSize 65 | fi 66 | 67 | } 68 | -------------------------------------------------------------------------------- /repit-fs-swap.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - File System Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### swap 13 | 14 | checkTools_fs_swap() { 15 | # only require tools if actually needed 16 | #checkTool mkswap 17 | : 18 | } 19 | 20 | processPar_swap_wipe_dry() { 21 | 22 | local n=$1 23 | local dev=$2 24 | local oldStart=$3 25 | local oldSize=$4 26 | local newStart=$5 27 | local newSize=$6 28 | 29 | info "will format the partition as swap area" 30 | checkTool mkswap 31 | 32 | } 33 | 34 | processPar_swap_wipe_wet() { 35 | 36 | local n=$1 37 | local dev=$2 38 | local oldStart=$3 39 | local oldSize=$4 40 | local newStart=$5 41 | local newSize=$6 42 | 43 | processParRecreate $n $oldStart $oldSize $newStart $newSize 44 | info "formatting the partition as swap area" 45 | mkswap $dev 46 | 47 | } 48 | 49 | processPar_swap_keep_dry() { 50 | 51 | local n=$1 52 | local dev=$2 53 | local oldStart=$3 54 | local oldSize=$4 55 | local newStart=$5 56 | local newSize=$6 57 | 58 | if [ $(( newStart != oldStart || newSize != oldSize )) -ne 0 ]; then 59 | fatal "cannot move or resize swap partitions "\ 60 | "(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)" 61 | fi 62 | 63 | } 64 | 65 | processPar_swap_keep_wet() { 66 | 67 | local n=$1 68 | local dev=$2 69 | local oldStart=$3 70 | local oldSize=$4 71 | local newStart=$5 72 | local newSize=$6 73 | 74 | if [ $(( newStart != oldStart || newSize != oldSize )) -ne 0 ]; then 75 | fatal "assertion failed: cannot move or resize swap partitions" 76 | fi 77 | 78 | } 79 | -------------------------------------------------------------------------------- /repit-fs-vfat.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - File System Handler # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### vfat 13 | 14 | checkTools_fs_vfat() { 15 | # only require tools if actually needed 16 | #mkfs_vfat=$(chooseTool mkdosfs mkfs.fat) 17 | #fsck_vfat=$(chooseTool dosfsck fsck.fat) 18 | : 19 | } 20 | 21 | processPar_vfat_wipe_dry() { 22 | 23 | local n=$1 24 | local dev=$2 25 | local oldStart=$3 26 | local oldSize=$4 27 | local newStart=$5 28 | local newSize=$6 29 | 30 | info "will format the partition in vfat" 31 | mkfs_vfat=$(chooseTool mkdosfs mkfs.fat) 32 | 33 | } 34 | 35 | processPar_vfat_wipe_wet() { 36 | 37 | local n=$1 38 | local dev=$2 39 | local oldStart=$3 40 | local oldSize=$4 41 | local newStart=$5 42 | local newSize=$6 43 | 44 | processParRecreate $n $oldStart $oldSize $newStart $newSize 45 | info "formatting the partition in vfat" 46 | $mkfs_vfat -I $dev 47 | 48 | } 49 | 50 | checkFs_vfat() { 51 | 52 | local n=$1 53 | local dev=$2 54 | 55 | info "checking the file system" 56 | # the -w flag is used here to bound memory use 57 | if ! $fsck_vfat -pw $dev; then 58 | info "errors detected, retrying the file system check" 59 | if ! $fsck_vfat -pw $dev; then 60 | fatal "file system errors in $(parName $n) could not be fixed" 61 | fi 62 | fi 63 | 64 | } 65 | 66 | processPar_vfat_keep_dry() { 67 | 68 | local n=$1 69 | local dev=$2 70 | local oldStart=$3 71 | local oldSize=$4 72 | local newStart=$5 73 | local newSize=$6 74 | 75 | if [ $(( newStart != oldStart || newSize != oldSize )) -ne 0 ]; then 76 | info "will move/resize the vfat partition" 77 | fi 78 | fsck_vfat=$(chooseTool dosfsck fsck.fat) 79 | checkFs_vfat $@ 80 | 81 | } 82 | 83 | processPar_vfat_keep_wet() { 84 | 85 | local n=$1 86 | local dev=$2 87 | local oldStart=$3 88 | local oldSize=$4 89 | local newStart=$5 90 | local newSize=$6 91 | 92 | if [ $(( newStart != oldStart || newSize != oldSize )) -ne 0 ]; then 93 | info "moving/resizing the vfat partition" 94 | info "note that the error 'unable to satisfy all constraints on the partition' usually means "\ 95 | "that the new desired partition size would be too small to hold the files already stored in the partition." 96 | runParted resize $n $newStart $(( newStart + newSize - 1 )) 97 | rereadParTable 98 | checkFs_vfat $@ 99 | fi 100 | 101 | } 102 | -------------------------------------------------------------------------------- /repit-par-tools.sh: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # Lanchon REPIT - Generic Partition Tools # 3 | # Copyright 2016, Lanchon # 4 | ##################################################### 5 | 6 | ##################################################### 7 | # Lanchon REPIT is free software licensed under # 8 | # the GNU General Public License (GPL) version 3 # 9 | # and any later version. # 10 | ##################################################### 11 | 12 | ### recreate partition 13 | 14 | processParRecreate() { 15 | 16 | local n=$1 17 | local oldStart=$2 18 | local oldSize=$3 19 | local newStart=$4 20 | local newSize=$5 21 | 22 | if [ $(( newStart != oldStart || newSize != oldSize )) -ne 0 ]; then 23 | 24 | info "deleting current partition" 25 | runParted rm $n 26 | 27 | info "creating new partition" 28 | if ! runParted mkpart primary $newStart $(( newStart + newSize - 1 )); then 29 | info "attempting to restore previous partition" 30 | runParted mkpart primary $oldStart $(( oldStart + oldSize - 1 )) 31 | info "naming the partition" 32 | runParted name $n $(parGet $n pname) 33 | rereadParTable 34 | fatal "unable to create new partition (previous partition was successfully restored)" 35 | fi 36 | 37 | info "naming the partition" 38 | runParted name $n $(parGet $n pname) 39 | rereadParTable 40 | 41 | fi 42 | 43 | } 44 | 45 | processParWipeCryptoFooter() { 46 | 47 | local n=$1 48 | local start=$2 49 | local size=$3 50 | local footerSize=$4 51 | 52 | if [ $(( footerSize != 0 )) -ne 0 ]; then 53 | 54 | local footerStart=$(( start + size - footerSize )) 55 | 56 | info "creating a temporary partition to wipe the crypto footer due to dd's 4 GiB wraparound bug" 57 | processParRecreate $n $start $size $footerStart $footerSize 58 | 59 | info "wiping the crypto footer" 60 | dd if=/dev/zero of=${dpar}$n bs=$sectorSize count=$footerSize conv=noerror,sync 61 | 62 | info "recreating the original partition" 63 | processParRecreate $n 0 0 $start $size 64 | 65 | fi 66 | 67 | } 68 | 69 | ### move partition 70 | 71 | moveDataChunk() { 72 | 73 | local n=$1 74 | local oldStart=$2 75 | local newStart=$3 76 | local size=$4 77 | 78 | echo "----- moving $(printSizeMiB $size) chunk: $(printSizeMiB $oldStart) -> $(printSizeMiB $newStart)" 79 | 80 | # WARNING: dd has a dangerous 4 GiB wraparound bug!!! 81 | #dd if=$ddev of=$tchunk bs=$sectorSize skip=$oldStart count=$size conv=noerror,sync 82 | #dd if=$tchunk of=$ddev bs=$sectorSize seek=$newStart count=$size conv=noerror,sync 83 | 84 | info "creating a temporary partition to read chunk at device offset $(printSizeMiB $oldStart)" 85 | runParted mkpart primary $oldStart $(( oldStart + size - 1 )) 86 | rereadParTable 87 | info "reading data" 88 | dd if=${dpar}$n of=$tchunk bs=$sectorSize conv=noerror,sync 89 | info "deleting the temporary partition" 90 | runParted rm $n 91 | 92 | info "creating a temporary partition to write chunk at device offset $(printSizeMiB $newStart)" 93 | runParted mkpart primary $newStart $(( newStart + size - 1 )) 94 | rereadParTable 95 | info "writing data" 96 | dd if=$tchunk of=${dpar}$n bs=$sectorSize conv=noerror,sync 97 | info "deleting the temporary partition" 98 | runParted rm $n 99 | 100 | #rereadParTable 101 | rm -f $tchunk 102 | 103 | echo 104 | 105 | } 106 | 107 | moveData() { 108 | 109 | local pn=$1 110 | local oldStart=$2 111 | local newStart=$3 112 | local size=$4 113 | 114 | local chunk=$moveDataChunkSize 115 | local n 116 | local m 117 | 118 | if [ $(( newStart < oldStart )) -ne 0 ]; then 119 | info "moving data towards the beginning of the disk" 120 | echo 121 | m=0 122 | for n in $(seq -- 0 $chunk $(( size - chunk - 1 )) ); do 123 | moveDataChunk $pn $(( oldStart + n )) $(( newStart + n )) $chunk 124 | m=$(( n + chunk )) 125 | done 126 | moveDataChunk $pn $(( oldStart + m )) $(( newStart + m )) $(( size - m )) 127 | fi 128 | 129 | if [ $(( newStart > oldStart )) -ne 0 ]; then 130 | info "moving data towards the end of the disk" 131 | echo 132 | m=$size 133 | for n in $(seq -- $(( size - chunk )) $(( - chunk )) 1); do 134 | moveDataChunk $pn $(( oldStart + n )) $(( newStart + n )) $chunk 135 | m=$n 136 | done 137 | moveDataChunk $pn $oldStart $newStart $m 138 | fi 139 | 140 | } 141 | 142 | processParMove() { 143 | 144 | local n=$1 145 | local oldStart=$2 146 | local newStart=$3 147 | local size=$4 148 | 149 | if [ $(( newStart != oldStart )) -ne 0 ]; then 150 | 151 | #rereadParTable 152 | #echo "##### calculating MD5 hash of partition" 153 | #md5sum ${dpar}$n 154 | 155 | # this does not work (so we manually dd data around instead) 156 | #runParted move $n $newStart $(( newStart + size - 1 )) 157 | #rereadParTable 158 | 159 | info "ensure that the destination partition can be created before starting the move" 160 | processParRecreate $n $oldStart $size $newStart $size 161 | 162 | #info "deleting the partition to ensure no access to partially moved data if move is interrupted" 163 | info "deleting the partition to workaround dd's 4 GiB wraparound bug" 164 | runParted rm $n 165 | #rereadParTable 166 | 167 | moveData $n $oldStart $newStart $size 168 | 169 | #info "recreating the partition" 170 | info "creating the final partition" 171 | runParted mkpart primary $newStart $(( newStart + size - 1 )) 172 | info "naming the partition" 173 | runParted name $n $(parGet $n pname) 174 | rereadParTable 175 | 176 | ##rereadParTable 177 | #echo "##### calculating MD5 hash of partition" 178 | #md5sum ${dpar}$n 179 | 180 | fi 181 | 182 | } 183 | -------------------------------------------------------------------------------- /repit.sh: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | ##################################################### 4 | # Lanchon REPIT # 5 | # Copyright 2016, Lanchon # 6 | ##################################################### 7 | 8 | ##################################################### 9 | # Lanchon REPIT is free software licensed under # 10 | # the GNU General Public License (GPL) version 3 # 11 | # and any later version. # 12 | ##################################################### 13 | 14 | set -e 15 | 16 | version="2017-01-15" 17 | 18 | ### logging 19 | 20 | fatal() { 21 | echo 22 | >&2 echo "FATAL:" "$@" 23 | exit 1 24 | } 25 | 26 | warning() { 27 | >&2 echo "WARNING:" "$@" 28 | } 29 | 30 | info() { 31 | echo "info:" "$@" 32 | } 33 | 34 | ### helpers 35 | 36 | printSizeMiB() { 37 | local size="$1" 38 | echo "$(( (size) / $MiB )) MiB" 39 | } 40 | 41 | checkTool() { 42 | #info "checking tool: $1" 43 | if [ -z "$(which "$1")" ]; then 44 | fatal "required tool '$1' missing (please use a recent version of TWRP to run this package)" 45 | fi 46 | } 47 | 48 | chooseTool() { 49 | #info "choosing tool: $*" 50 | local tool 51 | for tool in "$@"; do 52 | if [ -n "$(which "$tool")" ]; then 53 | echo "$tool" 54 | return 55 | fi 56 | done 57 | fatal "all tool alternatives missing: $* (please use a recent version of TWRP to run this package)" 58 | } 59 | 60 | runParted() { 61 | parted -s $ddev unit s "$@" 62 | } 63 | 64 | rereadParTable() { 65 | local hint="$1" 66 | info "rereading partition table" 67 | sync 68 | blockdev --flushbufs $ddev 69 | if ! blockdev --rereadpt $ddev; then 70 | fatal "unable to reread the partition table${hint}" 71 | fi 72 | sleep 1 73 | } 74 | 75 | detectBlockDeviceHeapRange() { 76 | info "determining usable sector range of block device" 77 | checkTool sgdisk 78 | local out="$(sgdisk "$ddev" --set-alignment 1 --print)" 79 | deviceHeapStart=$(echo "$out" | sed -n "s/^First usable sector is[ ]*\([0-9]*\)[, ]*last usable sector is[ ]*\([0-9]*\)[ ]*$/\1/p") 80 | deviceHeapEnd=$(echo "$out" | sed -n "s/^First usable sector is[ ]*\([0-9]*\)[, ]*last usable sector is[ ]*\([0-9]*\)[ ]*$/\2/p") 81 | if [ -z "$deviceHeapStart" ] || [ -z "$deviceHeapEnd" ]; then 82 | warning "unable to parse sgdisk output (dump of output follows)" 83 | >&2 echo 84 | >&2 echo "$out" 85 | >&2 echo 86 | fatal "unable to determine usable sector range of block device" 87 | fi 88 | deviceHeapEnd=$(( deviceHeapEnd + 1 )) 89 | } 90 | 91 | alignDown() { 92 | echo $(( ($1) / heapAlignment * heapAlignment )) 93 | } 94 | 95 | alignUp() { 96 | echo $(( (($1) + (heapAlignment - 1)) / heapAlignment * heapAlignment )) 97 | } 98 | 99 | ### data store 100 | 101 | parOldStart() { 102 | cat ${spar}$1/start 103 | } 104 | 105 | parNewStart() { 106 | cat ${tpar}$1/start 107 | } 108 | 109 | parOldSize() { 110 | cat ${spar}$1/size 111 | } 112 | 113 | parNewSize() { 114 | cat ${tpar}$1/size 115 | } 116 | 117 | parFooterSize() { 118 | cat ${tpar}$1/footerSize 119 | } 120 | 121 | parNewSizeMinusFooter() { 122 | echo $(( $(parNewSize $1) - $(parFooterSize $1) )) 123 | } 124 | 125 | parNewSizeAligned() { 126 | cat ${tpar}$1/sizeAligned 127 | } 128 | 129 | parOldEnd() { 130 | echo $(( $(parOldStart $1) + $(parOldSize $1) )) 131 | } 132 | 133 | parNewEnd() { 134 | echo $(( $(parNewStart $1) + $(parNewSize $1) )) 135 | } 136 | 137 | parNewEndAligned() { 138 | echo $(( $(parNewStart $1) + $(parNewSizeAligned $1) )) 139 | } 140 | 141 | parGet() { 142 | cat ${tpar}$1/$2 143 | } 144 | 145 | parSet() { 146 | echo -n "$3" >${tpar}$1/$2 147 | } 148 | 149 | parName() { 150 | echo -n "partition #$1 '$(parGet $1 fname)' ($(parGet $1 pname))" 151 | } 152 | 153 | ### initialization 154 | 155 | detectSideload() { 156 | 157 | local packageName="$1" 158 | 159 | # /tmp/update.zip: old sideload protocol 160 | # /sideload/package.zip: current sideload-host protocol 161 | if [ "$1" == "/tmp/update.zip" ] || [ "$1" == "/sideload/package.zip" ]; then 162 | fatal "adb sideload is not directly supported: it hides the package filename and thus filename-based configuration does not work "\ 163 | "(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)" 164 | fi 165 | 166 | } 167 | 168 | checkTools() { 169 | 170 | checkTool parted 171 | checkTool sort 172 | checkTool blockdev 173 | checkTool sed 174 | checkTool awk 175 | checkTool readlink 176 | checkTool basename 177 | checkTool dirname 178 | checkTool dd 179 | 180 | checkTools_fs_ext4 181 | checkTools_fs_vfat 182 | checkTools_fs_f2fs 183 | checkTools_fs_swap 184 | checkTools_fs_raw 185 | 186 | } 187 | 188 | initPartitionConf() { 189 | 190 | local n=$1 191 | local size=$2 192 | local content=$3 193 | local fs=$4 194 | 195 | $(parSet $n parsedSize $size) 196 | $(parSet $n parsedContent $content) 197 | $(parSet $n parsedFs $fs) 198 | 199 | } 200 | 201 | initPartition() { 202 | 203 | local n=$1 204 | local pname=$2 205 | local fname=$3 206 | local conf=$4 207 | local footerSize=$5 208 | 209 | mkdir -p ${tpar}$n 210 | 211 | $(parSet $n pname $pname) 212 | $(parSet $n fname $fname) 213 | 214 | initPartitionConf $n $conf 215 | 216 | $(parSet $n footerSize $footerSize) 217 | 218 | initedPartitions="$initedPartitions $n" 219 | 220 | } 221 | 222 | initPartitions() { 223 | 224 | rm -rf $tdir 225 | 226 | initedPartitions="" 227 | device_initPartitions 228 | 229 | } 230 | 231 | parsePartitionConfiguration() { 232 | 233 | local n=$1 234 | local packageName="$2" 235 | 236 | local parName=$(parGet $n fname) 237 | local conf="$(echo -n "$packageName" | sed -n "s/.*-${parName}=\([^-=]*\)\(-.*\|\)\$/\1/p")" 238 | 239 | if [ -n "$conf" ]; then 240 | 241 | local regex="^\(\|[0-9]\+[GgMm]\|[0-9]\+[.][0-9]*[GgMm]\|[.][0-9]\+[GgMm]\|same\|min\|max\)\(+\(\|keep\|wipe\)\(+\(\|ext4\|vfat\|f2fs\|swap\|raw\)\)\?\)\?$" 242 | 243 | if [ -n "$(echo -n "$conf" | sed "s/$regex//")" ]; then 244 | fatal "invalid partition configuration for '$parName': $parName=$conf" 245 | fi 246 | 247 | local val 248 | val="$(echo -n "$conf" | sed -n "s/$regex/\1/p")" 249 | if [ -n "$val" ]; then $(parSet $n parsedSize "$val"); fi 250 | val="$(echo -n "$conf" | sed -n "s/$regex/\3/p")" 251 | if [ -n "$val" ]; then $(parSet $n parsedContent "$val"); fi 252 | val="$(echo -n "$conf" | sed -n "s/$regex/\5/p")" 253 | if [ -n "$val" ]; then $(parSet $n parsedFs "$val"); fi 254 | 255 | fi 256 | 257 | } 258 | 259 | parsePackageName() { 260 | 261 | local packageName="$1" 262 | 263 | local parNames="" 264 | local n 265 | for n in $configurablePartitions; do 266 | if [ -n "$parNames" ]; then 267 | parNames="$parNames|" 268 | fi 269 | parNames="$parNames$(parGet $n fname)" 270 | done 271 | info "valid package names: [-($parNames)=]..." 272 | info "valid partition values: [(G|M)|same|min|max][+[keep|wipe][+[ext4|vfat|f2fs|swap|raw]]]" 273 | 274 | echo 275 | echo "----- DEFAULTS -----" 276 | for n in $configurablePartitions; do 277 | #echo "-$(parGet $n fname)=$(parGet $n parsedSize)+$(parGet $n parsedContent)+$(parGet $n parsedFs)" 278 | echo "$(parGet $n fname) = size:$(parGet $n parsedSize) + content:$(parGet $n parsedContent) + fs:$(parGet $n parsedFs)" 279 | done 280 | echo 281 | 282 | info "parsing package name" 283 | if [ -z "$packageName" ]; then 284 | fatal "unable to retrieve package name" 285 | fi 286 | packageName="$(basename "$packageName" .zip)" 287 | for n in $configurablePartitions; do 288 | parsePartitionConfiguration $n $packageName 289 | done 290 | 291 | echo 292 | echo "----- CONFIGURATION -----" 293 | for n in $initedPartitions; do 294 | #echo "-$(parGet $n fname)=$(parGet $n parsedSize)+$(parGet $n parsedContent)+$(parGet $n parsedFs)" 295 | echo "$(parGet $n fname) = size:$(parGet $n parsedSize) + content:$(parGet $n parsedContent) + fs:$(parGet $n parsedFs)" 296 | done 297 | echo 298 | 299 | } 300 | 301 | disableSwap() { 302 | #info "checking tool: swapoff" 303 | if [ -n "$(which swapoff)" ]; then 304 | info "disabling swap" 305 | swapoff -a 306 | fi 307 | } 308 | 309 | checkUnmount() { 310 | 311 | local packageName="$1" 312 | 313 | if [ ! -e $ddev ] || [ ! -e $sdev ]; then 314 | fatal "block device not found" 315 | fi 316 | 317 | local hint 318 | if [ -f "$packageName" ]; then 319 | local resolvedPackageName 320 | resolvedPackageName="$(readlink -f "$packageName")" 321 | if [ -z "$resolvedPackageName" ]; then 322 | resolvedPackageName="$packageName" 323 | fi 324 | if [ "$(dirname "$resolvedPackageName")" != "/tmp" ]; then 325 | info "copying package to '/tmp'" 326 | cp -f "$packageName" "/tmp/" 327 | hint="this package copied itself to '/tmp'; please run it again from there" 328 | else 329 | hint=\ 330 | "please disable MTP in TWRP's 'Mount' menu (or disconnect from PC), reboot TWRP and run this package again; "\ 331 | "run it immediately after boot up, do not enable USB mass storage; "\ 332 | "note that you might be told to run it yet again from '/tmp'; "\ 333 | "make sure your phone is not encrypted: encrypted phones are not supported" 334 | fi 335 | else 336 | hint="please use TWRP's file manager to copy this package to '/tmp' and run it again from there" 337 | fi 338 | 339 | info "unmounting all partitions" 340 | 341 | local dev 342 | for dev in $(grep -ow "^$unmountPattern" /proc/mounts | sort -u); do 343 | if ! umount $dev; then 344 | fatal "unable to unmount all partitions ($hint)" 345 | fi 346 | done 347 | 348 | # rereadParTable requires everything unmounted 349 | rereadParTable " ($hint)" 350 | 351 | } 352 | 353 | init() { 354 | 355 | local packageName="$1" 356 | 357 | detectSideload "$packageName" 358 | 359 | tdir=/tmp/lanchon-repit 360 | tchunk=$tdir/chunk.tmp 361 | tpar=$tdir/partition-info/p 362 | 363 | device_init 364 | 365 | MiB=$(( 1024 * 1024 / sectorSize )) # 1 MiB in sectors 366 | GiB=$(( 1024 * 1024 * 1024 / sectorSize )) # 1 GiB in sectors 367 | 368 | checkTools 369 | initPartitions 370 | parsePackageName "$packageName" 371 | disableSwap 372 | checkUnmount "$packageName" 373 | 374 | } 375 | 376 | ### setup 377 | 378 | setup() { 379 | 380 | checkTool parted 381 | checkTool sort 382 | checkTool blockdev 383 | checkTool awk 384 | 385 | #info "unmounting all partitions" 386 | #... 387 | #rereadParTable 388 | 389 | heapMinSize=$(( 8 * MiB )) 390 | 391 | device_setup 392 | 393 | info "checking existing partitions" 394 | 395 | local n 396 | for n in $(seq 1 $partitionCount); do 397 | if [ ! -e ${spar}$n ]; then 398 | fatal "partition #$n: not found" 399 | fi 400 | if [ $(( $(parOldStart $n) < 0 )) -ne 0 ]; then 401 | fatal "partition #$n: invalid start" 402 | fi 403 | if [ $(( $(parOldSize $n) <= 0 )) -ne 0 ]; then 404 | fatal "partition #$n: invalid size" 405 | fi 406 | done 407 | 408 | for n in $(seq $(( partitionCount + 1 )) $(( partitionCount + 100 )) ); do 409 | if [ -e ${spar}$n ]; then 410 | fatal "partition #$n: unexpected" 411 | fi 412 | done 413 | 414 | } 415 | 416 | setupHeapExisting() { 417 | 418 | info "checking existing partition layout" 419 | 420 | # TODO: verify that no partitions that are not members of the heap step into the heap area. 421 | # TODO: maybe verify that all partitions that are members of the heap are fully contained in the heap area. 422 | 423 | local nPrev="" 424 | local gap 425 | local n 426 | for n in $heapPartitions; do 427 | info "current size: $(parName $n): $(printSizeMiB $(parOldSize $n))" 428 | if [ -z "$nPrev" ]; then 429 | gap=$(( $(parOldStart $n) - heapStart )) 430 | if [ $(( gap < 0 )) -ne 0 ]; then 431 | warning "$(parName $n) starts $(printSizeMiB $(( -(gap) )) ) before the start of heap '$heapName'" 432 | fi 433 | gap=$(( $(parOldStart $n) - heapStartAligned )) 434 | if [ $(( gap > 0 )) -ne 0 ]; then 435 | warning "$(parName $n) starts $(printSizeMiB $gap) after the aligned start of heap '$heapName'" 436 | fi 437 | else 438 | gap=$(( $(parOldStart $n) - $(parOldEnd $nPrev) )) 439 | if [ $(( gap < 0 )) -ne 0 ]; then 440 | fatal "layout reversal between $(parName $nPrev) and $(parName $n) in heap '$heapName'" 441 | fi 442 | gap=$(( $(parOldStart $n) - $(alignUp $(parOldEnd $nPrev)) )) 443 | if [ $(( gap > 0 )) -ne 0 ]; then 444 | warning "$(parName $n) starts $(printSizeMiB $gap) after the aligned end of $(parName $nPrev)" 445 | fi 446 | fi 447 | nPrev=$n 448 | done 449 | gap=$(( heapEnd - $(parOldEnd $nPrev) )) 450 | if [ $(( gap < 0 )) -ne 0 ]; then 451 | warning "$(parName $nPrev) ends $(printSizeMiB $(( -(gap) )) ) after the end of heap '$heapName'" 452 | fi 453 | if [ $(( gap >= heapAlignment )) -ne 0 ]; then 454 | warning "$(parName $nPrev) ends $(printSizeMiB $gap) before the end of heap '$heapName'" 455 | fi 456 | 457 | } 458 | 459 | setupHeapPartition() { 460 | 461 | local n=$1 462 | 463 | local size="$(parGet $n parsedSize)" 464 | local content="$(parGet $n parsedContent)" 465 | local fs="$(parGet $n parsedFs)" 466 | 467 | if [ -z "$size" ]; then 468 | fatal "$(parName $n): undefined new size" 469 | fi 470 | if [ -z "$content" ]; then 471 | fatal "$(parName $n): undefined content policy" 472 | fi 473 | if [ -z "$fs" ]; then 474 | fatal "$(parName $n): undefined file system type" 475 | fi 476 | 477 | case "$size" in 478 | same) 479 | size=$(parOldSize $n) 480 | ;; 481 | min) 482 | size=$heapMinSize 483 | ;; 484 | max) 485 | size=0 486 | ;; 487 | *) 488 | local regex="^\([0-9.]*\)[ ]*\([GgMm]\)\?$" 489 | local sizeUnit="$(echo -n "$size" | sed -n "s/$regex/\2/p")" 490 | local size="$(echo -n "$size" | sed -n "s/$regex/\1/p")" 491 | case "$sizeUnit" in 492 | M|m) 493 | sizeUnit=$MiB 494 | ;; 495 | G|g|*) 496 | sizeUnit=$GiB 497 | ;; 498 | esac 499 | local sizeGranularity=$(( heapSizeGranularity )) 500 | size=$(awk "BEGIN { print int(($size) * $sizeUnit / $sizeGranularity + 0.5) * $sizeGranularity }") 501 | if [ $(( size < heapSizeGranularity )) -ne 0 ]; then 502 | fatal "$(parName $n): invalid new size" 503 | fi 504 | ;; 505 | esac 506 | 507 | case "$content" in 508 | keep) 509 | ;; 510 | wipe) 511 | ;; 512 | *) 513 | fatal "$(parName $n): invalid content policy" 514 | ;; 515 | esac 516 | 517 | case "$fs" in 518 | ext4) 519 | ;; 520 | vfat) 521 | ;; 522 | f2fs) 523 | ;; 524 | swap) 525 | ;; 526 | raw) 527 | ;; 528 | *) 529 | fatal "$(parName $n): invalid file system type" 530 | ;; 531 | esac 532 | 533 | $(parSet $n size $size) 534 | $(parSet $n content $content) 535 | $(parSet $n fs $fs) 536 | 537 | $(parSet $n sizeAligned $(alignUp $size)) 538 | 539 | } 540 | 541 | setupHeapNew() { 542 | 543 | info "checking new partition layout" 544 | 545 | local n 546 | for n in $heapPartitions; do 547 | setupHeapPartition $n 548 | done 549 | 550 | local sizeAligned=$(( heapEndAligned - heapStartAligned )) 551 | 552 | # correct $sizeAligned in case the size of last partition and the end of heap are both unaligned, 553 | # and their combination would lead to an unused area at heap end the size of $heapAlignment or larger. 554 | local lastPar=$n 555 | local lastParEnd=$(( heapEndAligned - $(parNewSizeAligned $lastPar) + $(parNewSize $lastPar) )) 556 | if [ $(( heapEnd - lastParEnd >= heapAlignment )) -ne 0 ]; then 557 | sizeAligned=$(( sizeAligned + heapAlignment )) 558 | fi 559 | 560 | for n in $heapPartitions; do 561 | sizeAligned=$(( sizeAligned - $(parNewSizeAligned $n) )) 562 | done 563 | 564 | local maxPar 565 | for n in $heapPartitions; do 566 | if [ $(( $(parNewSize $n) == 0 )) -ne 0 ]; then 567 | if [ -n "$maxPar" ]; then 568 | fatal "more than one partition in heap '$heapName' has its size set to 'max'" 569 | fi 570 | maxPar=$n 571 | local size=$(( sizeAligned / heapSizeGranularity * heapSizeGranularity )) 572 | if [ $(( size < heapSizeGranularity )) -ne 0 ]; then 573 | fatal "the new partition layout of heap '$heapName' requires more space than available" 574 | fi 575 | $(parSet $n size $size) 576 | $(parSet $n sizeAligned $sizeAligned) 577 | fi 578 | info "new size: $(parName $n): $(printSizeMiB $(parNewSize $n))" 579 | done 580 | 581 | local nextStart=$heapStartAligned 582 | for n in $heapPartitions; do 583 | $(parSet $n start $nextStart) 584 | nextStart=$(parNewEndAligned $n) 585 | done 586 | 587 | gap=$(( heapEnd - $(parNewEnd $lastPar) )) 588 | if [ $(( gap < 0 )) -ne 0 ]; then 589 | fatal "the new partition layout of heap '$heapName' requires more space than available" 590 | fi 591 | if [ $(( gap >= heapAlignment )) -ne 0 ]; then 592 | warning "there will be $(printSizeMiB $gap) of unused space at the end of heap '$heapName'" 593 | fi 594 | 595 | } 596 | 597 | setupHeap() { 598 | 599 | setupHeapExisting 600 | setupHeapNew 601 | 602 | } 603 | 604 | forEachHeap() { 605 | 606 | for heapName in $allHeaps; do 607 | 608 | echo "##### processing heap '$heapName'" 609 | 610 | device_setupHeap_$heapName 611 | 612 | heapStartAligned=$(alignUp $heapStart) 613 | heapEndAligned=$(alignDown $heapEnd) 614 | 615 | if [ -z "$heapSizeGranularity" ]; then 616 | heapSizeGranularity=$heapAlignment 617 | "$@" 618 | heapSizeGranularity="" 619 | else 620 | "$@" 621 | fi 622 | 623 | done 624 | 625 | } 626 | 627 | ### execution 628 | 629 | processPar() { 630 | 631 | local n=$1 632 | 633 | echo "***** processing $(parName $n)" 634 | 635 | eval processPar_$(parGet $n fs)_$(parGet $n content)_$processMode $n ${dpar}$n $(parOldStart $n) $(parOldSize $n) $(parNewStart $n) $(parNewSize $n) 636 | 637 | } 638 | 639 | processParList() { 640 | 641 | local first=$1 642 | local rest=${@:2} 643 | 644 | echo "----- analyzing $(parName $first)" 645 | 646 | if [ -z "$rest" ]; then 647 | 648 | processPar $first 649 | 650 | else 651 | 652 | local second=$2 653 | 654 | if [ $(( $(parNewEnd $first) > $(parOldStart $second) )) -ne 0 ]; then 655 | info "$(parName $first) will expand into storage area currently used by $(parName $second)" 656 | info "deferring processing of $(parName $first) until required space is freed" 657 | processParList $rest 658 | processPar $first 659 | else 660 | processPar $first 661 | processParList $rest 662 | fi 663 | 664 | fi 665 | 666 | } 667 | 668 | processHeap() { 669 | 670 | processMode=$1 671 | 672 | processParList $heapPartitions 673 | 674 | } 675 | 676 | flushBuffers() { 677 | 678 | info "flushing buffers" 679 | 680 | sync 681 | blockdev --flushbufs $ddev 682 | sleep 3 683 | 684 | } 685 | 686 | ### main 687 | 688 | main() { 689 | 690 | local packageName="$1" 691 | 692 | echo " ####################################" 693 | echo " Lanchon REPIT" 694 | echo " A Data-Sparing Repartitioning Tool" 695 | echo " Version: $version" 696 | echo " Device: $deviceName" 697 | echo " Copyright 2016, Lanchon (GPLv3)" 698 | echo " ####################################" 699 | echo 700 | 701 | echo "===== PRELIMINARY CHECKS =====" 702 | if [ -f "/tmp/repit-settings" ]; then 703 | packageName="$(cat "/tmp/repit-settings")" 704 | info "overriding configuration via '/tmp/repit-settings' to '$packageName'" 705 | elif [ -n "$FLASHIZE_ENV_VERSION" ] && [ -f "/tmp/flashize/repit-settings" ]; then 706 | packageName="$(cat "/tmp/flashize/repit-settings")" 707 | info "overriding configuration via 'flashize/repit-settings' to '$packageName'" 708 | fi 709 | init "$packageName" 710 | echo 711 | 712 | echo "===== PREPARATION =====" 713 | setup 714 | forEachHeap setupHeap 715 | echo 716 | 717 | echo "===== DRY-RUN =====" 718 | forEachHeap processHeap dry 719 | echo 720 | 721 | echo "===== EXECUTION =====" 722 | forEachHeap processHeap wet 723 | flushBuffers 724 | echo 725 | 726 | echo "===== SUCCESS =====" 727 | #echo 728 | 729 | } 730 | -------------------------------------------------------------------------------- /run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | device="$1" 6 | conf="$2" 7 | 8 | if [ -e run.conf ]; then 9 | source run.conf 10 | fi 11 | 12 | script="build/lanchon-repit-$device.sh" 13 | ./make-script "$device" "$script" 14 | 15 | adb push "$script" /tmp/repit.sh 16 | echo 17 | 18 | #adb shell sh -c ".\ /tmp/flashize/env/setup\ ;\ .\ /tmp/repit.sh\ /tmp/lanchon-repit-00000000-$conf-$device.zip" 19 | 20 | adb shell <