How to create a Swap partition of any size for any Android ROM - TouchPad General

No need to follow this instructions, but only if you want to learn!
Flash files are available here that will automatically do all this in TWRP Recovery.
https://forum.xda-developers.com/hp-touchpad/general/hp-touchpad-optimize-android-swap-t3901773
Before making this modifications, do this first:​
https://forum.xda-developers.com/hp-touchpad/general/how-to-backup-restore-using-twrp-copy-t3892047​
How to create a Swap partition of any size for any Android ROM
This is only need it to be create one time only and will work with any OS install in the Tablet( Any Android ROM, Any Linux OS, LunesOS, WebOS, Sailfish and many more ).
The following steps will partition the storage to create a swap partition that can be use for all Android ROM ever created for the HP Touchpad.
Also take a look at this link:
https://forum.xda-developers.com/hp-touchpad/general/powerful-feature-hp-touchpad-lvm-t3889068
Code:
[B]For the Experience User this are the simple steps, to get it out of the way and not need to read all the details. [/B]
If you know what you are doing, you can use it inside Android, TWRP using adb shell with root access is up to you.
Have unallocated space after creating all partitions.
(make a partition of whatever free space is available ) or you can specified the size you want, you know how to do it or
read above link)
./lvm.static lvcreate -l 100%FREE -C y -M y --major 254 --minor 0 -n /dev/store/swap
mkswap /dev/store/swap
Add to the fstab in Ramdisk:
/dev/store/swap swap swap defaults swapprio=1, 0 0
This steps are for the learning user, hopefully I am explaining it clearly and correctly!
My comments and Suggestion
Code:
I am making the steps as simple as I can. You can achieve this faster if you have done this before.
Basically is creating all the partitions but have 824MB unallocated free space for swap.
You can assign any size you want.
I recommend the following:
Media at least 1GB, this will be the USB Storage. This partition is the best to shrink if you ever need more space on other partitions.
cm-cache 200MB. If you want to use more you can, but I have not found any issues using 200MB.
cm-system 2048MB. If you ever want to install the FULL google open apps, it will take over 1.5GB. This will ensure, you can install anything and not have an issue.
cm-data (as much as you need to only have unallocated free space for swap )
A size of 500MB will be enough ( WebOS has a swap file size of 400 MB )
The maximum I will recommend is 1GB, but you can make it any size you want. Is all up to what you use your tablet for.
Starting all fresh, from zero. All Data will be erase. Back up your data before proceeding.
THE BEGINNING of the process.
1. Load the ToolBox v42 2015-01-08
2. Complete Data Reset ( If you want to clear all partitions )
3. Resize Android Volumes (Using the ToolBox)
3.A Select Media ( select -1024 ) press home button 28 times
New size 1112
unallocated 28672
Select BACK (on top)
3.B Select cm-cache (select +8 ) press home button 25 times
New size 200
unallocated 28472
Select BACK (on top)
3.C Select cm-system (select +1024) press home button 2 times
New size 2048
unallocated 26424
Select BACK (on top)
3.D Select cm-data (select +1024) press home button 25 times
New size 25600
unallocated 824
Select Back (on top)
4. Select Apply Changes
5. Select Reboot
<<< moboot 0.3.8 >>>
6. Select boot webOS Recovery (connect the TP to computer)
7. Unzip FLINTMAN-TWRP-touch-data_media-SELINUX-f2fs-3.1.0-0-5-09-17.zip
8. Open a terminal in the directory of the unzip file.
9. Copy and paste the following in terminal.
Code:
novacom boot mem:// <uImage.TWRP
At this point The ToolBox already created all the partitions or volumes, but the unallocated space left is the one that we need to manually create
and format as a native Linux partition. This is why we need to use TWRP Recovery and to enter two lines of code, create the partition and format it.!
<<< TWRP >>>
10. Select Mount --->> check BOOT --->> select back (triangle lower left)
11. Entering adb shell :In the open Terminal paste the following
adb shell
Code:
cd /boot/usr/sbin
./lvm.static vgchange -ay
Result: /boot/usr/sbin # ./lvm.static vgchange -ay
4 logical volume(s) in volume group "store" now active
Code:
./lvm.static lvcreate -l 100%FREE -C y -M y --major 254 --minor 0 -n /dev/store/swap
Result: /boot/usr/sbin # ./lvm.static lvcreate -l 100%FREE -C y -M y --major 254 --minor
0 -n /dev/store/swap
ffff0000-ffff1000 r-xp 00000000 00:00 0 [vectors]: mlock failed: Cannot allocate memory
ffff0000-ffff1000 r-xp 00000000 00:00 0 [vectors]: munlock failed: Cannot allocate memory
Logical volume "swap" created
Code:
mkswap /dev/store/swap
Result: /boot/usr/sbin # mkswap /dev/store/swap
Setting up swapspace version 1, size = 864022528 bytes
Code:
./lvm.static vgchange -ay
Result: /boot/usr/sbin # ./lvm.static vgchange -ay
5 logical volume(s) in volume group "store" now active
<<<-- All Done Swap partition created -->>>
12. Copy FLINTMAN-TWRP-touch-data_media-SELINUX-f2fs-3.1.0-0-5-09-17.zip file in the Micro SDCard showing on your Computer.
13. Select Install --->> Up one level --->> external_sd ( the TWRP.zip file should be there ) Install it, Reboot System.
14. TWRP is on the moboot menu. Now you can install any ROM.
But Files in the Ramdisk needs to be modified for Android to mount the swap partition at boot.
I have done all this already, you can use the boot uImages that I posted below for Dirty Unicorns and Evervolv. If you feel like doing it yourself then keep having fun!
15. To modify the Ramdisk, click on this link:
https://forum.xda-developers.com/hp-touchpad/development/make-root-permanet-read-write-to-t3846567
16. The following needs to be added to fstab.tenderloing
/dev/store/swap swap swap defaults swapprio=1, 0 0
The zRAM needs to be disable, by placing # in front of the mount point.
# /dev/block/zram0
The fun has just started and now Android will see the swap partition and start swapping, but changes need to be made on more files in the ramdisk to optimize Android to work on a Tablet with swapping and not be use as a smartphone with zRAM and limited resources like it has been use from all this years.
The system is not optimized and it will not work properly with current settings. I have created modified boot images for the Evervol 7.1.2 and Dirty Unicorns V12.5.3 with all the best optimization possible to use the Touchpad as a tablet and not a smartphone. The links are below, just copy the files into your boot directory.
Before you boot using the new image, disable any optimization apps or changes that you have done because it will override any settings done after boot is completed and make the system very slow.
Dirty Unicorns:
https://forum.xda-developers.com/hp...ty-unicorns-v12-5-3-20181116-0140-rc-t3894042
Everlvolv:
https://forum.xda-developers.com/hp...rvol-7-1-2-skz-kernel-swap-partition-t3892091
Attention: This is extremely easy to deploy by all developers creating any ROM or Kernel for the TP. The regular user does not need to do none of this.
The only thing the user needs to do is left some space available when creating the Android partitions using the ToolBox, which everyone needs to do.
Is up to the user to select how much space they want for their Swap partition.
Then the developer that provides the ROM or Kernel can create an script to run after installation that will create the partition from whatever free space is available and format it. No input is need it by the user to do so. And if the partition is already created, nothing will happen, LVM is smart enough to not recreated.
./lvm.static lvcreate -l 100%FREE -C y -M y --major 254 --minor 0 -n /dev/store/swap
mkswap /dev/store/swap

