Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

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

OP ChronoMonochrome

5th November 2014, 08:24 PM   |  #1  
ChronoMonochrome's Avatar
OP Senior Member
Flag Pyatigorsk
Thanks Meter: 641
 
533 posts
Join Date:Joined: Jan 2014
More
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/...92d6b2f8106170 - 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
Last edited by ChronoMonochrome; 12th November 2014 at 08:54 AM.
The Following 13 Users Say Thank You to ChronoMonochrome For This Useful Post: [ View ]
14th November 2014, 05:55 AM   |  #2  
sorset's Avatar
Member
Thanks Meter: 62
 
93 posts
Join Date:Joined: Jun 2011
More
@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?
14th November 2014, 06:06 AM   |  #3  
ChronoMonochrome's Avatar
OP Senior Member
Flag Pyatigorsk
Thanks Meter: 641
 
533 posts
Join Date:Joined: Jan 2014
More
Quote:
Originally Posted by sorset

@ChronoMonochrome
Thanks. do you mean that kernel2 partition is useless in stock and cyanogenmod firmware?

As it turned out, it's unneeded even on stock. So if you won't restore kernel2 partition, nothing will happen.
Quote:

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?

Yes, you can roll back to usual kernels. it doesn't matter what written on kernel2 partition - real kernel or anything else...
The Following User Says Thank You to ChronoMonochrome For This Useful Post: [ View ]
14th November 2014, 06:31 AM   |  #4  
sorset's Avatar
Member
Thanks Meter: 62
 
93 posts
Join Date:Joined: Jun 2011
More
Quote:
Originally Posted by ChronoMonochrome

As it turned out, it's unneeded even on stock. So if you won't restore kernel2 partition, nothing will happen.

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?)
14th November 2014, 07:19 AM   |  #5  
ChronoMonochrome's Avatar
OP Senior Member
Flag Pyatigorsk
Thanks Meter: 641
 
533 posts
Join Date:Joined: Jan 2014
More
Quote:
Originally Posted by sorset

And inside of OS is just an extra storage! (is that true?)

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.
The Following User Says Thank You to ChronoMonochrome For This Useful Post: [ View ]
14th November 2014, 07:26 AM   |  #6  
Senior Member
Flag Cologne
Thanks Meter: 348
 
504 posts
Join Date:Joined: Apr 2014
Donate to Me
More
Ace 2 has 15 - 20 Partitions my Friend
The Following User Says Thank You to ace2nutzer For This Useful Post: [ View ]
14th November 2014, 07:30 AM   |  #7  
ChronoMonochrome's Avatar
OP Senior Member
Flag Pyatigorsk
Thanks Meter: 641
 
533 posts
Join Date:Joined: Jan 2014
More
Quote:
Originally Posted by ace2nutzer

Ace 2 has 15 - 20 Partitions my Friend

And what ? We actually talking about kernel2 partition.
14th November 2014, 07:45 AM   |  #8  
Senior Member
Flag Cologne
Thanks Meter: 348
 
504 posts
Join Date:Joined: Apr 2014
Donate to Me
More
Quote:
Originally Posted by ChronoMonochrome

And what ? We actually talking about kernel2 partition.

sorry, i meant @sorset
14th November 2014, 02:13 PM   |  #9  
sorset's Avatar
Member
Thanks Meter: 62
 
93 posts
Join Date:Joined: Jun 2011
More
Quote:
Originally Posted by ChronoMonochrome

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.

You are right , but I remember days that 1.44MB floppy disk was a large STORAGE and 16MB was HUGE :P

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) ?

Quote:
Originally Posted by ace2nutzer

Ace 2 has 15 - 20 Partitions my Friend

Yes,With counting internal storage , 17 exactly , but thats not the point , I'm afraid.
Last edited by sorset; 14th November 2014 at 02:35 PM.
14th November 2014, 03:04 PM   |  #10  
ChronoMonochrome's Avatar
OP Senior Member
Flag Pyatigorsk
Thanks Meter: 641
 
533 posts
Join Date:Joined: Jan 2014
More
Quote:
Originally Posted by sorset

sry , I have another question , So can I remove its line from fstab to prevent mounting?

just redownload bootscripts(kernel/ramdisks), as I said, newest scripts doesn't mount kernel2 partition.
Quote:

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) ?

I don't get it rephrase please

The Following User Says Thank You to ChronoMonochrome For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
dedicated recovery, univeral kernel
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes