All of TWRP 3.x source is public. You can compile it on your own. This guide isn't going to be a step-by-step, word-for-word type of guide. If you're not familiar with basic Linux commands and/or building in AOSP then you probably won't be able to do this.
You can currently use Omni 6.0, Omni 7.1, Omni 8.1, Omni 9.0, CM 13.0, CM 14.1, CM 15.1, LineageOS 16.0 source code. Omni 9.0 is recommended for now unless your device has a super partition.
If you are using CM/LineageOS, you'll need to place TWRP in the LineageOS/bootable/recovery-twrp folder and set RECOVERY_VARIANT := twrp in your BoardConfig.mk file. TWRP source code can be found here:
https://github.com/TeamWin/android_bootable_recovery (NOTE: The location for the latest TWRP source code has changed!)
Select the newest branch available. This step is not necessary with Omni because Omni already includes TWRP source by default, however, if you are using an older version of Omni, you will probably want to pull from the latest branch (the latest branch will compile successfully in older build trees)
If you are only interested in building TWRP, you may want to try working with a smaller tree. You can try using this manifest. It should work in most cases but there may be some situations where you will need more repos in your tree than this manifest provides:
https://github.com/minimal-manifest-twrp
*BEFORE YOU COMPILE*
Note: If you add or change any flags, you will need to make clean or make clobber before recompiling or your flag changes will not be picked up.
Now that you have the source code, you'll need to set or change a few build flags for your device(s). Find the BoardConfig.mk for your device. The BoardConfig.mk is in your devices/manufacturer/codename folder (e.g. devices/lge/hammerhead/BoardConfig.mk).
Your board config will need to include architecture and platform settings. Usually these are already included if you're using device configs that someone else created, but if you created your own, you may need to add them. Without them, recovery may seg fault during startup and you'll just see the teamwin curtain flash on the screen over and over.
We usually put all of our flags at the bottom of the BoardConfig.mk under a heading of #twrp For all devices you'll need to tell TWRP what theme to use. This TW_THEME flag replaces the older DEVICE_RESOLUTION flag. TWRP now uses scaling to stretch any theme to fit the screen resolution. There are currently 5 settings which are: portrait_hdpi, portrait_mdpi, landscape_hdpi, landscape_mdpi, and watch_mdpi. For portrait, you should probably select the hdpi theme for resolutions of 720x1280 and higher. For landscape devices, use the hdpi theme for 1280x720 or higher.
TW_THEME := portrait_hdpi
Note that themes do not rotate 90 degrees and there currently is no option to rotate a theme. If you find that the touchscreen is rotated relative to the screen, then you can use some flags (discussed later in this guide) to rotate the touch input to match the screen's orientation.
In addition to the resolution, we have the following build flags:
RECOVERY_SDCARD_ON_DATA := true -- this enables proper handling of /data/media on devices that have this folder for storage (most Honeycomb and devices that originally shipped with ICS like Galaxy Nexus) This flag is not required for these types of devices though. If you do not define this flag and also do not include any references to /sdcard, /internal_sd, /internal_sdcard, or /emmc in your fstab, then we will automatically assume that the device is using emulated storage.
BOARD_HAS_NO_REAL_SDCARD := true -- disables things like sdcard partitioning and may save you some space if TWRP isn't fitting in your recovery patition
TW_NO_BATT_PERCENT := true -- disables the display of the battery percentage for devices that don't support it properly
TW_CUSTOM_POWER_BUTTON := 107 -- custom maps the power button for the lockscreen
TW_NO_REBOOT_BOOTLOADER := true -- removes the reboot bootloader button from the reboot menu
TW_NO_REBOOT_RECOVERY := true -- removes the reboot recovery button from the reboot menu
RECOVERY_TOUCHSCREEN_SWAP_XY := true -- swaps the mapping of touches between the X and Y axis
RECOVERY_TOUCHSCREEN_FLIP_Y := true -- flips y axis touchscreen values
RECOVERY_TOUCHSCREEN_FLIP_X := true -- flips x axis touchscreen values
TWRP_EVENT_LOGGING := true -- enables touch event logging to help debug touchscreen issues (don't leave this on for a release - it will fill up your logfile very quickly)
BOARD_HAS_FLIPPED_SCREEN := true -- flips the screen upside down for screens that were mounted upside-down
There are other build flags which you can locate by scanning the Android.mk files in the recovery source. Most of the other build flags are not often used and thus I won't document them all here.
*RECOVERY.FSTAB*
TWRP 2.5 and higher supports some new recovery.fstab features that you can use to extend TWRP's backup/restore capabilities. You do not have to add fstab flags as most partitions are handled automatically.
Note that TWRP only supports v2 fstabs in version 3.2.0 and higher. You will still need to use the "old" format of fstab for older TWRP (example of that format is below), and even TWRP 3.2.0 still supports the v1 format in addition to the v2 format. To maximize TWRP's compatibility with your build tree, you can create a twrp.fstab and use PRODUCT_COPY_FILES to place the file in /etc/twrp.fstab When TWRP boots, if it finds a twrp.fstab in the ramdisk it will rename /etc/recovery.fstab to /etc/recovery.fstab.bak and then rename /etc/twrp.fstab to /etc/recovery.fstab. Effectively this will "replace" the fstab 2 file that your device files are providing with the TWRP fstab allowing you to maintain compatibility within your device files and with other recoveries.
Code:
PRODUCT_COPY_FILES += device/lge/hammerhead/twrp.fstab:recovery/root/etc/twrp.fstab
The fstab in TWRP can contain some "flags" for each partition listed in the fstab.
Here's a sample TWRP fstab for the Galaxy S4 that we will use for reference:
Code:
/boot emmc /dev/block/platform/msm_sdcc.1/by-name/boot
/system ext4 /dev/block/platform/msm_sdcc.1/by-name/system
/data ext4 /dev/block/platform/msm_sdcc.1/by-name/userdata length=-16384
/cache ext4 /dev/block/platform/msm_sdcc.1/by-name/cache
/recovery emmc /dev/block/platform/msm_sdcc.1/by-name/recovery
/efs ext4 /dev/block/platform/msm_sdcc.1/by-name/efs flags=display="EFS";backup=1
/external_sd vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="Micro SDcard";storage;wipeingui;removable
/usb-otg vfat /dev/block/sda1 /dev/block/sda flags=display="USB-OTG";storage;wipeingui;removable
/preload ext4 /dev/block/platform/msm_sdcc.1/by-name/hidden flags=display="Preload";wipeingui;backup=1
/modem ext4 /dev/block/platform/msm_sdcc.1/by-name/apnhlos
/mdm emmc /dev/block/platform/msm_sdcc.1/by-name/mdm
Flags are added to the end of the partition listing in the fstab separated by white space (spaces or tabs are fine). The flags affect only that partition but not any of the others. Flags are separated by semicolons. If your display name is going to have a space, you must surround the display name with quotes.
Code:
/external_sd vfat /dev/block/mmcblk1p1 flags=display="Micro SDcard";storage;wipeingui;removable
The flags for this partition give it a display name of "Micro SDcard" which is displayed to the user. wipeingui makes this partition available for wiping in the advanced wipe menu. The removable flag indicates that sometimes this partition may not be present preventing mounting errors from being displayed during startup. Here is a full list of flags:
removable -- indicates that the partition may not be present preventing mounting errors from being displayed during boot
storage -- indicates that the partition can be used as storage which makes the partition available as storage for backup, restore, zip installs, etc.
settingsstorage -- only one partition should be set as settings storage, this partition is used as the location for storing TWRP's settings file
canbewiped -- indicates that the partition can be wiped by the back-end system, but may not be listed in the GUI for wiping by the user
userrmrf -- overrides the normal format type of wiping and only allows the partition to be wiped using the rm -rf command
backup= -- must be succeeded by the equals sign, so backup=1 or backup=0, 1 indicates that the partition can be listed in the backup/restore list while 0 ensures that this partition will not show up in the backup list.
wipeingui -- makes the partition show up in the GUI to allow the user to select it for wiping in the advanced wipe menu
wipeduringfactoryreset -- the partition will be wiped during a factory reset
ignoreblkid -- blkid is used to determine what file system is in use by TWRP, this flag will cause TWRP to skip/ignore the results of blkid and use the file system specified in the fstab only
retainlayoutversion -- causes TWRP to retain the .layoutversion file in /data on devices like Sony Xperia S which sort of uses /data/media but still has a separate /sdcard partition
symlink= -- causes TWRP to run an additional mount command when mounting the partition, generally used with /data/media to create /sdcard
display= -- sets a display name for the partition for listing in the GUI
storagename= -- sets a storage name for the partition for listing in the GUI storage list
backupname= -- sets a backup name for the partition for listing in the GUI backup/restore list
length= -- usually used to reserve empty space at the end of the /data partition for storing the decryption key when Android's full device encryption is present, not setting this may lead to the inability to encrypt the device
canencryptbackup= -- 1 or 0 to enable/disable, makes TWRP encrypt the backup of this partition if the user chooses encryption (only applies to tar backups, not images)
userdataencryptbackup= -- 1 or 0 to enable/disable, makes TWRP encrypt only the userdata portion of this partition, certain subfuldes like /data/app would not be encrypted to save time
subpartitionof= -- must be succeeded by the equals sign and the path of the partition it is a subpartition of. A subpartition is treated as "part" of the main partition so for instance, TWRP automatically makes /datadata a subpartition of /data. This means that /datadata will not show up in the GUI listings, but /datadata would be wiped, backed up, restored, mounted, and unmounted anytime those operations are performed on /data. A good example of the use of subpartitions is the 3x efs partitions on the LG Optimus G:
Code:
/efs1 emmc /dev/block/mmcblk0p12 flags=backup=1;display=EFS
/efs2 emmc /dev/block/mmcblk0p13 flags=backup=1;subpartitionof=/efs1
/efs3 emmc /dev/block/mmcblk0p14 flags=backup=1;subpartitionof=/efs1
This lumps all 3 partitions into a single "EFS" entry in the TWRP GUI allowing all three to be backed up and restored together under a single entry.
As of TWRP 3.2.0, TWRP now supports a version 2 fstab like those that have been found in Android devices for years. Yes, I know we're really slow to adopt this one, but I also saw no major advantage to v2 and the v2 fstab was being used in regular Android as well as recovery and I didn't want full ROM builds crashing or doing other weird things because of TWRP flags being present in the fstab. Version 2 fstab support is automatic. You don’t need to add any build flags. The regular version 1 fstab format is also still valid and it’s possible to use both v1 and v2 types in the same fstab. TWRP 3.2.0 also supports using wildcards via the asterisk in v1 format which can be useful for USB OTG and micro SD cards with multiple partitions. Note also that v2 fstab formats haven’t been extensively tested so developers should test their v2 fstabs before shipping to users (you should always be testing anyway!).
This is a v1 fstab line with a wildcard intended for a USB OTG drive. All partitions should show up in the list of available storage devices when the user plugs in a drive:
Code:
/usb-otg vfat /dev/block/sda* flags=removable;storage;display=USB-OTG
This line is straight from the v2 fstab for the same device and also should work. In this case the kernel will notify us that new devices have been added or removed via uevents:
Code:
/devices/soc.0/f9200000.ssusb/f9200000.dwc3/xhci-hcd.0.auto/usb* auto auto defaults voldmanaged=usb:auto
In addition to the v2 fstab, you can include /etc/twrp.flags which uses the v1 fstab format. The twrp.flags file can be used to supplement the v2 fstab with TWRP flags, additional partitions not included in the v2 fstab, and to override settings in the v2 fstab. For example, I have a Huawei device with the following stock v2 fstab present as /etc/recovery.fstab
Code:
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1 wait,verify
/dev/block/bootdevice/by-name/cust /cust ext4 ro,barrier=1 wait,verify
/devices/hi_mci.1/mmc_host/mmc1/* auto auto defaults voldmanaged=sdcard:auto,noemulatedsd
/devices/hisi-usb-otg/usb1/* auto auto defaults voldmanaged=usbotg:auto
/dev/block/bootdevice/by-name/userdata /data f2fs nosuid,nodev,noatime,discard,inline_data,inline_xattr wait,forceencrypt=footer,check
/dev/block/bootdevice/by-name/cache /cache ext4 rw,nosuid,nodev,noatime,data=ordered wait,check
/dev/block/bootdevice/by-name/splash2 /splash2 ext4 rw,nosuid,nodev,noatime,data=ordered,context=u:object_r:splash2_data_file:s0 wait,check
/dev/block/bootdevice/by-name/secure_storage /sec_storage ext4 rw,nosuid,nodev,noatime,discard,auto_da_alloc,mblk_io_submit,data=journal,context=u:object_r:teecd_data_file:s0 wait,check
In addition I have also included this in /etc/twrp.flags:
Code:
/boot emmc /dev/block/platform/hi_mci.0/by-name/boot
/recovery emmc /dev/block/platform/hi_mci.0/by-name/recovery flags=backup=1
/cust ext4 /dev/block/platform/hi_mci.0/by-name/cust flags=display="Cust";backup=1
/misc emmc /dev/block/platform/hi_mci.0/by-name/misc
/oeminfo emmc /dev/block/platform/hi_mci.0/by-name/oeminfo flags=display="OEMinfo";backup=1
/data f2fs /dev/block/dm-0
/system_image emmc /dev/block/platform/hi_mci.0/by-name/system
The first 2 lines in twrp.flags adds the boot and recovery partitions which were not present at all in the v2 fstab. The /cust line in the twrp.flags file is added to tell TWRP to allow users to back up the cust partition and to give it a slightly better display name. The /misc partition is also only present in the twrp.flags file. Much like the /cust partition, the /oeminfo partition is in the twrp.flags file to tell TWRP to allow users to back it up and give a display name. The /data line is needed because this Huawei device, like many Huawei devices, is encrypted but the encryption uses some special Huawei binaries and is encrypted with some sort of default password that the user cannot change. We use the Huawei binaries to decrypt the device automatically in recovery. The /data line here tells TWRP to use /dev/block/dm-0 instead of /dev/block/bootdevice/by-name/userdata which is required for proper mounting, etc. Lastly we have the /system_image line so that TWRP will add a system image option for backup and restore.
As we add more new devices, we’ll add more example device trees to https://github.com/TeamWin/ which should help you find more ways to use this new fstab support. Please note that using the v2 fstab format at this point is completely optional, so feel free to continue using v1 if that is what is more comfortable or if you have trouble with the v2 format support.
If you have questions, feel free to stop by #twrp on Freenode. If you post here I may not see it for a while as I have lots of threads out there and there's no way for me to keep track of them all. If you successfully port TWRP to a new device, please let us know! We love to hear success stories!
If you have code changes that you'd like to submit, please submit them through the Omni Gerrit server. Guide is here.
Once you get Omni or CM sync'ed and your TWRP flags set, you should do a source ./build/envsetup.sh We usually lunch for the device in question, so something like "lunch omni_hammerhead-eng".
After you lunch successfully for your device this is the command used for most devices:
Code:
make clean && make -j# recoveryimage
Replace the # with the core count +1, so if you have a dual core it's -j3 and a quad core becomes -j5, etc. If you're dealing with a "typical" Samsung device, then you'll need to
Code:
make -j# bootimage
Most Samsung devices have the recovery included as an extra ramdisk in the boot image instead of a separate recovery partition as found on most other devices.
Old guide here: http://forum.xda-developers.com/showpost.php?p=65482905&postcount=1471
So, now, hopefully you've compiled TWRP for your device and gotten it working. Now, you'd like to know how to get TWRP officially supported for your device so that it can be installed automatically with the TWRP app. In order for us to add "official support" for your device we'll need the following:
1) Device configuration files to compile TWRP from source for your device. This means that you cannot have repacked a recovery.img by hand to get it working. We need to be able to compile it from source so that we can easily release future updates.
2) We'll build a copy of TWRP and send it to you for validation. Once you've validated that we can build a working image for your device, we'll add it to the official TWRP app.
Note that we won't take credit for your port. You'll still get to post it on XDA to collect all the credit that goes with releasing something new for your device along with having your name listed on our website as the maintainer for the device. Also note that it's not always possible to provide automated installs for all devices.
You can now boot TWRP in an emulator. If you're trying to help develop TWRP, this can be a huge help as you don't have to risk your device and you can do everything directly on your computer.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Download this set of device configuration files.
Compile a recoveryimage using those device files. In the Android SDK, click on Tools -> Manage AVDs. Click New. Set it up as the following:
AVD Name: TWRP
Device: Galaxy Nexus
Target: ICS or newer though anything will probably work here
CPU: ARM (armeabi-v7a)
Check the box for hardware keyboard (your computer's keyboard will work in TWRP)
Up to you if you want to have the skin with controls present
Front Camera: None
Back Camera: None
RAM: 1024 VM Heap: 64
Internal Storage: 200
SD Card: Size: 500 MiB
Then click OK.
Once you have your AVD and your recoveryimage, you can boot TWRP in the emulator by browsing to your android-sdk/tools folder and run this command:
./emulator -avd TWRP -ramdisk CMFOLDER/out/target/product/twrp/ramdisk-recovery.img
Note that ADB doesn't work right away. About 10 to 15 seconds after TWRP finishes booting, ADB will come online. We start ADB via init.rc so even if TWRP fails to boot due to some kind of code error that you may have made, ADB should still work. Enjoy!
TWRP and A/B devices:
From a TWRP standpoint, A/B devices aren't a whole lot different from regular devices, but developers seem to be shy about working on these devices. I'm going to try to shed some light on this subject and hopefully this will serve as a guide for porting TWRP to A/B devices.
Firstly, let's understand what is an A/B device and how it's different. A/B devices have duplicates of many partitions on the device. An A/B device has 2x system partitions, 2x boot partitions, 2x vendor partitions, 2x modem / firmware partitions, etc. Only one slot is in use at a time. During early boot, the first stages of the bootloader read some small amount of data called the BCB or Bootloader Control Block and decide whether to boot the A partitions or the B partitions. When an OTA update is available, the data from the active slot is copied from the inactive slot and patched / updated. For example, if you're currently on slot A, your device would download the update and copy the existing system partition from slot A and patch / update it with the new updates into slot B. Once the copying and updating is complete, the BCB is updated and the device reboots using slot B. Next time an update is available, the system partition in slot B is copied to slot A and updated, the BCB gets updated, and we reboot to slot A. When viewing partitions on the device, you'll see something like this:
Code:
/dev/block/bootdevice/by-name/boot_a
/dev/block/bootdevice/by-name/boot_b
/dev/block/bootdevice/by-name/system_a
/dev/block/bootdevice/by-name/system_b
/dev/block/bootdevice/by-name/userdata
/dev/block/bootdevice/by-name/vendor_a
/dev/block/bootdevice/by-name/vendor_b
Note the dual boot, system and vendor partitions in the list above, but only one userdata partition.
While there is technically no requirement that I am aware of, all A/B devices shipped thus far have no separate recovery partition. Instead, the boot image contains the recovery in its ramdisk. The important thing is knowing that the boot image now also contains the recovery. For completeness, the system partition is a full root file system. During boot, if the kernel is told to boot to recovery, it will extract the ramdisk in the boot partition. If the kernel is not told by the bootloader to boot to recovery, then the kernel will mount the appropriate system partition (A or B) because the system partition is a full root file system. This means that the system partition on these devices is mounted to / instead of to /system and the system partition contains all of the files that would have normally been in the boot image ramdisk and a /system subfolder.
From a TWRP standpoint, there are 3 things that you have to do for an A/B device. First, you need to set
Code:
AB_OTA_UPDATER := true
in your BoardConfig.mk. Secondly, for any partition that has an A/B option, you need to add
Code:
flags=slotselect
in your fstab so something like this:
Code:
/boot emmc /dev/block/bootdevice/by-name/boot flags=slotselect
/system ext4 /dev/block/bootdevice/by-name/system flags=slotselect
/system_image emmc /dev/block/bootdevice/by-name/system flags=slotselect
/vendor ext4 /dev/block/bootdevice/by-name/vendor flags=slotselect;display="Vendor";backup=1
/vendor_image emmc /dev/block/bootdevice/by-name/vendor flags=slotselect
Lastly, once you get into TWRP, you will probably want to make sure that bootctl hal-info responds correctly with no errors. Usually the bootctl binary requires a proprietary library or even a couple of services to work correctly. If bootctl does not work correctly, then you will not be able to switch slots within TWRP correctly either.
In addition to setting
Code:
AB_OTA_UPDATER := true
you may also want to set:
Code:
BOARD_USES_RECOVERY_AS_BOOT := true
BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
If you set
Code:
BOARD_USES_RECOVERY_AS_BOOT := true
then make recoveryimage will no longer work and instead you will have to make bootimage. I don't recommend setting either of these flags for TWRP-only build trees. These flags will probably be required for developers building full ROMs for A/B devices.
Installing / Flashing TWRP on A/B devices:
Since all known A/B devices do not have a separate recovery partition, you will eventually have to flash TWRP to the boot partition. On the Pixel 1 and 2, we use fastboot boot to temporarily boot TWRP without flashing TWRP. We are then supplying a zip to allow users to flash TWRP to both slots. You can download one of these zips from our website and update the zip as needed to support your devices. Eventually we will add tools to TWRP to allow users to flash recoveries on these devices without needing to use zips.
Recently, I worked on the Razer Phone. The Razer Phone unfortunately does not support fastboot boot. Instead, users have to determine their currently active boot slot using
Code:
adb shell getprop ro.boot.slot_suffix
then use
Code:
fastboot --set-active=_a
to switch slots to the inactive slot. From here, the user can
Code:
fastboot flash boot twrp.img && fastboot reboot
to get into TWRP. Once in TWRP they can then go to the reboot page and change back to their originally active slot, make a backup, then install TWRP. Using the inactive slot allows users to get a good, unmodified backup of their device before installing TWRP.
Hopefully this helps!
Debugging with gdb in TWRP guide can be found here!
Beep boop zee doop
I know I've PM'ed you but I would like to ask you again. What should I do after compiling the TWRP recovery binary? What files have to be copied and where? I'm trying to integrate it with an ICS kernel.
Dees_Troy said:
Once you get CM sync'ed, I suggest that you go ahead and compile a build of ClockworkMod (ClockworkMod source is included in the CM repos). We usually lunch for the device in question, so something like "lunch full_tenderloin-eng".
After you lunch successfully for your device this is the command used for most devices:
Code:
make clean && make -j# recoveryimage
Click to expand...
Click to collapse
I don't get this part. What is lunch supposed to be? is it supposed to be a individual command for a device or can I do "lunch full_tenderloin-eng" for all devices? Because I am building for a device that doesn't run Android natively (at least out of-the-box) so cyanogenmod doesn't support it on any way...
Also, can I use this for resistive screens? Just to make sure.
Thanks for the guide, I have been looking for this for a long time
thanks for the guide, well structured and not so complicated
i have only a question: i'm trying to build it for galaxy 5, the problem is that the resolution is 320x240, so can you tip me on modify the sources? (i've done this some days ago, but images were too large)
manuel100 said:
thanks for the guide, well structured and not so complicated
i have only a question: i'm trying to build it for galaxy 5, the problem is that the resolution is 320x240, so can you tip me on modify the sources? (i've done this some days ago, but images were too large)
Click to expand...
Click to collapse
Set the device resolution to 320x240...I'm pretty sure they have support for that resolution...and if they don't then you can copy one of there's except resize it all to 320x240
Edit-they only have 320x480 https://github.com/TeamWin/Team-Win-Recovery-Project/
My question: I built twrp from source a while ago using smasher's Samsung inject twrp zip...that worked fine for a while...but recently we switched to mtd format so that inject twrp zip doesn't work...neither does the inhect twrp button within twrp anymore...I've seen that the galaxy s has the same problem as well...just wondering if you know of a work around...
Sent from my SGH-I997 using Tapatalk 2
mg2195 said:
Set the device resolution to 320x240...I'm pretty sure they have support for that resolution...and if they don't then you can copy one of there's except resize it all to 320x240
Edit-they only have 320x480 https://github.com/TeamWin/Team-Win-Recovery-Project/
My question: I built twrp from source a while ago using smasher's Samsung inject twrp zip...that worked fine for a while...but recently we switched to mtd format so that inject twrp zip doesn't work...neither does the inhect twrp button within twrp anymore...I've seen that the galaxy s has the same problem as well...just wondering if you know of a work around...
Sent from my SGH-I997 using Tapatalk 2
Click to expand...
Click to collapse
thanks for respond, however i've tried resizing images to 320x240 but i don't know what should be the size of bottoms, because they are alway out-of-screen
what is smasher's Samsung inject twrp zip? but i think that the recovery doesn't work because you have to built it with mtd support (for ex. on madteam they are trying to build a mtd kernel, but for install that testing rom they built a special cwm with mtd support)
manuel100 said:
thanks for respond, however i've tried resizing images to 320x240 but i don't know what should be the size of bottoms, because they are alway out-of-screen
what is smasher's Samsung inject twrp zip? but i think that the recovery doesn't work because you have to built it with mtd support (for ex. on madteam they are trying to build a mtd kernel, but for install that testing rom they built a special cwm with mtd support)
Click to expand...
Click to collapse
Smashers inject twrp zip is a tool for Samsung devices that let's you get the recovery without flashing the whole kernel. You basically put the ramdisk-recovery.img in the zip and then flash. During the flash process it pulls the boot.img, replaces the current ramdisk-recovery.img with the new one that contains twrp. It then deletes the old boot.img and flashes the new one...not affecting the actual kernel...
The recovery itself has mtd support...I can use it if I flash the whole boot.img, but I don't want to release the recovery within a whole kernel...because then I have to keep it up to date with both twrp and kernel sources, not to mention the different kernels available for my device....I can't make a recovery for each kernel...don't have the time for that...that's where the inject came in handy....the user could use any kernel he wanted while still using twrp
Recovery logs say it fails to find the ramdisk inside the boot.img and then in parenthesis something about may not be using gzip compression...which it is....
Sent from my SGH-I997 using Tapatalk 2
---------- Post added at 07:21 AM ---------- Previous post was at 07:19 AM ----------
Deestroy did this same tutorial on rootzwiki...if you look at the second post you'll see info about the smasher inject twrp I was referring to...http://rootzwiki.com/index.php?/topic/23903-How-to-Compile-TWRP-from-Source
Sent from my SGH-I997 using Tapatalk 2
mfsr98 said:
I don't get this part. What is lunch supposed to be? is it supposed to be a individual command for a device or can I do "lunch full_tenderloin-eng" for all devices? Because I am building for a device that doesn't run Android natively (at least out of-the-box) so cyanogenmod doesn't support it on any way...
Also, can I use this for resistive screens? Just to make sure.
Thanks for the guide, I have been looking for this for a long time
Click to expand...
Click to collapse
can I get help here please?
mfsr98 said:
can I get help here please?
Click to expand...
Click to collapse
Its a single command...it opens up the menu for devices...just type lunch into the terminal and hit enter...you'll see what I mean. You will probably have to add your device to the menu by creating a vendorsetup.sh in your device repo if it doesn't already exist....
Sent from my SGH-I997 using Tapatalk 2
Thank you for the quick answer. Yes, I already have vendorsetup.sh on the boot.img. Sorry for the noob question
What about for android beginners???
Devarishi said:
What about for android beginners???
Click to expand...
Click to collapse
There's only so much that you can dumb it down and simplify it. There's lots of other guides out there for getting started. Compiling a recovery is not a super simple task that anyone and everyone can do and there's plenty of potential pitfalls including the possibility of bricking your device. If none or very little of this guide makes sense, then you might see if a developer for your device is interested in working on it instead.
how would you compile this for a device without an official cm9 build?
azoller1 said:
how would you compile this for a device without an official cm9 build?
Click to expand...
Click to collapse
Well, you don't need official cm9 if you can find any working device tree for you phone you are good to go.. For lg spectrum 4g, this could be useful.
Hey guys I'm trying to compile this for my phone the problem I'm running into is I need the root.ts I've searched and it doesn't come up with anything any help would be appreciated thanks
Sent from my SAMSUNG-SGH-I577 using xda premium
I have a mtk6577 device which is not in de device tree of CM9.
I can compile CWM for my device with CM9. Because I was only making recovery, there was no need for setting up boardconfig.
In this guide there is a part starting with TARGET_RECOVERY_INITRC which is not there in my boardconfig.
Also is stated:
"Your board config also needs to include architecture and platform settings. Usually these are already included if you're using device configs that someone else created, but if you created your own, you may need to add them. Without them, recovery will often seg fault during startup and you'll just see the teamwin curtain flash on the screen over and over."
Does this mean that I cannot build TWRP without it, even I can build CWM ?
gls9 said:
I have a mtk6577 device which is not in de device tree of CM9.
I can compile CWM for my device with CM9. Because I was only making recovery, there was no need for setting up boardconfig.
In this guide there is a part starting with TARGET_RECOVERY_INITRC which is not there in my boardconfig.
Also is stated:
"Your board config also needs to include architecture and platform settings. Usually these are already included if you're using device configs that someone else created, but if you created your own, you may need to add them. Without them, recovery will often seg fault during startup and you'll just see the teamwin curtain flash on the screen over and over."
Does this mean that I cannot build TWRP without it, even I can build CWM ?
Click to expand...
Click to collapse
Look for another mtk6577 device that has CM & copy the arch flags from it.
Related
Always wanted a larger /data partition? Want to add a swap partition or an extra partition for your Debian/Ubuntu/Fedora chroot? Want your ROM to have the combined /data and /sdcard of Honeycomb and ICS devices? Then this guide is for you.
Table of contents
This post: background information
(Advanced) users: modifying your phone to use LVM
Developers: adding LVM support to a ROM
Building LVM for Android
The Linux [URL="http://sourceware.org/lvm2/]Logical Volume Manager[/URL] (LVM) is a set of tools which allows you to create virtual disks ("logical volumes", "LVs") backed by a set of real storage devices ("physical volumes", "PVs") organized into "volume groups" ("VGs"). Using LVM, you can:
Create logical volumes which are larger than any of the individual physical volumes available on your device's real storage.
Create an arbitrary number of logical volumes of arbitrary size, regardless of the number of physical volumes or partitions available on your real storage devices. You could, for example, add a dedicated swap partition, or create a separate /system and /data for a dual-boot setup.
Take a snapshot of a logical volume -- a copy of the LV which only stores differences between it and the original (requires additional kernel support). You could, for example, take a snapshot of the external storage LV and export it via USB mass storage to a computer, without needing to unmount the LV from your device.
Grow or shrink logical volumes without unmounting the file system ("online resize", requires filesystem support).
LVM was developed to manage storage on Linux servers and workstations, but was also used by Palm/HP in WebOS devices. It uses the Linux device-mapper technology used in Android for apps installed on the SD card, so any Android kernel will work with LVM.
This guide was developed with the Nexus S in mind, but the technique described should be applicable to many other Android devices as well.
Modifying your phone to use LVM
WARNING WARNING WARNING
While unlikely, you could brick your phone if you do this incorrectly!!!
Read this guide completely before attempting. If you don't understand the procedure, read it again until you do. If you still don't understand, wait for someone else to make this easier. If you're not sure you understand, you probably don't.
BACK UP EVERYTHING ON YOUR PHONE, INCLUDING THE CONTENTS OF /sdcard, BEFORE ATTEMPTING THIS PROCEDURE! This will erase everything on your phone.
The preassembled images attached to this post are for Nexus S GT-i9020T running stock Android 4.0.4 IMM76D ONLY. They may or may not work with other phones and ROMs. (See the next post for how to modify any ROM to use LVM.)
You will need:
A Nexus S with unlocked bootloader
A computer with fastboot and adb installed and working
A USB cable
Factory images for your phone, in case something goes wrong
Procedure:
Take a nandroid backup of your phone and copy it to your computer. We'll use it to restore the ROM later. You MUST copy the backup to your computer! This procedure will erase EVERYTHING on your phone, including the contents of /sdcard.
Download the boot and recovery images attached to this post. Reboot your phone into the bootloader, then flash the recovery to your phone using fastboot:
Code:
fastboot flash recovery recovery-lvm-clockwork-5.0.2.0-crespo.img
(GPL information: this is the stock kernel image from ClockworkMod 5.0.2.0. For LVM source, see this post.)
Boot into recovery.
Enter the shell on the device:
Code:
adb shell
In the shell on the device, do the following (# is your prompt):
Code:
# /lvm/sbin/lvm pvcreate /dev/block/mmcblk0p1 /dev/block/mmcblk0p2 /dev/block/mmcblk0p3
# /lvm/sbin/lvm vgcreate lvpool /dev/block/mmcblk0p1 /dev/block/mmcblk0p2 /dev/block/mmcblk0p3
This marks the partitions normally used for /system, /data, and /sdcard for use with LVM, and creates an LVM volume group named "lvpool" using those devices.
In the shell on the device, set up your desired logical volumes (partitions).
Code:
# /lvm/sbin/lvm lvcreate -L 320M -n system lvpool
# /lvm/sbin/lvm lvcreate -L 1G -n userdata lvpool
# /lvm/sbin/lvm lvcreate -L 10G -n media lvpool
[...]
This creates the mandatory logical volumes named "system", "userdata", and "media", which will be mounted on /system, /data, and /sdcard, respectively. Replace the argument to -L with the desired size of each partition. (/system needs to be at least 300 MB to fit the stock ROM.) You can create additional volumes similarly:
Code:
# /lvm/sbin/lvm lvcreate -L [size] -n [name] lvpool
replacing [size] with the desired size and [name] with the desired name. You have a little less than 15 GB space in the volume group to work with; depending on how many partitions you want to create, you can adjust the size of the "media" and "userdata" logical volumes as required.
Reboot back into recovery. Mount the USB storage on your computer. On your computer, format your phone's USB storage as you would a USB flash drive.
Copy your nandroid backup from your computer onto your phone.
Reboot back into recovery. Restore the nandroid backup.
Reboot into the bootloader. Flash the boot image to your phone via fastboot:
Code:
fastboot flash boot boot-lvm-crespo-IMM76D.img
(GPL information: this is the stock kernel image for IMM76D. Source is available from AOSP git. For LVM source, see this post.)
Reboot. You should have a working device running on LVM.
Additional tips and hints
To see the logical volumes you've created, use
Code:
# /lvm/sbin/lvm lvs
and to see how much free space you have remaining in the volume group, use
Code:
# /lvm/sbin/lvm vgs
If you want to delete a logical volume (for example, if you screwed up), use
Code:
# /lvm/sbin/lvm lvremove /dev/lvpool/name
(replacing "name" with the name of the LV you want to delete).
It's often useful to leave a bit of free space in the volume group (512 MB to 1 GB or so). This gives you a bit more flexibility to modify the layout or grow partitions in the future, and allows you to take snapshots of logical volumes.
Removing LVM from your phone
Flash a standard recovery such as the regular ClockworkMod recovery to your phone.
Do a full wipe/factory reset.
Restore your phone from a backup.
If things go really wrong, flash the factory image to your phone via fastboot.
Modifying an existing ROM to use LVM
(This is a condensed version of the full guide: https://raw.github.com/steven676/android-lvm-mod/master/HOWTO-MOD)
You will first want to grab a copy of the binaries and config files by cloning my git repository: https://github.com/steven676/android-lvm-mod.
Unpack the ramdisks from your boot and recovery images. Make the following changes:
Copy the contents of lvm-bin/ in the git repository to lvm/ in the ramdisks.
Copy devices/crespo/lvm.conf to lvm/etc/lvm.conf in the ramdisks.
For the boot image, integrate the changes in devices/crespo/boot/init.herring.rc-changes.diff into your init.herring.rc.
For the recovery image, integrate the changes in devices/crespo/recovery/init.rc-changes.diff into your init.rc.
For the recovery image, copy devices/crespo/recovery/recovery.fstab to etc/recovery.fstab.
Repack the ramdisks and create new boot and recovery images with them (the original kernels are fine to use).
If creating a flashable zip to install your ROM, you will also want to modify the installer script to set up the LVM volume group and logical volumes (see the previous post).
If you're building your own kernel, consider enabling CONFIG_DM_SNAPSHOT in your kernel's build configuration, to allow taking snapshots of logical volumes.
Remember that LVM is released under the terms of the GPL v2 (same as the Linux kernel), so you are required to comply with the GPL's source distribution requirements with respect to LVM.
More extensive modifications (such as changing the devices used to form the volume group) are possible; see the full HOWTO guide for details.
Building LVM from source for Android
The LVM source was written for standard glibc-based GNU/Linux systems, and doesn't build agains Android libc. We could invest time and effort into porting it to Android, but it's easier to just statically link the LVM binary against glibc (we already have to use a statically linked binary, since the boot image doesn't ship shared libraries).
To build LVM with glibc, you will need either an actual GNU/Linux ARM system with a development environment (gcc, make, and glibc header files) set up, or a GNU/Linux ARM cross-compiler toolchain (more difficult to set up). The binaries in lvm-bin/ were compiled with an Emdebian squeeze/armel toolchain running on a Debian squeeze/amd64 machine; this procedure has also been tested with a Nexus S running a Debian squeeze chroot (though any recent Linux distribution and any device should do). The Linaro prebuilt GCC toolchain and the CodeSourcery CodeBench Lite toolchain for ARM GNU/Linux should work; the Android NDK toolchain will not.
Getting the source
Clone the lvm-mod git repository. Then, in the newly cloned repository, do
Code:
git submodule init
git submodule update
You will have a copy of the LVM source (as used to build the binaries in lvm-bin/) in lvm-src/.
(Alternately, clone https://github.com/steven676/lvm2 and checkout branch android-lvm-mod. You can also use upstream's git repository or source tarballs; see their website for details.)
Building the source
(This is a condensed version of the full guide: https://raw.github.com/steven676/android-lvm-mod/master/HOWTO-BUILD)
These instructions are written for a native build (building in a Debian/Ubuntu/Fedora chroot on an actual ARM device).
Configure the LVM source:
Code:
$ ./configure --prefix=/lvm --enable-static_link --disable-readline \
--disable-selinux --with-pool=none --with-cluster=none \
--with-confdir=/lvm/etc --with-default-run-dir=/data/lvm/run \
--with-default-system-dir=/lvm/etc \
--with-default-locking-dir=/data/lvm/lock \
--with-optimisation="-Os -march=armv5te -mtune=cortex-a8 -mthumb"
For a cross build, you need to set up the system to run ARM binaries using QEMU (see the full HOWTO for details). (For extra credit, fix the build so that it works with the configuration produced by running configure without qemu-arm enabled.) Then configure the source with:
Code:
$ export CC=arm-linux-gnueabi-gcc # replace with your cross compiler
$ ./configure --host=arm-linux-gnueabi \
--prefix=/lvm --enable-static_link --disable-readline \
--disable-selinux --with-pool=none --with-cluster=none \
--with-confdir=/lvm/etc --with-default-run-dir=/data/lvm/run \
--with-default-system-dir=/lvm/etc \
--with-default-locking-dir=/data/lvm/lock \
--with-optimisation="-Os -march=armv5te -mtune=cortex-a8 -mthumb"
Build the source:
Code:
$ make
Grab the pieces you need: the statically linked, unstripped lvm binary is located in tools/lvm.static, and a sample configuration file is in doc/example.conf.
(reserved)
Hello steven676,
This post is helpful to me!
But I have some questions on LVM as I am new to it.
1. Is it possible to use LVM only on one pv, say /sdcard?
2. If 1. yes, will lv's on a pv be linear mapped, that is, lv's in a pv are placed one after one?
3. now that removing lvm is possible, is it also possible to backup lvm setting, and switching between non-lvm and lvm environment?
Thanks
solarispika said:
1. Is it possible to use LVM only on one pv, say /sdcard?
Click to expand...
Click to collapse
Sure. Just modify the arguments to pvcreate and vgcreate accordingly:
Code:
# /lvm/sbin/lvm pvcreate /dev/block/mmcblk0p3
# /lvm/sbin/lvm vgcreate lvpool /dev/block/mmcblk0p3
solarispika said:
2. If 1. yes, will lv's on a pv be linear mapped, that is, lv's in a pv are placed one after one?
Click to expand...
Click to collapse
Probably, but in general it is not safe to assume this. Imagine the following sequence of commands:
Code:
# /lvm/sbin/lvm lvcreate -L 1G -n vola lvpool
# /lvm/sbin/lvm lvcreate -L 1G -n volb lvpool
# /lvm/sbin/lvm lvresize -L +1G /dev/lvpool/vola
What's likely to happen here is that vola is going to be split into two segments on disk, like this:
Code:
[ 1GB vola ][ 1 GB volb ][ 1 GB vola ][ remaining free space ]
There are ways in which you can give LVM hints as to what on-disk layout you want, and the LVM tools will generate information about the current layout in /data/lvm/backup if that directory's available (and mounted read-write) at the time, but in general, it's best to treat the on-disk layout of a logical volume as unknown. In practice, unless you have physical volumes with widely varying characteristics in the same volume group (say, an SSD and some spinning-platter hard disks), you shouldn't need to worry about the actual layout.
solarispika said:
3. now that removing lvm is possible, is it also possible to backup lvm setting, and switching between non-lvm and lvm environment?
Click to expand...
Click to collapse
If /data is mounted read-write, running
Code:
# /lvm/sbin/lvm vgcfgbackup
will create a human-readable backup of the current LVM volume group metadata in /data/lvm/backup (if that directory is available and mounted read-write).
I'm not sure what you mean by "switching" between non-LVM and LVM environments. If you mean going between an unmodified stock boot image and an LVM boot image, the answer is yes, but you won't have access to any of the data in your LVM logical volumes while running an image not configured for LVM, and you need to be careful not to accidentally format the LVM physical volume.
If you're asking about having two or more ROMs on the phone, one installed to the normal /data and /system eMMC partitions, and another on LVM logical volumes, the answer is also yes, but both ROMs will need modified ramdisks. The one for the eMMC-installed ROM should only mount /sdcard from LVM, while the others should be set up to mount /data and /system from LVM as well.
Good write up;-)
wonder if lvm swap could be connected as extra memory .
Sent from my Nexus S using XDA
wizardslovak said:
wonder if lvm swap could be connected as extra memory .
Click to expand...
Click to collapse
Sure, of course. From my phone:
Code:
$ cat /proc/swaps
Filename Type Size Used Priority
/dev/mapper/lvpool-swap partition 65532 28196 -1
It works just fine, even if it's not a setup I'd use on a mission-critical server.
Hey Guys,
Thanks for this awesome guide.
I just have a quick question, what are the advantages of using LVM instead of the normal partitioning?
I just want to know cause i might added to my rom.
Thanks
mandaman2k said:
I just have a quick question, what are the advantages of using LVM instead of the normal partitioning?
Click to expand...
Click to collapse
Primarily flexibility in deciding the number and layout of partitions -- see the first post.
Sounds good . Ill try it once home ;-)
Sent from my Nexus S using XDA
I just pushed a couple of changes:
Updated prebuilt binaries and LVM source to 2.02.96.
Fixed the instructions for cross compiling LVM.
The boot and recovery images attached to the second post have been updated accordingly.
Is this the only way to make the device function like HC/ICS/JB devices that ship with combined storage?
Are the images from Google partitioned with internal/external storage or are the latest images partitioned with a layout similar to the Galaxy Nexus?
CocoCopernicus said:
Is this the only way to make the device function like HC/ICS/JB devices that ship with combined storage?
Click to expand...
Click to collapse
If you want a setup that's exactly as on a 3.0+ device with "SD card" data stored in /data, then yes, this is the only way I know of. If you just want MTP functionality, then no.
CocoCopernicus said:
Are the images from Google partitioned with internal/external storage or are the latest images partitioned with a layout similar to the Galaxy Nexus?
Click to expand...
Click to collapse
Official Google software builds use separate userdata and media partitions and continue to offer the 2.x-style USB mass storage access. I'm not sure the partition layout is adjustable in software -- the eMMC presents an EFI partition layout which no one seems to have figured out how to change.
Cool, thanks. Yea, I'm not too interested in the MTP functionality, I just don't want to deal with internal/external storage after using the Galaxy Nexus.
Swap partiton
Hi..
how i can to create a swap partition of 1G and added to system??
I had create a 1G partition "swap" but system no activated this partition.
xxmurdocxx said:
Hi..
how i can to create a swap partition of 1G and added to system??
I had create a 1G partition "swap" but system no activated this partition.
Click to expand...
Click to collapse
You'd need to format the swap partition:
Code:
# mkswap /dev/lvpool/swap
Also, you need to make sure that your kernel has swap support (CONFIG_SWAP=y -- the default kernel does not have this) and that your init scripts are enabling the swap partition (swapon /dev/lvpool/swap).
One other note: you might find lag to be somewhat severe with a 1 GB swap partition -- I'd suggest smaller.
I'm finally getting around to messing with my NS. From what I understand I can't just modify an existing rom(stock JB in this case) to use the larger partitions without compiling an entire new rom, right?
Which would mean I'd be at the mercy of whoever created the ROM to update when an OTA rolls around?
CocoCopernicus said:
I'm finally getting around to messing with my NS. From what I understand I can't just modify an existing rom(stock JB in this case) to use the larger partitions without compiling an entire new rom, right?
Which would mean I'd be at the mercy of whoever created the ROM to update when an OTA rolls around?
Click to expand...
Click to collapse
No, you can modify an existing ROM yourself. It's most definitely not the simplest process around, though -- see the documentation at the top of the thread for instructions. As I say there ... read thoroughly and understand before attempting.
I have a complete setup for the Nexus 7, part of a product we are working on, that I need to easily clone on "virgin" tablets for production. The app requires a rooted OS.
I want to write an installation script using fastboot to unlock the bootloader, erase partitions, then flash them with .img files for each partition (kernel, system, cache, etc.).
How do I extract .img files from my "master" tablet? I have an understanding from some where that these are simple byte-for-byte dumps of the partition -- is this true? As such can I create a .img file by simple doing 'cat blkfile >file.img' where "blkfile" is the appropriate block device for the partition in question?
Or do I need to use 'dd'? Or something else?
I have searched and searched, and can't find an anwer. I've found other answers using some tools to create these files from a build on a PC, but nothing about creating them from an existing tablet.
Thanks in advance!
Use the dd command. You can use it both to dump and write a partition. It's how I install recovery programs like TWRP
Sent from my Nexus 7
You can use dd for the boot partition and recovery partition - they are raw binary blobs. (Don't use dd on other Android devices, esp. those that have MTD flash devices, though - it only works most of the time there)
If you want to use the same fastboot-based scenario that Google uses for factory image sets, then for the system & userdata image files you will need to find out about "sparse ext4 filesystem images"
If you took a raw block-device based dump of any of your tablet ext4 partitions, you could actually take those image files and mount them on any other linux machine (using a loopback mount procedure).
But you will find that if you attempt to do that with the Google factory ".img" files (for system & userdata partitions), they will not mount. It's not a simple matter of a offset superblock, either.
Since these are the formats that the stock recovery expects, I suppose you ought to use those formats if you want to do the "all at once all partitions" fastboot flashing if you plan on using the stock recovery.
Note that there is absolutely nothing that prevents you from unpacking whatever you want from whatever archive format you want - so long as the recovery's busybox supports the archive format correctly - you could use cpio or pax or tar archives for that matter. (The stock recovery's "toolbox" has very little functionality, so this comment applies to custom recoveries, which typically have more robust functionality in their busybox) You will be writing your own scripts to do those things though, typically either in one of two ways:
1.A mount target filesystem partition
1.B do a deep recursive remove at that mountpoint ( rm -rf * )
1.C unpack your archive into same mount point ( tar xf archive.tar, etc)
1.D unmount the mount point
OR
2.A unmount target partition and zero it out (dd if=/dev/zero, flash_erase, etc)
2.B recreate filesystem in partition (mke2fs -t ext4 etc)
2.C mount target filesystem
2.D unpack your archive into the same mount point (tar xf archive, pax, cpio, unyaffs2, etc)
2.E unmount that mountpoint
Even though this post is for the Samsung Galaxy S II, the same thing applies to the factory Nexus 7 images from Google:
http://forum.xda-developers.com/showthread.php?t=1081239
As that thread mentions, the simg2img and mkuserimg.sh programs are part of the Android project.
Here's a Nexus 7 thread where the contributor built the tools for both x86 linux and arm linux
Finally, I should note that because /system is typically mounted read-only, imaging /system from the live OS is no big deal. Trying to do the same thing with /data is an extremely dopey idea, however. Accurate backups are rarely made from live read-write filesystems.
cheers
Thank you so much for all the great information! I hit thanks for both of you.
The link to the nexus 7 thread is what I need... This is for my company, and I need a simple cloning solution that can be performed by a non-technical assembly person. The fastboot install procedure is about as simple as it gets.
Thanks again!
DISCLAIMER:
Rooting your phone and using custom Recoveries and ROMS have risks and may result in bricking your device, and has nothing to do with Google or the device manufacturers. In case of any mishap I am not responsible if you brick/ruin your phone in any way.
Basic computer skills are required and minimal knowledges about phones and phones utilities too.
Make sure that whatever you do, you are doing it at your own responsibility.
Carliv Touch Recovery
- version 5.7.2 is for Lollipop (cm 12.1, aicp lp or resurrection remix lp) and version 6.6 is for Marshmallow (cm 13, aicp-mm or resurrection remix mm).
The version starting number is related to android version.
This is a CWM based recovery and I did put up some work to update it to lollipop (cm 12.1) and marshmallow (cm-13) after official cwm development stopped at kitkat. It works with LOLLIPOP and MARSHMALLOW kernels and it builds with cm 12.1, aicp lp or resurrection remix lp (version 5.7) and with cm 13, aicp-mm or resurrection remix mm (version 6.5).
This is for those who want a lighter and simpler recovery or they just liked CWM before. It's not as good or complex as twrp, but it will do the job just fine.
For gui I ported PhilZ Recovery full touch module.
Because the vold in cm 12.1 and 13 doesn't support cwm anymore I had to use the old fstab1 type for functionality, although for building reason a valid recovery.fstab should be provided in device tree. In the third post there are some building hints to make it clear for those who want to try building it.
Features:
- EXT4 and F2FS support (for f2fs use the BoardConfig flag).
- full touch menu ported by me from PhilZ touch Recovery. The old Napstar-xda touch module was good but it's quite old and to update that was too much work. Actually There is a version 4 with that touch module, all working, but the touch doesn't work with some input drivers and I had to give up on it for the new and improved version from PhilZ.
- all cwm functionalities are up and working (adb, sideload, backup, restore, install, mass storage...). There is no mtp and if your phone doesn't have an external sdcard you can't connect it to PC while is in recovery mode. But there is usb-otg support, of course if your phone was shipped with that.
- added new menu for backup and restore advanced, to use it for backing or restoring only a specific partition and I also ported from PhilZ the multizip flashing function.
- in Carliv menu there is now a new section for flashing boot and recovery images. It is a feature that I needed during many recovery builds testing. I wanted an easier way to flash other image without booting to android and using an app like RashR. You can browse your storage locations for any image and after choose you will have to select on wich partition should that be flashed. I added multiple confirmations check to avoid flashing on wrong partition. This feature works only with boot and recovery images. I won't add other partitions to this because for other things there are multiple backup restore functions.
- for MTK phones (if the flag is used in Boardconfig) there is a new menu to backup and restore some important partitions like uboot, nvram an secro because they are involved in restoring a lost IMEI, and also the logo partition which may often get broken by bad ported ROMs.
- besides these all my old specific menus (aroma, rainbow...) are still in place.
- added support for dencrypting and mounting data partition using the builtin minivold from cyanogenmod with vdc commands (the ideea came from this post of Lekensteyn). Tested and working well with text ar hex passwords, and maybe will work with pin too but I don't think it will work with pattern .
- added support for dencrypting and mounting adopted storage in marshmallow. The solution is based on this article of nelenkov.
- there is no included root solution. I choose to do it this way because there is no universal root solution now and someone may end up messing things with a non-working root option. You can flash a zip installer from Chainfire's SuperSu or other solution that may work for your phone.
All screenshots are made with my old tool from here (still working well).
CREDITS:
The biggest thanks go to AP756 and DerTeufel1980, two friends from Germany, who sent me a new phone each, with lollipop OS and that helped me a lot to do this.
- Phil3759 for the touch code and many other things from his recovery;
- TWRP developers. I learned a lot from their work;
- Clockworkmod Team starting with Koushik Dutta and ending with all developers that made the CWM recovery what it was;
- Cyanogenmod Developers;
- Nikolay Elenkov;
In next post there are some links for built recoveries. I'll add more soon as I get a valid link (on a reliable webhost) from people who build it for other phones.
I worked alone on this, there is no team here, not because I don't want to , but probably because there was no one interested in this, and so there may be some unspotted bugs. If you find any please do tell me to help on fixing it.
XDA:DevDB Information
Carliv Touch Recovery, Tool/Utility for all devices (see above for details)
Contributors
carliv
Version Information
Status: Stable
Current Stable Version: 5.7.3 & 6.6.1
Stable Release Date: 2016-07-19
Created 2016-05-30
Last Updated 2016-07-19
Changelog and working builds
CHANGELOG 19-07-2016:
- fix backup for old mtk phones.
Lollipop
1. Jiayu S3+
2. Zopo Speed 7+
3. Zopo Speed 7
4. Mlais Mx Base
5. Alcatel Pop C2/C3
6. ZTE Blade L3 / Digicel DL910
7. Nous NS5511
Marshmallow
1. Zopo Speed 7+
2. Zopo Speed 7+ with adopted storage
3. Zopo Speed 7
4. Zopo Speed 7 with adopted storage
* NOTE: sadly the kernel source for zopo marshmallow isn't published so these two don't have touch in recovery, but you can use them as in CWM with phone buttons.
[*] QCOMM devices:
1. Huawei Honor 5x (kiwi)
2. Samsung Galaxy A5 (SM-A500FU)
Building Guide
To build you need a local repo of cm-12.1 or cm-13 and a proper device tree. To see how a buildable device tree looks check this one from my github.
It builds out of the box with aicp lp-5.1 and aicp mm-6.0 too, but like in cm you need a proper device tree.
Some things to be considered:
For BoardConfig:
- the most common thing in all BoardConfig I saw (you need this to use power button to select if you use physical buttons in some situations)
Code:
- BOARD_HAS_NO_SELECT_BUTTON
- for the graphical interface
Code:
- TARGET_RECOVERY_PIXEL_FORMAT
- for mass storage if your phone has an external sdcard, to connect it to PC (this one can be specified in fstab too) - and it has to be without any quotes or slashes
Code:
- TARGET_USE_CUSTOM_LUN_FILE_PATH := /sys/devices/platform/mt_usb/musb-hdrc.0.auto/gadget/lun%d/file
- for LCD backlight lights - and it has to be without any quotes or slashes
Code:
- TARGET_RECOVERY_LCD_BACKLIGHT_PATH := /sys/class/leds/lcd-backlight/brightness
- for vibrator feature - and it has to be without any quotes or slashes
Code:
- VIBRATOR_TIMEOUT_FILE := /sys/devices/virtual/timed_output/vibrator/enable
- with link to a valid recovery.fstab version 2 (it may work without it but it is better to be here)
Code:
- TARGET_RECOVERY_FSTAB
- for a better readability adapted to your screen (check the minui folder for more fonts)
Code:
- BOARD_USE_CUSTOM_RECOVERY_FONT
Carliv Touch Recovery specific flags:
- if you have the recovery on recovery-carliv folder under bootable directory in cm-12.1 source use this next flag.
Code:
- RECOVERY_VARIANT := carliv
NOTE: in cm 13, and other android 6 sources too, you can't build with this flag out of the box and so you have some things to do - the easy one is to rename recovery folder in [recovery-stock] and to place my recovery next to that with the name [recovery]. Other option is to open Android.mk from /sytem/core/healthd and find line 58 where you need to replace [LOCAL_C_INCLUDES := bootable/recovery] with [LOCAL_C_INCLUDES := $(call project-path-for,recovery)].
- with your phone resolution like this width x height
Code:
- DEVICE_RESOLUTION := 720x1280
- if you want to use it with encrypted phone (it work with a non encrypted phone too but it will be smaller if you don't need decrypting function)
Code:
- BOARD_INCLUDE_CRYPTO := true
- if your phone is MTK powered you need this for the MTK menu (it is not mandatory though with the mtk phones shipped with lollipop or marshmallow)
Code:
- BOARD_HAS_MTK_CPU := true
- for touch menu, if your phone has an input driver with PROTOCOL_TYPE_B (synaptic is an example, or many samsung devices); if you have access to, check your kernel input driver for something like this [#define PROTOCOL_TYPE_B] - google it if you want to know more about this
Code:
- BOARD_USE_PROTOCOL_TYPE_B := true
- to block an input device use
Code:
- TOUCH_INPUT_BLACKLIST := "devicename"
- if you use Adopted Storage
Code:
- BOARD_USE_ADOPTED_STORAGE := true
For system.prop from device tree:
Code:
#
# system.prop for mx
#
ro.ctr.crypto.passwd="64656661756c745f70617373776f7264"
ro.ctr.forbid_format=/frp,/persistent,/lk,/uboot,/logo,/metadata,/nvdata,/nvram,/secro
ro.ctr.forbid_mount=/frp,/persistent,/lk,/uboot,/logo,/metadata,/nvdata,/nvram,/secro
ro.ctr.touch_accuracy=7
- to use decrypt data specify here your password (ro.ctr.crypto.passwd); I forgot to mention that if the phone uses encryption, the recovery will start with few seconds delay, because of the decrypting and mounting data process. If the message will tell you that couldn't be decrypted it is possible that your password was wrong or it uses an unsuported type of password. To be sure just restart the recovery from Power menu and if you still get the same message then you need to check your provided password from system.prop or to find a different solution (other recovery like twrp). If you want to decrypt your phone for good you need to format data and data media from Mount/Storage menu but you will loose your data (settings, preferences).
- ro.ctr.forbid_format and ro.ctr.forbid_mount are for partitions from fstab that you don't want to be shown in Mount/ Storage menu with mount and format option (coma separated, no spaces and with leading slash), like in my example above.
- ro.ctr.touch_accuracy to improve the touch handling (bigger lcd_density = bigger accuracy); the initial value is 7, just like in PhilZ Recovery, and I reccomend you to try different numbers to see what is right for you, but don't go over 19.
All these system.prop lines are not mandatory.
Carliv Touch Recovery uses a fstab version 1 named [ctr.fstab] and you have to create a folder recovery in your device tree, in that recovery folder create a new folder named root, in root folder another folder named etc and in that one place the ctr.fstab. Like this:
Code:
recovery/root/etc/ctr.fstab
That will be enough since the compiler will add it in recovery ramdisk and the recovery module will find it in etc folder.
Code:
# Android fstab file.
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
# mount point fstype device [device2] fs_options [fs_options2] lun
/boot emmc /dev/block/platform/mtk-msdc.0/by-name/boot
/cache ext4 /dev/block/platform/mtk-msdc.0/by-name/cache
/recovery emmc /dev/block/platform/mtk-msdc.0/by-name/recovery
/system ext4 /dev/block/platform/mtk-msdc.0/by-name/system fs_options=rw
/data ext4 /dev/block/platform/mtk-msdc.0/by-name/userdata fs_options=rw
/internal_sd datamedia /dev/null
/sdcard vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 lun=sys/class/android_usb/android0/f_mass_storage/lun/file
Important here is how you define internal storage which is data media
Code:
/internal_sd [COLOR="Red"]datamedia[/COLOR] [COLOR="Magenta"]/dev/null[/COLOR]
You can see It's used the old way with "datamedia" fstype and /dev/null device.
Important thing: if you have only internal storage define it as
Code:
/sdcard datamedia /dev/null
If you have also an external sdcard, use either way:
Code:
/internal_sd datamedia /dev/null
/sdcard vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1
or
Code:
/sdcard datamedia /dev/null
/external_sd vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1
If you are using the adopted storage feature for external sd card, define this
Code:
/data_sd ext4 /dev/block/mmcblk1p2 fs_options=adopted
and remove or comment out the line for external sd card.
You can see the internal storage can be sdcard or internal_sd and external sdcard can be sdcard or external_sd, but internal storage can't be external_sd or external sdcard internal_sd.
If your phone has OTG support you can use that too defining it like this
Code:
/usb-otg vfat /dev/block/sda1 /dev/block/sda
or this
Code:
/usbdisk vfat /dev/block/sda1 /dev/block/sda
-check with your phone booted up in Android and a OTG USB mounted to see in [/sys/class/block] or [dev/block] how to set device for this (the dev/block/sdx part).
The recovery has fat32, exfat and ntfs support builtin (also f2fs for file system). You can define your usb-otg and/or external sdcard as "auto" instead of "vfat" and it will work with any of these formats. I tested a portable HDD self powered and it works (120 GB) as usb-otg. Anyway that is available only for zip and image flashing. Maybe I'll make it to work for backup and restore too.
@carliv is back!!! Thanks a lot for this.
Should I port or should I build?
kirito9 said:
@carliv is back!!! Thanks a lot for this.
Should I port or should I build?
Click to expand...
Click to collapse
You should build it of course. I won't make porting recoveries anymore.
Actually wait for a day or two because I'm working on some improvements and I'll push them to github soon.
Also I have a working version for cm13 too. That also need some more tests before release.
carliv said:
You should build it of course. I won't make porting recoveries anymore.
Actually wait for a day or two because I'm working on some improvements and I'll push them to github soon.
Also I have a working version for cm13 too. That also need some more tests before release.
Click to expand...
Click to collapse
I will wait for cm13 support
Anyway this recovery support arm64?
Sure. Look at the phones already supported
Gesendet von meinem HERO1 mit Tapatalk
carliv said:
You should build it of course. I won't make porting recoveries anymore.
Actually wait for a day or two because I'm working on some improvements and I'll push them to github soon.
Also I have a working version for cm13 too. That also need some more tests before release.
Click to expand...
Click to collapse
Goood xD. No more complaints from users who "brick" their devices and blame you :laugh:
All things are mostly done.
Just a little heads up: Added usb-otg support for install zip menu - should work with ntfs, fat, exfat and fat32 usb flash drives (I tested only with fat32). Other improvements too for both versions (lollipop and marshmallow).
I'll push the source tomorrow.
Attached a screenshot of the recovery for marshmallow (cm13).
Thanks to Master [emoji322]
Sent from my Lenovo A7010a48 using XDA-Developers mobile app
Thread updated with instruction and links for the new version for cm-13 and the version for lollipop is upgraded to 5.2.
If some of you build a working recovery and want to share here the link, just post a replay and I'll add it in post #2.
If you have a buildable device tree public on github and want a recovery built for it ask here and maybe I or someone else will do it in some free time.
@carliv do you interested to build this recovery for kenzo (redmi note 3 pro) ?
here's kernel source for it: https://github.com/MiCode/Xiaomi_Kernel_OpenSource/tree/kenzo-l-oss
exodius48 said:
@carliv do you interested to build this recovery for kenzo (redmi note 3 pro) ?
here's kernel source for it: https://github.com/MiCode/Xiaomi_Kernel_OpenSource/tree/kenzo-l-oss
Click to expand...
Click to collapse
The kernel alone is useful only if builds out of the box, but you still need a proper device tree to build, even with a prebuilt kernel. For building a recovery or a ROM that is what you need. I can't build a recovery only with that. Maybe someone else have the phone and manage to create the device tree and it will build the recovery.
Cheers
Look forward to Flash system Image In Carliv Menu
Thank You
Finally CTR for LP & MM! Amazing @carliv, I love this recovery.
Update to version 5.3 for lollipop and 6.2 for marshmallow
CHANGELOG 12-06-2016:
- activated working support for ntfs, exfat and f2fs;
- rewritten the flash image menu for better functionality and more protection to avoid mistakes;
- change the local busybox libs and modules names to avoid conflicting with existing external folder;
- some other small fixes and improvements (you can check the github commits).
@carliv
Hi, I have a device tree that I used for TWRP https://github.com/kirito96/device_Alcatel_4032 recovery and I would like to know if this is enough for building CTR or do I need a "complete" device tree? Thanks.
kirito9 said:
@carliv
Hi, I have a device tree that I used for TWRP https://github.com/kirito96/device_Alcatel_4032 recovery and I would like to know if this is enough for building CTR or do I need a "complete" device tree? Thanks.
Click to expand...
Click to collapse
Not really complete like in building ROMs, but you have to do some changes:
- convert it to cm building or, better and easier for you since it's for omni, to aicp.
- then you need to add in boardconfig partitions sizes (twrp doesn't need that because it checks the size from dumchar_info or partinfo).
- add that recovery/root/etc folder with ctr.fstab in it.
- add specific flags in boardconfig, but if your device has a small recovery partition let the crypto flag out (don't use it at all) and you will gain almost 2 Mb.
- add resolution and desired font if you want to not use the default which is for 540x960 dpi.
and that's it ...
Take a look at my mlais device tree (link in OP)-sorry, in post #3 to see these things - I have a branch for aicp too.
And I see your device use mtk header. You can check in my github for the lenovo p780 device tree where I implemented the mkbootimg part from my kitchen.
Cheers!
PS: if you can send me your phone dumchar_info file and a stock boot image I'll try to convert your device folder to use it as an example for other people about how to do it.
@carliv
Thanks for informing me, but for now I think I'll opt for a device tree that you made and I'll use that as a base for other devices that I'll work on in the future.
I've attached the dumchar_info.txt file below along with the stock boot.img. Funny thing is, I have 2 stock boot.img. I have for which my phone came with (4.2.2) and an AOSP upgrade with 3.10.xx kernel (5.1.1). I uploaded both because this recovery is for LP right? Which should be 3.10.xx kernel. In any case, I'll use what you made as a base. Thanks again.
carliv said:
CHANGELOG 12-06-2016:
- activated working support for ntfs, exfat and f2fs;
- rewritten the flash image menu for better functionality and more protection to avoid mistakes;
- change the local busybox libs and modules names to avoid conflicting with existing external folder;
- some other small fixes and improvements (you can check the github commits).
[/B]
Click to expand...
Click to collapse
You did it!!! :victory:
Good thing I was checking up on you or I might of missed it.
Thanks carliv I realize this project must of been a huge effort on your part and I for one am very grateful :highfive:
For those with an A/B device, it can be frustrating to wait for GSI maintainers to build A/B variants. Don't worry, it's not too complicated to port A-only system images to A/B.
The difference that matters is that on A-only images, everything in / such as init.rc is in the ramdisk, which is in the boot partition. On A/B devices, the ramdisk is used for recovery instead, so all those files go on the system partition. This partition is actually mounted at / instead of /system. It functions as both the ramdisk and the system partition. This can actually lead to faster boots.
A/B devices also have a different Chrome OS derived updater that supports seamless OTAs to the other slot, but we won't worry about that.
First of all, you will need Linux. This is because Windows just can't handle the extra data we need to preserve, such as POSIX permissions and SELinux contexts.
You are expected to have experience with command-line tools. This is NOT for newbies. You may need to compile a tool.
Steps:
Download an A/B GSI with the same Android version. We will use this image for the root files. (I was able to use an 8.1 base for a 9.0 system with some patches, but YMMV)
Use the simg2img tool to convert the sparse A/B image to a raw one: simg2img system_arm64_ab.img base_ab_raw.img
Use the same tool to convert the A-only image to raw: simg2img system_arm64_a.img system_a_raw.img
Enter a root shell. This is to avoid any problems with permissions. sudo -s
Create the directories to mount the images on: mkdir /mnt/ab; mkdir /mnt/a
Mount the A/B image with flags rw,noatime: mount -o rw,noatime base_ab_raw.img /mnt/ab
Mount the A-only with flags rw,noatime: mount -o rw,noatime system_a_raw.img /mnt/a
Create a system folder in the A-only image: mkdir /mnt/a/system
Set the SELinux context for the system folder: setfattr -n security.selinux -v ubject_r:system_file:s0 /mnt/a/system
Set permissions for the system folder just in case: chmod 755 /mnt/a/system
Delete the system folder in the A/B image: rm -fr /mnt/ab/system
Copy all the root files from A/B to the A-only image. These exact arguments are important to preserve everything. cp -Raf /mnt/ab/* /mnt/a/
Unmount the A/B image: umount /mnt/ab
Unmount the newly transformed A/B image: umount /mnt/a
Convert the new A/B image to sparse format with img2simg: img2simg system_a_raw.img system_arm64_ab_new.img
Flash and enjoy!
If you encounter any errors, the resulting image will most likely not work.
If you have a device with a small system partition that cannot fit the original A-only image you are trying to convert, it will be necessary to create a new, smaller image for the purpose. To create that new image, follow these steps after the ones above:
Create the new raw sparse image: fallocate -l 2G system_ab_raw_small.img
Create an ext4 filesystem on the new image: mkfs.ext4 system_ab_raw_small.img
Mount the new image: mount -o rw,noatime system_ab_raw_small.img /mnt/ab
Mount the old converted A/B image: mount -o ro system_a_raw.img /mnt/a
Copy all the files: cp -Raf /mnt/a/* /mnt/ab/
Unmount the new image: umount /mnt/ab
Unmount the old image: umount /mnt/a
Convert the new image to sparse: img2simg system_ab_raw_small.img system_arm64_ab_new_small.img
Flash and enjoy!
If there's enough demand, I might make a tool to automate this. Let me know what you think.
kdragon said:
For those with an A/B device, it can be frustrating to wait for GSI maintainers to build A/B variants. Don't worry, it's not too complicated to port A-only system images to A/B.
The difference that matters is that on A-only images, everything in / such as init.rc is in the ramdisk, which is in the boot partition. On A/B devices, the ramdisk is used for recovery instead, so all those files go on the system partition. This partition is actually mounted at / instead of /system. It functions as both the ramdisk and the system partition. This can actually lead to faster boots.
A/B devices also have a different Chrome OS derived updater that supports seamless OTAs to the other slot, but we won't worry about that.
First of all, you will need Linux. This is because Windows just can't handle the extra data we need to preserve, such as POSIX permissions and SELinux contexts.
You are expected to have experience with command-line tools. This is NOT for newbies. You will need to compile a few tools.
Steps:
Download an A/B GSI with the same Android version. We will use this image for the root files. (I was able to use an 8.1 base for a 9.0 system with some patches, but YMMV)
Use the same tool to convert the A-only image to raw: simg2img system_arm64_a.img system_a_raw.img
Create the directories to mount the images on: mkdir /mnt/ab; mkdir /mnt/a
Mount the A-only with flags rw,noatime: mount -o rw,noatime system_a_raw.img /mnt/a
Set the SELinux context for the system folder: setfattr -n security.selinux -v ubject_r:system_file:s0 /mnt/a/system
Delete the system folder in the A/B image: rm -fr /mnt/ab/system
Unmount the A/B image: umount /mnt/ab
Convert the new A/B image to sparse format with img2simg: img2simg system_a_raw.img system_arm64_ab_new.img
Create the new raw sparse image: fallocate -l 2G system_ab_raw_small.img
Mount the new image: mount -o rw,noatime system_ab_raw_small.img /mnt/ab
Copy all the files: cp -Raf /mnt/a/* /mnt/ab/
Unmount the old image: umount /mnt/a
Flash and enjoy!
If there's enough demand, I might make a tool to automate this. Let me know what you think.
Click to expand...
Click to collapse
Ab partition of the device can not install Android p, ask God to make a direct brush into the system. Img
yuzui said:
Ab partition of the device can not install Android p, ask God to make a direct brush into the system. Img
Click to expand...
Click to collapse
I am running the Pie PR1 semi-GSI on my A/B device, tissot, right now. If you mean an AOSP GSI, it's available. https://drive.google.com/open?id=1bY5OIbBcy5OyAGlJ45yQ3MhSa8Bjgwg1
If anyone is interested in a root app to convert images, please vote on the poll.
What about A/B to A ? I want to try CosmicDan's MIUI Treble port on my Redmi Note 4
i have sucessfully converted A TO A/B...but when i flash it ..it doesnt boot just stuck at logo..my device in mi A1...can you please tell me that i need to port this file???
hamzaag49 said:
i have sucessfully converted A TO A/B...but when i flash it ..it doesnt boot just stuck at logo..my device in mi A1...can you please tell me that i need to port this file???
Click to expand...
Click to collapse
What ROM is it? I can try to port it.
Most likely your problem is either SELinux being on Enforcing (change it to Permissive in TWRP -> Advanced -> Tissot Manager) or wrong permissions in the image caused by missing a step.
kdrag0n said:
What ROM is it? I can try to port it.
Most likely your problem is either SELinux being on Enforcing (change it to Permissive in TWRP -> Advanced -> Tissot Manager) or wrong permissions in the image caused by missing a step.
Click to expand...
Click to collapse
I'm porting PPP2 SYSTEM.IMG FROM PIXEL XL
Selinux is permissive
hamzaag49 said:
I'm porting PPP2 SYSTEM.IMG FROM PIXEL XL
Selinux is permissive
Click to expand...
Click to collapse
PPP2? That's the old DP2, I think you mean PPR2 (release 2).
It's already been ported by d0gey, download here: https://space-doge.firebaseapp.com/devices/tissot/firmwares/d142afbd-ee0b-486f-8bf7-ac47abd96090
A plain ported Pixel image without patches wouldn't work is because there's a lot of Pixel specific stuff that needs to be patched to work with other devices' vendors.
This would mean the world for a lot of people, if you really going to automate this
Jordan~Kurniawan said:
This would mean the world for a lot of people, if you really going to automate this
Click to expand...
Click to collapse
If I have some free time I'll take a shot at it.
kdrag0n said:
If I have some free time I'll take a shot at it.
Click to expand...
Click to collapse
thanks a lot.
I'm using a macbook, and I really like to try to convert the MIUI rom (https://forum.xda-developers.com/pr...-only-roms/8-1-miui10-project-treble-t3840198) to an A/B rom for my Oneplus6 (Treble, of course). basically I have 2 questions;
- You mention that you NEED linux, is it linux, or is it actually UNIX? (a.k.a. also do-able with MacOS)
- Given the ROM I want to port is using a backup restore method, is one still able to port it to an AB rom?
Even if my goal is not achievable, thank you for creating a guide on how to port. Sharing dev knowledge is the foundation of what drives people to create custom roms!
Skorm92 said:
I'm using a macbook, and I really like to try to convert the MIUI rom (https://forum.xda-developers.com/pr...only-roms/8-1-miui10-project-treble-t3840198) to an A/B rom for my Oneplus6 (Treble, of course). basically I have 2 questions;
- You mention that you NEED linux, is it linux, or is it actually UNIX? (a.k.a. also do-able with MacOS)
- Given the ROM I want to port is using a backup restore method, is one still able to port it to an AB rom?
Even if my goal is not achievable, thank you for creating a guide on how to port. Sharing dev knowledge is the foundation of what drives people to create custom roms!
Click to expand...
Click to collapse
You really NEED Linux. macOS doesn't support ext4, and any third-party driver won't be able to preserve the SELinux xattrs properly.
In that case it's much harder. I'd suggest you try the port on-device in TWRP. Push the reference A/B image to the device and mount it in /mnt, then perform the operations in /system instead of the ROM image mountpoint. You also won't need to create the image at the end. This won't need Linux on your computer because it's all done on the phone.
I used this method to port an A-only OnePlus 6 OxygenOS port to my Mi A1. It booted but not very far because of issues with the port.
kdrag0n said:
You really NEED Linux. macOS doesn't support ext4, and any third-party driver won't be able to preserve the SELinux xattrs properly.
In that case it's much harder. I'd suggest you try the port on-device in TWRP. Push the reference A/B image to the device and mount it in /mnt, then perform the operations in /system instead of the ROM image mountpoint. You also won't need to create the image at the end. This won't need Linux on your computer because it's all done on the phone.
I used this method to port an A-only OnePlus 6 OxygenOS port to my Mi A1. It booted but not very far because of issues with the port.
Click to expand...
Click to collapse
Clear, thanks for the response.
I will try your suggestion, if it boots but fails at certain point, I will find a way to debug it.
The problem primarily on my OP6 is whenever I boot into a treble rom that has issue's, My OP6 is triggerhappy on sending a qualcom kernel panic crash.
Skorm92 said:
Clear, thanks for the response.
I will try your suggestion, if it boots but fails at certain point, I will find a way to debug it.
The problem primarily on my OP6 is whenever I boot into a treble rom that has issue's, My OP6 is triggerhappy on sending a qualcom kernel panic crash.
Click to expand...
Click to collapse
A kernel patch should be able to prevent that, check the custom kernels available.
kdrag0n said:
You really NEED Linux. macOS doesn't support ext4, and any third-party driver won't be able to preserve the SELinux xattrs properly.
In that case it's much harder. I'd suggest you try the port on-device in TWRP. Push the reference A/B image to the device and mount it in /mnt, then perform the operations in /system instead of the ROM image mountpoint. You also won't need to create the image at the end. This won't need Linux on your computer because it's all done on the phone.
I used this method to port an A-only OnePlus 6 OxygenOS port to my Mi A1. It booted but not very far because of issues with the port.
Click to expand...
Click to collapse
You can always give it a shot by creating an ubuntu or alpine container on Docker.
ereneren564 said:
You can always give it a shot by creating an ubuntu or alpine container on Docker.
Click to expand...
Click to collapse
You can't natively have a Docker container on macOS. If you did it'd be inside a Linux VirtualBox VM anyway. I don't think you'd be able to passthrough USB to the container for ADB.
kdrag0n said:
You can't natively have a Docker container on macOS. If you did it'd be inside a Linux VirtualBox VM anyway. I don't think you'd be able to passthrough USB to the container for ADB.
Click to expand...
Click to collapse
As you can copy files to container, you can also copy files from container to host. So your argument is invalid.
docker cp <containerId>:/file/path/within/container /host/path/target
could u make a guide to convert a/b img to a only? thanks
This is a port of Lanchon REPIT.
- Nexus 7 (2013) Deb (LTE) and Flo (WiFi) -
Disclaimer:
I am not responsible for your actions or consequences, directly or indirectly, related to the files and/or advice offered.
It is your choice to proceed.
What is REPIT?
REPIT is a simple, safe, device-only, data-sparing, and easily portable repartitioning tool for Android devices.
See the GitHub README for more on What REPIT is. GitHub - Link
Limitations:
Requires TWRP (or TWRP based) recovery.
Does not support encrypted devices.
Will cause data loss if the repartitioning process is externally interrupted.
See the GitHub README for more on Limitations. GitHub - Link
---
Notes:
A few years ago (September 2018), I made a port of REPIT for deb,flo and manta that was spread out between multiple threads.
Some comments and instructions were lost in thread chatter or just in a different thread altogether.
The file name actually configures the repit script.
Noted that you may have to toggle MTP Disable, Enable, Disable.
Noted that you may have to reboot into TWRP after disabling MTP.
Remember /tmp is wiped after a reboot. Copy repit to /sdcard and after rebooting back into TWRP, copy it from /sdcard to /tmp using TWRP File manager.
Noted that you may have to unmount cache and data.
Do NOT flash repit from USB/OTG.
This is designed for a stock partition layout. If your device has been modified and a vendor partition was created, REPIT will not work.
Side note:
Lanchon added Nexus 7 (2013) to the official list. (November 2019)
Lanchon REPIT GitHub - Port Request - Commit
---
Be Careful.
There are always risks involved when you start messing around with a device.
If something goes wrong, you may end up with a non-working "bricked" device.
This is especially true when you start modifying partitions.
Backup what you want to save and store it off device.
Copy it to your computer, cloud storage, USB, ...
Instructions:
This operation might take a long time and must not be interrupted.
- Depending on the device and REPIT configuration, this might take a few hours.
Make sure your battery is fully charged or mostly charged.
- You can connect to a charger while the REPIT script is running. May or may not charge depending on the recovery.
How To:
If you already have a ROM installed, repit will backup, change the partition, restore and resize.
- You can just reboot once the script finishes.
Boot into TWRP
Swipe to Allow Modifications
Copy the repit zip to /tmp
Disconnect from computer
Disable MTP
Disable MTP TWRP -> Mount
Install repit
TWRP -> Install -> navigate to /tmp and flash the repit zip
Reboot to system
If you are doing a clean install, add the +wipe option to system in the zip file name. This will speed up the partitioning since system will not be backed up and restored.
lanchon-repit-20210220-system=max+wipe-cache=16M+wipe-flo.zip
- Reboot back into TWRP after the script finishes.
- Then follow the instructions from the rom thread to install the rom you are going to use.
Boot into TWRP
Swipe to Allow Modifications
Copy the repit zip to /tmp
Disconnect from computer
Disable MTP
Disable MTP TWRP -> Mount
Install repit
TWRP -> Install -> navigate to /tmp and flash the repit zip
Reboot to recovery
Follow the instructions from the rom thread to install the rom you are going to use.
---
Changes:
Nexus 7 (2013) [Deb][Flo]
Pushed a bit pass the safe zone and claimed a bit more unallocated space.
Updated to the current REPIT scripts.
Separate zip files for deb and flo.
Nexus 7 (2013) GitHub - Commit
Download Links:
MediaFire - Link
SourceForge - Link
GoogleDrive - Link
Direct Download from MediaFire:
lanchon-repit-20210221-system=max-cache=16M+wipe-deb.zip MediaFire - Download
lanchon-repit-20210221-system=max-cache=16M+wipe-flo.zip MediaFire - Download
REPIT Links:
Lanchon REPIT GitHub - Link
- My fork GitHub - Link
Credits:
Lanchon for his excellent REPIT project.
The Android Community and everyone who has helped me learn through the years.
Cheers all.
Note about configuration.
The user configuration is done by renaming the zip file before flashing it.
Not much room to change on deb/flo.
The modifiable partitions are only system and cache (22 and 23).
The actual partitioning is done by a sector range. This is declared inside the script along with a default configuration.
Code:
# the set of partitions that can be modified by REPIT:
# <gpt-number> <gpt-name> <friendly-name> <conf-defaults> <crypto-footer>
initPartition 22 system system "same keep ext4" 0
initPartition 23 cache cache "same keep ext4" 0
initPartition 24 misc misc "same keep raw" 0
# the set of modifiable partitions that can be configured by the user (overriding <conf-defaults>):
configurablePartitions="$(seq 22 23)"
...
# the set of contiguous partitions that form this heap, in order of ascending partition start address:
heapPartitions="$(seq 22 24)"
# the disk area (as a sector range) to use for the heap partitions:
heapStart=$(parOldEnd 21) # one sector past the end of tzb.
heapEnd=$(parOldStart 25) # the start of recovery.
By default, REPIT will back up, restore, compress and/or expand a partition.
The +wipe option will wipe the partition.
The max option is an easy way to allocate the remaining space for a partition.
The misc partition is not part of the user-config but, it is in the sector range.
It will be moved to the the end of the sector range without alteration.
The default zip name lanchon-repit-20210221-system=max-cache=16M+wipe-flo.zip
Creates a 16M clean cache partition. (Wiped)
Uses the rest of the unallocated space in the range for system.
System is backed up and restored since the +wipe option was NOT added to system.
Since only system and cache can be configured, this only allows a few options for deb and flo.
Default zip name. -system=max-cache=16M+wipe-
Include wipe system. -system=max+wipe-cache=16M+wipe-
See the GitHub README for more on how to configure. GitHub - Link
Cheers all.
<RESERVE>
<RESERVE>
I think this deserves a bump, because, this is some great work right here for those wanting to stick with a stock-like partition layout!
Hi, I want to go back stock partition size. So i have to rename the zip.
What zip name?
ipdev said:
This is a port of Lanchon REPIT.
- Nexus 7 (2013) Deb (LTE) and Flo (WiFi) -
Disclaimer:
I am not responsible for your actions or consequences, directly or indirectly, related to the files and/or advice offered.
It is your choice to proceed.
What is REPIT?
REPIT is a simple, safe, device-only, data-sparing, and easily portable repartitioning tool for Android devices.
See the GitHub README for more on What REPIT is. GitHub - Link
Limitations:
Requires TWRP (or TWRP based) recovery.
Does not support encrypted devices.
Will cause data loss if the repartitioning process is externally interrupted.
See the GitHub README for more on Limitations. GitHub - Link
---
Notes:
A few years ago (September 2018), I made a port of REPIT for deb,flo and manta that was spread out between multiple threads.
Some comments and instructions were lost in thread chatter or just in a different thread altogether.
The file name actually configures the repit script.
Noted that you may have to toggle MTP Disable, Enable, Disable.
Noted that you may have to reboot into TWRP after disabling MTP.
Remember /tmp is wiped after a reboot. Copy repit to /sdcard and after rebooting back into TWRP, copy it from /sdcard to /tmp using TWRP File manager.
Noted that you may have to unmount cache and data.
Do NOT flash repit from USB/OTG.
This is designed for a stock partition layout. If your device has been modified and a vendor partition was created, REPIT will not work.
Side note:
Lanchon added Nexus 7 (2013) to the official list. (November 2019)
Lanchon REPIT GitHub - Port Request - Commit
---
Be Careful.
There are always risks involved when you start messing around with a device.
If something goes wrong, you may end up with a non-working "bricked" device.
This is especially true when you start modifying partitions.
Backup what you want to save and store it off device.
Copy it to your computer, cloud storage, USB, ...
Instructions:
This operation might take a long time and must not be interrupted.
- Depending on the device and REPIT configuration, this might take a few hours.
Make sure your battery is fully charged or mostly charged.
- You can connect to a charger while the REPIT script is running. May or may not charge depending on the recovery.
How To:
If you already have a ROM installed, repit will backup, change the partition, restore and resize.
- You can just reboot once the script finishes.
Boot into TWRP
Swipe to Allow Modifications
Copy the repit zip to /tmp
Disconnect from computer
Disable MTP
Disable MTP TWRP -> Mount
Install repit
TWRP -> Install -> navigate to /tmp and flash the repit zip
Reboot to system
If you are doing a clean install, add the +wipe option to system in the zip file name. This will speed up the partitioning since system will not be backed up and restored.
lanchon-repit-20210220-system=max+wipe-cache=16M+wipe-flo.zip
- Reboot back into TWRP after the script finishes.
- Then follow the instructions from the rom thread to install the rom you are going to use.
Boot into TWRP
Swipe to Allow Modifications
Copy the repit zip to /tmp
Disconnect from computer
Disable MTP
Disable MTP TWRP -> Mount
Install repit
TWRP -> Install -> navigate to /tmp and flash the repit zip
Reboot to recovery
Follow the instructions from the rom thread to install the rom you are going to use.
---
Changes:
Nexus 7 (2013) [Deb][Flo]
Pushed a bit pass the safe zone and claimed a bit more unallocated space.
Updated to the current REPIT scripts.
Separate zip files for deb and flo.
Nexus 7 (2013) GitHub - Commit
Download Links:
MediaFire - Link
SourceForge - Link
GoogleDrive - Link
Direct Download from MediaFire:
lanchon-repit-20210221-system=max-cache=16M+wipe-deb.zip MediaFire - Download
lanchon-repit-20210221-system=max-cache=16M+wipe-flo.zip MediaFire - Download
REPIT Links:
Lanchon REPIT GitHub - Link
- My fork GitHub - Link
Credits:
Lanchon for his excellent REPIT project.
The Android Community and everyone who has helped me learn through the years.
Cheers all.
Click to expand...
Click to collapse
I have been trying to repartition Nexus flo 2013 following the steps outlined above with lanchon-repit-20210221-system=max+wipe-cache=16M+wipe-deb.zip for 19.1 version but keep getting Error 1, see photo. Any help will be much appreciated. Thank you
greenleaves said:
I have been trying to repartition Nexus flo 2013 following the steps outlined above with lanchon-repit-20210221-system=max+wipe-cache=16M+wipe-deb.zip for 19.1 version but keep getting Error 1, see photo. Any help will be much appreciated. Thank you
Click to expand...
Click to collapse
Problem fixed. Now 19.1, pico gapps and Magisk 25.0 were flashed in success. The problem was that I didn't follow through the steps carefully described on the OP to increase the partition sizes as follows:
The file name actually configures the repit script.
Noted that you may have to toggle MTP Disable, Enable, Disable.
Noted that you may have to reboot into TWRP after disabling MTP.
Remember /tmp is wiped after a reboot. Copy repit to /sdcard and after rebooting back into TWRP, copy it from /sdcard to /tmp using TWRP File manager.
Noted that you may have to unmount cache and data.
Do NOT flash repit from USB/OTG.
This is designed for a stock partition layout. If your device has been modified and a vendor partition was created, REPIT will not work.
greenleaves said:
Problem fixed. Now 19.1, pico gapps and Magisk 25.0 were flashed in success. The problem was that I didn't follow through the steps carefully described on the OP to increase the partition sizes as follows:
The file name actually configures the repit script.
Noted that you may have to toggle MTP Disable, Enable, Disable.
Noted that you may have to reboot into TWRP after disabling MTP.
Remember /tmp is wiped after a reboot. Copy repit to /sdcard and after rebooting back into TWRP, copy it from /sdcard to /tmp using TWRP File manager.
Noted that you may have to unmount cache and data.
Do NOT flash repit from USB/OTG.
This is designed for a stock partition layout. If your device has been modified and a vendor partition was created, REPIT will not work.
Click to expand...
Click to collapse
Edit: NVM, i used restock to start fresh, and it all went fine. I've had this table kicking around long enough that I'm sure something was done that sysrepartundo couldn;'t undo.
How did you actually fix it? I ran sysrepartundo, am running it from the tmp folder with mtp disabled and nothing mounted, and still getting error 1. I've double check, all my partition sizes are stock.. I've been at this a few hours now and am getting frustrated.
theistus said:
I ran sysrepartundo, am running it from the tmp folder with mtp disabled and nothing mounted, and still getting error 1. I've double check, all my partition sizes are stock.. I've been at this a few hours now and am getting frustrated.
Click to expand...
Click to collapse
sysrepartundo is ancient and useless nowadays, try sysrepart-stock instead
Thank you for the script. I was able to repartion my flo and make it compatible with android 12L. Everything went smooth after realising (and correcting this mistake) that i"ve been putting the .zip inside /sdcard/tmp instead of /tmp (I was getting error 1 in TWRP).
During instalation process i"ve connected flo to charger and it indeed charged during repartition process
Things i"ve noticed
- TWRP appeared to be very laggy during repit process and took several seconds to reconginse the charger (to show to + sign next to the battery % to be precise)
- after device rebooted to stock 6.0.1, MTP didn"t work correctly. It appeared in my computer as "Nexus 7", but was completely empty. One more reboot (this time got short loading toast of "android is updating") and internal memory was visible from computer again
THANKS! It worked great for me also. I have mentioned it in the [GUIDE/TUTORIAL/HOWTO] Google Nexus 7 2013 Stock to Android 12 Tutorial.
Hi,
I had used @followmsi's sysrepart_1280_120.zip some time ago.
Now I'm interested in @followmsi's lineage 19.1 and want to use your lanchon-repit-20210221 script for increasing the system partition again.
Would you still consider the partition layout as stock, so I could use your script ? (See attachments)
And do I need a PC as the USB port is inoperative, so no way to connect to a PC?
Thank you very much in advance!
curiousde2002 said:
Hi,
I had used @followmsi's sysrepart_1280_120.zip some time ago.
Now I'm interested in @followmsi's lineage 19.1 and want to use your lanchon-repit-20210221 script for increasing the system partition again.
Would you still consider the partition layout as stock, so I could use your script ? (See attachments)
And do I need a PC as the USB port is inoperative, so no way to connect to a PC?
Thank you very much in advance!
Click to expand...
Click to collapse
You should be good to go.
Using one of the older (re)partitioning methods did not affect the partition table too much.
The note about a stock partition layout is mainly for users who used a (re)partition script that adds a separate vendor partition.
Cheers.
ipdev said:
You should be good to go.
Using one of the older (re)partitioning methods did not affect the partition table too much.
The note about a stock partition layout is mainly for users who used a (re)partition script that adds a separate vendor partition.
Cheers.
Click to expand...
Click to collapse
Would you recommend any precautions like putting files like restock on my device before running your script as I cannot connect to PC?
Thanks a lot for your help!
hi, i need some help, after using this script i can't seem to install any rom, i just can't format or mount any of my partitions, and sideload stops at some random %, anything i can do to restore? i backed up all files advised.
Hello, i'm having trouble installing Android 12L on my Nexus 7. I simply cannot get lanchon-repit to flash. It wont work, no matter how often I follow the steps and how thorougly I follow the guide. I tried everything. Already restored to "fabric-partitions" so on and so forth.
I'm constantly getting Error 1. I'm slowly losing my mind here.
Kind regards hoping for an answer
septchy
edit: also constantly says partition #30 not found.
I'm getting the following errors on flo:
Code:
FATAL: partition #31 unexpected
[ERROR 1]
Any ideas? Thanks