HP_TOUCHPAD said:
Before making this modifications, do this first:​https://forum.xda-developers.com/hp-touchpad/general/how-to-backup-restore-using-twrp-copy-t3892047​
How to create a Swap partition of any size for any Android ROM
The following steps will partition the storage to create a swap partition that can be use for all Android ROM ever created for the HP Touchpad.
Also take a look at this link:
https://forum.xda-developers.com/hp-touchpad/general/powerful-feature-hp-touchpad-lvm-t3889068
For the Expert is as simple as:
Have unallocated space.
(make a partition of whatever free space is avalaible ) or it can be specified.
Code:
./lvm.static lvcreate -l 100%FREE -C y -M y --major 254 --minor 0 -n /dev/store/swap
Format
Code:
mkswap /dev/store/swap
Where? adb shell? That's where I'm doing it, and I get "unable to create new logical volume with no extents"
Add to the fstab in Ramdisk:
/dev/store/swap swap swap defaults swapprio=1, 0 0
Optimize Swapping settings.
I am making the steps as simple as I can. You can achieve this faster if you have done this before.
Basically is creating all the partitions but have 824MB unallocated free space for swap.
You can assign any size you want.
I recommend the following:
Media at least 1GB, this will be the USB Storage. This partition is the best to shrink if you ever need more space on other partitions.
cm-cache 200MB. If you want to use more you can, but I have not found any issues using 200MB.
cm-system 2048MB. If you ever want to install the FULL google open apps, it will take over 1.5GB. This will ensure, you can install anything and not have an issue.
cm-data (as much as you need to only have unallocated free space for swap )
A size of 500MB will be enough ( WebOS has a swap file size of 400 MB )
The maximum I will recommend is 1GB, but you can make it any size you want. Is all up to what you use your tablet for.
Starting all fresh, from zero. All Data will be erase. Back up your data before proceeding.
Is this where we're supposed to start. Is all the rest above this just commentary?
1. Load the ToolBox v42 2015-01-08
2. Complete Data Reset ( If you want to clear all partitions )
3. Resize Android Volumes (Using the ToolBox)
3.A Select Media ( select -1024 ) press home button 28 times
New size 1112
unallocated 28672
Select BACK (on top)
3.B Select cm-cache (select +8 ) press home button 25 times
New size 200
unallocated 28472
Select BACK (on top)
3.C Select cm-system (select +1024) press home button 2 times
New size 2048
unallocated 26424
Select BACK (on top)
3.D Select cm-data (select +1024) press home button 25 times
New size 25600
unallocated 824
Select Back (on top)
4. Select Apply Changes
5. Select Reboot
<<< moboot 0.3.8 >>>
6. Select boot webOS Recovery (connect the TP to computer)
7. Unzip FLINTMAN-TWRP-touch-data_media-SELINUX-f2fs-3.1.0-0-5-09-17.zip
8. Open a terminal in the directory of the unzip file.
9. Copy and paste the following in terminal.
Code:
novacom boot mem:// <uImage.TWRP
<<< TWRP >>>
10. Select Mount --->> check BOOT --->> select back (triangle lower left)
11. Entering adb shell :In the open Terminal paste the following
Is this actually the place where the lvm volumes are created after we go through TPTB and reinstall TWRP?
adb shell
Code:
cd /boot/usr/sbin
./lvm.static vgchange -ay
Result: /boot/usr/sbin # ./lvm.static vgchange -ay
4 logical volume(s) in volume group "store" now active
Code:
./lvm.static lvcreate -l 100%FREE -C y -M y --major 254 --minor 0 -n /dev/store/swap
Result: /boot/usr/sbin # ./lvm.static lvcreate -l 100%FREE -C y -M y --major 254 --minor
0 -n /dev/store/swap
ffff0000-ffff1000 r-xp 00000000 00:00 0 [vectors]: mlock failed: Cannot allocate memory
ffff0000-ffff1000 r-xp 00000000 00:00 0 [vectors]: munlock failed: Cannot allocate memory
Logical volume "swap" created
Code:
mkswap /dev/store/swap
Result: /boot/usr/sbin # mkswap /dev/store/swap
Setting up swapspace version 1, size = 864022528 bytes
Code:
./lvm.static vgchange -ay
Result: /boot/usr/sbin # ./lvm.static vgchange -ay
5 logical volume(s) in volume group "store" now active
<<<-- All Done Swap partition created -->>>
12. Copy FLINTMAN-TWRP-touch-data_media-SELINUX-f2fs-3.1.0-0-5-09-17.zip file in the Micro SDCard showing on your Computer.
13. Select Install --->> Up one level --->> external_sd ( the TWRP.zip file should be there ) Install it, Reboot System.
14. TWRP is on the moboot menu. Now you can install any ROM.
But Files in the Ramdisk needs to be modified for Android to mount the swap partition at boot.
15. To modify the Ramdisk, click on this link:
https://forum.xda-developers.com/hp-touchpad/development/make-root-permanet-read-write-to-t3846567
16. The following needs to be added to fstab.tenderloing
/dev/store/swap swap swap defaults swapprio=1, 0 0
The zRAM needs to be disable, by placing # in front of the mount point.
# /dev/block/zram0
The fun has just started and now Android will see the swap partition and start swapping, but changes need to be made on more files in the ramdisk to optimize Android to work on a Tablet with swapping and not be use as a smartphone with zRAM and limited resources like it has been use from all this years.
The system is not optimized and it will not work properly with current settings. I have created modified boot images for the Evervol 7.1.2 and Dirty Unicorns V12.5.3 with all the best optimization possible to use the Touchap as a tablet and not a smartphone. The links are below, just copy the files into your boot directory.
Before you boot using the new image, disable any optimization apps or changes that you have done because it will override any settings done after boot is completed and make the system very slow.
<<--link will be here --->>
Click to expand...
Click to collapse
This may be clear to you, but it isn't to me. See my comments in red above. How about cleaning this up? Anything you want to add that is extraneous to just getting this done should be in a second post.

I kinda get the feeling you are hoping the ROM builders will add this to their Roms but i don't think we have too many programmers left for the touchpad.
I can't even get this far
8. Open a terminal in the directory of the unzip file. ( on windows? with what?)
9. Copy and paste the following in terminal.
Sorry ...i'm trying though...Thanks for your effort

Touchie Pad said:
I kinda get the feeling you are hoping the ROM builders will add this to their Roms but i don't think we have too many programmers left for the touchpad.
I can't even get this far
8. Open a terminal in the directory of the unzip file. ( on windows? with what?)
9. Copy and paste the following in terminal.
Sorry ...i'm trying though...Thanks for your effort
Click to expand...
Click to collapse
The tablet originally came with a swap partition on webOS, is nothing new.
Do not worry about doing this, I already created a zip file that can be install using TWRP Recovery!
Everything will be done in less than two minutes and everything will be created!
Working on getting the files on here...

my touchpads are in twrp and attached to my computer!

Touchie Pad said:
my touchpads are in twrp and attached to my computer!
Click to expand...
Click to collapse
It will be very quick thing to apply, download the zip file. Flash it and in less than 2 minutes is done!

HP_TOUCHPAD said:
It will be very quick thing to apply, download the zip file. Flash it and in less than 2 minutes is done!
Click to expand...
Click to collapse
I did not see the zip available anywhere. Where is the zip file?

Well I was able to create the swap partition by following your instructions in the terminal of the twrp on the touchpad. When i type in #free it does show a swap file with numbers, so i think i got it right. Did it on a DU Rom and a Lineage build. Never could get your optimized settings to boot though. Or get into the ramdisk yet. I used 3ctoolbox to try to mimic your suggested settings. It does seem to be quite a bit improved...especially when watching videos on youtube etc...I still do come across lag at times, if more than a couple things are running at the same time...and some apps are still tough for it to handle, but every bit helps.

Touchie Pad said:
Well I was able to create the swap partition by following your instructions in the terminal of the twrp on the touchpad. When i type in #free it does show a swap file with numbers, so i think i got it right. Did it on a DU Rom and a Linaro build. Never could get your optimized settings to boot though. Or get into the ramdisk yet. I used 3ctoolbox to try to mimic your suggested settings. It does seem to be quite a bit improved...especially when watching videos on youtube etc...I still do come across lag at times, if more than a couple things are running at the same time...and some apps are still tough for it to handle, but every bit helps.
Click to expand...
Click to collapse
Thanks for trying it out!
Today I will upload all the zip files than can be easily flash using TWRP, it will be extremely simple, just touch and install and it will do a complete fresh install of everything, like a brand new Device!
Also the DU optimized Kernel and Evervolv, just touch and Install.
You will see how fast and stable the HP Touchpad really is!

Here are the Flash files to Install ! Thanks to shumash for the help of providing the script binary and for initiating the idea to make it easy!
https://forum.xda-developers.com/hp-touchpad/general/hp-touchpad-optimize-android-swap-t3901773

Related

[Q] MKFS.EXT4 Compiled for Android

