64GB Kernel Script Patch for Z1

Search This thread

eclyptos

Senior Member
Jun 14, 2008
3,040
640
Planet Earth
Hey Guys,

I asked @kokotas to help me figure out a way to make a Patch to extend the Internal Memory as for me, due to the size of the high-end Applications and Games, is too limited 16GB, 11,70GB available only, on our Z1.

So my first Idea was to sacrifice 16Gb Internal Memory and use 64GB External SD Memory formatted in EXT4 where all the Data will be stored.

To do so we have to understand few thing and how is the structure of the Z1 Kernel is made and try to extract "ramdisk.cpio" where we can edit "init.rc" and change the line "/data mount"

As for the kernel "Autopsy" we used @krabappel2548 kernel build, I hope he is fine with that. :)

From what we know, the recovery is injected in the boot.img and this makes things more complicated.

Are all kernels built in this way? Even the stock ones?

Also, is there a specific rule in the way of naming the included ramdisks?

I attached a picture to make things more clear.

Any help will be appreciate.
 
Last edited:

Riyal

Senior Member
Dec 16, 2011
3,038
1,770
Iloilo City
Hey Guys,

I asked @kokotas to help me figure out a way to make a Patch to extend the Internal Memory as for me, due to the size of the high-end Applications and Games, is too limited 16GB, 11,70GB available only, on our Z1.

So my first Idea was to sacrifice 16Gb Internal Memory and use 64GB External SD Memory formatted in EXT4 where all the Data will be stored.

To do so we have to understand few thing and how is the structure of the Z1 Kernel is made and try to extract "ramdisk.cpio" where we can edit "init.rc" and change the line "/data mount"

As for the kernel "Autopsy" we used @krabappel2548 kernel build, I hope he is fine with that. :)

From what we know, the recovery is injected in the boot.img and this makes things more complicated.

Are all kernels built in this way? Even the stock ones?

Also, is there a specific rule in the way of naming the included ramdisks?

I attached a picture to make things more clear.

Any help will be appreciate.


1. Sony doesn't have a recovery partition in their phones hence developers add the recovery in the ramdisk. Also stock sony kernels doesn't have a recovery included by default only bootloader/flashmode.
2. You can't adjust the 16gb internal partition without diving deeply into the bootloader. The NAND partition profiles are hardcoded in the bootloader so modifying even just a little bit of info in the partition of the NAND would brick your device. The only way I could possibly suggest to try is hijacking the fstab and ramdisk to unmount the internal storage and mount the external storage on init. But if your issue is only about disk space I suggest you leave the internal storage and just symlink the obb folder instead of hijacking the whole internal storage. And BTW the disk IO of the internal storage is worlds apart compared to your microsd card no matter what class it is so it would be very unefficient if you use your microSD card as internal. IMHO reading the dalvik-cache 1 by 1 on startup would be pretty slow! Same goes for reading the byte code of an app once you open it.
 
Last edited:

eclyptos

Senior Member
Jun 14, 2008
3,040
640
Planet Earth
1. Sony doesn't have a recovery partition in their phones hence developers add the recovery in the ramdisk. Also stock sony kernels doesn't have a recovery included by default only bootloader/flashmode.

We know that. If there will be a Partition for recovery it will be much more easy and safe. That why we also used a Kernel with recovery implemented.

2. You can't adjust the 16gb internal partition without diving deeply into the bootloader. The NAND partition profiles are hardcoded in the bootloader so modifying even just a little bit of info in the partition of the NAND would brick your device.

We trying and this is the risk of everybody who flashing a Custom Kernel.

The only way I could possibly suggest to try is hijacking the fstab and ramdisk to unmount the internal storage and mount the external storage on init. But if your issue is only about disk space I suggest you leave the internal storage and just symlink the obb folder instead of hijacking the whole internal storage.

Maybe not the whole internal storage but implement the external SD with the internal?

And BTW the disk IO of the internal storage is worlds apart compared to your microsd card no matter what class it is so it would be very unefficient if you use your microSD card as internal. IMHO reading the dalvik-cache 1 by 1 on startup would be pretty slow! Same goes for reading the byte code of an app once you open it.

I know the difference between Internal and External Storage. Yes the internal bandwidth is higher but like I said is worth the sacrifice, or try. Best solution will be System and Apk on Internal and link the SD to use there all Data. This is more efficient that a third Apps like Link2sd or kind of. BTW, I don't think it will be so slow but we have to try. The idea have to be made to improve what next.

So we need more Ideas, do you have any?
 

Riyal

Senior Member
Dec 16, 2011
3,038
1,770
Iloilo City
We know that. If there will be a Partition for recovery it will be much more easy and safe. That why we also used a Kernel with recovery implemented.



