[Q&A] [GUIDE] How to build CWM-based Recovery from source in Ubuntu 12.04 with CM-11 - Android Q&A, Help & Troubleshooting

[Q&A] [GUIDE] How to build CWM-based Recovery from source in Ubuntu 12.04 with CM-11
Q&A for [GUIDE] How to build CWM-based Recovery from source in Ubuntu 12.04 with CM-11.0
Some developers prefer that questions remain separate from their main development thread to help keep things organized. Placing your question within this thread will increase its chances of being answered by a member of the community or by the developer.
Before posting, please use the forum search and read through the discussion thread for [GUIDE] How to build CWM-based Recovery from source in Ubuntu 12.04 with CM-11.0. If you can't find an answer, post it here, being sure to give as much information as possible (firmware version, steps to reproduce, logcat if available) so that you can get help.
Thanks for understanding and for helping to keep XDA neat and tidy!

My phone has 16mb recovery part but the recovery.img I made is 25 mb so I can't flash it In BoardConfig.mk, I can wrote at least 24.936.448 at the line of BOARD_RECOVERYIMAGE_SIZE to compile the recovery image. How can I solve this problem? Can I reduce the size of the .img file to 16 mb?

denizyildizi345 said:
My phone has 16mb recovery part but the recovery.img I made is 25 mb so I can't flash it In BoardConfig.mk, I can wrote at least 24.936.448 at the line of BOARD_RECOVERYIMAGE_SIZE to compile the recovery image. How can I solve this problem? Can I reduce the size of the .img file to 16 mb?
Click to expand...
Click to collapse
I don't understand how you ended up with such a big recovery... The biggest ramdisk I saw (in TWRP) is not more than 4-5 Mb. Do you have a kernel over 20Mb? It can't be, otherwise the stock recovery will be oversized too. Somewhere you made a mistake probably.
And to answer your question, no you can't reduce the size of recovery that big; if you have a kernel compressed in xz, you may try to compress the ramdisk in xz too, and the size will be smaller, but not enough... you need to downsize it with 9Mb, which is not possible.
So check again, to see if there isn't a mistake somewhere.

carliv said:
I don't understand how you ended up with such a big recovery... The biggest ramdisk I saw (in TWRP) is not more than 4-5 Mb. Do you have a kernel over 20Mb? It can't be, otherwise the stock recovery will be oversized too. Somewhere you made a mistake probably.
And to answer your question, no you can't reduce the size of recovery that big; if you have a kernel compressed in xz, you may try to compress the ramdisk in xz too, and the size will be smaller, but not enough... you need to downsize it with 9Mb, which is not possible.
So check again, to see if there isn't a mistake somewhere.
Click to expand...
Click to collapse
I took a screenshot of my CM11-0/out/target/product/msm8226/root folder which is 25 mb. There is a boot.img file. I think the problem is that file. I unpacked a few recovery.img files but none of them included that file. If problem is this, how can I remove that file from my ramdisk?
I removed that file and flashed new recovery.img but now my phone isn't booting in recovery mode.

denizyildizi345 said:
I took a screenshot of my CM11-0/out/target/product/msm8226/root folder which is 25 mb. There is a boot.img file. I think the problem is that file. I unpacked a few recovery.img files but none of them included that file. If problem is this, how can I remove that file from my ramdisk?
I removed that file and flashed new recovery.img but now my phone isn't booting in recovery mode.
Click to expand...
Click to collapse
No, for checking recovery root you need to look here: CM11-0/out/target/product/msm8226/recovery/root . But anyway that folder looks strange (I see a perl script there)....
Check my screenshot below.
And type a
Code:
make clobber
before stating a new build, or
Code:
make clean
between repetitive builds.

im getting this error each time i try to compile:
make: *** No rule to make target `/etc/init.rc'
please any suggestions

george676 said:
im getting this error each time i try to compile:
make: *** No rule to make target `/etc/init.rc'
please any suggestions
Click to expand...
Click to collapse
You need to be more specific: what recovery you try to build, in what environment (if it's not cm-11), and post a link to your device folder tree. That error means that the compiler can't find an init.rc file to add in ramdisk.

Compiler stops after a few segments
This is shown in my terminal:
Code:
cp: cannot stat ‘/home/paul/cm-10.2/out/target/product/Ultra/root/init.recovery.*.rc’: No such file or directory
make: [/home/paul/cm-10.2/out/target/product/Ultra/recovery/root.ts] Error 1 (ignored)
mkdir -p /home/paul/cm-10.2/out/target/product/Ultra/recovery/root/system/bin
cp -rf device/CherryMobile/Ultra/recovery/root /home/paul/cm-10.2/out/target/product/Ultra/recovery/
cp: omitting directory ‘device/CherryMobile/Ultra’
make: *** [/home/paul/cm-10.2/out/target/product/Ultra/recovery/root.ts] Error 1
[email protected] ~/cm-10.2 $ make clobber
And you wrote about the problem:
During the build process you may encounter some errors or warnings.
*********************
Code:
Code:
cp: cannot stat `/home/carliv/CM11-0/out/target/product/P780/root/init.recovery.*.rc': No such file or directory
make: [/home/carliv/CM11-0/out/target/product/P780/recovery/root.ts] Error 1 (ignored)
This will not stop the build, and it appears if you don't use a init.recovery.{hardware}.rc file. Can be ignored, as the build process does.
Though in my terminal it just stopped at that part so I had to rename mine which was originally init.recovery.qcom.rc to init.recovery.*.rc
--edit--
And yet it still would not continue ... Any ideas on how to fix this?
--edit # 2--
Here's the pastebin link just in case ->biQ7kjV8 add that to pastebin...(I can't post links)
--edit # 3--
I fixed it... Turns out that it was just a BoardConfig.mk parameter that I forgot to complete

Calculate proper BoardConfig.mk partition sizes
I have this log:
Code:
----- Making recovery image ------
/home/paul/cm-10.2/out/target/product/Ultra/recovery.img maxsize=8380416 blocksize=135168 total=8409088 reserve=270336
error: /home/paul/cm-10.2/out/target/product/Ultra/recovery.img too large (8409088 > [8650752 - 270336])
make: *** [/home/paul/cm-10.2/out/target/product/Ultra/recovery.img] Error 1
make: *** Deleting file `/home/paul/cm-10.2/out/target/product/Ultra/recovery.img'
Meaning I have wrong sizes for the partitions so I need help on it...
When I ran the following:
cat /proc/mtd
cat /proc/emmc
they both return: No such file or directory...
Now If I run the command: cat /proc/partitions
it comes up with this:
As far as I know.... mmcblk1p1 is my external sd card which is about 32 GB...
My system image is about 1 GB and more(confirmed) when I used the dd command(to dump it) and is located at mmcblk0p16
Userdata reaches more than 4 GB as reported by the dd command(file size too large) and is located at mmbblk0p25
here(recovery.fstab):
/boot mtd /dev/block/mmcblk0p10
/cache yaffs2 /dev/block/mmcblk0p18
/data yaffs2 /dev/block/mmcblk0p25
/misc mtd /dev/block/mmcblk0p20
/recovery mtd /dev/block/mmcblk0p19
/system yaffs2 /dev/block/mmcblk0p16
-- edit --
I solved this already

Help required for compiling CWM for android 4.4.2 version only?
I am on Ubuntu 14.0.4 and I am trying to build a CWM recovery for Celkon Q 5009android 4.4.2, Broadcom processor). I have set up build environment and currently working on syncing repo. I have heard that it takes too much time and disk space to complete this process. I am interested to know in the following particular scenario : want to build only CWM recovery from source for an android running on version 4.4.2. So do I have to download all repositories or is there any shortcut that would enable me to not download all, but a certain part that is required for android 4.4.2? If yes, how to go about it? please help.