I'm trying to make an auto install script within the initramfs. I've got everything working, including automatic fdisk, but I cannot get mkfs.ext4 to work on the Android kernel, and there is no version of Busybox with the ext4 applet. Does anyone have a mkfs.ext4 that runs successfully on Android? When I run it from a terminal the output is
Code:
mkfs.ext4: 1: Syntax error: word unexpected (expecting ")")
Here's my code if you want to see what I'm doing.
Code:
mount /dev/mmcblk1p1 /tmp/mnt
if [ -f /tmp/mnt/mysticfw.tar.gz ]; then
$FDISK /dev/mmcblk0 < /home/fdisk.input
$MKFS_EXT4 -O ^huge_file /dev/mmcblk0p2
mount /dev/mmcblk1p2 /tmp/tmproot
mkdir /tmp/tmproot/itworks
tar -xzvf /tmp/mnt/mysticfw.tar.gz -C /tmp/tmproot/
sync
#rm /tmp/mnt/mysticfw.tar.gz
umount /tmp/tmproot
fi
sync
umount /tmp/mnt
It automatically partitions the stock Android block and installs a tar.gz from the internal storage to simplify my unsquashed 2.1.4 filesystem install, and the only part I can't get working is mkfs.ext4.
Found one! It's 3 MBs though, so if anyone has a smaller one, it would be very nice.
msticninja said:
I'm trying to make an auto install script within the initramfs. I've got everything working, including automatic fdisk, but I cannot get mkfs.ext4 to work on the Android kernel, and there is no version of Busybox with the ext4 applet. Does anyone have a mkfs.ext4 that runs successfully on Android? When I run it from a terminal the output is
Code:
mkfs.ext4: 1: Syntax error: word unexpected (expecting ")")
Click to expand...
Click to collapse
Why do you don't use the mke2fs from Uruk for example (the easiest way) asking $auron if it's ok for him. His size is only 49KB.
Find it like the following on Uruk installation:
Code:
[COLOR="DarkRed"]
# mkfs.ext4 -V
mke2fs 1.41.3 (12-Oct-2008)
Using EXT2FS Library version 1.41.3
# find / -name mke2fs | xargs ls -l
-rwxr-xr-x 1 root root 30584 Dec 15 03:46 /system/bin/mke2fs
[B]-rwxr-xr-x 5 root root 49248 4 Jan 15 13:14 /usr/local/sbin/mke2fs[/B]
#/usr/local/sbin/mke2fs -V
mke2fs 1.41.3 (12-Oct-2008)
Using EXT2FS Library version 1.41.3
[/COLOR]
Here's my code if you want to see what I'm doing.
Code:
mount /dev/mmcblk1p1 /tmp/mnt
if [ -f /tmp/mnt/mysticfw.tar.gz ]; then
$FDISK /dev/mmcblk0 < /home/fdisk.input
$MKFS_EXT4 -O ^huge_file /dev/mmcblk0p2
mount /dev/mmcblk1p2 /tmp/tmproot
mkdir /tmp/tmproot/itworks
tar -xzvf /tmp/mnt/mysticfw.tar.gz -C /tmp/tmproot/
sync
#rm /tmp/mnt/mysticfw.tar.gz
umount /tmp/tmproot
fi
sync
umount /tmp/mnt
It automatically partitions the stock Android block and installs a tar.gz from the internal storage to simplify my unsquashed 2.1.4 filesystem install, and the only part I can't get working is mkfs.ext4.
Click to expand...
Click to collapse
and don't forget to add "-l" on FDISK command and change the device mmcblk0 with mmcblk1 on the lines:
Code:
$FDISK /dev/mmcblk0 < /home/fdisk.input
$MKFS_EXT4 -O ^huge_file /dev/mmcblk0p2
Cheers,
shklifo said:
Why do you don't use the mke2fs from Uruk for example (the easiest way) asking $auron if it's ok for him. His size is only 49KB.
Find it like the following on Uruk installation:
Code:
[COLOR="DarkRed"]
# mkfs.ext4 -V
mke2fs 1.41.3 (12-Oct-2008)
Using EXT2FS Library version 1.41.3
# find / -name mke2fs | xargs ls -l
-rwxr-xr-x 1 root root 30584 Dec 15 03:46 /system/bin/mke2fs
[B]-rwxr-xr-x 5 root root 49248 4 Jan 15 13:14 /usr/local/sbin/mke2fs[/B]
#/usr/local/sbin/mke2fs -V
mke2fs 1.41.3 (12-Oct-2008)
Using EXT2FS Library version 1.41.3
[/COLOR]
and don't forget to add "-l" on FDISK command and change the device mmcblk0 with mmcblk1 on the lines:
Code:
$FDISK /dev/mmcblk0 < /home/fdisk.input
$MKFS_EXT4 -O ^huge_file /dev/mmcblk0p2
Cheers,
Click to expand...
Click to collapse
Why didn't I think of that? Thanks.
But regarding mmcblk0/1, I'm replacing the stock Android, so the fdisk.input file contains the commands to delete mmcblk0p2 and p3, and make a new partition in the unused space. I hate using space on my Internal Storage, so I'm using Archos' space.
msticninja said:
Why didn't I think of that? Thanks.
But regarding mmcblk0/1, I'm replacing the stock Android, so the fdisk.input file contains the commands to delete mmcblk0p2 and p3, and make a new partition in the unused space. I hate using space on my Internal Storage, so I'm using Archos' space.
Click to expand...
Click to collapse
If you are using the mmcblk0p2 as rootfs as you say (and you are expanded tar archive on mmcblk1p2), than you have to change the line:
mount /dev/mmcblk1p2 /tmp/tmproot
Click to expand...
Click to collapse
with
mount /dev/mmcblk0p2 /tmp/tmproot
Click to expand...
Click to collapse
shklifo said:
If you are using the mmcblk0p2 as rootfs as you say (and you are expanded tar archive on mmcblk1p2), than you have to change the line:
with
Click to expand...
Click to collapse
I know, that's my current data partition, I'll change it once I'm done testing. The tar file just has a test file in it, so when I boot back into block1, I can see if the IF statement was executed by seeing if it was extracted to block1. I'll also have to change etc/mountpoints once testing is actually finished.
One more question since you're so quick. I think I have everything working, except it needs a reboot in between the fdisk and mke2fs commands to reload the partition table. I'm trying to use partprobe instead of rebooting, but it hasn't been cross compiled to work on Android, AFAIK. Have you seen a way to reload the MBR without rebooting?
msticninja said:
I know, that's my current data partition, I'll change it once I'm done testing. The tar file just has a test file in it, so when I boot back into block1, I can see if the IF statement was executed by seeing if it was extracted to block1. I'll also have to change etc/mountpoints once testing is actually finished.
One more question since you're so quick. I think I have everything working, except it needs a reboot in between the fdisk and mke2fs commands to reload the partition table. I'm trying to use partprobe instead of rebooting, but it hasn't been cross compiled to work on Android, AFAIK. Have you seen a way to reload the MBR without rebooting?
Click to expand...
Click to collapse
I'v been looking at the recovery_lib.sh in the recovery boot image and can't find anything special to re-read the partition table. And yes they also use fdisk to repartition. So I suspect the driver for the block device does not cache the MBR and you can just mke2fs after the partition table is created.
I can't remember from what firmware that recovery boot image was but I think it's from the 2.1.04 and they do some repartitioning there for the swap space.
I'll check it again and get back to you.
wdl1908 said:
I'v been looking at the recovery_lib.sh in the recovery boot image and can't find anything special to re-read the partition table. And yes they also use fdisk to repartition. So I suspect the driver for the block device does not cache the MBR and you can just mke2fs after the partition table is created.
I can't remember from what firmware that recovery boot image was but I think it's from the 2.1.04 and they do some repartitioning there for the swap space.
I'll check it again and get back to you.
Click to expand...
Click to collapse
I just checked the recovery image from 2.1.04 and after the fdisk commands there is nothing to re-read the MBR the next commands executed are mount commands to check if the fs is present I suggest you look at the /etc/scripts/recovery_lib.sh yourself it could give some clues on how to do things.
wdl1908 said:
I just checked the recovery image from 2.1.04 and after the fdisk commands there is nothing to re-read the MBR the next commands executed are mount commands to check if the fs is present I suggest you look at the /etc/scripts/recovery_lib.sh yourself it could give some clues on how to do things.
Click to expand...
Click to collapse
For me too, it have nothing to do with a reboot to load partitions table and access partition to format them with the choised filesystem.
You can delete any partition on linux (except rootfs one ), recreate them and directly format them as you like, reboot isn't necesary.
Thanks for all the replies, very helpful, but I'm stuck. Fdisk seems to use ioctl to reload the partition table, so you don't need a reboot if everything on the device is unmounted before writing the partition table, but I'm having very strange issues with mke2fs now. I've had the whole thing work twice now, but when I flash back to stock, then retry the script, it usually does everything except the formatting. Here's the code:
Code:
mount /dev/mmcblk1p1 /tmp/mnt
if [ -f /tmp/mnt/mysticfw.tar.gz ]; then
umount /dev/mmcblk0p1
umount /dev/mmcblk0p2
umount /dev/mmcblk0p3
umount /dev/mmcblk0p4
fdisk /dev/mmcblk0 < /home/fdisk.input
mv /tmp/mnt/mysticfw.tar.gz /tmp/mnt/mysticf.tar.gz
sync
umount /tmp/mnt
log_and_reboot
fi
if [ -f /tmp/mnt/mysticf.tar.gz ]; then
rm /etc/mtab
touch /etc/mtab
mke2fs -T ext4 -O ^huge_file /dev/mmcblk0p2
mount /dev/mmcblk0p2 /tmp/tmproot
tar -xzf /tmp/mnt/mysticf.tar.gz -C /tmp/tmproot/
sync
mv /tmp/mnt/mysticf.tar.gz /tmp/mnt/mysticdone.tar.gz
umount /tmp/tmproot
rm /etc/mtab
ln -s /proc/mounts /etc/mtab
fi
sync
umount /tmp/mnt
I have it reboot after the fdisk just in case, and the fdisk works perfectly, so the second IF/THEN is the issue. I had to retouch the mtab just to make sure it's empty, as mke2fs fails if mtab doesn't exist(at least in terminal), then I relink it to /proc/mounts as they do in the stock firmware. Here's my mke2fs.conf:
Code:
[defaults]
base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr
blocksize = 4096
inode_size = 256
inode_ratio = 16384
[fs_types]
ext3 = {
features = has_journal
}
ext4 = {
features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
inode_size = 256
}
ext4dev = {
features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
inode_size = 256
options = test_fs=1
}
small = {
blocksize = 1024
inode_size = 128
inode_ratio = 4096
}
floppy = {
blocksize = 1024
inode_size = 128
inode_ratio = 8192
}
news = {
inode_ratio = 4096
}
largefile = {
inode_ratio = 1048576
blocksize = -1
}
largefile4 = {
inode_ratio = 4194304
blocksize = -1
}
hurd = {
blocksize = 4096
inode_size = 128
}
Is there a way to echo the output from my script to a file like dontpanic so I can see what the error is?
msticninja said:
Is there a way to echo the output from my script to a file like dontpanic so I can see what the error is?
Click to expand...
Click to collapse
Simple append (">>") and "echo" doesn't work to a redirected logfile?
I've only learned what I've needed to learn over the years, usually with endless google searches and reading through man pages, so I've never tried to log outputs, because I could always see the output in a terminal or onscreen during boot. Android is the first time I haven't been able to actually see the boot process.
Once again, thanks for your help. I probably could've googled this, but I kind of asked as an afterthought. I didn't even think about redirecting. So if the mke2fs line is the one I want to log, I just add "2&>> /tmp/mnt/logfile" to the end of it, right?
Also, thanks for your original thread about booting from Internal Storage, I never got around to developing on Android until you posted that, and I realized just how similar Android is to L/unix(e.g. exactly the same).
msticninja said:
I didn't even think about redirecting. So if the mke2fs line is the one I want to log, I just add "2&>> /tmp/mnt/logfile" to the end of it, right?
Click to expand...
Click to collapse
ehm, no.
In your case must be like the following:
Code:
"your command" >> /tmp/mnt/logfile 2>&1
That means redirect all messages from STDERR (2 - standard error) to STDOUT (1 - standard output) and all messaged collected on STDOUT to the redirected log file /tmp/mnt/logfile, or more comprensible redirect all mesage including error ones to the log file.
I'm working in Unix environments and use them often
And a good practice in developing is to use "echo" to the same log file, so you know the exact place the script is running, like:
Code:
echo "I'm just before the formatting step of the ..." >> /tmp/mnt/logfile
shklifo said:
ehm, no.
In your case must be like the following:
Code:
"your command" >> /tmp/mnt/logfile 2>&1
That means redirect all messages from STDERR (2 - standard error) to STDOUT (1 - standard output) and all messaged collected on STDOUT to the redirected log file /tmp/mnt/logfile, or more comprensible redirect all mesage including error ones to the log file.
I'm working in Unix environments and use them often
And a good practice in developing is to use "echo" to the same log file, so you know the exact place the script is running, like:
Code:
echo "I'm just before the formatting step of the ..." >> /tmp/mnt/logfile
Click to expand...
Click to collapse
Strange. The google searching lead me to believe the "2>&1" was before the location, and replaced ">>". Once again, thanks for the help.
any chance of you getting this uploaded? iterested in this since I'm not that good with linux
TjaXanK said:
any chance of you getting this uploaded? iterested in this since I'm not that good with linux
Click to expand...
Click to collapse
I could probably finish it, but I'm waiting for a new version of Uruk first, as his install script already gets rid of the linux steps, it just doesn't give you the choice to install to the internal memory yet. Once he does that, I'll add my changes to make it install to the Archos partition. The latest Uruk is also a bit too big for the archos partition. I had to cut my data partition down to ~150 megs.
msticninja said:
I could probably finish it, but I'm waiting for a new version of Uruk first, as his install script already gets rid of the linux steps, it just doesn't give you the choice to install to the internal memory yet. Once he does that, I'll add my changes to make it install to the Archos partition. The latest Uruk is also a bit too big for the archos partition. I had to cut my data partition down to ~150 megs.
Click to expand...
Click to collapse
ok, I'm currently running urk with the new install system and it's brillant but it would be perfect if we could run it without cutting down on our storage space