We trying and this is the risk of everybody who flashing a Custom Kernel.
A: This isn't about risk this is a fact. Once you successfully manage to alter the partition table of the built in NAND you're sure to get a hard brick from doing this.


Maybe not the whole internal storage but implement the external SD with the internal?
A: Implementing internal storage with external to support it is possible but limited. Like I said you could symlink the obb and Android folder to the external storage. That way you can allocate some of the storage space to data, dalvik etc. and the data files to the external SD which uses the most resources.
 

Jay794

Senior Member
Nov 3, 2012
488
50
What benefit would this give a user?

Sent from my C6903 using xda app-developers app
 

eclyptos

Senior Member
Jun 14, 2008
3,040
640
Planet Earth
I am not an expert here,

Me either, @kokotas is the Master here and all thanks should go to him for help me with this, actually the picture is of his work. :)

Hmm, changing the partition table has been successfully done on the xperia T
http://xdaforums.com/showthread.php?t=2147997

We do not try to repartitioning the Sony Z1 internal memory to get a recovery bootable from different partition, which still a very good idea to develop for Z1. We try to mount the External SD instead of the Internal to expand the storage for the Z1, and here we need a patch. If kind of patch like that will really work, with some help, anyone just will format the SD in EXT4 and use what like he like, 32/64GB.

So we will be glad even to involve more "Programmers" to help us make it true.

So any way to let this work?
 

eclyptos

Senior Member
Jun 14, 2008
3,040
640
Planet Earth
What benefit would this give a user?

Expand storage. You will be able to format a 64GB, micro SD in 2 Partitions and use 32GB by the System and 32GB like a normal SD, for example, and it will be managed by the system and not by Apps. So instead of 11,70GB you will have 30GB in System.
 
Last edited:

Jay794

Senior Member
Nov 3, 2012
488
50
Surely this will just make accessing the SD card data really slow? Even with a class 10 running games off the SD card would be laggy as hell

Sent from my C6903 using xda app-developers app
 

eclyptos

Senior Member
Jun 14, 2008
3,040
640
Planet Earth
Expert Request Please..

Can someone who know more than me just have a look on the attachment and answer few question, unanswered form post 1.

..for Z1

1) Are all kernels built in this way? Even the stock ones?

2) Also, is there a specific rule in the way of naming the included ramdisks?

3) Do all kernels use the sbin folder?

4) Is ramdisk.cpio the default name used in all kernels
 

Jay794

Senior Member
Nov 3, 2012
488
50
Hey, I support the idea, I just don't see how useful it will be

Sent from my C6903 using xda app-developers app
 

Riyal

Senior Member
Dec 16, 2011
3,038
1,770
Iloilo City
Hmm, changing the partition table has been successfully done on the xperia T
http://xdaforums.com/showthread.php?t=2147997

I am not an expert here, but is this what you are talking about,

Yes it is possible but not easy... I'm pretty sure the dev that made that had a hard time before he successfully got it. Also I'm pretty sure he has a JTAG box so in case his phone got hard bricked he can easily fix it again. Also IMHO that was already patched by sony on the latest s1boot so I'm sure it's alot harder than before.
 

gregbradley

Retired Forum Moderator
Yes it is possible but not easy... I'm pretty sure the dev that made that had a hard time before he successfully got it. Also I'm pretty sure he has a JTAG box so in case his phone got hard bricked he can easily fix it again. Also IMHO that was already patched by sony on the latest s1boot so I'm sure it's alot harder than before.

Yes, he did brick his Xperia T a few times, and the LK kernel was never really taken up because of the risks.
But it does show that it was possible to change the partition table.

As for on the xperia Z1, I don't know
 

dlads

Senior Member
Aug 24, 2010
16,758
6,466
Liverpool
Nothing Phone 2
Only problem with having the SD used all the time for system files is the risk of corruption and or a failed card.

Saying that I had it on the S3 and it worked brilliantly, was a relatively simple script which required init'd support from a custom kernel.

In all fairness, after using folder mount the worries i've had with my internal memory have gone, i'm always over 10GB of space with several really big games installed which would easily take over the whole internal memory.
 

eclyptos

Senior Member
Jun 14, 2008
3,040
640
Planet Earth
Only problem with having the SD used all the time for system files is the risk of corruption and or a failed card.

Here you sound like Google. ;)

Saying that I had it on the S3 and it worked brilliantly, was a relatively simple script which required init'd support from a custom kernel.

I had it on HD2 as well and never had any issues and I had full control of my device, this is what also we looking at, no restrictions and no storage limit on a high-end device. I will be glad to see 64GB recognized as my System Storage instead using Apps on Apps like the Mount Folder.