Please help. I do not undertstand why 'repo sync' always fails at a particular stage, though I have 30+ GB of disk space available in my working folder named 'cm12'. Following is the last screen message :
Fetching project platform/external/ant-glob
Fetching projects: 8% (40/495) Receiving objects: 86% (2389/2771), 26.68 MiBerror: RPC failed; result=56, HTTP code = 200iB | 124.00 KiB/s
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
remote: Sending approximately 1.94 GiB ...
remote: Counting objects: 85, done
remote: Finding sources: 100% (85/85)
error: RPC failed; result=56, HTTP code = 200iB | 88.00 KiB/s
fatal: The remote end hung up unexpectedly
Now should I run 'repo sync' again or should I use 'repo sync -j1' ?
fatal: early EOF
fatal: index-pack failed
error: Cannot fetch device/lge/mako-kernel
error: Exited sync due to fetch errors

Hey,
In which size are the values in BoardConfig.mk at BOARD_BOOTIMAGE_PARTITION_ZISE? bit?
And how I can convert blocks to this size because my lge only print out the partition sizes in blocks.
LG Noel

Black Manta said:
Hey,
In which size are the values in BoardConfig.mk at BOARD_BOOTIMAGE_PARTITION_ZISE? bit?
And how I can convert blocks to this size because my lge only print out the partition sizes in blocks.
LG Noel
Click to expand...
Click to collapse
http://forum.xda-developers.com/showpost.php?p=60297989&postcount=51
Somewhere around that post you will find your answer.

Hi. Your guide is the most useful I found on the net. Much more than the official cyanogenmod wiki's porting one. Thanks a lot.
I'm trying to use it to build a cm 12.1 (lollipop) cwm on a mediatek device.
1) My stock rom (also Android 5.1) already ships a fstab.mt6795 file into the ramdisk. I moved it inside /recovery/root, and copied its content in /recovery/recovery.fstab
This is its content, should I make any change inside it?
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/platform/mtk-msdc.0/by-name/system /system ext4 ro wait
/dev/block/platform/mtk-msdc.0/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check,resize,encryptable=footer
/dev/block/platform/mtk-msdc.0/by-name/cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check
/dev/block/platform/mtk-msdc.0/by-name/protect1 /protect_f ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,autoformat
/dev/block/platform/mtk-msdc.0/by-name/protect2 /protect_s ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,autoformat
#please add cip or persist on project fstab
#/dev/block/platform/mtk-msdc.0/by-name/persist /persist ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,autoformat
#/dev/block/platform/mtk-msdc.0/by-name/custom /custom ext4 ro wait
/devices/mtk-msdc.0/11230000.MSDC0 auto vfat defaults voldmanaged=sdcard0:[email protected],noemulatedsd
/devices/mtk-msdc.0/11240000.MSDC1 auto vfat defaults voldmanaged=sdcard1:auto
/devices/bus.2/11270000.USB3_XHCI auto vfat defaults voldmanaged=usbotg:auto
/dev/block/platform/mtk-msdc.0/by-name/frp /persistent emmc defaults
2) How can I find out which of the .rc files available in stock ramdisk include in my recovery, besides the renamed init.rc copied from /bootable/recovery/etc ?
3) My stock rom obviously already ships a init.mt6795.rc. Should I merge any of its lines to the one I copied from /bootable/recovery/etc in my /recovery folder?
Thanks in advance for your time and your efforts.

4javier said:
Hi. Your guide is the most useful I found on the net. Much more than the official cyanogenmod wiki's porting one. Thanks a lot.
I'm trying to use it to build a cm 12.1 (lollipop) cwm on a mediatek device.
1) My stock rom (also Android 5.1) already ships a fstab.mt6795 file into the ramdisk. I moved it inside /recovery/root, and copied its content in /recovery/recovery.fstab
This is its content, should I make any change inside it?
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/platform/mtk-msdc.0/by-name/system /system ext4 ro wait
/dev/block/platform/mtk-msdc.0/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check,resize,encryptable=footer
/dev/block/platform/mtk-msdc.0/by-name/cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check
/dev/block/platform/mtk-msdc.0/by-name/protect1 /protect_f ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,autoformat
/dev/block/platform/mtk-msdc.0/by-name/protect2 /protect_s ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,autoformat
#please add cip or persist on project fstab
#/dev/block/platform/mtk-msdc.0/by-name/persist /persist ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,autoformat
#/dev/block/platform/mtk-msdc.0/by-name/custom /custom ext4 ro wait
/devices/mtk-msdc.0/11230000.MSDC0 auto vfat defaults voldmanaged=sdcard0:[email protected],noemulatedsd
/devices/mtk-msdc.0/11240000.MSDC1 auto vfat defaults voldmanaged=sdcard1:auto
/devices/bus.2/11270000.USB3_XHCI auto vfat defaults voldmanaged=usbotg:auto
/dev/block/platform/mtk-msdc.0/by-name/frp /persistent emmc defaults
2) How can I find out which of the .rc files available in stock ramdisk include in my recovery, besides the renamed init.rc copied from /bootable/recovery/etc ?
3) My stock rom obviously already ships a init.mt6795.rc. Should I merge any of its lines to the one I copied from /bootable/recovery/etc in my /recovery folder?
Thanks in advance for your time and your efforts.
Click to expand...
Click to collapse
First let me ask you where did you find a cwm for lollipop to build it? I'm interested to see that.
Second in recovery fstab you may want to add emmc partitions like boot, recovery... Check my github and look at elephone p6000 device folder (it's close enough to understand). If internal sdcard is on data/media you don't have to add it at all in fstab (at least that was the rule for kitkat... again I need to see the source for that lollipop cwm to tell you exactly). In elephone device recovery fstab you can see that usb and external sdcard are defined as auto for type not vfat because it is better to let minivold manage that.
Normaly for cm12.1 ther is no need to copy any rc file in root, only the fstab. {hardware}, which you said you did.
Again I can tell more if I will see the source code for the recovery, and last thing my guide is quite old now but I'm glad you found it useful.

Thanks for your quick reply.
I think I've not been so clear explaining what I'm doing: when I talk about "Lollipo CWM" I just mean that I'm working on 12.1 branch of cyanogenmod source tree, that as you know is based on the same sources of Lollipop, instead of the one the guide was originally aimed to.
1) I feel really dumb at this moment. I don't know exactly how many time I read that fstab file, and I never noticed that it lacks entries for partitions not managed by stock recovery. Sorry if I wasted your time with a stupid question.
2)For sdcards, then it's better to leave untouched the voldmanaged options, but change the filesystem type to auto?
3) I don't need to copy any other .rc file (init.mt6795.usb.rc, init.xlog.rc, etc...), nor to merge anything from init.mt6795.rc of the stock rom. Right?
Thanks again.

4javier said:
Thanks for your quick reply.
I think I've not been so clear explaining what I'm doing: when I talk about "Lollipo CWM" I just mean that I'm working on 12.1 branch of cyanogenmod source tree, that as you know is based on the same sources of Lollipop, instead of the one the guide was originally aimed to.
1) I feel really dumb at this moment. I don't know exactly how many time I read that fstab file, and I never noticed that it lacks entries for partitions not managed by stock recovery. Sorry if I wasted your time with a stupid question.
2)For sdcards, then it's better to leave untouched the voldmanaged options, but change the filesystem type to auto?
3) I don't need to copy any other .rc file (init.mt6795.usb.rc, init.xlog.rc, etc...), nor to merge anything from init.mt6795.rc of the stock rom. Right?
Thanks again.
Click to expand...
Click to collapse
I did understand it's cm12.1, but that was my question since there is no cwm for cm12.1 only cyanogenmod recovery which is different. At the moment I only recommend twrp for cm12.1+ and for that you have to use a different fstab, easy to find on github or here on xda in twrp threads.