Merged Thread, Swap file, Multiple Partitions

This is a merged thread, from the two previous posts I created, both questions I awnserd myself. here is the awnser you really want multiple partitions for your phone
First you must run gparted from command promp on your computer, so connect your phone to your computer and run in the terminal:
Code:
adb shell
parted /dev/block/mmcblk0
print
remove any partitions
Code:
rm1
rm2
rm3
rm4
rm5
now create new partitions these partitions should be as so, for sense or 2.1, or gingerbread roms fat32 ext2 swap file is the order, for froyo I believe it is swap ext2 fat32, but I have not tried a froyo rom yet.
Code:
mkpartfs primary fat32 0 14500MB
mkpartfs primary ext2 14500MB 15500MB
mkpartfs primary linux-swap 15500MB 15900MB
now push swap.zip file from below to your phone, and flash swap.zip
now reboot
now open terminal emulator and type:
Code:
ls /dev/block/
this should print something like this:
mmcblk0p1
mmcblk0p2
mmcblk0p3
mntblock1
mntblock2
loop1
loop2
the mmcblk0p'# are the sdcard partitions
to mount the fat32 partition type:
Code:
mount -o rw -t vfat /dev/block/mmcblk0p1 /mnt/sdcard/
now use one of SwapScriptv2.1.1 thanks to cyanogen
type in terminal:
Code:
[B]swapscriptv2[/B]
Follow the prompts and you should see your new swap partition in use, by typing:
Code:
[B]free[/B]
in your terminal now if you woud like to have the swap started at boot time type
Code:
[B]bootswapv2[/B]
rd
and follow the prompts after this you should have a new 3 partitioned sdcard fat32 ext2 and swap and using and mounted on fat32 on sdcard and swap running
using the ext2 will be for either cach2cach appsor maybe linux, I have not decied yet
http://forum.cyanogenmod.com/topic/208-swap-enabledisable/
Flash from Recovery
Compatible with 2 and 3 partition layouts (ext(fat+ext+swap) and no ext(fat+swap))
http://www.mediafire...qdvxh7sos5svcvc
or
http://www.sendspace.com/file/h66oap
This script adds commands to terminal:
Code:
swapscriptv2
bootswapv2
swap-off
bootswap-off
vmtweaks
vmtweaks-boot
swapscriptv2 - you will be asked what partition layout you are using as well as swappiness, optional vm settings prompted
bootswapv2 - you will be asked what partition layout you are using as well as swappiness, and an init script will be placed for swap at boot time, optional boot time vm settings prompted
swap-off turns off active swap partition (error for parition not in use is normal)
bootswap-off removes bootswap init file.
vmtweaks allows changing settings for vfs_cache_pressure and page-cluster, some people have reported success in reducing these values.
vmtweaks-boot allows changing settings for vfs_cache_pressure and page-cluster and applying them at boot.
Let me know if there are any problems with the new script.
the following commands in the terminal
SwapScript: (v1)
Flash from Recovery
fat32+ext+swap or swap on /dev/block/mmcblk0p3
http://www.mediafire...bnc79k6pkespzbj
fat32+swap no ext or swap on /dev/block/mmcblk0p2
http://www.mediafire...b3ykdk3r21js96q
This script adds several commands to terminal:
swapon10
swapon20
swapon30
swapon40
swapon50
swapon60
swapon70
swapon80
swapon90
bootswap10
bootswap20
bootswap30
bootswap40
bootswap50
bootswap60
bootswap70
bootswap80
bootswap90
swap-off
bootswap-off
Instructions
swaponXX (20,30,40,50,60) - will result in swap being turned on with a swappiness of XX
bootswapXX (20,30,40,50,60) - will enable swap at boot time with a swappiness of XX (no usuerinit.sh needed)
swap-off - Turns running swap off.
bootswap-off - removes init swap script from boot. (see above notes for removal if you used the newer script)
SWAPFILE CREATOR:
http://www.mediafire...yr7w2yd5sfobyte
For anyone interested in testing different swap sizes and swappiness or those with no partition other than the standard fat, I threw together a swapfile script allowing for several common configurations. Similar to my swapscript after flashing from recovery a number of new commands will become available in terminal:
Instructions
First create a swap file on your sdcard or sd-ext partition:
swapfileXX (size 12,24,36,64,96,128 on sdcard fat partition)
extswapXX (size 12,24,36,64,96,128 on sdcard ext partition)
Then set swappiness:
swpXX (XX is swappiness in increments of 10 up to 90)
errors in script are normal, script references both fat and ext locations, will fix this next update
swapfile-off (stop swap file in use)
errors in script are normal, script references both fat and ext locations, will fix this next update
clearswapfile (stops swap file and removes all swap files created)
errors in script are normal, script references both fat and ext locations, will fix this next update
Swapfile at boot ONLY SUPPORTED FOR SWAPFILE ON EXT:
bootswapfileXX (XX is swappiness in increments of 10 up to 90)
bootswapfil-off - removes bootswap
SwapFileScript:
http://www.mediafire...yr7w2yd5sfobyte
How to tell if swap is currently in use:
in terminal emulator or adb shell type 'free' with no 's and press enter
if there is a number in the space that says swap you have swap enabled