I play Most Wanted, of curse a bit slow, on mine HD2 so if we get this work we will have 40mb/s in writing and reading, instead of 70mb/s in internal, due to the limitation of the slot. I think even with a kind of transfare like that you will never see any slow down of the performance on your device.

Some Smart One will say now to me "Why then you don't go back to HTC". That's the point! Imagine have Z1 with such a Development and full control of you device.

At last it's a choice of the user if he want apply that patch or not, but I think if this will be possible many will be happy, but like I can see, we don't have much support due to the risk and any Developer will not take this in consideration, or maybe will, but apparently not now.
 
Last edited:

dlads

Senior Member
Aug 24, 2010
16,758
6,466
Liverpool
Nothing Phone 2
Here you sound like Google. ;)



I had it on HD2 as well and never had any issues and I had full control of my device, this is what also we looking at, no restrictions and no storage limit on a high-end device. I will be glad to see 64GB recognized as my System Storage instead using Apps on Apps like the Mount Folder.

I play Most Wanted, of curse a bit slow, on mine HD2 so if we get this work we will have 40mb/s in writing and reading, instead of 70mb/s in internal, due to the limitation of the slot. I think even with a kind of transfare like that you will never see any slow down of the performance on your device.

Some Smart One will say now to me "Why then you don't go back to HTC". That's the point! Imagine have Z1 with such a Development and full control of you device.

At last it's a choice of the user if he want apply that patch or not, but I think if this will be possible many will be happy, but like I can see, we don't have much support due to the risk and any Developer will not take this in consideration, or maybe will, but apparently not now.

I actually probably will be going back to HTC after this phone. Doubt it'll be the M8, although i do like it, the camera is sup par though and i've come accustomed to a decent picture.
 

eclyptos

Senior Member
Jun 14, 2008
3,040
640
Planet Earth
I actually probably will be going back to HTC after this phone. Doubt it'll be the M8, although i do like it, the camera is sup par though and i've come accustomed to a decent picture.

I know, I try to don't give up on it too but to much to deal with. The camera is good but I was disappointed anyway. So I was thinking about 64GB HTC One, or wait for the next release and I will finally be fine. For the moment I try to deal with Z1, I hope somewhere we will have 64GB system storage :D , this maybe will change my mind, everything is possible.
 

dlads

Senior Member
Aug 24, 2010
16,758
6,466
Liverpool
Nothing Phone 2
I know, I try to don't give up on it too but to much to deal with. The camera is good but I was disappointed anyway. So I was thinking about 64GB HTC One, or wait for the next release and I will finally be fine. For the moment I try to deal with Z1, I hope somewhere we will have 64GB system storage :D , this maybe will change my mind, everything is possible.