Then, if I'm not too much confused:
- since CM12, Clockworkmod isn't anymore included in its source tree
- if I don't set any RECOVERY_VARIANT it defaults to CyanogenMod Recovery, not CWM anymore
- the recovery.img I built is, at its best, a Cyanogenmod recovery
- the recovery.fstab I used (the one i posted before, but now with /boot, /recovery and /nvram entries added) is in version 2 format, that twrp doesn't understand. So I have to find out how to convert in the old fstab format.
Am I right?
Another question: I used the last version of your CarlivKitchen. That doesn't offer anymore the choice to re/pack for standard android or for mtk images, because it automatically detect the format. But when it repacks, it adds the mtk header if the original image had it? Or am I forced to use a custom boot image maker?

4javier said:
Then, if I'm not too much confused:
- since CM12, Clockworkmod isn't anymore included in its source tree
- if I don't set any RECOVERY_VARIANT it defaults to CyanogenMod Recovery, not CWM anymore
- the recovery.img I built is, at its best, a Cyanogenmod recovery
- the recovery.fstab I used (the one i posted before, but now with /boot, /recovery and /nvram entries added) is in version 2 format, that twrp doesn't understand. So I have to find out how to convert in the old fstab format.
Am I right?
Another question: I used the last version of your CarlivKitchen. That doesn't offer anymore the choice to re/pack for standard android or for mtk images, because it automatically detect the format. But when it repacks, it adds the mtk header if the original image had it? Or am I forced to use a custom boot image maker?
Click to expand...
Click to collapse
Yes for all and for twrp fstab I think you can study device folders from twrp github (few are mediatek).
My kitchen now detects if image has mtk header and will repack it the same way (it stores a variable in unpacked folder which will tell that it must add a mtk header).

I decided to follow this guide to integrate the changes needed to build twrp instead of cwm: http://forum.xda-developers.com/showthread.php?t=1943625
It doesn't cover all the preparation steps like yours do. Do you think there are changes to be made to make your guide suitable for cm12 and twrp, or I can follow it until the " Build a CWM-based Recovery " paragraph?

Related

KEXEC for Sony Xperia Sola