[MOD] Increase RAM memory size(without swapper!) (good for gaming)

Hi, here is a good mod specially for gaming and ICS roms which consumes big memory amount!!!
It is basically an .sh script that enables swapping. This makes device use part of sdcard to use it as RAM memory, so it can be increased a lot...
The only requirement is have root, use relatively fast sdcard and have enabled init.d scripts..
WI always have used this mod on my phone so i think it no needs testing
To it follow these steps:
1.- Root your device
2.- Make a swap partition in your sdcard (this step will format your sdcard!)
http://forum.xda-developers.com/wiki/SD_card_partitioning
2.1-In step 3 select "swap partition"
2.2-I recommend to make ~512MB partition because the SO will be going to fill it during you use the phone, but i always had 1GB partition, and no problems You can select 100MB or 50MB, but this is too little
3.- Check if there is a folder called init.d inside /system/etc/
3.1-If its there, follow next steps
3.2-If it is not there, you must activate init.d support, follow this tutorial: http://forum.xda-developers.com/showthread.php?t=1422061
3.- Copy 00userinit file to your device (must remove the .txt extension of the file, because i needed to put it to attatch the file)
4.- With root explorer, xplore, or similar copy it to /system/etc/init.d
5.- Set all permissions: rwxr-xr-x
6.- Reboot device
7.- For checking if it works, download Terminal emulator and type "free". See attatchment.
8.- If "swap" line has no "0" value, it works, congratulations
Click to expand...
Click to collapse
With this, you will:
Have swapping activated in your phone permanently, or until you remove that script or change of ROM.
Have bigger RAM memory amount, depending on your swap partition size
If you use supercharger or any RAM manager program, i should recomend you to activate hard gaming option, because:
-As you have bigger RAM memory, the useless aplications, instead of be closed, they will be stored in your sdcard partition so, you re able to have multitasking and hard gaming option at the same time
Click to expand...
Click to collapse
But this is not all!! You can open and edit this file to adapt it to your requirements:
You can edit this line to set swapiness cuantity, this defines the OS tendency to use swap partition, I not recommend to set it to 100, but 60 is good. Also, if you have slower sdcard, you should set it to 30~40:
-Change 60 value by something you want from 1 to 100 "then echo 60 > /proc/sys/vm/swappiness;"
If you have another sdcard partition like EXT4 or something to APP2SD, you should change the last number of "mmcblk0p2" by the number of the partition, i mean:
-If you have 3 partitions with this order: Fat32(that you use everyday), EXT4, and SWAP you should change it by mmcblk0p3
-If 3 partitions with this order: Fat32, SWAP,and EXT4, you should set it mmcblk0p2
Click to expand...
Click to collapse
I forgot it! To use this, remember that you should:
INSTALL THE LATEST BUSYBOX VERSION!!!
Click to expand...
Click to collapse
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
FOR THOSE WHO HAVE NOT WORKING, DELETE 00userinit and follow the steps with 01userinit attatched file
Isnt this much like swapfipe/partition?
Sent from my R800i using xda app-developers app
Does it works on locked bootloaders, obviously on gingerbread??????
i already have linux swap partition and use "swapper 2 " with doom kernel
after using swap we should disable ( turn off ) the swapper2 and then mount the SD card to computer ... so , my question is , is your script the same ? or it can disable - enable itself automatically ?
romeo_charly said:
Does it works on locked bootloaders, obviously on gingerbread??????
Click to expand...
Click to collapse
Locked or Unlocked shouldn't make a difference as long as you have Init.d support
Sent from my R800i using XDA APP and NXT2JB
bamsbamx said:
Hi, here is a good mod specially for gaming and ICS roms which consumes big memory amount!!!
It is basically an .sh script that enables swapping. This makes device use part of sdcard to use it as RAM memory, so it can be increased a lot...
The only requirement is have root, use relatively fast sdcard and have enabled init.d scripts..
WI always have used this mod on my phone so i think it no needs testing
To it follow these steps:
With this, you will:
But this is not all!! You can open and edit this file to adapt it to your requirements:
I forgot it! To use this, remember that you should:
Click to expand...
Click to collapse
Will this reck your phone in the long run
extremetempz said:
Will this reck your phone in the long run
Click to expand...
Click to collapse
This can't 'wreck a phone' but it can make the life of the SDCARD shorter.
sewer56lol said:
This can't 'wreck a phone' but it can make the life of the SDCARD shorter.
Click to expand...
Click to collapse
That is what says some people, but i always have used it and no problems...
In addition, sdcard life is sure longer than 10 years, if you use swap constantly it could be reduced to7 or 8...
Then, it makes no sense to say that, because you probably will buy another sdcard in less than 5 years
I tried this without success. I had to change the script that you provided. First I added #!/system/bin/sh to line 1 so it would run as a shell script and then the partition on my device was /dev/block/mmcblk0p3. I had to do the following to figure out which partition on my sdcard was actually set as swap. Once I edited the script with the addition to line 1 and the correct partition everything worked as expected.
Code:
~ # su
[email protected]:/ # fdisk -l /dev/block/mmcblk0
Disk /dev/block/mmcblk0: 31.9 GB, 31914983424 bytes
255 heads, 63 sectors/track, 3880 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1 3818 30666992 c Win95 FAT32 (LBA)
/dev/block/mmcblk0p2 3818 3849 250000 83 Linux
/dev/block/mmcblk0p3 3850 3880 249007+ 82 Linux swap
And my 00userinit script looks like:
Code:
#!/system/bin/sh
if [ -n /dev/block/mmcblk0p3 ];
then mkswap /dev/block/mmcblk0p3;
fi;
if [ -e /dev/block/mmcblk0p3 ];
then echo 60 > /proc/sys/vm/swappiness;
swapon /dev/block/mmcblk0p3;
fi;
I'm running FXP 142 CM9.1.
jimmyvau said:
I tried this without success. I had to change the script that you provided. First I added #!/system/bin/sh to line 1 so it would run as a shell script and then the partition on my device was /dev/block/mmcblk0p3. I had to do the following to figure out which partition on my sdcard was actually set as swap. Once I edited the script with the addition to line 1 and the correct partition everything worked as expected.
Code:
~ # su
[email protected]:/ # fdisk -l /dev/block/mmcblk0
Disk /dev/block/mmcblk0: 31.9 GB, 31914983424 bytes
255 heads, 63 sectors/track, 3880 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1 3818 30666992 c Win95 FAT32 (LBA)
/dev/block/mmcblk0p2 3818 3849 250000 83 Linux
/dev/block/mmcblk0p3 3850 3880 249007+ 82 Linux swap
And my 00userinit script looks like:
Code:
#!/system/bin/sh
if [ -n /dev/block/mmcblk0p3 ];
then mkswap /dev/block/mmcblk0p3;
fi;
if [ -e /dev/block/mmcblk0p3 ];
then echo 60 > /proc/sys/vm/swappiness;
swapon /dev/block/mmcblk0p3;
fi;
I'm running FXP 142 CM9.1.
Click to expand...
Click to collapse
Dont know what happened, the script I provided works for me, maybe you had to add that because you are running CM...
And what you say about partition number, I already stated that in original post.... thanks for reporting
Which is better
Is this MOD better than the ROEHSOFT ram expander
af230 said:
Is this MOD better than the ROEHSOFT ram expander
Click to expand...
Click to collapse
i think its different, i dont know how does it work, but reading its description I think that this app creates a swap file, instead of using swap partition.. I think this is worse method than i have posted, because system compresses all swapped memory into a file,so it could be slower... In addition, you must install an app to make it work, which means a service running in background, less space for other apps, etc,etc...
I dont know, but i think my method is better
in theory should this work on any phone?
evol4g said:
in theory should this work on any phone?
Click to expand...
Click to collapse
Yes, because android is based in linux
Is there a way u could do this without wiping the sd card?
Hello, can you tell us how this interferes with z-ram? I have z ram init.d script activated also. What is your recomandation? Turn it off or keep them both? Thx
CyberScopes said:
Is there a way u could do this without wiping the sd card?
Click to expand...
Click to collapse
Yes. I never partition from my phone. Insert ur card into ur laptop and partition with paragon partition manager (or your choice). If you have some free space on it you could easily resize ur fat32 partition to make it smaller and then use the unpartitioned space to make a linux swap partition or en ext2/3 for link2sd, if u want (I have both).. Did it lots of times. No problem
---------- Post added at 11:11 AM ---------- Previous post was at 11:06 AM ----------
jimmyvau said:
I tried this without success. I had to change the script that you provided. First I added #!/system/bin/sh to line 1 so it would run as a shell script and then the partition on my device was /dev/block/mmcblk0p3. I had to do the following to figure out which partition on my sdcard was actually set as swap. Once I edited the script with the addition to line 1 and the correct partition everything worked as expected.
Code:
~ # su
[email protected]:/ # fdisk -l /dev/block/mmcblk0
Disk /dev/block/mmcblk0: 31.9 GB, 31914983424 bytes
255 heads, 63 sectors/track, 3880 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1 3818 30666992 c Win95 FAT32 (LBA)
/dev/block/mmcblk0p2 3818 3849 250000 83 Linux
/dev/block/mmcblk0p3 3850 3880 249007+ 82 Linux swap
And my 00userinit script looks like:
Code:
#!/system/bin/sh
if [ -n /dev/block/mmcblk0p3 ];
then mkswap /dev/block/mmcblk0p3;
fi;
if [ -e /dev/block/mmcblk0p3 ];
then echo 60 > /proc/sys/vm/swappiness;
swapon /dev/block/mmcblk0p3;
fi;
I'm running FXP 142 CM9.1.
Click to expand...
Click to collapse
I had to add the first line too. Thx for the tip. I'm on stock (NXT 1.3 flavour )
Works
+1 For you good sir
Will this be any good on GB for daily use, I'm always short on RAM on my SGS+
Whether Thise need what memory class 2 best performance?and thise damage on sd or not?
Sent from my R800i using Tapatalk 2