Have you used folder mount before? It really is a great app and i've not needed the larger internal storage since using it.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    Hey Guys,

    I asked @kokotas to help me figure out a way to make a Patch to extend the Internal Memory as for me, due to the size of the high-end Applications and Games, is too limited 16GB, 11,70GB available only, on our Z1.

    So my first Idea was to sacrifice 16Gb Internal Memory and use 64GB External SD Memory formatted in EXT4 where all the Data will be stored.

    To do so we have to understand few thing and how is the structure of the Z1 Kernel is made and try to extract "ramdisk.cpio" where we can edit "init.rc" and change the line "/data mount"

    As for the kernel "Autopsy" we used @krabappel2548 kernel build, I hope he is fine with that. :)

    From what we know, the recovery is injected in the boot.img and this makes things more complicated.

    Are all kernels built in this way? Even the stock ones?

    Also, is there a specific rule in the way of naming the included ramdisks?

    I attached a picture to make things more clear.

    Any help will be appreciate.
    2
    Hi! To answer your questions...

    Can someone who know more than me just have a look on the attachment and answer few question, unanswered form post 1.

    ..for Z1

    1) Are all kernels built in this way? Even the stock ones?
    A:What do you mean by built in this way? If you're talking about the procedure on building then yes. Even Cyanogen infact all android phones are built the same with the minor differences on offsets. If you're asking about something else then just ask again.

    2) Also, is there a specific rule in the way of naming the included ramdisks?
    A:No. In fact ramdisks doesn't have a filename at all. It's included in the kernel in a single file.

    3) Do all kernels use the sbin folder?
    A:Yes unless devs decide to make a custom one of course.

    4) Is ramdisk.cpio the default name used in all kernels
    A:No ramdisk.cpio is just a common filename made by developers to create a tutorial on repacking a kernel. I can name it as b.cpio and include it in the kernel and there won't be any difference.


    And to answer your question since you're really so eager on making a your 64gb memorycard replace the internal memory then create an init.d out of this.

    Code:
    #!/system/bin/sh
    mount -o auto,rw,nosuid,nodev /devices/platform/msm_sdcc.2/mmcblk1p1 /mnt/sdcard
    mount -o auto,rw,nosuid,nodev /devices/platform/msm_sdcc.2/mmcblk1p1 /mnt/shell/emulated/0
    mount -o auto,rw,nosuid,nodev /devices/platform/msm_sdcc.2/mmcblk1p1 /sdcard
    mount -o auto,rw,nosuid,nodev /devices/platform/msm_sdcc.2/mmcblk1p1 /storage/sdcard0
    mount -o auto,rw,nosuid,nodev /devices/platform/msm_sdcc.2/mmcblk1p1 /storage/emulated/legacy
    mount -o auto,rw,nosuid,nodev /devices/platform/msm_sdcc.2/mmcblk1p1 /data/media
    mkdir -p /sdcard/Android/obb
    ln -s /sdcard/Android/obb /mnt/obb
    ln -s /sdcard/Android/obb /mnt/shell/emulated/obb

    I can't assure you it would work but I can tell you that if it does indeed work as it should then you will get what you wanted for. And don't worry it's not messing with your internal SD so it should be safe.(This is only replacing the internal storage not the whole userdata so dalvik cache, user installed apks and other stuffs that go in userdata should still use the internal storage.)

    If you really wanted to exclude the whole internal data then you really need to hijack the init.d so android can write all the data files into the memory card for successful boot. And yeah the downside is you won't be able to remove/mount your memory card as MSC and mounting it in MTP would expose all your data files.
    1
    Hmm, changing the partition table has been successfully done on the xperia T
    http://xdaforums.com/showthread.php?t=2147997

    I am not an expert here, but is this what you are talking about,
    1
    Solved, as a stupid I am..:D..let's see now if natively we get 64GB..:p

    What do you have a problem with?
    1
    And to answer your question since you're really so eager on making a your 64gb memorycard replace the internal memory then create an init.d out of this.

    Code:
    #!/system/bin/sh
    mount -o auto,rw,nosuid,nodev /devices/platform/msm_sdcc.2/mmcblk1p1 /mnt/sdcard
    mount -o auto,rw,nosuid,nodev /devices/platform/msm_sdcc.2/mmcblk1p1 /mnt/shell/emulated/0
    mount -o auto,rw,nosuid,nodev /devices/platform/msm_sdcc.2/mmcblk1p1 /sdcard
    mount -o auto,rw,nosuid,nodev /devices/platform/msm_sdcc.2/mmcblk1p1 /storage/sdcard0
    mount -o auto,rw,nosuid,nodev /devices/platform/msm_sdcc.2/mmcblk1p1 /storage/emulated/legacy
    mount -o auto,rw,nosuid,nodev /devices/platform/msm_sdcc.2/mmcblk1p1 /data/media
    mkdir -p /sdcard/Android/obb
    ln -s /sdcard/Android/obb /mnt/obb
    ln -s /sdcard/Android/obb /mnt/shell/emulated/obb

    I can't assure you it would work but I can tell you that if it does indeed work as it should then you will get what you wanted for. And don't worry it's not messing with your internal SD so it should be safe.(This is only replacing the internal storage not the whole userdata so dalvik cache, user installed apks and other stuffs that go in userdata should still use the internal storage.)

    If you really wanted to exclude the whole internal data then you really need to hijack the init.d so android can write all the data files into the memory card for successful boot. And yeah the downside is you won't be able to remove/mount your memory card as MSC and mounting it in MTP would expose all your data files.

    Did you just write that up? Your a bloody legend if you are m8.

    Just incase this all ends up as a mod here for sharing the previous script that I used was on the galaxy s3

    This one http://xdaforums.com/galaxy-s3/development/mod-extsd2internalsd-v8increase-data-t1772234

    What was recommended was a complete back up of both memories (i wiped the external after that, the internal was then seen as external so post flash you could simply remove what was once there, or if it's not a hindrance then you could leave it) and then reflash the rom you were using from scratch.

    Once the memories showed in their respective places you could then go ahead and restore your data to what was your external (now internal) memory.

    The script worked superbly and I used it throughout my S3 life (basically around 10 - 11 months) the SD card I'm still using today in my Z1.

    This one http://www.amazon.co.uk/SanDisk-Ult...F8&qid=1396606947&sr=8-1&keywords=micro+sd+64

    All the info is back on that thread, considering that this is going to do the same thing.

    Thanks for your efforts m8, it's appreciated. :)

    PS: I should mention that when I first got the Z1 that I asked mattiadj about porting his script but apparently without prior use of the phone it would be a pain to accomplish, then said that if he didn't own it then he wouldn't do it.

    Which to me means that it's at least possible, or at least I hope it is.