[DUAL_BOOT]Dual booting an android phone with an extrrnal SD card - Xiaomi Redmi 2 ROMs, Kernels, Recoveries, & Other

So here you come. To read and perform this tutorial, you obviously need a first hand experience on flashing a ROM and/or kernels. Otherwise this tutorial and my efforts to get you a device with two OSes running might end up giving you a bricked device. So, if you're hearing the terms "flashing" or 'kernels' for the first time and thinking it's kinda good food, then bro, just go and taste those first.
Something's to remind before we gonna dig deep into this tutorial->
1> Noone but you will be responsible for what you end up with.
2> The warranty of your device will be voided after this if it isn't already after rooting. For MI users, the good news is that you can reclaim it by just flashing the fastboot ROM for your device.
Enough lectures. Bro let's get to work.
This you'll be needing =>
1> One working Windows PC(because I doesn't know any replacement of bootimg.exe on any other OS. If you know, then let me).
2> A class 10 memory card ( I recommend 32GB for the spaces)
3> A custom ROM and kernel for your phone(the second os)
4> Any custom CWM based recovery installed.(since TWRP is most popular, I will demonstrate using it. You can use any other you want overall process will be the same)
5> ADB, fastboot and the device drivers (easily found in XDA)
PART 1: MODIFYING THE BOOT
At first, how does your device boots up? What are the partitions called /data and /system? The answer is quite simple. It's your kernel that points out the location from where the OS should be picked up. So for booting into the second OS we need some modifications to it at first.
Search and download bootimg.exe on XDA, I'll post a link later. Create two folders. Name them "Internal OS" and "External OS" respectively. Put the zip file of the OS you're currently using to the first one and the OS you're gonna use on the external storage to the second one. Rename the second OS to originalExternalOS.zip. Extract originalExternalOS.zip. Pick the boot.img file from the root of the extracted folder and move it to a new folder named "boot2". Extract the IMG using bootimg.exe. Navigate to the initrd folder and you will get a file named 'fstab".
Basically it's the file that tells the kernel which partition does the OS resides in.
Open the file in your favourite text editor.
Replace every instance of the first line with the second one:
/dev/block/bootdevice/by-name/system => /dev/block/mmcblk1p2
/dev/block/bootdevice/by-name/userdata => /dev/block/mmcblk1p3
/dev/block/bootdevice/by-name/cache => /dev/block/mmcblk1p4
Save the file without giving any extension to it. Repack it using the same tool. You'll have boot-new.img and boot-old.img. Rename boot-new.img to boot.img and replace the one in the root folder with this. Basically what we're doing here is replacing the old boot.img with the modified one.
For your knowledge, blocks are the partitions of any storage you have on your device. For example, your internal storage is partitioned to near about 30 different blocks each starting with prefix "mmcblk0p". We here just told the kernel to load the OS from the blocks mentioned. We'll be creating these blocks in the external SD card next.
PART 2: PARTITIONING THE SD CARD
Connect your device with the memory card inserted to your PC. If you haven't installed fastboot, ADB, and the drivers, do it now.
READ THE FOLLOWING CAREFULLY
Reboot the device to recovery mode. Type the commands in cmd:
Code:
adb shell
parted
unit MB
print
quit
umount external_sd
Read and store the minimum and maximum capacity of your card. Since different cards will have different capacities I will point it as variable MIN_SIZE and MAX_SIZE. You'll need to calculate and put the values in the commands. Now type the following commands on cmd:
Code:
parted /dev/block/mmcblk1
rm 1
//START_BLOCK = MAX_SIZE - 5000
mkpartfs primary fat32 MIN_SIZE START_BLOCK
//SYS_START = START_BLOCK+1
//SYS_END = SYS_START + 1200
mkpartfs primary ext2 SYS_START SYS_END
//DATA_START = SYS_END+1
//DATA_END = DATA_START + 3500
mkpartfs primary ext2 DATA_START DATA_END
//CACHE_START = DATA_END + 1
mkpartfs primary ext2 CACHE_START MAX_SIZE
//We have partitioned the memory card. Let's format them. Ignore all "Do you wish to continue" question in the next commands as we're already mentioning yes.
mkfs yes 1 fat32
mkfs yes 2 ext2
mkfs yes 3 ext2
mkfs yes 4 ext2
quit
//Now they are almost ready. Just make the newly created blocks readable by the OS.
make_ext4fs /dev/block/mmcblk1p2
make_ext4fs /dev/block/mmcblk1p3
make_ext4fs /dev/block/mmcblk1p4
//Now you get where does the blocks come in the kernel right?
exit
//You've covered up the hardest part. Let's get some coffee and cheeerssss.
PART 3: MODIFYING THE NEW OS
You've left the OS extracted in the "External OS" folder right? It's time to do some magic in it. We're gonna tell the OS to be installed in the blocks we created just like the kernel. But wait, where does the OS know before installing where it should get installed? Well, the answer hides in the updater-script in the folder META-INF > com > google > android. Navigate yourself in it. Open the updater-script file in your favourite editor ( I use notepad++ ) and modify it in the same way as the kernel.
Replace every instance of the first line with the second one:
/dev/block/bootdevice/by-name/system => /dev/block/mmcblk1p2
/dev/block/bootdevice/by-name/userdata => /dev/block/mmcblk1p3
Leave the /dev/block/bootdevice/by-name/boot as it's the fundamental block and we can't replicate it. Don't think for the /cache partition as we've already done that in the boot.img file. Now navigate to the root of the folder where you extracted the External OS. Select all files, add them to a zip file using WinRAR. Name the file to newOS.zip. Open newOs.zip and originalExternalOS.zip with WinRAR and compare them if you find any change in the folder tree. They must and they should be exactly the same. You're 80% done.
PART 4: MODIFYING THE RECOVERY
We often flash many zips including very popular Xposed and other mods to our OS right? They also look for the /system partition. So what are we gonna do? Modifying each of them? Nah. Let's modify where they get which one the /system is. The recovery. Extract the img of the recovery you're using with the same bootimg.exe. Modify exactly the same things. I.e.
Replace every instance of the first line with the second one:
/dev/block/bootdevice/by-name/system => /dev/block/mmcblk1p2
/dev/block/bootdevice/by-name/userdata => /dev/block/mmcblk1p3
/dev/block/bootdevice/by-name/cache => /dev/block/mmcblk1p4
in the following files : initrd/fstab.qcom
initrd/etc/recovery.fstab
initrd/etc/twrp.fstab(For TWRP only)
Save them. Repack. And you got your recovery-new.img and recovery-old.img. Put recovery-new.img and newOS.zip in the same folder. Now wake up, it's time for some action.
PART 5 : INSTALLING THE OS
Open cmd in the folder where newOS.zip resides. Reboot the devixe in fastboot mode. Type the following commands:
Code:
adb push newOS.zip external_sd
fastboot flash recovery recovery-new.img
fastboot boot recovery
Now your device should boot up in recovery mode. To check if everything has gone fine mount system using TWRP. Use twrp's built in file manager and navigate to system folder. It's empty? Yup. You've done a great job. Now flash the newOS.zip using TWRP and your device should boot up in the new OS. To cross check again remove the SD card and try to boot. If you're headed towards recovery or bootloop after that then it's a win. Put the SD card back again and watch the new OS to boot.
PART 6: SWITCHING BETWEEN THE TWO
Extract the boot.img from the "Internal OS" zip file and put it together with recovery-old.img. To check if your old system is untouched type the following commands in fastboot mode:
Code:
fastboot flash recovery recovery-old.img
fastboot flash boot boot.img
fastboot boot system
Your device should take you back to the old one. Surprised? Now let's make a switch between the two. There are two methods.
METHOD 1: USING FLASHIFY
Create two folders in your SD card. Put boot.img and recovery-old.img to one and boot-new.img and recovery-new.img to the other. To switch to the external OS, just flash boot-new.img as boot and recovery-new.img using flashify. Ignore reboot now dialog and reboot directly to the system. To go back, first install flashify in the new OS and flash boot.img and recovery-old.img. Easy right?
METHOD 2: USING ZIPS
I'm gonna tell you that tomorrow as I can write no more today.
More to come....
CREDITS:
justzzshadz from MIUI forum for this revolutionary concept. @iamsubhranil for adding TWRP support and rewriting the tutorial.

Unnecessary

Continuation2
........

reserved
For future posts.

reserved
For future posts

"External" is spelled wrong in the title.

God of War™ said:
"External" is spelled wrong in the title.
Click to expand...
Click to collapse
If you read the whole tutorial, then that just doesn't matter

God of War™ said:
"External" is spelled wrong in the title.
Click to expand...
Click to collapse
Have you tried it?

bootimg.exe
"bootimg.exe on any other OS. If you know, then let me)."
please, send bootimg.exe

tim241 said:
Thanks!!
Click to expand...
Click to collapse
Why you quoted the whole post only to say thanks? That thank you button under the post isn't enough?

tim241 said:
Thanks!!
Click to expand...
Click to collapse
Tried?

fstab not found there is a file named fstab.qcom??????

keerten said:
fstab not found there is a file named fstab.qcom??????
Click to expand...
Click to collapse
Try MultiROM man

iamsubhranil said:
Try MultiROM man
Click to expand...
Click to collapse
Ok Bro

iamsubhranil said:
Try MultiROM man
Click to expand...
Click to collapse
Bro, you are working on EFIDROID. Can you give us update that project

abhianand123 said:
Bro, you are working on EFIDROID. Can you give us update that project
Click to expand...
Click to collapse
I've already told it to some people. The project is currently stun for some complications. Will resume.

Pretty useful. Thanks a lot.

Am I right, that when the memory chip on the motheboard holding /system and /userdata partitions died, I can boot the phone from sdcard using this method? I have HM2014813 variant of Redmi 2.
EDIT: I tried this method but I need to use fastboot boot modified.img to boot my phone. Any ideas how to avoid this step?

tulen_kobi said:
Am I right, that when the memory chip on the motheboard holding /system and /userdata partitions died, I can boot the phone from sdcard using this method? I have HM2014813 variant of Redmi 2.
EDIT: I tried this method but I need to use fastboot boot modified.img to boot my phone. Any ideas how to avoid this step?
Click to expand...
Click to collapse
I too have same problem 0 mb internal stoarage
/sbin/sh: parted: not found
---------- Post added at 03:49 PM ---------- Previous post was at 03:43 PM ----------
warrenlobo said:
I too have same problem 0 mb internal stoarage
/sbin/sh: parted: not found
Click to expand...
Click to collapse
they are missing i guess

warrenlobo said:
I too have same problem 0 mb internal stoarage
/sbin/sh: parted: not found
---------- Post added at 03:49 PM ---------- Previous post was at 03:43 PM ----------
they are missing i guess
Click to expand...
Click to collapse
There is no parted on the device anymore, you need to preparation your sdcard on your computer. Do you use Windows or Linux on your pc?
If Windows try to use: FWUL to partition your sdcard.

Related

Honeycomb on eMMC (updated download file to the correct one)

I Highly suggest you follow the steps in this post first (http://forum.xda-developers.com/showthread.php?t=920347)
Froyo is completely stable and will give you a back up OS in case anything happens or you want to do something that doesn't work in HC.
Steps:
If anyone knows how to shrink a partition using parted please let me know. This would eliminate steps 2 & 3
QUICK EDIT WARNING: PLEASE READ: THIS IS BASED ON THE DUAL BOOT FROM ROOKIE1. FROM WHAT I KNOW THIS DOES NOT WORK ON 1.1.0 ONLY 1.0.1
(Note: Requires adb)
1 ) Have a working honeycomb v02 sd card (v03 has a custom kernel which causes rotation issues on the eMMC).
2) Install EASEUS (Windows) or gParted (Linux)
(if you need help with this just PM me)
3) Shrink the second partition of the SD card to 400mb
4) Download and extract my zip to your android/platform-tools folder
5) Run Internal.bat
Make sure not to format your sdcard from your nook while using this.
< standard disclaimer - I'm not responsible for whatever damage you did to your NC >
Also, the reason I did not post a clockwork zip or a dd img for system is I'm unsure of the legality of it, if someone else would like to then by all means do so.
PM me for any questions, and I would like to say thanks to samuelhalff, as without his help I never would've gotten it running from internal memory
Also, please make sure you know how to recover your nook color back to stock. Not only if something goes wrong, but since honeycomb isn't fully working yet.
That being said, if you run the dual-boot script first from rookie1 you'll always be able to fall back onto froyo to fix any issues.
----------------------------------------------------------------------------
How this works:
It copies the system partition from honeycomb onto the internal memory.
It then pushes my boot.img to your sd card.
Finally it overwrites your boot.img with mine
(My boot.img contains everything from rookie1's dual boot alongside the needed jar files included on honeycombs boot.img)
Download link:
http://www.multiupload.com/0TTH2OJS3C
Uploading fixed version now
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
And for those who like doing everything manually. Here is Sam's modified uRamdisk. Make sure its on the bootpartiton alongside the jar files included in deeper-blue's release
Ramdisk: http://www.multiupload.com/90H38OX0S9
Also, the first time it starts up may take a few min. So be patient before trying to restart it
Thanks this will be very useful for myself and others. I'll report back with any issues.
Why must my laptop break today of all days?
Sent from my SPH-D700 using XDA App
marcusant said:
Why must my laptop break today of all days?
Sent from my SPH-D700 using XDA App
Click to expand...
Click to collapse
Sorry to hear that. I would say you could do it without one but you need the modified ramdisk inside my boot.img
Hey maybe i'm doing something wrong but i keep getting this error message:
rm failed for *, no such file or directory
i am not an expert on adb so this may be my fault, just reporting feedback for you.
tgallant21 said:
Hey maybe i'm doing something wrong but i keep getting this error message:
rm failed for *, no such file or directory
i am not an expert on adb so this may be my fault, just reporting feedback for you.
Click to expand...
Click to collapse
its not rm * its "rm * -r" as that is the recursive switch...
MattJ951 said:
I Highly suggest you follow the steps in this post first (http://forum.xda-developers.com/showthread.php?t=920347)
Froyo is completely stable and will give you a back up OS in case anything happens or you want to do something that doesn't work in HC.
Steps:
QUICK EDIT WARNING: PLEASE READ: THIS IS BASED ON THE DUAL BOOT FROM ROOKIE1. FROM WHAT I KNOW THIS DOES NOT WORK ON 1.1.0 ONLY 1.0.1
(Note: Requires adb)
1 ) Have a working honeycomb v02 sd card (v03 has a custom kernel which causes rotation issues on the eMMC).
2) Download and extract my zip to your android/platform-tools folder
3) Run Internal.bat
Make sure not to format your sdcard while using this.
Note: I'm not sure if you need to clear your data partition or not. I did, but it may not be required.
the steps under froyo would be : something similar to this (I dd'd HC data partition to the internal, so i'm not 100% sure of this)
Code:
adb shell
mount -o remount,rw /dev/block/mmcblk1 /
mkdir data_temp
mount /dev/block/mmcblk0p6 data_temp
cd /data_temp [B]MAKE SURE THIS COMMAND WORKS BEFORE CONTINUING[/B]
rm * -rf
exit
< standard disclaimer - I'm not responsible for whatever damage you did to your NC >
Also, the reason I did not post a clockwork zip or a dd img for system is I'm unsure of the legality of it, if someone else would like to then by all means do so.
PM me for any questions, and I would like to say thanks to samuelhalff, as without his help I never would've gotten it running from internal memory
Also, please make sure you know how to recover your nook color back to stock. Not only if something goes wrong, but since honeycomb isn't fully working yet.
That being said, if you run the dual-boot script first from rookie1 you'll always be able to fall back onto froyo to fix any issues.
----------------------------------------------------------------------------
How this works:
It copies the system partition from honeycomb onto the internal memory.
It then pushes my boot.img to your sd card.
Finally it overwrites your boot.img with mine
(My boot.img contains everything from rookie1's dual boot alongside the needed jar files included on honeycombs boot.img)
Click to expand...
Click to collapse
You have verified this working with your boot.img? Mine gets hampered during the boot and locks up... I had the same issue when I was building my ramdisk for this purpose.... I am going to continue to look into this and will post anything I find.
Cheers!
A quick question:
You say not to format the SDCard while using this. Does this mean that there are still some system files on the SDCard after the procedure is done or can I format my card as FAT32 once the whole operation is done?
Ooglez said:
A quick question:
You say not to format the SDCard while using this. Does this mean that there are still some system files on the SDCard after the procedure is done or can I format my card as FAT32 once the whole operation is done?
Click to expand...
Click to collapse
I believe I may have included an incorrect boot.img in my original upload, im reuploading it now.
As for formatting the sd card, i'll clairfy that in the OP. Don't format the sd card from inside the nook. formatting it inside a computer is fine.
MattJ951 said:
How this works:
It copies the system partition from honeycomb onto the internal memory.
It then pushes my boot.img to your sd card.
Finally it overwrites your boot.img with mine
(My boot.img contains everything from rookie1's dual boot <B>alongside the needed jar files included on honeycombs boot.img)</B>
Click to expand...
Click to collapse
I think I see the issue, your dd image is lacking those jar files... I am going to try and add those files to my boot partition and go from there.... Disregard! per the post above this one.......
modembug said:
I think I see the issue, your dd image is lacking those jar files... I am going to try and add those files to my boot partition and go from there.... Disregard! per the post above this one.......
Click to expand...
Click to collapse
The boot.img must be from another project I was working on. It's using the wrong u-boot.bin and is missing the jar files. Updating main post in 20 seconds once it finishes uploading
And its up.
http://www.multiupload.com/KPDAPGYXSI
Also thanks for the feedback.
MattJ951 said:
The boot.img must be from another project I was working on. It's using the wrong u-boot.bin and is missing the jar files. Updating main post in 20 seconds once it finishes uploading
And its up.
http://www.multiupload.com/KPDAPGYXSI
Click to expand...
Click to collapse
Thanks for updating so quickly. I've been waiting to run Honeycomb off of EMMC. I'll let you know how it goes.
MattJ951 said:
The boot.img must be from another project I was working on. It's using the wrong u-boot.bin and is missing the jar files. Updating main post in 20 seconds once it finishes uploading
And its up.
http://www.multiupload.com/KPDAPGYXSI
Also thanks for the feedback.
Click to expand...
Click to collapse
I am getting ready to dd that image over as we speak, i will report back shortly...
No problem, let me know if it works and if it doesn't ill try updating it again. (I personally have it working but I didn't use a script, i entered the commands manually. Also make sure youre using v02 [though note: HC runs faster for some reason if you copy the data partition from v03 and dd it to the internal while running v02's system. v03 has problems with the kernel due to the 90degrees thing deeper added]
MattJ951 said:
No problem, let me know if it works and if it doesn't ill try updating it again. (I personally have it working but I didn't use a script, i entered the commands manually. Also make sure youre using v02 [though note: HC runs faster for some reason if you copy the data partition from v03 and dd it to the internal while running v02's system. v03 has problems with the kernel due to the 90degrees thing deeper added]
Click to expand...
Click to collapse
I am having issues with it locking up on "Android _ " could be due to crap on the data partition from the last boot.img... cleaning it off and trying again. Yeah I took a look at your bat file and just ran things manually... i have issues with unknown bat/sh files lol
UPDATE: okay, so its still locking up... did you dd the data partition or any of that stuff over as well? as of right now, i am running your boot.img and i DD'd the system partition from a working HC-SD, and i removed all files from the internal /data partition....
modembug said:
I am having issues with it locking up on "Android _ " could be due to crap on the data partition from the last boot.img... cleaning it off and trying again. Yeah I took a look at your bat file and just ran things manually... i have issues with unknown bat/sh files lol
Click to expand...
Click to collapse
Let me know if it works. The "Android _" screen originally locked up for me because of the uRamdisk. I'll upload the one Sam sent me which is included in the boot.img but maybe is causing problems for you.
The modified uRamdisk is now in the OP.
Nada, still no dice.... I have all the folders from HC /Boot with your boot files replacing uboot, uramdisk etc.. Still running into the same issue, might need to work busybox into this thing to see what is going on...
UPDATE: going to try dd'ing the /data part over to emmc /data..
modembug said:
Nada, still no dice.... I have all the folders from HC /Boot with your boot files replacing uboot, uramdisk etc.. Still running into the same issue, might need to work busybox into this thing to see what is going on...
UPDATE: going to try dd'ing the /data part over to emmc /data..
Click to expand...
Click to collapse
Thats not the problem. I realized my mistake.
where i wrote
adb shell dd if=/dev/block/mmcblk0p5 of=/dev/block/mmcblk1p1
it should be
adb shell dd if=/dev/block/mmcblk0p5 of=/dev/block/mmcblk1p2
if you run that it should boot correctly.
uploading a fixed version to the OP now
MattJ951 said:
Thats not the problem. I realized my mistake.
where i wrote
adb shell dd if=/dev/block/mmcblk0p5 of=/dev/block/mmcblk1p1
it should be
adb shell dd if=/dev/block/mmcblk0p5 of=/dev/block/mmcblk1p2
if you run that it should boot correctly.
uploading a fixed version to the OP now
Click to expand...
Click to collapse
which is why i run commands manually ;-) yeah I double check prior to DD and i have pushed the correct partition to /system... i have now pushed /data over and still no love... Can you dd your /boot and post it?
modembug said:
which is why i run commands manually ;-) yeah I double check prior to DD and i have pushed the correct partition to /system... i have now pushed /data over and still no love... Can you dd your /boot and post it?
Click to expand...
Click to collapse
That actually is my current /boot inside the 7z. Also i can't think of a reason why it wouldn't work.
I'll format my NookColor and try it to see if I can figure out whats going wrong.

[GUIDE] Recover phone from a formated /efs partition

I'm just writting this because i've recently had this problem. I managed to sort it out by my own but didn't really find it written anywhere, just bits and pieces scavenged from so many pages that might point to a solution (granted, part of my problem was also finding what was really my problem since the phone stopped working so fast i didn't really had the time to get what happened)
I was trying out swap for my S3, i had created a swap partition in my external card and then followed a guide here from xda to use an app called swapper2 (from market) to enable swap. I must have done something wrong because what it did was format my /efs partition instead as if it was a swap partition. Phone stopped working on the spot, obviously, and wouldn't past samsung's bootscreen.
Also, keep in mind while this worked for me there might be other ways of doing this which may be simpler. This is just what i figured for a solution.
When this helps:
- you accidentally formated your /efs partition
- you have a backup from your /efs partition, files copied with root explorer but not an image you can just flash back to the partition.
- your phone boots to download and to recovery but not to main system (which every tutorial i found seemed to assume to be able to do, i just figured their /efs was not as screwed as mine was)
- your recovery won't mount the /efs partition because it expects it to be ext4 but it's formated to something else and it showing the message:
"e: failed to mount /efs (Invalid argument)"
What doesn't work:
- any kind of standard solution like reflashing a stock rom with odin, with or without .pit file, clear EFS, whatever. It will flash, just won't solve since, apparently, nothing touches the /efs partition because it's so sensible. Even custom recoveries do mount it and apparently format and replace every single other partition but the /efs, which is why i had to do it manually.
Solution:
- simply format the /efs partition back to ext4 and copy your backup files there
What's needed:
- phone drivers installed on the computer. If you had kies installed, this should be covered already. Think you can't have it running while doing this though. Also, for what's worth, i've done this with windows 8 x64.
- updated android sdk tool, mainly adb. If adb is saying device not connected or not found, you may be using an outdated adb.exe (i was). I used adb.exe that came with this software here:
http://forum.xda-developers.com/showthread.php?t=1308546
- root. If your rom isn't rooted you can always flash CF-root from odin in download mode.
http://forum.xda-developers.com/showthread.php?t=1695238
- busybox, am not really sure if i actually got to need this, think so for the formating tool. Can't hurt to have more options though. This is how to install:
http://www.omappedia.com/wiki/Android_Installing_Busybox_Command_Line_Tools
- custom recovery that allows root through adb, i used Philz which is pretty awesome
http://forum.xda-developers.com/showthread.php?t=2002953
- backup files from your /efs. I had mine unzipped and copied to my externalsd while in windows. They were in an efs folder in the sd card. You can push this through adb to the phone later, but i found this way simpler.
How to:
- get into recovery (vol up+home+power button) and plug your phone to the computer. You'll hear an usb connected sound from windows after a bit.
- in recovery, navigate to Mounts and try the "mount /efs". It'll fail. Now, navigate to advanced and "view log". You'll see below that the phone tried to mount a partition and failed, in my case, it had unsucessfully tried to mount /dev/block/mmcblk0p3 which is the partition /efs uses. Take note of this partition name.
- On windows, open a command line (type cmd on you start menu), navigate to where you have adb.exe and type:
adb shell
If all went well, command prompt has changed. You can now issue commands directly to your phone from terminal.
- type "su" to get root permissions. Your command line should change to something like [email protected] Before i had this working i needed to use "Fix permissions". It's an option in the recovery menus on the phone.
- this step is optional but i did it anyway. I created an image of the partition i was going to mess with. If anything went wrong i could always flash it back even if it was broken. By the way, this is what i should have done in the first place instead of just copying /efs files. Would have made the process so much simpler... also, do this if you ever get the phone back working again. Type:
dd if=/dev/block/mmcblk0p3 of=/externalsd/efs.img
The /externalsd/efs.img is just a place you can save stuff to, like your external sd card. You can check what's your mounting point for the card with the command "mount" and look for something relevant like "externalsd".
Also, you may want to copy that efs.img to somewhere else from your phone (like your computer) for safekeeping. Literally remove card from phone, put in computer and copy files there. Notice you may need to reboot phone to recovery if you remove your card so it detects and mounts your card again. Sure, you can also do that from the command line, but it's just easier to reboot the phone.
- Now, we'll format the partition to something your phone can mount (ext4) and is expecting. Be careful, by doing this, you're actually erasing what's left of your partition and replacing by something clean. Type:
mk2fs /dev/block/mmcblk0p3
If all went well, you should see some kind of small report about what was just done.
- To mount this we'll need a mounting point. Type:
mkdir /efs
this will create an /efs folder in root, if it doesn't exist already, and to mount, type:
mount -t ext4 /dev/block/mmcblk0p3 /efs
- if all went well, you now have access to the /efs folder and can copy you files back:
cp -r /externalsd/efs/* /efs
where externalsd was my external sd card mounted on my phone.
- Check if your /efs folder has it's contents properly
ls /efs
I had to reboot the phone to recovery once more at this point and use the "fix permissions" option again.
After this, my phone booted up normally again.
I'm getting Segmentation fault, I guess there's some kinda hardware error on my phone. Gonna take it to Sammy's tomorrow.
Code:
mke2fs -F /dev/block/mmcblk0p11
Segmentation fault
sh-4.2#
Hi thnx for your Guide. I have the EFS problem, after installin 4 diferent rom in 2 hours my imei and baseband lost.( dont now why) i dont have a backup. I was thinking if it take the EFS from another S3 does it work?
Will this work with a Galaxy S4? I545
Enea307 said:
Hi thnx for your Guide. I have the EFS problem, after installin 4 diferent rom in 2 hours my imei and baseband lost.( dont now why) i dont have a backup. I was thinking if it take the EFS from another S3 does it work?
Click to expand...
Click to collapse
No. Read General > Sticky roll-up thread > "IMEI / EFS - Know this stuff"
is normal this output? (i'm meaning the tar.gz unfinding file)
Code:
*****************************************
* BACKUP EFS *
*****************************************
WARNING: Do you wish to Continue? (This will make EFS BACKUP) [Y,N]?Y
--- STARTING ----
--- WAITING FOR DEVICE
--- Backup efs image ---
761 KB/s (9357 bytes in 0.012s)
7 KB/s (39 bytes in 0.005s)
SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_
Creating filesystem with parameters:
Size: 20971520
Block size: 4096
Blocks per group: 32768
Inodes per group: 1280
Inode size: 256
Journal blocks: 1024
Label:
FLEX_BG size: 0
Blocks: 5120
Block groups: 1
Reserved block group size: 0
Created filesystem with 59/1280 inodes and 2432/5120 blocks
40960+0 records in
40960+0 records out
20971520 bytes transferred in 7.271 secs (2884269 bytes/sec)
unknown option -- ZBusyBox v1.19.4-cm9 bionic (2012-02-05 18:40 +0100) multi-cal
l binary.
Usage: tar -[cxtzjahmvO] [-X FILE] [-T FILE] [-f TARFILE] [-C DIR] [FILE]...
Create, extract, or list files from a tar file
Operation:
c Create
x Extract
t List
f Name of TARFILE ('-' for stdin/out)
C Change to DIR before operation
v Verbose
z (De)compress using gzip
j (De)compress using bzip2
a (De)compress using lzma
O Extract to stdout
h Follow symlinks
m Don't restore mtime
exclude File to exclude
X File with names to exclude
T File with names to include
2684 KB/s (9962352 bytes in 3.623s)
2805 KB/s (20971520 bytes in 7.299s)
remote object '/sdcard/SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_EFS.tar.gz' does n
ot exist
7-Zip (A) 4.65 Copyright (c) 1999-2009 Igor Pavlov 2009-02-03
Scanning
SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_EFS.tar.gz: WARNING: Impossibile trovare
il file specificato. [COLOR=Red](impossible to find the specify file)[/COLOR]
Creating archive SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_EFS.zip
Compressing getprop.txt
Compressing SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_EFS.raw.img
Compressing SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_EFS.tar.md5
WARNINGS for files:
SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_EFS.tar.gz : Impossibile trovare il file
specificato.[COLOR=Red] (impossible to find the specify file)[/COLOR]
----------------
WARNING: Cannot find 1 file
-
-
Finished. Output file is SM-N9000ZWEXXV_N900XXUCMJ3_RF1DA111EAY_EFS BACKUP
Premere un tasto per continuare . . .
well in the zip there are only the txt + md5 + .raw.img
Thanks for this great tutorial. It was my final step to recover my efs partition, without any backup. I copied the efs folder from another device and modified the files according my devices info (bluetooth mac, serial etc). Worked great on my SGS4
By the way I had the same error:
Code:
mke2fs /dev/block/mmcblk0p10
Segmentation fault
You get this error if you run adb shell when you booted to your ROM.
You need to run adb shell in recovery mode
Great tutorial but i hope you can help me, I can't seem to properly find the SDcard. When I type cp -r /externalsd/efs/* /efs
it comes back with cp: can't stat '/sdcard/efs*' : No such file or directory
I cleared my whole sdcard card except for efs directory. I also tried sdcard instead of externalsd but same thing.
I am getting stuck trying to fix this as I have a boot loop or corrupt /efs or something. I have tried to get my phone working by installing my ROM ( Omega v58 ) and also by trying to flash the latest stock 4.3 through Odin v3.09. I havent tried total stock 4.0.3 yet. No matter what I have done though I can't get past the boot logo ( or the walking Omega droid ). My phone just sits there and hangs
I have followed your steps and I have Philz ( 6.07.9.19 ) installed ( but not busybox unless it is sat there somehow from the Omega install ) but when i try to get adb shell running nothing happens or works..as you can see
What am i doing wrong? OR is my phone totally borked?
hi..
Blackwatch said:
I am getting stuck trying to fix this as I have a boot loop or corrupt /efs or something. I have tried to get my phone working by installing my ROM ( Omega v58 ) and also by trying to flash the latest stock 4.3 through Odin v3.09. I havent tried total stock 4.0.3 yet. No matter what I have done though I can't get past the boot logo ( or the walking Omega droid ). My phone just sits there and hangs
I have followed your steps and I have Philz ( 6.07.9.19 ) installed ( but not busybox unless it is sat there somehow from the Omega install ) but when i try to get adb shell running nothing happens or works..as you can see
What am i doing wrong? OR is my phone totally borked?
Click to expand...
Click to collapse
I have successfully fix my efs partition follwing this thread.
you are receiving such message in cmd. I faced it too.
Sol: Use Philoz Recovery 5.0.
Fix permissions.
there you are.. done..
Philz 6.0 do not have an option for "fix permission".
hope it helps..
I wrote a script that attempts to recover your nv_data.bin from a corrupted EFS partition for the i9300. Thus if you don't have a backup and your EFS is corrupt, try the script. The script is still in Alpha phase and may not work for other devices. Feedback would be much appreciated.
You can find the script at: https://github.com/chriscz/efs_recover
I dont have /efs backed up
Hi ,
If i dont have /efs backed up , can I copy any other mobile (same model) efs data to my mobile and try?
Thanks and Regards
Vamshi Pulumati
vamshipulumati said:
Hi ,
If i dont have /efs backed up , can I copy any other mobile (same model) efs data to my mobile and try?
Thanks and Regards
Vamshi Pulumati
Click to expand...
Click to collapse
No, it won't work and trying to clone another imei is illegal.
boomboomer said:
No, it won't work and trying to clone another imei is illegal.
Click to expand...
Click to collapse
How to register for a new IMEI ? Is it possible?? Could you please help me with any site or link?? I don't want to replace motherboard..
Any help are highly appreciated.
No, it isn't possible and discussion about changing imei is banned on xda.
Take your phone to a service centre and pay then to recode it for you, make sure it works on 4.3 before you pay.
boomboomer said:
No, it isn't possible and discussion about changing imei is banned on xda.
Take your phone to a service centre and pay then to recode it for you, make sure it works on 4.3 before you pay.
Click to expand...
Click to collapse
Hey I would like to tell you that a miracle happened for my S3. Yesterday i tried to do same as per in this guide. After taking backup of broken efs backup i tried to clear the efs folder with this command "mk2fs /dev/block/mmcblk0p3"
After that i just flashed 4.4.4 based stock ROM and somehow phone booted up perfectly. No network issues. Bluetooth wifi sim card everything works. IMEI & Serial No is there. But when i'm checking network unlock status it is showing as everything locked. But still I can use everything... I'm amazed.!!!!
Do you have any idea how this happened??
@boomboomer
Same problem with a Samsung gt-i9070 - Galaxy S Advance
Hi!
My i9070 has the same problem, but when i run the command: "mke2fs /dev/block/mmcblk0p3" shows the "Segmentation fault" error message.
Some one can help?
Thanks.
Bro U stated to format but How to format /efs partition
/efs not backed up
boomboomer said:
No, it won't work and trying to clone another imei is illegal.
Click to expand...
Click to collapse
I Dont have efs backed up and I also have formatted efs partition from adb shell and using that Dev type commands now i am in factory mode and my network is not working please give me any solution.
kaynpayn said:
I'm just writting this because i've recently had this problem. I managed to sort it out by my own but didn't really find it written anywhere, just bits and pieces scavenged from so many pages that might point to a solution (granted, part of my problem was also finding what was really my problem since the phone stopped working so fast i didn't really had the time to get what happened)
I was trying out swap for my S3, i had created a swap partition in my external card and then followed a guide here from xda to use an app called swapper2 (from market) to enable swap. I must have done something wrong because what it did was format my /efs partition instead as if it was a swap partition. Phone stopped working on the spot, obviously, and wouldn't past samsung's bootscreen.
Also, keep in mind while this worked for me there might be other ways of doing this which may be simpler. This is just what i figured for a solution.
When this helps:
- you accidentally formated your /efs partition
- you have a backup from your /efs partition, files copied with root explorer but not an image you can just flash back to the partition.
- your phone boots to download and to recovery but not to main system (which every tutorial i found seemed to assume to be able to do, i just figured their /efs was not as screwed as mine was)
- your recovery won't mount the /efs partition because it expects it to be ext4 but it's formated to something else and it showing the message:
"e: failed to mount /efs (Invalid argument)"
What doesn't work:
- any kind of standard solution like reflashing a stock rom with odin, with or without .pit file, clear EFS, whatever. It will flash, just won't solve since, apparently, nothing touches the /efs partition because it's so sensible. Even custom recoveries do mount it and apparently format and replace every single other partition but the /efs, which is why i had to do it manually.
Solution:
- simply format the /efs partition back to ext4 and copy your backup files there
What's needed:
- phone drivers installed on the computer. If you had kies installed, this should be covered already. Think you can't have it running while doing this though. Also, for what's worth, i've done this with windows 8 x64.
- updated android sdk tool, mainly adb. If adb is saying device not connected or not found, you may be using an outdated adb.exe (i was). I used adb.exe that came with this software here:
http://forum.xda-developers.com/showthread.php?t=1308546
- root. If your rom isn't rooted you can always flash CF-root from odin in download mode.
http://forum.xda-developers.com/showthread.php?t=1695238
- busybox, am not really sure if i actually got to need this, think so for the formating tool. Can't hurt to have more options though. This is how to install:
http://www.omappedia.com/wiki/Android_Installing_Busybox_Command_Line_Tools
- custom recovery that allows root through adb, i used Philz which is pretty awesome
http://forum.xda-developers.com/showthread.php?t=2002953
- backup files from your /efs. I had mine unzipped and copied to my externalsd while in windows. They were in an efs folder in the sd card. You can push this through adb to the phone later, but i found this way simpler.
How to:
- get into recovery (vol up+home+power button) and plug your phone to the computer. You'll hear an usb connected sound from windows after a bit.
- in recovery, navigate to Mounts and try the "mount /efs". It'll fail. Now, navigate to advanced and "view log". You'll see below that the phone tried to mount a partition and failed, in my case, it had unsucessfully tried to mount /dev/block/mmcblk0p3 which is the partition /efs uses. Take note of this partition name.
- On windows, open a command line (type cmd on you start menu), navigate to where you have adb.exe and type:
adb shell
If all went well, command prompt has changed. You can now issue commands directly to your phone from terminal.
- type "su" to get root permissions. Your command line should change to something like [email protected] Before i had this working i needed to use "Fix permissions". It's an option in the recovery menus on the phone.
- this step is optional but i did it anyway. I created an image of the partition i was going to mess with. If anything went wrong i could always flash it back even if it was broken. By the way, this is what i should have done in the first place instead of just copying /efs files. Would have made the process so much simpler... also, do this if you ever get the phone back working again. Type:
dd if=/dev/block/mmcblk0p3 of=/externalsd/efs.img
The /externalsd/efs.img is just a place you can save stuff to, like your external sd card. You can check what's your mounting point for the card with the command "mount" and look for something relevant like "externalsd".
Also, you may want to copy that efs.img to somewhere else from your phone (like your computer) for safekeeping. Literally remove card from phone, put in computer and copy files there. Notice you may need to reboot phone to recovery if you remove your card so it detects and mounts your card again. Sure, you can also do that from the command line, but it's just easier to reboot the phone.
- Now, we'll format the partition to something your phone can mount (ext4) and is expecting. Be careful, by doing this, you're actually erasing what's left of your partition and replacing by something clean. Type:
mk2fs /dev/block/mmcblk0p3
If all went well, you should see some kind of small report about what was just done.
- To mount this we'll need a mounting point. Type:
mkdir /efs
this will create an /efs folder in root, if it doesn't exist already, and to mount, type:
mount -t ext4 /dev/block/mmcblk0p3 /efs
- if all went well, you now have access to the /efs folder and can copy you files back:
cp -r /externalsd/efs/* /efs
where externalsd was my external sd card mounted on my phone.
- Check if your /efs folder has it's contents properly
ls /efs
I had to reboot the phone to recovery once more at this point and use the "fix permissions" option again.
After this, my phone booted up normally again.
Click to expand...
Click to collapse
I have restored my s6 edge by following this method. The EFS partition name is "sda3" for s6 edge if anyone want to restore s6 edge. There is typo in command "mk2fs /dev/block/mmcblk0p3" it should be mke2fs i think.
After restoring EFS my phone recovered from boot loop. But the imei is still invalid. Do you know any method to repair imei for s6 edge?. Thank You
---------- Post added at 02:18 PM ---------- Previous post was at 02:14 PM ----------
Blackwatch said:
I am getting stuck trying to fix this as I have a boot loop or corrupt /efs or something. I have tried to get my phone working by installing my ROM ( Omega v58 ) and also by trying to flash the latest stock 4.3 through Odin v3.09. I havent tried total stock 4.0.3 yet. No matter what I have done though I can't get past the boot logo ( or the walking Omega droid ). My phone just sits there and hangs
I have followed your steps and I have Philz ( 6.07.9.19 ) installed ( but not busybox unless it is sat there somehow from the Omega install ) but when i try to get adb shell running nothing happens or works..as you can see
What am i doing wrong? OR is my phone totally borked?
Click to expand...
Click to collapse
You don't have to run "su" command. "#" shows you already have root access.

[Q] Some questions about Android Recovery Mode

Recently I was studying android recovery mode, and I have some questions. Anyone knows the answer? Thanks very much.
1. Can recovery flash bootloader?
From this link====>http://forum.xda-developers.com/showthread.php?t=2321310, I think it can do that. But I'm not sure.
2. Can recovery flash recovery partition itself?
I think it can not do this. Not confirm that.
3. We know in update.zip, boot.img is corresponding boot partition, but why system is a folder, not system.img? There is a system partition also.
4. While OTA upgrade system, why the update package downloaded under /cache path? Can we change it to sdcard?
5. Most important, what exactly update-script do things under recovery mode? How the command executed?
BTW, there are other questions, but not related to Recovery Mode.
1. How can I see the flash partitions? I know to use the command cat /proc/mtd, but as Samsung, it use emmc flash, while I type that command, no results printed. How to see?
2. About userdata partition, we know that when first run android OS, system will copy files from /system to /data, but does it do it every time that we turn on the phone or just do it once after the first booting after we update our system?
Hello,
I can answer some questions, and I hope someone else can fill the blanks.
1. Can recovery flash bootloader?
=> Yes, you have to modify your boot image, but it still possible, just include the modified boot image in the update file, and give good command in update.zip
2. Can recovery flash recovery partition itself?
=> I am not sure, but I think its possible, I saw code of recovery in Android code, so if you modify it, and include the good image in update.zip, I think you will see the modification. Never tried for now.
3. We know in update.zip, boot.img is corresponding boot partition, but why system is a folder, not system.img? There is a system partition also.
=> In fact is depend witch compilation system you use. For Cyanogen, yes in fact its a folder, but for AOSP its System.img
The difference comes from the command file in update, theire not the same. But finally the result in the same. We have a system partition.
4. While OTA upgrade system, why the update package downloaded under /cache path? Can we change it to sdcard?
=> Reasons I can see :
--> In past, sdcard was not mounted by default in recovery mode, so can't see the update.zip file
--> sdcard can be removed at any time, its dangerous, when do the update to loose the file
--> To be sure have right to remove the update.zip when installation done
--> Old phone didn't have all a sdcard, cache is sure to exists
=>Yes we can change it, but we have to be sure the sdcard is mounted on recovery mode. And be sure of the path of sdcard on recovery mode. For exemple in Nexus one it is /sdcard, in Samsung Galaxy S2 is /emmc/, in Samsung S4 mini its /sdcard/0/ ... So it could be a reason why its not in sdcard, because the path is not generic.
5. Most important, what exactly update-script do things under recovery mode? How the command executed?
=>It does lot of stufs, like mount partitions, copy system files, ...
The update-script is in elf script. Generally, an elf interpreter is given just next to the update-script.
I hope it helped you,
JHelp
1 yes, but flashing firmware from recovery can be dangerous and all though unlikely I have seen many brick there phone doing so
2. Yes, rather easily so long as the .zip is put together properly. But like bootloader, it is safest so flash through fastboot or download mode but a very unlikely brick so mostly safe
3. This is how a ROM gets built from source but it needs not be in this setup. At the same note I can't see a better way to flash through recovery than like it is. Using flash_raw_image would work but due to size a system.img shouldn't be flashed in recovery rather through fastboot, bootloader or download mode
4 mostly because you couldn't have an oem ota update without an SD card which isn't a prerequisite for using a phone. Also I believe there is some added safety flashing directly from nand, but in truth this is all speculation. Yes with a rooted phone this could be changed but most often it isn't wise to flash an oem ota on a rooted device
5 lots of things, take a look at my threads for a guide I made explaining this
1 cat /proc/partitions
mount
ls -l /dev/block/
And then keep searching until you get /by-name which many phones have, but this isn't always the same path so if you need further help ask and I'll walk you through it
2 I think this depends on a lot of things, but I don't have a good answer so rather than speculating I'll choose not to answer
Feel free to ask other questions
Sent from my Nexus 4 using XDA Premium 4 mobile app
demkantor said:
1 yes, but flashing firmware from recovery can be dangerous and all though unlikely I have seen many brick there phone doing so
2. Yes, rather easily so long as the .zip is put together properly. But like bootloader, it is safest so flash through fastboot or download mode but a very unlikely brick so mostly safe
3. This is how a ROM gets built from source but it needs not be in this setup. At the same note I can't see a better way to flash through recovery than like it is. Using flash_raw_image would work but due to size a system.img shouldn't be flashed in recovery rather through fastboot, bootloader or download mode
4 mostly because you couldn't have an oem ota update without an SD card which isn't a prerequisite for using a phone. Also I believe there is some added safety flashing directly from nand, but in truth this is all speculation. Yes with a rooted phone this could be changed but most often it isn't wise to flash an oem ota on a rooted device
5 lots of things, take a look at my threads for a guide I made explaining this
1 cat /proc/partitions
mount
ls -l /dev/block/
And then keep searching until you get /by-name which many phones have, but this isn't always the same path so if you need further help ask and I'll walk you through it
2 I think this depends on a lot of things, but I don't have a good answer so rather than speculating I'll choose not to answer
Feel free to ask other questions
Sent from my Nexus 4 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
I've got /by-num, but no /by-name, device is Sansumg GT-9288
not sure what a Sansumg GT-9288 is, gsmarena and google dont give me results
what happens with
cat /proc/partitions
or just
mount
?
demkantor said:
not sure what a Sansumg GT-9288 is, gsmarena and google dont give me results
what happens with
cat /proc/partitions
or just
mount
?
Click to expand...
Click to collapse
Sorry, type wrong, should be GT-9228, it's a customer made smartphone only for CMCC.
I can get the partition info by GT-9220, so I think it's because of the customer made that I can not get the by-name folder.
Thanks again.

[HELP] Need A Dev or Experienced User for This

I was Just reading about a Triple Swap (Ram) trick on XDA, It Uses Cache and Data and System partition as Swap Space.
Idea
Android devices have got RAM memory and internal eMMC memory. The eMMC is separated into several partitions (e.g. /system, /boot, /data, /cache). In former times of Android, the /cache partition was used for caching. Nowadays, in ICS times, the applications are using the /data partition to save information, libraries and cache data. So /cache is no longer used by the operating system or applications. Therefore, this partitions is empty except 4ext-logfiles, last recovery-log and an obligatory and empty lost+found directory. So we have got another 114 MB of space that can now be used as fast swap space for the kernel.
Also, the /system partition normally is not fully used - depending on the rom, a more or less amount of this area is free and unused.
As these areas all are internal memory, these swaps are faster, than a swap area on the sdcard!
There are also a lot of read/write requests to the /data partition as well and this is in Android “by design”. Furthermore there are devices, that have a preconfigured eMMC-swap space "by design", as for exaple the HTC One V.
Click to expand...
Click to collapse
Click to expand...
Click to collapse
So the Help I need is: To get our device supported for this is are the following things:
To do this, we will need your help. At fist you have to install the script manually to confirm that it's working. In the second step we will need a few details of your phones to modify the Aroma setup. Let's start with the first step:
Installation instructions:
Download the Aroma
Extract the file 98swap_cache_v300 from the folder \swap\cache\50\etc\init.d in the Aroma
What to do:
Enter ES-Explorer and:
Go to ES-Explorer settings/Root settings/check (root explorer ,up to root and mount file as writable).
Copy the script 98swap_cache_v300 to /system/etc/init.d
Don't reboot!
Open a terminal session and get superuser rights with the command: su
Command: cd /system/etc/init.d (now you are in the init.d folder, where the script is)
Command: chmod 775 98swap_cache_v300 (now the script has execution rights)
Reboot
Now:
Open a terminal session and get superuser rights with the command: su
Command: cat /proc/swaps (shall show the new swap file /cache/swap/swap.img)
With ES-Explorer navigate to /data/swap and look into the log file swap_cache.log
Please, sent Me the logfile swap_cache.log via PM!.
If it's working, we have to do the second step:
The second step is, to include your Device in the Aroma; we need the internal device name and the mount point of the file systems. Do the following:
Open a terminal session
Get a superuser shell with the command: su
Now the command:getprop ro.product.device
(that's the internal device name - I will need that name exactly)
Now the command: mount
(we need the mount points from /cache and /data and /system; if you do not find them, just use the command "mount > file" - this will write all output to "file" - then send me "file")
Please, sent above info to Me via PM!
Click to expand...
Click to collapse
Click to expand...
Click to collapse
The Two Files I will send to the developer, Then We can pray that He gets to Work on it..
HJain13 said:
I was Just reading about a Triple Swap (Ram) trick on XDA, It Uses Cache and Data and System partition as Swap Space.
Idea
So the Help I need is: To get our device supported for this is are the following things:
The Two Files I will send to the developer, Then We can pray that He gets to Work on it..
Click to expand...
Click to collapse
U can just skip ur second step by not checking the device
Hmm..... BUT
T3snake said:
U can just skip ur second step by not checking the device
Click to expand...
Click to collapse
Hmm.. but It would be nice if We could use Aroma.. easier to choose amount of swaps and where etc...
HJain13 said:
Hmm.. but It would be nice if We could use Aroma.. easier to choose amount of swaps and where etc...
Click to expand...
Click to collapse
It will be aroma allright...
I meant ur second step (getprop 1) isn't mandatory
Anyway info u need is in build.prop
Sent from my SM-T211 using Tapatalk

[Dev][Guide][JB+KK] Dedicated recovery/boot.cpio partition

Hi there!
Today I finally found how to make our codinas' kernels universal, i.e. allow to install kernel on whatever ROM and finally separate recovery from kernel. It's well known, bootloader decides what will be loaded - kernel or recovery. That probably may explain why AnyKernel installer(or other similar) doesn't work on codina, because we can't move recovery partition anywhere.
But there is also a little trick that allow us load recovery and boot.cpio from different partition - https://github.com/ChronoMonochrome/Chrono_Kernel/commit/df9094f1f12618ad9599da266792d6b2f8106170 - just an another approach
Don't worry, we won't touch bootloader at all.
As can be seen, /dev/block/mmcblk0p17 (kernel2 partition) will be used for storing recovery.cpio and boot.cpio. On stock that may not work (I don't know for what exactly uses Kernel2 partition, besides of manually restoring of kernel1 partition. I only know that is almost useless on custom ROMs, and we can use it as we want )
First do some preparations:
Download this kernel and needed recovery/boot scripts(4.4.x.cpio.zip, 4.4.x_f2fs.cpio.zip, etc... 4.4.x.cpio means that it support only ext4) from my google drive (folder ramdisks), unzip recovery (twrp or cwm) and rename to recovery.cpio, then move it to external SD card. Then do it with boot scripts that you've downloaded (e.g. 4.4.x_f2fs.cpio.zip - unzip and rename to boot.cpio)
Well, that all that needs for installation. Read following instruction very carefully, otherwise that may cause brick Keep in mind, all that you do at your own risk! I'm not responsible if you brick your phone!
Installation method:
1) reboot into recovery, plug your phone to your PC, enable adb:
Code:
adb shell
2) Format kernel2 partition to ext4 file system:
Code:
mke2fs -T ext4 /dev/block/mmcblk0p17
Think twice before you hit 'enter' button - wrong command may cause hardbrick!
3) create /ramdisk folder and mount kernel2 partition
Code:
mkdir /ramdisk
mount -t ext4 /dev/block/mmcblk0p17 /ramdisk
move your recovery.cpio and boot.cpio to this folder, give 777 permissions:
Code:
chmod 777 /ramdisk/recovery.cpio
chmod 777 /ramdisk/boot.cpio
4) install downloaded kernel
Now you can change recovery via changing /ramdisk/recovery.cpio - just make a backup of this file, and then replace with one of another recoveries. If you want to install another ROM or change filesystem of partition then replace /ramdisk/boot.cpio with one of needed boot scripts. Don't forget to give 777 permission (probably 644 is enough, but I didn't test it) to both of these files.
This method tested and working on 4.4.x TC ROM + twrp recovery + kernel with full F2FS support.
Well, now it's time to create uncompressed kernel, that may slightly decrease the boot time
@ChronoMonochrome
Thanks. do you mean that kernel2 partition is useless in stock and cyanogenmod firmware?
Is it right that boot loader will read kernel1 partition then it will read system partition? and kernel2 is not necessary for booting?
I have installed new universal kernel (2.5) , so I flashed new ramdisk for 4.4.x , can I roll back to older versions or stock firmware with this ramdisk or I should restore Partition17 backup?
sorset said:
@ChronoMonochrome
Thanks. do you mean that kernel2 partition is useless in stock and cyanogenmod firmware?
Click to expand...
Click to collapse
As it turned out, it's unneeded even on stock. So if you won't restore kernel2 partition, nothing will happen.
Is it right that boot loader will read kernel1 partition then it will read system partition? and kernel2 is not necessary for booting?
I have installed new universal kernel (2.5) , so I flashed new ramdisk for 4.4.x , can I roll back to older versions or stock firmware with this ramdisk or I should restore Partition17 backup?
Click to expand...
Click to collapse
Yes, you can roll back to usual kernels. it doesn't matter what written on kernel2 partition - real kernel or anything else...
ChronoMonochrome said:
As it turned out, it's unneeded even on stock. So if you won't restore kernel2 partition, nothing will happen.
Click to expand...
Click to collapse
Ok, thanks , But why do you mount kernel2 partition inside of OS? As I understand boot.cpio is necessary before booting OS . And inside of OS is just an extra storage! (is that true?)
sorset said:
And inside of OS is just an extra storage! (is that true?)
Click to expand...
Click to collapse
Yes and no, is 16 Mb big enough to be called "storage"? I did it, just to be able replace ramdisks even without booting to recovery. But newest boot scripts doesn't have it.
Ace 2 has 15 - 20 Partitions my Friend
ace2nutzer said:
Ace 2 has 15 - 20 Partitions my Friend
Click to expand...
Click to collapse
And what ? We actually talking about kernel2 partition.
ChronoMonochrome said:
And what ? We actually talking about kernel2 partition.
Click to expand...
Click to collapse
sorry, i meant @sorset
ChronoMonochrome said:
Yes and no, is 16 Mb big enough to be called "storage"? I did it, just to be able replace ramdisks even without booting to recovery. But newest boot scripts doesn't have it.
Click to expand...
Click to collapse
You are right , but I remember days that 1.44MB floppy disk was a large STORAGE and 16MB was HUGE
sry , I have another question , So can I remove its line from fstab to prevent mounting?
I'm confused
boot.img in kernel archive is recovery image that will extract on partition15 (kernel) , but what recovery.cpio exactly is that yu copy on partition17 (kernel2) ?
ace2nutzer said:
Ace 2 has 15 - 20 Partitions my Friend
Click to expand...
Click to collapse
Yes,With counting internal storage , 17 exactly , but thats not the point , I'm afraid.
sorset said:
sry , I have another question , So can I remove its line from fstab to prevent mounting?
Click to expand...
Click to collapse
just redownload bootscripts(kernel/ramdisks), as I said, newest scripts doesn't mount kernel2 partition.
boot.img in kernel archive is recovery image that will extract on partition15 (kernel) , but what recovery.cpio exactly is that yu copy on partition17 (kernel2) ?
Click to expand...
Click to collapse
I don't get it rephrase please
ChronoMonochrome said:
just redownload bootscripts(kernel/ramdisks), as I said, newest scripts doesn't mount kernel2 partition.
I don't get it rephrase please
Click to expand...
Click to collapse
I didn't too
There is an Image named boot.img in kernel flashable zip archive that extracts into partition 15 (named kernel) as I understood is recovery (TWRP or CWM) image and you wont touch linux orginal image , and your modified custom kernel is new modules for linux image that loads while booting (sry, I cant explain fine), So what is recovery.cpio that is in recovery flashable zip image that extracts into partition 17 (named kernel2) ?
sorset said:
as I understood is recovery (TWRP or CWM) image and you wont touch linux orginal image
Click to expand...
Click to collapse
originally kernel + recovery
, and your modified custom kernel is new modules for linux image that loads while booting (sry, I cant explain fine), So what is recovery.cpio that is in recovery flashable zip image that extracts into partition 17 (named kernel2) ?
Click to expand...
Click to collapse
In my mod kernel(mmcblk0p15) and recovery (mmcblk0p17) are splitted.
Thank you. I see.
This is probably the best (and only?) way to rebuild the ramdisk without having to compile anything, which is an excellent base for my NoUMS patches
:good:
<remove>

Categories

Resources