[Experimental] Dual Boot and above Discussion

Alright so I have achieved Dual Boot :victory:
THIS IS NOT KEXEC .
It's a simple hack or probably an elegant one.
We can probably achieve multiboot but that is not important.
There are some other things which will be ironed out but thats for later.
Thread Rules :
No Thank you or How Do I do it or nooby questions.
This thread is exclusively for Developers, Enthusiasts and/or Professionals.
Knowledge of Linux and Terminal is MANDATORY.
Dual Partitioned SD card. Second partition preferably
Linux Installed on your computer.
Rubbish posts will be removed .
Save some pride by not being a n00b.
Currently I have planned two types in my mind.
Type 1: Dual Booting ROMs with Same Boot Images - Completed
This hack works across ROMs which use same kernel with same ramdisk... ICS ROMs series , LXP ROMs who use the LXP kernels.. If there is even slight difference in the ramdisk (esp. the init.rc) ,you wont be able to boot ROMs.
Type 2: Dual Booting ROMs with Same kernels but different Ramdisks- Therotically completed.
Post 1: Intro
Post 2: Prepare SD Card and Images
Post 3: Prepare Ramdisk and ROM Installations
Post 4: Installation and switching ROMs
Post 5:Ramdisk Mod
Post 6 : Multiple Mounts/ MultiBoot
Post 7: FAQ
Problems :
Partitioning SD card is annoying and not fruitful
Second SD card partition might be used as second SD card on First ROM.
Solution"
Use loop Images.
I WOULD RECOMMEND USING ANY LINUX DISTRO FOR MAKING A LOOP IMAGE. Because LINUX !!!
Preparation:
Dump Images and formatting.
Make dump images
Code:
dd if=/dev/zero of=system.kdpr bs=4096 count=100000
Will you give you 400 MB image
Code:
dd if=/dev/zero of=data.kdpr bs=4096 count=200000
Will you give you 800 MB image.
Mount Images (as root)
Code:
losetup /dev/loop0 system.kdpr
Code:
losetup /dev/loop1 data.kdpr
Format images(as root)
Code:
sudo mkfs.ext4 -T ext4 -b 4096 -m 0 -J size=4 -O ^huge_file,^has_journal,^resize_inode,^ext_attr /dev/loop0
sudo mkfs.ext4 -T ext4 -b 4096 -m 0 -J size=4 -O ^huge_file,^has_journal,^resize_inode,^ext_attr /dev/loop1
tune2fs -c 100 -i 100d -m 0 /dev/loop0
tune2fs -c 100 -i 100d -m 0 /dev/loop1
You have two ext4 formatted images system.kdpr and data.kdpr ready.
Copy those images to sd-ext folder.You can mount /dev/mmcblk0p2 on a folder and directly push these images via adb push
OR copy images to SD card and copy to second partition.
Either way the system.kdpr and data.kdpr should be in root of the second SD card partition.
Assuming you have mounted second sd card partition on /data/sd-ext.
Run this command
Code:
touch flag_kdpr
The Images are now ready and loaded :victory:
Now is the time to hack the boot image.
Unpack Boot image and navigate to ramdisk folder
Navigate to the lines in init.rc where partitions are mounted .
Comment off or remove the lines mounting system and data
For stock ICS it is in init.semc.rc
Code:
#mount yaffs2 [email protected] /system
#mount yaffs2 [email protected] /system rw remount
#mount yaffs2 [email protected] /data nosuid node
v
add a line
Code:
exec /sbin/mount_fs.sh
now create a bash script named mount_fs.sh as follows
Bash:
#!/sbin/sh
mount /dev/block/mmcblk0p2 /res/sdext
flag_boot=`cat /res/sdext/flag_kdpr`
if [ ${flag_boot} -eq 1 ]
then
mount /res/sdext/system.kdpr /system
mount -o remount,rw /res/sdext/system.kdpr /system
mount /res/sdext/data.kdpr /data
else
mount /dev/block/mtdblock0 /system
mount -o rw,remount /system
mount /dev/block/mtdblock1 /data
fi
make a folder named /res/sdext or choose mount point of your choice
We will be controlling the mount point and boot via the file flag_kdpr.
Using this flag we can also achieve MultiBoot
Repack the boot image.
Installing Secondary ROM
Open the zip and extract the updater script .
Remove the lines for mounting/formatting system and data.
Repack the zip
Mount sd-ext
Run these commands in terminal
Code:
mount /sd-ext/system.kdpr /system
mount /sd-ext/data.kdpr /data
Install the zip ROM.
ROM will be installed in the dump images.
Booting to secondary ROM:
In the recovery or first ROM run this command
Code:
echo 1 > /sd-ext/flag_kdpr
OR
Code:
echo 1 > /res/sdext/flag_kdpr
and reboot
Booting to primary ROM:
In the recovery or first ROM run this command
Code:
echo 0 > /sd-ext/flag_kdpr
OR
Code:
echo 0 > /res/sdext/flag_kdpr
and reboot
Stage 2 : Ramdisk Mod .
This is actually theoretical, but it should work anyway. @nobodyAtall 's recovery for locked bootloader works in a similar fashion.
This is for LXP+ kernels or kernels who use init.sh to load the ramdisk archives.
Steps .
Preparation :
SD Card
Add a folder named ramdisk in root of second SD card
Code:
mkdir ramdisk
Add ramdisks in this folder
Add a flag for ramdisk
Code:
touch flag_ramdisk
Make a script mount ramdisk.sh
Bash:
#!/sbin/busybox sh
flag_ramdisk=`cat /sdext/flag_ramdisk`
if [ ${flag_ramdisk} -eq 1 ]
then
busybox cpio -i < /sdext/ramdisk/abc_ramdisk.cpio
elif [ ${flag_ramdisk} -eq 2 ]
then
busybox cpio -i < /sdext/ramdisk/pqr_ramdisk.cpio
else
busybox cpio -i < /sbin/ramdisky.cpio
fi
Ramdisk of Primary kernel
Edit init.sh
create directory
Code:
mkdir -m 755 -p /sdext
Mount second SD card partition before loading the ramdisk
Code:
mount /dev/block/mmcblk0p2 /sdext
Comment or delete the line loading kernel.
Replace/add with
Code:
busybox sh /sdext/ramdisk.sh
Unmount Second sd card
Ramdisk will "theoretically" load.
Handling Multiple Ramdisks and Multiple Mounts.
Multiple Ramdisk mod is useful when.
You have to test a new ramdisk
You have to run alternative ROM on a same kernel(e.g MIUI)
Load custom recovery for alternative mount points (CM12 ,Secondary ROM)
Dual/Multi ROM is useful for
Alpha/Beta testing
For the lulz
Both of these mods are independent of each other.
You can use Primary Ramdisk with Ramdisk mod and Secondary Ramdisks with mount mods
Multi Boot is similarly implemented. Except you need lot of space in second partition ,each around 1-1.5 GB per system-data combo.
Some "friendlier" ways to dual Boot.
Method 1
Noob Friendly Instructions for Dual Boot.
I have done most of the heavy lifting
You need to flash the kernels above first.
Currently only Radium is supported for primary ROM.
But you can install ANY ICS ROM as secondary.
Requirements :
Basic Notepad Skills.
Dual Partition SD card Exceeding 1.2GB atleast.
Battery % atleast above 70%
Patience
Download
https://www.mediafire.com/folder/aiv828ivuumrk/Dual_Boot_Zips
Download all zips in this folder.
Definition
Dual_Boot_Install_400.zip : 400MB system + 400 MB data
Dual_Boot_Install_600.zip : 400 MB system + 600 MB data
Dual_Boot_Install_800.zip : 400 MB system +800 MB data
Mount.zip : To Mount The secondary system/data before installing ROMs
prim.zip : Boot to Primary ROM
sec.zip :Boot to Secondary ROM
Setup Dual Boot:
Go to recovery
Go to mounts & storage
Format sd-ext
Flash any ONE of the Dual_Boot_Install_Zips
Patience part comes here. Depending on how your SD card is ,it takes 5-10 minutes to copy.
ROM Preparation
Extract the updater script of your ROM zip in your desktop.
Open it in notepad++
Delete the lines mounting and formatting system and userdata like these
unmount("/system");
format("MTD", "system");
mount("MTD", "system", "/system");
Click to expand...
Click to collapse
Copy back the updater script in the ROM folder
Copy ROM to SD card
ROM installation:
Run Mount.zip
Run The ROM installer
Finished
Before Installing Zips below ,Make sure sd-ext is NOT mounted in mounts and storage.
Booting to primary ROM
Run the primary.zip in recovery OR
OR
mount sd-ext and run
Code:
echo 0 > /sd-ext/flag_kdpr
in adb shell
Booting to secondary ROM
Run the secondary.zip in recovery.
OR
mount sd-ext and run
Code:
echo 1 > /sd-ext/flag_kdpr
in adb shell
Those huge blank images can be fit in such a small zip file. There is no data so it can be compressed to the Max.
Method 2
Even more easier Dual ROM installation. This type of stuff can only be achieved on the Zero Layout
Noob Friendly Instructions for Dual Boot.
Requirements :
Dual Partition SD card Exceeding 1.2GB atleast.
Battery % atleast above 70%
Patience
Download
https://www.mediafire.com/folder/aiv828ivuumrk/Dual_Boot_Zips
Download all zips in this folder.
Definition
Dual_Boot_Install_400.zip : 400MB system + 400 MB data
Dual_Boot_Install_600.zip : 400 MB system + 600 MB data
Dual_Boot_Install_800.zip : 400 MB system +800 MB data
Mount.zip : To Mount The secondary system/data before installing ROMs
prim.zip : Boot to Primary ROM
sec.zip :Boot to Secondary ROM
clone2.zip :cloning Primary ROM to Secondary ROM
Setup Dual Boot:
Go to recovery
Go to mounts & storage
Format sd-ext
Flash any ONE of the Dual_Boot_Install_Zips
Patience part comes here. Depending on how your SD card is ,it takes 5-10 minutes to copy.
ROM INSTALLATION :
Install Secondary ROM as you install any ROM
Finish installation
Don't reboot.
Mount sd-ext in mounts and storage
Flash clone2.zip
[optional]Watch Anime
After installation finished
Install Primary ROM.
Finish Installation
Clone Zip basically clones your running ROM as secondary ROM. This stuff beats nandroid backup !!
Booting to primary ROM
Run the primary.zip in recovery OR
OR
mount sd-ext and run
Code:
echo 0 > /sd-ext/flag_kdpr
in adb shell
Booting to secondary ROM
Run the secondary.zip in recovery.
OR
mount sd-ext and run
Code:
echo 1 > /sd-ext/flag_kdpr
in adb shell
Those huge blank images can be fit in such a small zip file. There is no data so it can be compressed to the Max.
Lagfix after a while.
After 5-7 boots , Secondary ROM starts lagging.
fsck is needed to be performed from the reccovery to fix lag.
Commands :
Code:
e2fsck /res/sdext/data.kdpr
e2fsck /res/sdext/system.kdpr
Or just add it to mount scripts before mounting.
@karandpr,is there any possibility to dualboot some roms with different kernel layout or version (like multiboot on newer phone)?
ryanrinaldhi said:
@karandpr,is there any possibility to dualboot some roms with different kernel layout or version (like multiboot on newer phone)?
Click to expand...
Click to collapse
Nope. On fly layout change is impossible.
Even when you change layout ,you need a fastboot erase ,or the consequences can be weird.
Version change is possible.
anonymous had a kernel which can boot ICS , CM9 ,CM 10 & MIUI JB.
Multiboot off his hybrid kernel is very possible.
I am exploring the possibility of Kitkat and lollipop since both are versions 3.4 . Not sure if it can happen but worth a risk.