Hallo, after two days of trying to make kexec working, got it working! Its based on hard boot kexec! We can create now multiboot menu and boot multi roms without need for flashing them! Will make this thread updated including files, kernel and instructions!
munjeni said:
Hallo, after two days of trying to make kexec working, got it working! Its based on hard boot kexec! We can create now multiboot menu and boot multi roms without need for flashing them! Will make this thread updated including files, kernel and instructions!
Click to expand...
Click to collapse
and probably now guys with locked bootloader can boot roms requiring custom kernels
DevSwift1 said:
and probably now guys with locked bootloader can boot roms requiring custom kernels
Click to expand...
Click to collapse
NO because kernel need enabled kexec and reguire some other modifications whick is not exist on stock kernel!!!
Tried to boot stock kernel but failed, seems not stable kexec by now! Need help!
Here is kernel changes (3 commits by Aug.09.2013) -> https://github.com/munjeni/android_kernel_xperiago/commits/jb-dev seems there is problem with clean reboot! Got kexec working with usind zImage from the same kernel version but seems when there is another kernel version its fail! I think it fail on my reboot function implementation! Need help to solve these things!
Got ansfer by self. Stock kernel and everyother without kexec patch ca not be loaded more info here -> http://forum.xda-developers.com/showthread.php?p=44077327
Tomorow will make it better, hope perfectly working.
Ok, lets go multiboot development!
My experience using kexec:
- since hard reboot owerwrite new kernel and ramdisk, I disabled hard reboot. So we need shutdown cpu instead of using function reboot! Since we have no shutdown cpu function we have very slow boot after executing new kernel and ramdisk (curently I am satisfied with slow boot because kexec can boot new kernel and ramdisk, yes its slow but working )
What is needed for kexec boot:
- kexec can not boot non kexec based kernels
- kexec can boot only kexec enabled kernel which mean only kernel which have my kexec patch (you can patch your kernel using kexec patch from my git)
- suported phones by now is only Sola and Go
My idea for multiboot by now:
- making boot menu based on modified CWM recovery
Modified CWM recovery plan:
- create new recovery and add new sub menu for multiboot feature
CWM multiboot menu idea:
- here we can write kexec multiboot functions
CWM kexec function idea:
- mount system, cache, userdata partition from external sdcard EXT4 partitons and mount them (only if these partions is created by you on your sdcard !!! We can create an small submenu for creating these partitons if these partitons not exist, but not now, we can do it later after creating simple kexec main menu))
- after mounting these partitions we can:
- boot android from allready installed android from these partitions
- ability to install new android to these partiton and boot them
Lets go! Before I start making new CWM, I need better ideas! What you think how we can do it??? Waiting your ideas!!!
Maybe we can do it without using CWM???
So, how about another kernel or rom which isn't supporting kexec yet?
Sent from risahikari
munjeni said:
Lets go! Before I start making new CWM, I need better ideas! What you think how we can do it??? Waiting your ideas!!!
Maybe we can do it without using CWM???
Click to expand...
Click to collapse
I cannot think of a way to do this without involving CWM. But we could make use of the volume buttons to select the ROM on boot (by mounting the appropriate partition based on the volume button that has been pressed down when the bootsplash screen is displayed). However this would limit us to the number of ROMs that can be installed to two (or max 3, if we have an option to set a default ROM to boot if no button is pressed).
Brilliant work by the way. You are Godlike! :victory:
itachilinux said:
So, how about another kernel or rom which isn't supporting kexec yet?
Sent from risahikari
Click to expand...
Click to collapse
Simple not supported!
First of all we need to create ramdisk which will boot android located on external sdcard, than if we get it working we can play with kexec. I need your help! If some one get android working from external sdcard than I will continue further. I am allso playing now with new ramdisk and trying to get external android booting!!
Our multiboot is not ready. Only ready is kexec tool and kexec kernel. Our multiboot feature is not yet implemented. Our multiboot is in plan and our multiboot need ideas!
can this be of any help?
http://forum.xda-developers.com/showpost.php?p=42057833&postcount=1
github:
https://github.com/tux-mind/tf201-dev
Changed fstab, recovery.fstab and sony fstab device paths to point to the external sdcard partition, modified updater_script paths, rebooted to the recovery, installed rom to the external sdcard partitions, rebooted, after abnormaly slow boot system booted but is abnormally unresponsive, so I deleted and reverted back to the emmc boot. Sory guys I am stopping here until some one get android booted from sdcard! I have no free time to play with external boot. When you done it I will continue
Any one have idea what is use of the fota kernel??? Got fota kernel and ramdisk kexeced and booted, found some tools in sbin folder, there is fota tools, for example after exacution of the fota-ua got this output:
./fota-ua --help
FOTA-UA May 21 2013 18:05:10
ERROR [181] Parameter Error
Info [745] No status file
Total physical memory: 407695360 bytes
Total available physical memory: 8314880 bytes
Configuration information at runtime:
The number of pages of physical memory SC_PHYS_PAGES: 99535
The number of currently available pages of physical memory _SC_AVPHYS_PAGES: 203
0
Info [88] The number of processors configured _SC_NPROCESSORS_CONF: 2
The number of processors currently online (available) _SC_NPROCESSORS_ONLN: 2
Size of a page in bytes _SC_PAGESIZE: 4096
Logging of resource usage measures:
Maximum resident set size ru_maxrss: 172 KB
Page reclaims ru_minflt: 84
Page faults ru_majflt: 0
Block input operations: 0
Block output operations: 0
Info [468] No sdcard found in mounts
Info [757] Update Failed
WARN [48] Failed to remove /sbin/fota-ua, Read-only file system
WARN [52] Failed to remove /sbin/fota-mke2fs, Read-only file system
WARN [56] Failed to remove /sbin/rb_repart, No such file or directory
Click to expand...
Click to collapse
What we can do with these tools???
Or another tool:
./rb_repart
Repartitioning Tool
(C) Copyright 1999-2011 Red Bend Ltd.
4 Hacharash St. Hod-Hasharon, Israel
Version: 7.0.15.5514
Usage: ./rb_repart
-r [OPTIONAL, DEFAULT] - Run full operation
-t [OPTIONAL] - Run in test mode. Do not perform writes
-c config_file [OBLIGATIONAL] - Configuration file
Click to expand...
Click to collapse
munjeni said:
Any one have idea what is use of the fota kernel??? Got fota kernel and ramdisk kexeced and booted, found some tools in sbin folder, there is fota tools, for example after exacution of the fota-ua got this output:
What we can do with these tools???
Or another tool:
Click to expand...
Click to collapse
Well have you ever updated Sola with OTA,you will notice it boots to recovery and thats fota kernel "f-ota" - friendly over the air update system
XperianPro said:
Well have you ever updated Sola with OTA,you will notice it boots to recovery and thats fota kernel "f-ota" - friendly over the air update system
Click to expand...
Click to collapse
When I tried on Xperia Go to update trought fota it was not worked! I never seen anything related to the fota recovery! Is recovery exist on fota kernel??? Have any menu???
Found some logs:
/data/local/tmp/sbin/fotatools # find / | grep fota
find / | grep fota
/cache/recovery/fota
/cache/recovery/fota/executed
/cache/recovery/fota/report
/cache/recovery/fota/status
/system/bin/fota-snoop
find: /proc/2652: No such file or directory
find: /proc/3172: No such file or directory
find: /proc/3554: No such file or directory
find: /proc/3610: No such file or directory
find: /proc/3723: No such file or directory
find: /proc/3884: No such file or directory
/data/local/tmp/sbin/fota-tad
/data/local/tmp/sbin/fotatools
/data/local/tmp/sbin/fotatools/rb_repart
/data/local/tmp/sbin/fotatools/vold.fstab
/data/local/tmp/sbin/fotatools/toolbox
/data/local/tmp/sbin/fota-mke2fs
/data/local/tmp/sbin/fota-ua
/dev/.fota_ui_down
/dev/.fota_ui_shutdown
/data/local/tmp/sbin/fotatools # ls /cache/recovery
ls /cache/recovery
fota
last_log
/data/local/tmp/sbin/fotatools # ls /cache/recovery/last_log
ls /cache/recovery/last_log
/cache/recovery/last_log
/data/local/tmp/sbin/fotatools # cat /cache/recovery/last_log
cat /cache/recovery/last_log
MR: Master reset starting Sat Aug 10 20:26:26 2013
recovery filesystem table
=========================
0 /tmp ramdisk (null) (null)
1 /data ext4 /dev/block/mmcblk0p11 (null)
2 /cache ext4 /dev/block/mmcblk0p12 (null)
3 /modemfs ext4 /dev/block/mmcblk0p6 (null)
MR: Got content --wipe_data from /cache/recovery/command
MR: Formatting /cache
Creating filesystem with parameters:
Size: 262144000
Block size: 4096
Blocks per group: 32768
Inodes per group: 8000
Inode size: 256
Journal blocks: 1024
Label: /cache
Blocks: 64000
Block groups: 2
Reserved block group size: 15
Created filesystem with 11/16000 inodes and 2065/64000 blocks
MR: Formatting /data
Creating filesystem with parameters:
Size: 2147483648
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 8192
Label: /data
Blocks: 524288
Block groups: 16
Reserved block group size: 127
Created filesystem with 11/131072 inodes and 17193/524288 blocks
MR: Unlocking gesture
MR: Resetting RFHAL parameters
MR: Cleaning dir /modemfs/RFHAL
MR: Leaving dir /modemfs/RFHAL
MR: Master reset done
/data/local/tmp/sbin/fotatools #
Click to expand...
Click to collapse
I hope it will work on Xperia™ U, I don't know if it could be possible as I don't know how many differences are between Sola's and U's ramdisk and stuff. :/
munjeni said:
Any one have idea what is use of the fota kernel??? Got fota kernel and ramdisk kexeced and booted, found some tools in sbin folder, there is fota tools, for example after exacution of the fota-ua got this output:
What we can do with these tools???
Or another tool:
Click to expand...
Click to collapse
well, on xperia s for example we use fota partition like a it was a recovery partition
otherwise as soon as you unlock your bl (= no more OTA) it becomes usless
mirhl said:
well, on xperia s for example we use fota partition like a it was a recovery partition
otherwise as soon as you unlock your bl (= no more OTA) it becomes usless
Click to expand...
Click to collapse
How you load recovery from ota partition? Seems you have something like LK bootloader???
munjeni said:
How you load recovery from ota partition? Seems you have something like LK bootloader???
Click to expand...
Click to collapse
a sort of
newer kernels when booting recovery, check if FOTA partition has the custom one installed
if yes, they loads that. otherwise standard recovery
more information here
mirhl said:
a sort of
newer kernels when booting recovery, check if FOTA partition has the custom one installed
if yes, they loads that. otherwise standard recovery
more information here
Click to expand...
Click to collapse
Thats good idea, but thats not ideal solution in comparation with phones which have separated recovery/boot partition and bootloader ui like HTC devices which have direct recovery load trought bootloader, these solution only working if primary boot partition is modified and added "few lines" for booting recovery from seccond partition (like ota partition). Will be perfect solution if we make LK bootloader for separating recovery/boot partition, allso with LK we will be able to create custom emmc layout, by now I can not see any small bootloader for NovaThor on google search, seems thats not public. Searching for a way for creating bootloader based on kernel. How we can modify curent kernel and make them bootloader??? We can modify recovery and make them bootloader kexec based, but I am not happy with kexec because we need to fix them first because loading an kernel trought current kexec patch is very slow! I will be happy if some one look into my git and find a solution for fixing them!
mirhl said:
well, on xperia s for example we use fota partition like a it was a recovery partition
otherwise as soon as you unlock your bl (= no more OTA) it becomes usless
Click to expand...
Click to collapse
What about if I relock my bootloader, do I will be able to use fota??? Seems ota working only if drm keys is not broken??
munjeni said:
What about if I relock my bootloader, do I will be able to use fota??? Seems ota working only if drm keys is not broken??
Click to expand...
Click to collapse
i have a locked bootloader but on xperia u and if you want anything i will happly help and mine has never been unlocked
---------- Post added at 04:59 PM ---------- Previous post was at 04:44 PM ----------
bobthecooldad said:
i have a locked bootloader but on xperia u and if you want anything i will happly help and mine has never been unlocked
Click to expand...
Click to collapse
just read this about fota
http://forum.xda-developers.com/showpost.php?p=12615775&postcount=1
and the orginal file is checked and if it isnt the correct one the phone wont boot

[Q] when building CM12, ko:Invalid cache partition image type: yaffs2 (expected ext4)

Hi all,
I am new to build a rom, excuse me for the newbie question.
I try to build the CM12 by myself, and follow the CM WIKI, I have successfully build the source code,
but when i try to boot it up in emulator, I got errors
Code:
emulator: WARNING: system partition size adjusted to match image file (454 MB > 200 MB)
ko:Invalid cache partition image type: yaffs2 (expected ext4)
in my opinion, the warning may not matter, but the second line do.
so I search the internet, but nothing help.
Is there anything i can do to find out how to solve it or
find out what have happened?
Thanks,
PapEr.
Delete the img file and re-install
PsyGik said:
Delete the img file and re-install
Click to expand...
Click to collapse
it doesn't works, I have delete all img file and rebuild the project, but i got the same error.
You can't run CM12 on emulator,
You should port CM12 to device and work it on device

I need help with a MTK6752 device