[Guide]Resizing Partitions on Android (Redmi device)

4 this kind of guys x)
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Code:
Warning:
Your device will never boot :D
Does this enough?
Ok jk but consider its possible
So don't blame me,
not responsible for anything
Trick:
Read 2nd Post First
(if u think necessary)(i would)
Why ?? :
Cuz u want to increase/decrease size on internal storage/internal sd card/nand/emmc.
So u can save Avengers 1080p in dual audio
I.e. default internal storage will increase from 24.x GB to 26.x GB
Sounds cool ?
Go ahead
Tools required:
0. Nandorid Backup ,
back up everything every way you can/know
1. Rooted Phone
2. Custom Recovery with ADB Sideload
3. Minimal ADB and Fastboot Tools(for Computer)
4 parted utilities.zip (download from below)
5. Computer should recognise device for that install necessary drive
6. brain, commen sense, patients,calm etc.
---> PROCEDURE/STEPS
(will add screen shot, Rewrite again )
1.
Extract 'parted' from zip copy to "/system/bin"
(if can't Open Es File explorer app>find & tape Root explorer option>mount r/w option> mount system to r/w (read/write allow)
2.
Put phone in TWRP Recovery
3.
Connect to computer
On command line interface
(Windows>Run>CMD>enter)
#commands:
adb shell
su
parted /dev/block/mmcblk0
you will see the following screen
4.
Now to see the partitions and their partition numer use the following command
print
It will output a screen like follows
From the list above we can see partition number, the start position, the end position and the type of partition
Now from the List we need to figure out what partitions we need to remove and remake, and since we are majorly concerned about the Userdata and system partition, we will be playing around with those partitions only. But from the screenshot above you can see that Between the system and the userdata partition there is the cache partition.
To avoid any problems further. i would suggest you take a screenshot of this list .
5
Now Enlisting the partitions that we would have to remove inorder to resize them, they are:-
partition no. 27 i.e. system
partition no. 28 i.e cache
partition no. 29 i.e. userdata
In case you are using a device that has 2 system partitions (For eg. MI3) and you wanna reduce system2 and increase system1 you will need to delete only those 2 partitions
So now going further we will now remove the partitions using the following commands
rm 27
The above command will remove the partition no. 27 i.e the system partition
rm 28
This will remove the partition no. 28 i.e cache
rm 29
This will remove the partition no. 29 i.e. userdata
At this point of time you have lost all the data on your internal storage, system and cache partition. that means your device wont boot anymore except in recovery (which we are already in )
6.
Now that we have removed the partitions, we have raw space with us, which we would allocate to the three partitions that we removed, as per our choice.
To do that, we use the following commands
mkpartfs primary ext2 336 1250
mkpartfs primary ext2 1250 1653
mkpartfs primary ext2 1653 7818
336 is the start position of the partition and 1250 is the end position of the paritition.
since the partitions we removed started at 336 and ended at 7818, for my device, we would be able to play around only between these two numbers. i.e 336 and 7818
The first parition we made here is numbered 27 by default and will be of the size (1250-336 = 914) MBs
The second partition we made is numbered 28 and will be of the size 403 MB. (This is the cache partition and since I did not want to change the size i kept it the same)
The third partition we made is numbered 29 and will be of the size (7818-1653 = 6165) MB
The Important thing we need to note here is that the partition Number should not change as this could cause problems later on. i.e., considering my case the system parition should be 27, cache should be 28 and userdata should be 29.
7.
Now we will name these partitions using the following commands
name 27 system
name 28 cache
name 29 userdata
8.
Now punch the following command
quit
This will make you come out of parted utility. so that we can perform the next set of commands
Now we need to convert the partitions from ext2 to ext4 using the following commands
**// For System Partition //**
tune2fs -j /dev/block/mmcblk0p27
e2fsck -fDp /dev/block/mmcblk0p27
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p27
e2fsck -fDp /dev/block/mmcblk0p27
**// **
**// For cache Partition //**
tune2fs -j /dev/block/mmcblk0p28
e2fsck -fDp /dev/block/mmcblk0p28
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p28
e2fsck -fDp /dev/block/mmcblk0p28
**// **
**// For userdata Partition //**
tune2fs -j /dev/block/mmcblk0p29
e2fsck -fDp /dev/block/mmcblk0p29
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p29
e2fsck -fDp /dev/block/mmcblk0p29
**// **
9.
Now we have changed the type of the 3 partitions that we created from ext2 to ext4 and we are ready to go
Now we will enter the parted utility again and check to see if the partitions are made properly or not.
parted /dev/block/mmcblk0
print
As we can see in the screenshot. The system partition is now 914 MB and the userdata partition is no 6165 MB
Now punch the command
quit
exit
exit
Yes you need to exit two times.. first to come out of super user and second to come out of ADB shell
10.
Now Once the repartitioning is done
you need to flash your ROM
(MIUI /Lineage/RR/Viper/Mokee etc)
Now exit sideload in the TWRP and goto Install and select the Rom package and flash it.
Reboot and you should be done!
CREDITS, Thanks :
https://iwf1.com/how-to-re-partition-your-android-tablet-or-smartphone-all-options-included-change-size-fs-type-etc
https://forum.xda-developers.com/crossdevice-dev/android-one-general/guide-repartition-internal-storage-to-t3292159
http://en.miui.com/thread-183258-1-1.html
Reserved
sry for being so direct
here explanation for things that might didn't understood
->
Note: as much as I’d like to, I do not currently possess the resources to grant readers technical support. The guide itself, in the vast majority of cases should be sufficient help. For any individual issue please refer to online forums which are meant for that purpose.
Why Re-Partition?
If you’re here out of curiosity or any other reason than necessity, you may wonder: “why would anyone want to repartition a smartphone / tablet?”.
To answer, each person probably has their own reason, a couple of such I can think of are:
In the case of an upgrade, when there’s not enough space on one partition but others has aplenty.
When you don’t have enough space to install more apps – since your data partition is full – so you want to resize that partition.
Of course, some cases can be resolved via a more simple solution, however, if you want to deal with the problem directly and not just bypassing it – repartition is perhaps the best way to go.
In order to re-partition your device, basically, these are the steps you’ll need to make:
1. Connect your device to your PC.
2. Open up a command shell, on Windows you’d probably use CMD / PowerShell, on Mac / Linux – Terminal.
2-a. Reboot into recovery mode. (Optional, depends on the partition you plan to modify)
3. Use ADB to connect to your device.
4. Launch a partitioning software.
5. Start partitioning.
6. Reinstall any required system file in case you’ve deleted those and afterwards you may exit the shell and reboot your device.
Explaining The Steps
1. We use another machine, in this case our PC, in order to re-partition Android, because we want to have access to our Android system just in case something goes wrong during the partitioning, and also, since Android system cannot be run and resized at the same time.
2. This step is rather self explanatory. We must use a flexible tool that will assist us re-partitioning.
2-a. If you wish to modify any partition other than the recovery partition, I recommend booting into recovery mode in order to do so.
Being inside recovery mode wouldn’t interfere with the process as you may delete the system partition and its files. Furthermore, it might become handy in case you’ll need to reinstall Android system.
3. ADB is an official Android developers tool and it also happens to be the most suitable tool for the job at the moment.
5.
Since this step depends on what you’re actually intending to do with your device – it doesn’t say much, it is an open step, open for your decisions that is.
By typing the help command of your partitioning tool you’ll get a list of the options available to you. For example, these are a few of the options you’ll see in parted:
rm NUMBER – will delete a partition
mkpart – will create a partition
unit UNIT – will set unit type, for example “unit b” will set parted to use bytes, “unit gb” for Giga bytes, etc… (Tip: use bytes for maximum accuracy).
name NUMBER NAME – lets you name the partition (upon making any changes, don’t forget to name the partitions properly).
q – quit parted.
Important Things To Note:
fdisk executes your commands only when changes are saved whereas Parted executes them instantly.
fdisk may not fully support GPT partition table, thus in case yours is GPT, it’s recommended to use Parted instead.
6.
* Tip: If you’re unsure about your device partition names, you can use a command that shows them: cat /proc/partitions.
As you can see, there’s mmcblk0 – which is the main block where all the partitions are stored.
And there are 12 partitions in total which uses the name format “mmcblk0” plus “p” and a number that represent them, such as: mmcblk0p1, mmcblk0p2, etc…
Blocks lie inside /dev directory in Linux (yes, Android is a variation of Linux). We will use the block we’ve found in order to re-partition the device.
A short explanation regarding the relevant partitions:
Partition number 9 labeled FACTORYFS – is the “system” partition where all the operating system files are stored in.
Number 10 – DATAFS – is the “data” partition where all applications usually save their data.
Number 11 – UMS (USB Mass Storage) – is the internal storage partition where all the stuff such as: pictures, videos, etc, are stored in.
To resize those, you’ll have to delete them all and then assign different sizes – this is where a backup might become handy (I recommend copying all the files to your computer prior to erasing any partition).
After erasing and re-partitioning the available space, you should re-label the partitions with the same names (for compatibility sake) and create file systems (I prefer using ext4, however, if your device came with other specific file systems, it might be a good idea to stick to those).
So, how do we do it?
Here’s the sequence of commands with a following explanation:
(parted) rm 9
(parted) rm 10
(parted) rm 11
Will delete FACTORYFS, DATAFS and UMS respectively.
************
From another thread different info
By default, Parted uses MB as the storage unit. To prevent possible unused space after repartitioning, we’ll use sectors as a unit instead.
Type
unit s
This’ll change to sectors.
Type
print
It’ll give a warning, just type
i
Then:
print free
At the top, you’ll see that the sector size is written. Write this number down somewhere. For my Android One 4GB, the sector size is 512 bytes.
Now, you need to understand what the list means. Each horizontal row shows the details of a partition.
The 1st column shows the partition number.
The 2nd column shows the start offset of that partition. That means that the partition starts at the location mentioned.
The 3rd column shows where the partition ends. Notice that each partition starts exactly 1 sector after the previous one ends.
The 4th column is obviously the size of the partition.
The 5th column is the file system used by the partition. If nothing is written in this column, that means that it’s a binary partition.
The 6th column is the partition name.
You’ll see that the sizes in that list are weird. They’re not in any standard unit you might know. That’s because we used sectors instead of megabytes. The ‘s’ after each number indicates that it’s in sectors. (You can use the default MB unit (1MB=1000 KB. 1KB=1000bytes), or the MiB unit (1MiB=1024 KiB), but that just might leave 1 or 2 MB of space unused. So, I’m using sectors).
Remember that 1 sector = 512 bytes for my phone.
There’s some free space at the top and bottom of the list. Leave that free space there. Do not make partitions using those.
To convert sectors to MiB or KiB:
1s = 512bytes (Use the sector size you wrote down previously for this step, it might not be 512 bytes for you)
1024 bytes = 1 KiB
1024 KiB = 1 MiB
1024 MiB = 1GiB
So, 4833280s = (4833280 x 512) B = 2474639360 B
= (2474639360 / 1024) KiB = 2416640 KiB
= (2416640 /1024) MiB = 2360 MiB
= (2360 / 1024) GiB = 2.30 GiB
We’ll use another terminal window with sizes in MiB now. So open another Parted prompt in a new terminal / command prompt window, but instead of
unit s,
this time, write
unit MiB
Type “print”, “i”, and “print free” again
Look at my 11th partition. Its size is 8MiB. I know that this logo partition doesn’t need more than 2 MiB. So, I’ll make it smaller.
When you make partitions smaller, all the data inside will be lost. So, we need to back up the partitions first.
Open a 3rd terminal window. Type
adb shell dd if=/dev/block/mmcblk0p11 of=/microSD/p11
The “dd” command copies bytes from the “if=” location, to the “of=” location. The internal storage is /dev/block/mmcblk0. The “p11” after that refers to the partition we are backing up. Notice that in the Parted list, “logo” has a partition number of “11”. So the general command to back up partitions is
adb shell dd if=/dev/block/mmcblk0p<partition_number> of=/microSD/p<partition_number>
From recovery, unmount all partitions except microSD and oem. Then back up partitions 11, and 13 from PC. We will copy the files from OEM instead of using dd. So type
adb shell mkdir /microSD/oem
adb shell cp –a /oem/ /microSD/oem
Go to /microSD/oem/oem/app with TWRP’s file manager, and delete everything there.
Open the 1st terminal with sizes in sectors.
Type
rm 11
This will delete the oem partition. Type
print free
.
Abhijeet Rajgor said:
sry for being so direct
here explanation for things that might didn't understood
->
Note: as much as I’d like to, I do not currently possess the resources to grant readers technical support. The guide itself, in the vast majority of cases should be sufficient help. For any individual issue please refer to online forums which are meant for that purpose.
Why Re-Partition?
If you’re here out of curiosity or any other reason than necessity, you may wonder: “why would anyone want to repartition a smartphone / tablet?”.
To answer, each person probably has their own reason, a couple of such I can think of are:
In the case of an upgrade, when there’s not enough space on one partition but others has aplenty.
When you don’t have enough space to install more apps – since your data partition is full – so you want to resize that partition.
Of course, some cases can be resolved via a more simple solution, however, if you want to deal with the problem directly and not just bypassing it – repartition is perhaps the best way to go.
Click to expand...
Click to collapse
Hey, Can you tell me the partition sizes for different partitions i.e. system, data, cache.... for the attached zip file.
incomplete guide
Bro go to link in the post guide is yet incomplete , I'll rewrite again with more specific n Direct to point
Thanks
Abhijeet Rajgor said:
Bro go to link in the post guide is yet incomplete , I'll rewrite again with more specific n Direct to point
Thanks
Click to expand...
Click to collapse
Do you know how we can delete the /cust partition and include it into the system?
I don't know
bekcicandrej said:
Do you know how we can delete the /cust partition and include it into the system?
Click to expand...
Click to collapse
Am yet working on my device itself yet didn't tried on Redmi 3s,
Cwm recovery for my Alcatel

Categories

Resources