Hello guys,
I have a Ulefone Be Touch 2 (with a MT6752 cpu) that only boot and stay on the ulefone logo, and I can't install any ROM (official or custom ones)...
In fact, the tools (latest SPFlashTool v5.1628 and the one provided by ulephone I used successfully earlier) do the download process until 100% without error message, but the only thing that seems to be on the phone (and working) is the recovery.
With this two softwares I am able to install the official recovery or TWRP (2.8.7.0 from needrom), and they both are usable.
But when I try to do something in recovery mod, it tells me that cache or system partitions (and others) are not mounted (or found).
In SPFlashTool, I tryed many features without success but I have (NAND and UFS) errors when doing memory tests :
#External RAM:
#
# Type = DRAM
#
# Size = 0x80000000 (2048MB/16384Mb)
#
#NAND Flash:
#
# ERROR: NAND Flash was not detected!
#
#EMMC:
#
# EMMC_PART_BOOT1 Size = 0x0000000000400000(4MB)
# EMMC_PART_BOOT2 Size = 0x0000000000400000(4MB)
# EMMC_PART_RPMB Size = 0x0000000000400000(4MB)
# EMMC_PART_GP1 Size = 0x0000000000000000(0MB)
# EMMC_PART_GP2 Size = 0x0000000000000000(0MB)
# EMMC_PART_GP3 Size = 0x0000000000000000(0MB)
# EMMC_PART_GP4 Size = 0x0000000000000000(0MB)
# EMMC_PART_USER Size = 0x00000003a3e00000(14910MB)
#
#UFS:
#
# ERROR: UFS was not detected!
I don't understand what it meens and how can I change the recovery if the NAND is gone? Are system partitions and recovery stored in different places/memory (types)?
I searched and read on differents thread (the UBT2 review, mtk6755 ERROR: NAND Flash was not detected by split52 , [GUIDE] How to 'unbrick' your Mediatek MT65xx...) and googled and watched related videos but didn't find anything than matches and can really help me.
So, if someone can help me I would really be grateful.
Thank you in advance.
I'm sorry if I post this thread in the wrong section (I think it's the first I creat).
sylkyls
I had a problem like your's when I walked all over my partition layout because of a botched flash. Didn't have UFS errors tho. No info anywhere. Had to verify my scatter file and recovery fstab layout agreed with each other. Ended up modifying my scatter file. Took it one partition at a time using the fstab until the recovery recognized all partitions then backed up my files, reformatted and flashed the stock rom using SPF Tools. Took a while to boot. After that, the original scatter file worked. Still don't make sense why it worked that way but it got me back working.
smith901 said:
I had a problem like your's when I walked all over my partition layout because of a botched flash. Didn't have UFS errors tho. No info anywhere. Had to verify my scatter file and recovery fstab layout agreed with each other. Ended up modifying my scatter file. Took it one partition at a time using the fstab until the recovery recognized all partitions then backed up my files, reformatted and flashed the stock rom using SPF Tools. Took a while to boot. After that, the original scatter file worked. Still don't make sense why it worked that way but it got me back working.
Click to expand...
Click to collapse
Thank you smith901,
I don't know how to do this: I can run a terminal into the recovery but if I do cat /etc/fstab or less /etc/fstab , I only have :
/system ext4 rw
/cache ext4 rw
/data ext4 rw
/external_sd auto rw
I think I'm doing the wrong way.
Could you tell me (or redirect me to) a method please?
Have a nice day
sylkyls
sylkyls said:
Thank you smith901,
I don't know how to do this: I can run a terminal into the recovery but if I do cat /etc/fstab or less /etc/fstab , I only have :
/system ext4 rw
/cache ext4 rw
/data ext4 rw
/external_sd auto rw
I think I'm doing the wrong way.
Could you tell me (or redirect me to) a method please?
sylkyls
Click to expand...
Click to collapse
Seems to be fstab problems.
Use whatever unpacking tool you are comfortable with to unpack the stock recovery and TWRP. Then replace your fstab files in the root and /etc directories after changing what you want, rw to /system or whatever. Modify the twrp.fstab file in /etc using the values from stock fstab. You might have to add in or replace your rc and mt6735 files also. Repack then flash. The log screen in TWRP will let you know what partitions can't be read. Choosing the correct encryption partition took some trial & error.
Once you get it all to read, the modified twrp.fstab, files in the unpacked stock recovery folder plus a device tree, and the TWRP building thread will get a recovery built by yourself as soon as you can sync from git.
smith901 said:
Seems to be fstab problems.
Use whatever unpacking tool you are comfortable with to unpack the stock recovery and TWRP. Then replace your fstab files in the root and /etc directories after changing what you want, rw to /system or whatever. Modify the twrp.fstab file in /etc using the values from stock fstab. You might have to add in or replace your rc and mt6735 files also. Repack then flash. The log screen in TWRP will let you know what partitions can't be read. Choosing the correct encryption partition took some trial & error.
Once you get it all to read, the modified twrp.fstab, files in the unpacked stock recovery folder plus a device tree, and the TWRP building thread will get a recovery built by yourself as soon as you can sync from git.
Click to expand...
Click to collapse
Thank you again, but I'm really sorry that I can't apply your instructions... ( unpacking with 7-zip does not give me any fstab file )
Could you try to do it with the official rom please? ( download link is in the bottom of this page: http://ulefone.com/download/betouch2.html , at the next step my phone needs the "option 2" rar file).
With custom roms (zip files flashable with a custom recovery or rar archive), I can unpack thems and obtain/open a fstab file ( recovery.fstab ) but not with things flashable with SPFlashTool.
sylkyls
sylkyls said:
Thank you again, but I'm really sorry that I can't apply your instructions... ( unpacking with 7-zip does not give me any fstab file )
Could you try to do it with the official rom please? ( download link is in the bottom of this page: http://ulefone.com/download/betouch2.html , at the next step my phone needs the "option 2" rar file).
With custom roms (zip files flashable with a custom recovery or rar archive), I can unpack thems and obtain/open a fstab file ( recovery.fstab ) but not with things flashable with SPFlashTool.
sylkyls
Click to expand...
Click to collapse
I meant an unpacking tool like Carliv Image Kitchen or Android Image Kitchen. I'm rarely this helpful so once I finish cleaning the carpet I'll have a look.
The recovery.fstab file look slim in this recovery but that is what they made.
Download Aindroid Image Kitchen.
Follow the instructions to unpack your stock recovery and TWRP recovery.
Make the changes you want. Copy needed files, /etc/recovery.fstab, fstab.mt6752 and probably the *.rc files from stock to TWRP. Just check everything to be sure.
Repack TWRP then flash.
I don't use Windows so I couldn't use the program provided in the archive.
sylkyls,
did you solve the issue? I have the same problem.
cmarqz said:
sylkyls,
did you solve the issue? I have the same problem.
Click to expand...
Click to collapse
Hello,
Sorry every one but I forgot to follow this thread as I had a lot of work and someone giave me another phone ( a samsung note 4 N910F) that I repared (and am using now) and then I did let my ulefone away from my priorities.
Sorry cmarqz but I didn't try the solution proposed by smith901 on my MTK6752 device.
Maybe I'll try it later.
Did you find a solution for your device?
Best regards XDA users.

[REPARTITION] Nexus 7 (2013) Repartition [FLO/DEB] [16GB/32GB] [UA TWRP]

Nexus 7 (2013) Repartition​
No one is responsible for your actions except yourself. Everything written further may potentially brick your device, although risk is reduced to minimum.
This repartition package offers 1.5G /system; a /vendor partition and it is fully backward compatible with any ROM (including stock system.img).
Known-issues
HTML:
- If repartition pack says that device isn't correct,
than, if partition table wasn't modified before,
congrats! your device has different memory chip
that those I worked with. No worry, PM me and
I'll add support for it.
DO THE BACKUPs. Repartition will erase all your data
USB connection to PC is MANDATORY else you will not have opportunity to push ROM to your device
Backup
# Before processing further we highly recommend you backup persist and EFS using adb
# Or you might lose your IMEI/WIFI + BT mac addresses
Code:
adb root
adb shell
dd if=/dev/block/mmcblk0p2 of=/sdcard/modemst1.img
dd if=/dev/block/mmcblk0p3 of=/sdcard/modemst2.img
dd if=/dev/block/mmcblk0p4 of=/sdcard/persist.img
Now you can find 3 *.img files at path /sdcard. Copy them to your PC since internal memory will be erased.
Installation
HTML:
# This mod is backwards compatible with any ROM so we highly recommend NOT to reverse it if repartition went well.
# You should use ONLY recovery from this thread since other don't support all benefits of this mod.
# When installing ROM just after you flashed zip and before installing GAPPs you MUST make a resize in TWRP since all roms are build for ~800M system.
# Package is unified for flo and deb. To restore stock layout use same zip and steps as for repartition.
1. Boot into recovery (You need to allow system partition modification to be able resize /system in recovery).
2. Backup your data & Move your files from flash to your PC.
3. Flash repartition pack zip.
4. Do the actions asked by repartition pack (go to Terminal in ordinary recovery and input word that pack will tell you. Everything else will be done automatically).
5. Phone will reboot into recovery.
6. Install TWRP from below (it is build with support of new partitions layout and sizes. It can be differed from official TWRP by next format 3.x.x-1 UA).
7. Format everything. (mount errors will not affect formatting!)
- In TWRP: Wipe > Format data
- Type yes
- Once this completes go to: Wipe > Advanced Wipe
- Tick all the boxes and wipe. There should be no further mount errors. (Thanks [user=7694808]@mr_rubbish[/user] for corrections in formatting).
8. Install ROM which you like.
9. Enjoy better flash partition layout.
If something gone wrong - we recommend you NOT to do anything by yourself. Write here for help, else you may do only worse.
Downloads:
Repartitioning package: GitHub
Credits:
Special thanks to
- Unlegacy-Android team;
- Sudokamikaze;
- rlw6534 for Kingston MMC layout;
- surfrock66 for his gide for Nexus 5;
As usual, feedback is appreciated
XDA:DevDB Information
Nexus 7 (2013) Repartition, Tool/Utility for the Nexus 7 (2013)
Contributors
Clamor
Source Code: https://github.com/clamor95/android_device_unlegacy_recovery
Version Information
Status: Stable
Created 2018-09-19
Last Updated 2019-01-18
Common issues and F. A. Q.
Repartition pack should be safe for most devices. Common mistakes, issues and their solution will be published here.
1. You shouldn't flash any internal parts of repartition pack (*.sh files) only flash whole zip using TWRP. You may use my scripts for personal use or projects but authorship should to be kept.
2. If something isn't mounting after repartition try to format partitions that don't mount using Wipe -> Advanced Wipe in TWPR. Ideally you should format in that way all partitions in Advanced Wipe menu (see 5-th step of installation guide).
3. If you want to be sure that repartition went well I enclose loging zip. Flash it after repartition (when device reboots into TWRP). It won't modify anything only generates a partition.log in root of internal storage and outputs your current partition layout to screen. You should check if your layout is same as those fragments I provide under spoiler (file systems doesn't matter). If there are any differences you have to describe what you did and enclose partition.log to your post.
FLO/DEB STOCK
Code:
22 671088640B 1551892479B 880803840B system
23 1551892480B 2139095039B 587202560B cache
FLO/DEB MODIFIED
Code:
22 614429696B 2187293695B 1572864000B system
23 2187293696B 2270167039B 82873344B cache
...
30 2348843008B 2610987007B 262144000B vendor
4. After flashing most ROMs system size will reduce to stock, you need to resize /system in TWRP or use flashable resize zip for ROMs that support addon.d (automatic resize when dirty flashing updates).
5. After returning to stock partition table you won't be able to get into the Recovery from the bootloader anymore, but when you start the tablet normally it goes straight in the Recovery. It is normal state. New partition table proposes larger /recovery size (16MB) while stock gives only 10MB. During restoring stock process, it is impossible to restore larger recovery backup into new smaller partition. Whether not to leave user without recovery excess, recovery backup restores into /boot partition. Just flash ordinary TWRP and install ROMs from it.
6. Don't install the zip file from the USB OTG. Copy them into the /sdcard. Else you will get message after flashing repartition pack.
Code:
"Can not extract updater-script. Do you have it in package?
Updating partition details...
...done"
Link not working for the repartitioning package...
@rlw6534 should be fine now
Any chance you give details on backing up persist and EFS with dd command? I'm not really a noob but I also don't want to mess up my tab...
@rlw6534 You actually should't brake anything. Added an instruction how to backup EFS and persist.
OK. Tried to flash on a clean, freshly wiped system (Flo 32G), all stock, ext4 on cache and Data, TWRP 3.2.3-0. Got the following:
******Applying dark magic******
This is not a Nexus 7 (2013)
Updater process ended with ERROR: 1
How to restore files, that we copied from our tablet using dd command ? (I haven't done anything yet. Just asking)
Sent from my whyred using XDA Labs
@rlw6534 your partition table was modified.
@MikiGry same commands, just switch paths.
Clamor said:
@rlw6534 your partition table was modified.
@MikiGry same commands, just switch paths.
Click to expand...
Click to collapse
Do you mean that despite this error message:
******Applying dark magic******
This is not a Nexus 7 (2013)
Updater process ended with ERROR: 1
The partition table has been modified correctly?
@lollyjay No it wasnt. Package has 2 step security system. It checks if partition table was modified and in what way (by package itself, by user or it is stock). Second step is that package itself doesn't modify anything, it needs manual confirmation in terminal, else no changes will be applied.
Clamor said:
@lollyjay No it wasnt. Package has 2 step security system. It checks if partition table was modified and in what way (by package itself, by user or it is stock). Second step is that package itself doesn't modify anything, it needs manual confirmation in terminal, else no changes will be applied.
Click to expand...
Click to collapse
Thanks
So do I NOT flash the modded twrp first?
Your instructions said to flash it after reboot to recovery
@lollyjay actually it shouldn't metter, but after would be better
Clamor said:
@lollyjay actually it shouldn't metter, but after would be better
Click to expand...
Click to collapse
I'm going to do this when I get home. This might mean that flo/deb will get Android 9 Pie
@lollyjay look through UA ROM thread I wrote there about P on flo/deb
Clamor said:
@lollyjay look through UA ROM thread I wrote there about P on flo/deb
Click to expand...
Click to collapse
Sorry but can you give me a link?
Clamor said:
@rlw6534 your partition table was modified.
@MikiGry same commands, just switch paths.
Click to expand...
Click to collapse
I have previously used sysrepart.zip and sysrepartundo.zip from this thread, although not recently:
https://forum.xda-developers.com/showpost.php?p=76278047&postcount=19
I returned it to stock a while back (827MB). Perhaps I need to sgdisk a stock partition table?
@rlw6534 Every manual repartition or repartition made not by my pack needs an individual look and partition table restore.
@lollyjay here
Clamor said:
@rlw6534 Every manual repartition or repartition made not by my pack needs an individual look and partition table restore.
@lollyjay here
Click to expand...
Click to collapse
OK. Here is my partition layout. My userdata appears to be smaller than stock, but there isn't enough room on mmcblk0 to increase it to the size that your script is looking for. I have no idea how that could have been changed without bricking the tab. Everything else looks normal. Ideas?
Code:
Model: MMC MMC32G (sd/mmc)
Disk /dev/block/mmcblk0: 30937186304B
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 67108864B 156745727B 89636864B fat16 radio
2 201326592B 204472319B 3145728B modemst1
3 204472320B 207618047B 3145728B modemst2
4 268435456B 283795455B 15360000B ext4 persist
5 335544320B 336343039B 798720B m9kefs1
6 336343040B 337141759B 798720B m9kefs2
7 402653184B 403451903B 798720B m9kefs3
8 403451904B 406597631B 3145728B fsg
9 469762048B 471298047B 1536000B sbl1
10 471298048B 472834047B 1536000B sbl2
11 472834048B 474931199B 2097152B sbl3
12 474931200B 480174079B 5242880B aboot
13 480174080B 480698367B 524288B rpm
14 536870912B 553648127B 16777216B boot
15 603979776B 604504063B 524288B tz
16 604504064B 604505087B 1024B pad
17 604505088B 606041087B 1536000B sbl2b
18 606041088B 608138239B 2097152B sbl3b
19 608138240B 613381119B 5242880B abootb
20 613381120B 613905407B 524288B rpmb
21 613905408B 614429695B 524288B tzb
22 671088640B 1551892479B 880803840B ext4 system
23 1551892480B 2139095039B 587202560B ext4 cache
24 2147483648B 2148532223B 1048576B misc
25 2214592512B 2225078271B 10485760B recovery
26 2281701376B 2281709567B 8192B DDR
27 2281709568B 2281717759B 8192B ssd
28 2281717760B 2281718783B 1024B m9kefsc
29 2348810240B 2348843007B 32768B metadata
30 2415919104B 30937169407B 28521250304B ext4 userdata
@rlw6534 Thanks!

[RECOVERY][DUALBOOT][MAGISK][3.3.1-79][Unified]Unofficial TWRP for OnePlus 7/7 Pro/5G

If you want to make something like this for your device, check out this guide here
Since I no longer have an OP 7 series device, this mod is now deprecated and won't be receiving any more updates. @invernomut0 has made a continuation of this mod using orangefox recovery. Check it out here!
Team Win Recovery Project 3.x, or twrp3 for short, is a custom recovery built with ease of use and customization in mind. Its a fully touch driven user interface no more volume rocker or power buttons to mash. The GUI is also fully XML driven and completely theme-able. You can change just about every aspect of the look and feel.
Code:
#include <std_disclaimer.h>
/*
*
* We are not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this ROM
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at us for messing up your device, we will laugh at you.
*
*/
Compatibility
This has only been tested by me on Oxygen OS Stable - Android Q.
Disclaimer
This is a DANGEROUS mod. Anything involving repartitioning is. If you fail to read and bad things happen, that's on you. Although I thoroughly tested this (managed to brick my phone once), there's always the possibility that something could go wrong with the worst case scenario resulting in a brick.
YOU'VE BEEN WARNED - Use at your own risk
What is this?
This is @mauronofrio's TWRP (see official thread here) that's been modified for true dual booting by splitting userdata into a/b slots (also does the same for metadata for encryption support). The installer script repartitions userdata for dualboot or stock based on your input.
Limitations
See the section in the github readme. MAKE SURE YOU READ THIS!
Features:
Same as mauronofrio's TWRP
Can choose between stock layout, a/b userdata, or a/b/c userdata where 'c' is a common data partition that'll show up in both roms - it's quite handy
Option to choose between ext4 and f2fs
Disables verity - fstabs are modified for dual boot and so this is a must unless you choose stock layout in which case it's optional
Option to disable forced encryption
Option to install magisk
Common Data
I recommend the a/b/c layout which includes this common data partition
If you choose a/b/c layout - you'll have a/b userdata, but you'll also get a 3rd userdata partition I call 'Common Data'
The name 'Common Data' gives away its purpose - to store files that you'll access on both slots/roms. So stuff like zips, pictures, music, TWRP backups, etc.
In TWRP, this shows up as another storage option for backup/restore and on your pc as well - your phone will have 'Common Storage' and 'Internal Storage'
In order to be accessible when booted, some parts of the system are modified so that the it'll be accessible WITHOUT root by the following mechanisms:
- The common data partition is mounted to /sdcard/CommonData
- .nomedia file is placed in CommonData so files in it won't be picked up twice if you decide to mount over internal storage as outlined below
- Furthermore, if your use case is like mine where my music files are in common data, you can make 'mounts.txt' file in /datacommon containing a list of every FOLDER to mount directly over top of sdcard. So for example:
/datacommon/Music -> /sdcard/Music
+ This of course mounts over anything there (overwrites it for as long as it's mounted) so make sure that you don't have the same folder in both datacommon and regular data
+ Note that there are 3 exceptions to this folder mounting rule:
1) All - if this is the FIRST line, ALL folders in datacommon will be mounted
2 )Android
3) lost+found
+ The reasoning should be obvious - lost+found isn't something you should need to mess with and Android is for regular data partition only - that's OS specific and should be on separate slots
+ Note that you should have 1 folder listed on every line, for example:
Code:
DCIM
Music
Pictures
ViPER4AndroidFX
Flashing Instructions
You MUST be booted into TWRP already when flashing this zip. You can grab a bootable twrp img from here
Since this modifies data - the zip CANNOT be on sdcard or data at all UNLESS you do not want to repartition/format
- If you flash from data, the zip will copy itself to /tmp and instruct you to flash it from there OR you can just install twrp/magisk/disver-fec
- You could do the above or copy it to a place like /dev or /tmp and flash it from there
- Alternatively, you can adb sideload it
Read through ALL the prompts - there's lots of options
Note that if you change partition layout, THIS WILL WIPE ALL DATA INCLUDING INTERNAL STORAGE
How to Flash Roms - If you're NOT stock layout
Nothing changes here except ONLY FLASH IN TWRP
- Roms always flash to the opposite slot. Keep that in mind and you'll be fine
- So don't take an OTA while booted - boot into twrp, switch slots, reboot into twrp, flash rom
Normal flash procedure:
1) Boot into twrp
2) reboot into twrp selecting slot you do NOT want rom installed to
3) Flash rom
4) Flash this zip
5) Reboot into twrp
6) Flash everything else
Help! I Can't Boot!
Usually this is because you switched roms without formatting data first. This should be flashing 101 but we all forget sometimes. Plus this slot stuff can get confusing
If it only happens with a/b/c and not any other layout, there's a good chance it's selinux related. Try setting selinux to permissive at kernel level with this mod(source here). If this doesn't fix it, it could be because selinux can't be set to enforcing even with the mod depending on the rom
How to Manually Repartition Back to Stock
In the event any step in the repartioning fails, the entire installer aborts. The good news is that this prevents a potential brick. The bad is that you need to manually revert back. See the README on github for the procedure. Note that if the install went fine and you want to switch back to stock later, just flash the installer again and choose stock layout
Download
Source Code
Credits
Mauronofrio
Teamwin
CosmicDan
TopJohnWu
Very ****ing badass. ?
Wow, this is cool. Always wondered if something like this would be possible on AB partitioned devices.
Looking forward to testing it out
Does the dual boot mean I can boot two roms?
jaggillararla said:
Does the dual boot mean I can boot two roms?
Click to expand...
Click to collapse
Ya. You can have a different rom on each slot
Will it impact on my original data partition if I flashed this TWRP.( I means whether my original data being splitted into 2-individual-parition + 1-common-partition and I need to reinstall my data after entering system ?)
Kris Chen said:
Will it impact on my original data partition if I flashed this TWRP.( I means whether my original data being splitted into 2-individual-parition + 1-common-partition and I need to reinstall my data after entering system ?)
Click to expand...
Click to collapse
The installer will tell you if it'll wipe internal storage or not.
Basically, if you choose to change the partition layout, data will all be wiped since it'll be repartitioned. If you choose to keep your partition layout at the beginning of the install, your data will be fine.
You could just use this zip as twrp, magisk, verity/fec modifer/installer to save you the extra steps and keep with stock layout
This is super cool. Will be testing soon. Just to confirm, this means I can have a custom rom on one slot and oxygen os on the other? Also f2fs should work fine with common data right?
f41lbl0g said:
This is super cool. Will be testing soon. Just to confirm, this means I can have a custom rom on one slot and oxygen os on the other? Also f2fs should work fine with common data right?
Click to expand...
Click to collapse
Yup. You can do whatever you want with either slot. This mod formats all data partitions as ext4 since that's what oneplus does. You can always reformat userdata to f2fs in twrp gui later if you want though. Same goes for common data although I don't think there's a gui option for that
How does this zip to allocate the each size of userdata ? Can be customized by ourself or automated by zip itself ?
Kris Chen said:
How does this zip to allocate the each size of userdata ? Can be customized by ourself or automated by zip itself ?
Click to expand...
Click to collapse
From what I see it can not be customized through the flasher (may be possible by editing values in the zip). In case you were wondering the size of the partitions, they are 96.7gb for the common storage and 62.4gb each for the individual storages.
Kris Chen said:
How does this zip to allocate the each size of userdata ? Can be customized by ourself or automated by zip itself ?
Click to expand...
Click to collapse
f41lbl0g said:
From what I see it can not be customized through the flasher (may be possible by editing values in the zip). In case you were wondering the size of the partitions, they are 96.7gb for the common storage and 62.4gb each for the individual storages.
Click to expand...
Click to collapse
It's automated by installer. If you have a 128gb device:
32gb for each userdata slot, commondata gets what's left
256gb device:
Everything's doubled from above
Thank you for this work I have screwed up all of my partitions on my Oneplus and could use a pointer on how to restore all of the correct partitions... :-0
I must have screwed up one of the commands on restoring my original partitions here is what I have now
C:\Users\The Family>adb shell
OnePlus7Pro:/ # sgdisk /dev/block/sda --print
Creating new GPT entries.
Disk /dev/block/sda: 61409280 sectors, 234.3 GiB
Logical sector size: 4096 bytes
Disk identifier (GUID): B0281E2A-8376-4F4B-98C6-BF5221AD8A20
Partition table holds up to 128 entries
First usable sector is 6, last usable sector is 61409274
Partitions will be aligned on 256-sector boundaries
Total free space is 61409269 sectors (234.3 GiB)
Number Start (sector) End (sector) Size Code Name
OnePlus7Pro:/ #
What commands do I need to fix this. I can still get into adb shell
edit: msmtool cannot restore from this because the partitions are not correct from the way it looks when I try it. when in recovery touch does not work.
eyespunker said:
Thank you for this work I have screwed up all of my partitions on my Oneplus and could use a pointer on how to restore all of the correct partitions... :-0
I must have screwed up one of the commands on restoring my original partitions here is what I have now
C:\Users\The Family>adb shell
OnePlus7Pro:/ # sgdisk /dev/block/sda --print
Creating new GPT entries.
Disk /dev/block/sda: 61409280 sectors, 234.3 GiB
Logical sector size: 4096 bytes
Disk identifier (GUID): B0281E2A-8376-4F4B-98C6-BF5221AD8A20
Partition table holds up to 128 entries
First usable sector is 6, last usable sector is 61409274
Partitions will be aligned on 256-sector boundaries
Total free space is 61409269 sectors (234.3 GiB)
Number Start (sector) End (sector) Size Code Name
OnePlus7Pro:/ #
What commands do I need to fix this. I can still get into adb shell
edit: msmtool cannot restore from this because the partitions are not correct from the way it looks when I try it. when in recovery touch does not work.
Click to expand...
Click to collapse
I have the steps outlined here: https://github.com/Zackptg5/TWRP-DualBoot-Guac-Unified/#how-to-manually-repartition-back-to-stock
But what did you do? It looks like you formatted all of /dev/block/sda which is essentially a brick. You are able to restore that with msmtool btw but there will still be some device specific data that is lost and you'll likely need to file warranty claim
Zackptg5 said:
I have the steps outlined here: https://github.com/Zackptg5/TWRP-DualBoot-Guac-Unified/#how-to-manually-repartition-back-to-stock
But what did you do? It looks like you formatted all of /dev/block/sda which is essentially a brick. You are able to restore that with msmtool btw but there will still be some device specific data that is lost and you'll likely need to file warranty claim
Click to expand...
Click to collapse
It was this step that I really messed up
Final step is to format the new userdata partition: mke2fs -t ext4 -b 4096 /dev/block/sda$userdata_num $userdata_size - where userdata_size can be calculated with this shell command: sgdisk /dev/block/sda --print | grep "^ *$userdata_num" | awk '{print $3-$2+1}'
with this step I used the result from sgdisk /dev/block/sda --print | grep "^ *$userdata_num" | awk '{print $3-$2+1}' I do not remember the value into the spot where userdata_size was
It looks like have been able to flash partitions manually in fastboot but the two partitions that are no longer recognized are the system_a and system_b the reason I say that is because vendor and boot flash fine on both a and b partitions. and when I send the commands to flash system a or b the reply is partition not found?! I am not sure if it would fix my problem but if I could get help to restore system partitions maybe I can get this thing to boot up.
eyespunker said:
It was this step that I really messed up
Final step is to format the new userdata partition: mke2fs -t ext4 -b 4096 /dev/block/sda$userdata_num $userdata_size - where userdata_size can be calculated with this shell command: sgdisk /dev/block/sda --print | grep "^ *$userdata_num" | awk '{print $3-$2+1}'
with this step I used the result from sgdisk /dev/block/sda --print | grep "^ *$userdata_num" | awk '{print $3-$2+1}' I do not remember the value into the spot where userdata_size was
It looks like have been able to flash partitions manually in fastboot but the two partitions that are no longer recognized are the system_a and system_b the reason I say that is because vendor and boot flash fine on both a and b partitions. I am not sure if it would fix my problem but if I could get help to restore system partitions maybe I can get this thing to boot up.
Click to expand...
Click to collapse
The formatting steps is how I initially bricked my phone when I was figuring this stuff out - I since fixed that issue and made sure it'd never happen again in the zip :/
Why were you manually restoring? Did the zip cut off with partition error?
You'll need to use msmtool in this case. Even if your partition block is completely toast, it's able to bring it all back. You can grab the latest one from here: https://androidfilehost.com/?w=files&flid=296306
And here's the guide for it: https://forum.xda-developers.com/oneplus-7-pro/how-to/msm-tool-guac-t3934691
Zackptg5 said:
The formatting steps is how I initially bricked my phone when I was figuring this stuff out - I since fixed that issue and made sure it'd never happen again in the zip :/
Why were you manually restoring? Did the zip cut off with partition error?
You'll need to use msmtool in this case. Even if your partition block is completely toast, it's able to bring it all back. You can grab the latest one from here: https://androidfilehost.com/?w=files&flid=296306
And here's the guide for it: https://forum.xda-developers.com/oneplus-7-pro/how-to/msm-tool-guac-t3934691
Click to expand...
Click to collapse
When I run the latest 10.4 global I get "device does not match image" and then under status I loose connection. I have also tried the 10.31 file with no luck either.
eyespunker said:
When I run the latest 10.4 global I get "device does not match image" and then under status I loose connection. I have also tried the 10.31 file with no luck either.
Click to expand...
Click to collapse
In msmtool? Do you have the right variant?
Latest global: https://androidfilehost.com/?fid=4349826312261732245
Latest europe: https://androidfilehost.com/?fid=4349826312261732244
Download mode is really tricky too. It times out after several seconds so you pretty much have to keep holding down the key combo until msmtool picks it up and then you can release them
Zackptg5 said:
In msmtool? Do you have the right variant?
Latest global: https://androidfilehost.com/?fid=4349826312261732245
Latest europe: https://androidfilehost.com/?fid=4349826312261732244
Download mode is really tricky too. It times out after several seconds so you pretty much have to keep holding down the key combo until msmtool picks it up and then you can release them
Click to expand...
Click to collapse
I have now tried the latest two and have come up with the same results on the update when the device param load the result of the last communication is device does not match image.
eyespunker said:
I have now tried the latest two and have come up with the same results on the update when the device param load the result of the last communication is device does not match image.
Click to expand...
Click to collapse
Sounds like you may need to file a warranty claim then :/

Categories

Resources