[MOD] Increase RAM memory size(without swapper!) (good for gaming) - Xperia Play Android Development

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

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

[DEV] "Root easily your Gen8 device" (developers only thread!)

This thread is for discussing features and improvements of this rooting method
For questions and problems read the [HOWTO] thread
Project site online: archos-gen8-sde-rooting
wdl1908 said:
chulri what about creating a 1Gb file on the /mnt/storage and formatting that as ext3 copying all the original /data to it and then mounting that with a loop interface on /data.
Click to expand...
Click to collapse
That's what I tried previously (before the /data thing), but I had no luck and it's a big issue because android tries to unmount /mnt/storage when you connect your archos device to the computer but that's not possible because the lock of the mounted rw-file makes umounting of /mnt/storage impossible and I have to mount the rw-file before /mnt/storage gets mounted, that's another issue which must be resolved.
chulri said:
That's what I tried previously (before the /data thing), but I had no luck and it's a big issue because android tries to unmount /mnt/storage when you connect your archos device to the computer but that's not possible because the lock of the mounted rw-file makes umounting of /mnt/storage impossible and I have to mount the rw-file before /mnt/storage gets mounted, that's another issue which must be resolved.
Click to expand...
Click to collapse
Yeah I came to the same conclusion as you, that what I suggested would bork the usb mount option to the PC.
Another thing I realized is that the official firmware upgrades could probably update files on the data partition. So moving the whole partition is not an option as that would break the upgrade process.
I've been looking at splitting the storage partition in several parts with parted I found an arm binary at http://plugapps.com/arm/ maybe these can be included in the initramfs.
I've also been analyzing my data partition
Code:
# du -s /data/*
112003 app
70503 dalvik-cache
40084 data
4622 test
The test directory is the place where the google market is installed via arctools or gappsinstaller.
So if it's possible to split the storage partition in several part we could move these dirs to it's own partition. This would not be optimal a good solution would be to move the complete data partition over but this needs a bit of thinking how to handle upgrades.
wdl1908 said:
So if it's possible to split the storage partition in several part we could move these dirs to it's own partition. This would not be optimal a good solution would be to move the complete data partition over but this needs a bit of thinking how to handle upgrades.
Click to expand...
Click to collapse
We could shrink the internal storage and append partition(s) after it. I'll give it a try, as long as my usb port is broken I have more time to focus on this here
chulri said:
We could shrink the internal storage and append partition(s) after it. I'll give it a try, as long as my usb port is broken I have more time to focus on this here
Click to expand...
Click to collapse
I've been trying to cross compile e2fsprogs and parted but I can't seem to get it.
Code:
e2fsprogs-1.41.14$ cross ./configure --host=arm-linux-uclibcgnueabi --build=i686-linux
Completes without errors but the make does not complete.
Code:
gen_uuid.c:(.text+0x418): undefined reference to `__aeabi_read_tp'
../../lib/libuuid.a(gen_uuid.o):gen_uuid.c:(.text+0x788): more undefined references to `__aeabi_read_tp' follow
I've tried to use the pre-compiled packages but it seems they don't work or i'm missing something.
fdisk is already included in initramfs thus no need for a parted binary.
edit: but to minimize data loss we need a resize2fs binary to resize the fat/ext3 partition
mkfs.ext3 (for the rw partition) and fsck are included too in the initramfs by archos
chulri said:
fdisk is already included in initramfs thus no need for a parted binary.
edit: but to minimize data loss we need a resize2fs binary to resize the fat/ext3 partition
mkfs.ext3 (for the rw partition) and fsck are included too in the initramfs by archos
Click to expand...
Click to collapse
Yep resize2fs is part of e2fsprogs. I've been working on the packages in the buildroot there seems to be a lot of errors but I finally succeeded in building the e2fsprogs package. but riseze2fs is not included. I need to check the config for that package maybe there is an option missing.
To get the buildroot working properly you need to copy the file
Code:
cp local/g8_arm/g8_arm.config .config
remove the line
Code:
package/apdf/Config.in
from .config.cmd
remove the line
Code:
depends on BR2_EXT_UCLIBC_VERSION_0_9_30_1
from toolchain/uClibc/Config.in
then in the buildroot directory execute
Code:
make menuconfig
enable the e2fsprogs in Package selection -> Harware handling
also you have to remove the --disable-resizer from the e2fsprogs.mk file else the resizer is not build.
I can't believe this build package from archos is very up-to-date it seems very strange that all these bugs are in there how where they ever building a good firmware.
but that builds dynamic linked binaries, doesn't it? but we need a static build, don't we?
chulri said:
but that builds dynamic linked binaries, doesn't it? but we need a static build, don't we?
Click to expand...
Click to collapse
Yeah stupid me it needs to run in the initramfs and that does not contain any libraries. Let me check to see if it's possible to link it statically.
and because it has to be statically linked, maybe we better just take the newest e2fsprogs (btw.: does this support FAT resizing?!) and compile it without that buildroot stuff (except for the toolchain of course, we need that to crosscompile)
chulri said:
and because it has to be statically linked, maybe we better just take the newest e2fsprogs (btw.: does this support FAT resizing?!) and compile it without that buildroot stuff (except for the toolchain of course, we need that to crosscompile)
Click to expand...
Click to collapse
Well I tried that and failed. That's why I wanted to do it in the buildroot. I'll try again later need to create a clean environment and do some diffs after I fixed all the stuff that's wrong.
wdl1908 said:
Well I tried that and failed. That's why I wanted to do it in the buildroot. I'll try again later need to create a clean environment and do some diffs after I fixed all the stuff that's wrong.
Click to expand...
Click to collapse
I think I got it.
Add
Code:
export BOARD=g8_arm
To your .bashrc then in the buildroot directory do a make it will take a while as it needs to build everything. This is just a precaution as i think the statically linked resize2fs needs some linking with uclib libraries.
After that is finished do a
Code:
make e2fsprogs LDFLAGS=-static
in the buildroot directory. You should find the resize2fs binary in the directory buildroot/project_build_arm/uclibc/root/sbin
Code:
$ file resize2fs
resize2fs: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
resize2fs does not resize vfat so we probably need parted and some extra utils
How to compile parted with buildroot.
I found the attached files on some forum
e3fsprogs.mk is a replacement for the existing file.
Config.in parted.mk and parted-001-ui.cast.patch need to be placed in the directory buildroot/package/parted
then execute the following commands
Code:
make e2fsprogs LDFLAGS=-static
make e2fsprogs-libs
make parted LDFLAGS=-static
you can find the statically linked parted in buildroot/build_arm/parted-2.3/parted
and this is what i tried.
Code:
# [B]parted /dev/block/mmcblk1[/B]
GNU Parted 2.3
Using /dev/block/mmcblk1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) [B]print[/B]
print
Model: MMC MMC08G (sd/mmc)
Disk /dev/block/mmcblk1: 7466MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 8192B 7466MB 7466MB primary fat32 lba
(parted) [B]resize[/B]
resize
WARNING: you are attempting to use ./parted to operate on (resize) a file system.
./parted's file system manipulation code is not as robust as what you'll find in
dedicated, file-system-specific packages like e2fsprogs. We recommend
you use ./parted only to manipulate partition tables, whenever possible.
Support for performing most operations on most types of file systems
will be removed in an upcoming release.
Partition number? [B]1[/B]
1
Start? [8192B]?
End? [7466MB]? [B]6466MB[/B]
6466MB
(parted) [B]check[/B]
check
WARNING: you are attempting to use ./parted to operate on (check) a file system.
./parted's file system manipulation code is not as robust as what you'll find in
dedicated, file-system-specific packages like e2fsprogs. We recommend
you use ./parted only to manipulate partition tables, whenever possible.
Support for performing most operations on most types of file systems
will be removed in an upcoming release.
Partition number? [B]1[/B]
1
(parted) [B]quit[/B]
quit
Information: You may need to update /etc/fstab.
#[B]fdisk /dev/block/mmcblk1[/B]
The number of cylinders for this disk is set to 227840.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): [B]p[/B]
Disk /dev/block/mmcblk1: 7465 MB, 7465861120 bytes
4 heads, 16 sectors/track, 227840 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk1p1 1 197327 6314445+ c Win95 FAT32 (LBA)
Command (m for help): [B]n[/B]
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): [B]2[/B]
First cylinder (197327-227840, default 197327): Using default value 197327
Last cylinder or +size or +sizeM or +sizeK (197327-227840, default 227840): Using default value 227840
Command (m for help): [B]p[/B]
Disk /dev/block/mmcblk1: 7465 MB, 7465861120 bytes
4 heads, 16 sectors/track, 227840 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk1p1 1 197327 6314445+ c Win95 FAT32 (LBA)
/dev/block/mmcblk1p2 197327 227840 976426+ 83 Linux
Command (m for help): [B]w[/B]
The partition table has been altered!
Calling ioctl() to re-read partition table
# [B]mkfs.ext3 -v -I 128 /dev/block/mmcblk1p2[/B]
mke2fs 1.40.9 (27-Apr-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
61184 inodes, 244106 blocks
12205 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=251658240
8 block groups
32768 blocks per group, 32768 fragments per group
7648 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
# [B]tune2fs.static -c -1 -i 0 -m 1 /dev/block/mmcblk1p2[/B]
tune2fs 1.40.9 (27-Apr-2008)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
Setting reserved blocks percentage to 1% (2441 blocks)
I leave the scripting to you but with these utils it should work perfectly to resize the partition and create the second partition.
I copied the mkfs.ext3, fdisk and tune2fs.static from the recovery initramfs
I started hacking around and I came to the conclusion that it would be better to change the initramfs to mount /data from mmcblk1p2 if that partition exists and not if it's not existing and move the whole partition resizing, partition creating, partition deleting (if you wan't to revert without dataloss) and again resizing into an app. so the user has more control over what he's doing and see's if something is failing and not just get's a bootloop or some fancy log file.
edit: /data is mounted by /init.rc script, all of the above can be done by an app, incl. modifying /init.rc script. no need for any special initramfs, yay!
everybody who has +rw rooting installed will be able to use that app. I'm starting development...
edit2: project page online: http://code.google.com/p/archos-gen8-sde-rooting/
stay tuned
First test app: http://code.google.com/p/archos-gen8-sde-rooting/downloads/detail?name=AppDataResizer_v0.1.apk
Release notes:
initial test version v0.1:
- parted binary added
- test button lists partitions of mmcblk1 device
Click to expand...
Click to collapse
note: 250 GB version of the A70 is currently not supported.
chulri said:
First test app: http://code.google.com/p/archos-gen8-sde-rooting/downloads/detail?name=AppDataResizer_v0.1.apk
Release notes:
note: 250 GB version of the A70 is currently not supported.
Click to expand...
Click to collapse
Nice. Yep I was thinking about the transition from standard to custom and also came to the conclusion it had to be done outside the boot process scripts.
Edit: Should this app be installable via the usual way or should it be a system app? (Copied to /system/app)
What I was thinking was split the process in 3 steps.
Step1: Resize storage partition, Add new-data partition and format.
Step2: Copy existing /data to /new-data
Step3: Enable/Disable new-data
Maybe a step2a: To run after upgrade of firmware to check things that have changed.
The step1 requires a reboot as the partitioning should be done in the initramfs if you do that when apps are running you're going to have a hell of a time getting the storage partition unmounted (I know I had the problem when testing the parted binary)
Step2 can be done without any problem when storage is mounted and Step3 requires a reboot after the init.rc is changed.
wdl1908 said:
Nice. Yep I was thinking about the transition from standard to custom and also came to the conclusion it had to be done outside the boot process scripts.
Edit: Should this app be installable via the usual way or should it be a system app? (Copied to /system/app)
Click to expand...
Click to collapse
usual way (download and install) (or maybe I include it in the initramfs (like the Superuser.apk) and copy it to /system/app, but I don't like modifying initramfs any further, no need for 100 different versions )
wdl1908 said:
What I was thinking was split the process in 3 steps.
Step1: Resize storage partition, Add new-data partition and format.
Step2: Copy existing /data to /new-data
Step3: Enable/Disable new-data
Maybe a step2a: To run after upgrade of firmware to check things that have changed.
Click to expand...
Click to collapse
great, that were my plans too.
wdl1908 said:
The step1 requires a reboot as the partitioning should be done in the initramfs if you do that when apps are running you're going to have a hell of a time getting the storage partition unmounted (I know I had the problem when testing the parted binary)
Click to expand...
Click to collapse
No API to unmount /sdcard/? I think I got one: IMountService it's not a public API but android.os.FileUtils isn't public either and it's working great. I think IMountService is the API that the popup, which pops up when you connect your android device to the computer, uses. I think, no need to worry because android handles everything pretty well when you connect your device to the computer, isn't it?
wdl1908 said:
Step2 can be done without any problem when storage is mounted and Step3 requires a reboot after the init.rc is changed.
Click to expand...
Click to collapse
agreed
chulri said:
usual way (download and install) (or maybe I include it in the initramfs (like the Superuser.apk) and copy it to /system/app, but I don't like modifying initramfs any further, no need for 100 different versions )
Click to expand...
Click to collapse
I tried to install it but it won't install. logcat gives something like
Pckage chrulri.gen8.AppDataResizer has no certificated at entry res/layout/main.xml
Yep I agree no need for different versions of the initramfs
chulri said:
No API to unmount /sdcard/?
Click to expand...
Click to collapse
The problem is not only the mount of /mnt/storage if the user has used move2sd there are a lot of other mounts present that also uses that partition.
maybe the API will do. Needs to be tested.
One other remark. Let the AppDataResizer check for the unionfs directory so that you can be sure you'r running on the correct initramfs.

ext2 support?

Specifically, what do I need to install on my gtab so that it can read an sdcard formatted to ext2?
I've already installed Clockworkmod and Vegan-Tab Ginger. Maybe I need a different kernel too? I know very little about kernels - Are they device specific? Are they interchangeable? Can I change the kernel without wiping my files?
Has anyone ever had success with ext2 on the gtab?
deadfraggle said:
Specifically, what do I need to install on my gtab so that it can read an sdcard formatted to ext2?
Click to expand...
Click to collapse
Nothing.
I know very little about kernels - Are they device specific?
Click to expand...
Click to collapse
They have to be--that's their function after all.
Are they interchangeable?
Click to expand...
Click to collapse
They should be. For the gTablet, you can use either the Clemsyn or Pershoot kernels. Both have native extn support.
Can I change the kernel without wiping my files?
Click to expand...
Click to collapse
Yes.
Has anyone ever had success with ext2 on the gtab?
Click to expand...
Click to collapse
ext2/3/4 are all natively supported by the linux kernel, and issuing a mount command will work if you do it on the command line. However, the automounter program, called vold, likes to have ext4 or VFAT (aka FAT32) filesystems on the SD card. If your ext2 formatted SD card is not automatically mounted, format it again as ext4.
Formatted the sdcard to ext4, but still cannot read anything off it.
As for mounting through the terminal, if I use
fdisk -l
it shows nothing, not even an error. Is there another way to list disks so I know what to mount?
What I'm trying to do is use the Debian installer for Android, but the only version I could find is 2 years old. It's probably based on Lenny or earlier which does not have native ext4 support.
deadfraggle said:
Formatted the sdcard to ext4, but still cannot read anything off it.
Click to expand...
Click to collapse
What ROM are you on? Are you running Android or something else?
As for mounting through the terminal, if I use
fdisk -l
it shows nothing, not even an error. Is there another way to list disks so I know what to mount?
Click to expand...
Click to collapse
Code:
$ su
# /system/xbin/fdisk -l /dev/block/mmcblk3
Disk /dev/block/mmcblk3: 16.0 GB, 16097738752 bytes
255 heads, 63 sectors/track, 1957 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk3p1 1 1709 13720703 c Win95 FAT32 (LBA)
/dev/block/mmcblk3p2 1709 1958 1999744+ 83 Linux
Use /dev/block/mmcblk2 for the external SD card. Mount it as:
Code:
$ su
# mount /dev/block/mmcblk2p1 /some/path
or
Code:
$ su
# mount -t ext4 /dev/block/mmcblk2p2 /some/path
rajeevvp said:
What ROM are you on? Are you running Android or something else?
Click to expand...
Click to collapse
Vegan-Tab Ginger edition
rajeevvp said:
Code:
$ su
# /system/xbin/fdisk -l /dev/block/mmcblk3
Click to expand...
Click to collapse
This gives me similar results to yours.
rajeevvp said:
Use /dev/block/mmcblk2 for the external SD card. Mount it as:
Code:
$ su
# mount /dev/block/mmcblk2p1 /some/path
Click to expand...
Click to collapse
My result:
Code:
$ su
# mount /dev/block/mmcblk2p1 /micro
mount: mounting /dev/block/mmcblk2p1 on /micro failed: No Such file or directory
Also tried
mount /dev/block/mmcblk2p2 /micro
with the same result.
rajeevvp said:
or
Code:
$ su
# mount -t ext4 /dev/block/mmcblk2p2 /some/path
Click to expand...
Click to collapse
My result:
Code:
$ su
# mount -t ext4 /dev/block/mmcblk2p2 /micro
mount: mounting /dev/block/mmcblk2p2 on /micro failed: No Such file or directory
Edit:
If I insert a ext2 formatted sdcard, I get a notice that it is being scanned for errors. It goes away after a minute or so.
If I go to /sdcard2 in Root Explorer, the folder is empty but the stats show a correct 2 gb of used space and the correct amount of free space.
(Also in Root Explorer, if I try to create a test file, it says 'successful' but no file is created.)
If someone here owns a gtab and can access a ext2/4 sdcard, please let me know what setup/Rom you are using. Or if you own an extra sdcard you can format to ext2, and use some other aftermarket ROM/different kernel on your gtab, please test and post your results.
The commands I gave were just examples, you'll have to adjust them to suit your system.
deadfraggle said:
If I insert a ext2 formatted sdcard, I get a notice that it is being scanned for errors. It goes away after a minute or so.
Click to expand...
Click to collapse
That looks like the correct behaviour. The external SD card is being fsck'd and then automounted.
If I go to /sdcard2 in Root Explorer, the folder is empty but the stats show a correct 2 gb of used space and the correct amount of free space.
Click to expand...
Click to collapse
This, again, is correct, except that on a newly created filesystem, Root Explorer should've shown a lost+found directory.
(Also in Root Explorer, if I try to create a test file, it says 'successful' but no file is created.)
Click to expand...
Click to collapse
Reformat the filesystem again and try creating a file using the command line:
Code:
$ su
# echo test > /mnt/sdcard2/test.txt
# cat /mnt/sdcard2/test.txt
test
#
My external SD card is formatted as ext3 and I have no problem using Root Explorer. With other file managers, you'll have to be careful because of the standard Unix permissions that come into effect on all extn filesystems. If you want to use file managers other than Root Explorer, just create a new directory on your ext2 filesystem and give that directory a user of "system" and a group of "sdcard_rw", and give (at least) the group "rwx" permissions. Use the user, group and permissions of the /mnt/sdcard directory as a guide:
Code:
$ ls -ld /mnt/sdcard
d---rwxr-x 22 system sdcard_rw 8192 Jan 1 1970 /mnt/sdcard
$ su
# mkdir /mnt/sdcard2/user-dir
# chmod 0775 /mnt/sdcard2/user-dir [I]#or 0075 to exactly match /mnt/sdcard[/I]
# chown system.sdcard_rw /mnt/sdcard2/user-dir
If you don't want to bother with all this, just format the SD card as VFAT, and Android will automatically mount the VFAT filesystem with an owner of "system" and a group of "sdcard_rw". And since (all?) file managers belong to the "sdcard_rw" group, they get automatic read-write permissions to that filesystem. BTW, the Terminal Emulator app also belongs to the "sdcard_rw" group, so you can freely write onto VFAT formatted SD cards on the command line without resorting to the 'su' command (the example above).
Granted, it's been a while since I researched this - but I learned many months ago that the version of VOLD in Froyo does not support anything else but vFAT - so it just won't mount EXT2, or NTFS for that matter.
the mount command would bypass VOLD and we know that NTFS should work, if it's a custom kernel. Conceivably EXT2 should also work, but since it was all manual scripting I just stopped researching it - mainly because I'd still have issues using the card with other devices so it wouldn't really be a portable solution anymore.
As much as I detest FAT32 for its file size limitations, it's still the "standard" between portable devices. The various vendors have yet to figure out a replacement, since they can't seem to agree on anything.
rajeevvp said:
My external SD card is formatted as ext3 and I have no problem using Root Explorer.
Click to expand...
Click to collapse
Figures. Never tried ext3, mainly because it's not a readily available option in Ubuntu. Tried to format to ext3 via the terminal but got a weird error, even after unmounting the drive:
"/dev/sdb is apparently in use by the system; will not make a filesystem here!"
So I booted in to Parted Magic with my netbook, wiped the sdcard, and created a new ext3 partition.
Success!!
The sdcard auto-mounts, and is accessible by Root Explorer, ES File Explorer and File Manager.
Ext3 will suit my purposes just fine. Sorry to make you write all the rest of your post, but it will be a handy reference.
Thank you a million times over!
@ roebeet
I'm humbled this post got your attention. Thanks for the great work!
deadfraggle said:
Figures. Never tried ext3, mainly because it's not a readily available option in Ubuntu.
Click to expand...
Click to collapse
The ext3 format was the default filesystem of Ubuntu, until just recently. It is generally considered better to use ext2 on a SD card. Since a SD card has a limited number of read/writes, a journaling filesystem like ext3/ext4 would use up the limited number of read/writes faster than using ext2. Also, never create a swap partition on a flash drive or SD card.
To format a SD card in Ubuntu, first determine the device name:
Code:
[email protected]:~$ sudo fdisk -l
[sudo] password for paul:
Disk /dev/sda: 64.6 GB, 64609058816 bytes
255 heads, 63 sectors/track, 7854 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000d996
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3890 31246393+ 83 Linux
/dev/sda2 3891 7854 31840830 83 Linux
Disk /dev/sdb: 16.4 GB, 16437477376 bytes
255 heads, 63 sectors/track, 1998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b3366
Device Boot Start End Blocks Id System
/dev/sdb1 1 1998 16048903+ 83 Linux
My EEEPC has a 64 GB hard drive, and a 16 GB SDHC card. So the card I want to format is /dev/sdb1. Use fdisk again for the formatting, here are the steps copied directly from my terminal:
Run commands with root privileges (sudo).
Find the disk:
# sudo fdisk -l
Format the disk (sdb1):
# sudo fdisk /dev/sdb1
Command (m for help):d (delete any existing partitions)
Command (m for help):n (create a new partition)
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4):1
Command (m for help):w (to write the changes to the disk)
Format the card. You may need to unmount it first:
# sudo umount /dev/sdb1
# sudo mkfs -t ext3 /dev/sdb1

[GUIDE] Config EXT+SWAP partition on AlfsKernel+GDX

I made this Tutorial for enable ext and swap partition.
I have based this guide on:
- sdparted script (thanks to 51dusty): i modified the script for works on our X8
- on http://forum.cyanogenmod.com (Enabling swap)
Requirements:
- AlfsKernel (i used v03 for this tutorial)
- GDX (i used V019 for this tutorial)
- ADB
- sdcard (i used SD 8GB class 4 -> recomended class 6)
Click to expand...
Click to collapse
My configuration: (with SD 8GB class 4)
- fat32 -> 7040 MB
- ext3 -> 1024 MB
- swap -> 128 MB (swappiness 100)
Click to expand...
Click to collapse
Instructions:
1) download sdparted.txt and userinit.txt below to root of sdcard
2) boot into CWM recovery
3) mount /sdcard, /sd-ext (if you have ext partition) and /system
4) backup sdcard: adb pull /sdcard/ sdbackup
5) If you have ext partition and you want backup this: adb pull /sd-ext/ sdextbackup
6) run: adb shell
7) move sdparted.txt to /sbin -> mv /sdcard/sdparted.txt /sbin/sdparted
8) then, chmod 755 /sbin/sdparted
9) run sdparted: for the differents options see the original thread
This is for my configuration -> sdparted -es 1024M -ss 128M -efs ext3
10) restore sdcard backup: adb push sdbackup /sdcard
11) restore sd-ext backup( if necessary): adb push sxtbackup /sd-ext
12) move userinit.sh to /sd-ext -> mv /sdcard/userinit.txt /sd-ext/userinit.sh
13) then, chmod 755 /sd-ext/userinit.sh
14) reboot
Click to expand...
Click to collapse
Note:
For change swappiness, you must edit userinit.txt before of copy this to sdcard. You must modified line 12 with the value you want:
echo 100 > /proc/sys/vm/swappiness;
Click to expand...
Click to collapse
15-11-2011
Change sdparted.txt, there is error with command -ufs.
Click to expand...
Click to collapse
exactly what is this swapper for??
i've never used it before
here
make google as your friend..
i use swapper 2 with swap partition and is working perfectly.
i have a swap partition with 128mb,ext 3 with 512mb and the rest in fat32.
my sdcard is a kingston 4gb class 4.
jajss said:
i use swapper 2 with swap partition and is working perfectly.
i have a swap partition with 128mb,ext 3 with 512mb and the rest in fat32.
my sdcard is a kingston 4gb class 4.
Click to expand...
Click to collapse
With this, you don't need any app.
This is another option for use swap taking advantages of the kernel, and i think that some users don't know.
MarJar said:
With this, you don't need any app.
This is another option for use swap taking advantages of the kernel, and i think that some users don't know.
Click to expand...
Click to collapse
ok.i only say that because swapper 2 its noob friendly.
Hi dev,
Just ask questions, what is swapiness?
Whats wrong if swapiness set to higher value or lower value?
Sent from my SK17i using XDA Premium App
you can see this http://en.wikipedia.org/wiki/Swappiness
After some test, for me, the best performance is 100; but for some people is 80. You must test it in your phone with your configuration and apps.
For change it and test without reboot, you can type in console: sysctl -w vm.swappiness=0
MarJar said:
you can see this http://en.wikipedia.org/wiki/Swappiness
After some test, for me, the best performance is 100; but for some people is 80. You must test it in your phone with your configuration and apps.
For change it and test without reboot, you can type in console: sysctl -w vm.swappiness=0
Click to expand...
Click to collapse
Nice info, thankz dev for reference.
Sent from my SK17i using XDA Premium App
anyone experienced any performance improvements after enabling swap?
i can notice in games that slowed down sometimes. On the rest i can't notice anything at least for now.
and i have swapiness set to 80.
Nice tutorial, I have question :
1. Can I install it with terminal emulator or script manager?
2. When I want to change kernel (alf's kernel to LDX), is it need re-setting (re-install) or not?
ahlulnugraha said:
Nice tutorial, I have question :
1. Can I install it with terminal emulator or script manager?
2. When I want to change kernel (alf's kernel to LDX), is it need re-setting (re-install) or not?
Click to expand...
Click to collapse
1) I don't test in terminal emulator, but 51dusty in his thread say NO.
2) i don't re-setting anything when i did
Dexter_prog said:
anyone experienced any performance improvements after enabling swap?
Click to expand...
Click to collapse
For me, all work better
hi
everytime i try to sdparted i get this output
/ # sdparted -es 1024M -ss 128M -efs ext3
sdparted -es 1024M -ss 128M -efs ext3
[: not found
[: not found
[: not found
checking script requirements...
checking /dev/block/mmcblk0...
[: not found
err: /dev/block/mmcblk0 does not exist!
:S
guelas said:
hi
everytime i try to sdparted i get this output
/ # sdparted -es 1024M -ss 128M -efs ext3
sdparted -es 1024M -ss 128M -efs ext3
[: not found
[: not found
[: not found
checking script requirements...
checking /dev/block/mmcblk0...
[: not found
err: /dev/block/mmcblk0 does not exist!
:S
Click to expand...
Click to collapse
+1
guelas said:
hi
everytime i try to sdparted i get this output
/ # sdparted -es 1024M -ss 128M -efs ext3
sdparted -es 1024M -ss 128M -efs ext3
[: not found
[: not found
[: not found
checking script requirements...
checking /dev/block/mmcblk0...
[: not found
err: /dev/block/mmcblk0 does not exist!
:S
Click to expand...
Click to collapse
+1
ADB writes this for me too.
I googled a bit, and "they've" said that the newer CWM could be the problem, it's not fully compatible to all SDCARDs. (mine is a Class6 8Gigs)
u need mount /data & /system.
terst said:
u need mount /data & /system.
Click to expand...
Click to collapse
We followed all the steps, and that includes mount data and system.
hi,
When I use this option(alfs 03+dx020).
sdparted -es 512M -ss 256M -efs ext4
got error like these:
converting /dev/block/mmcblk0p2 to ext4 filesystem...
/dev/block/mmcblk0p2: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
(i.e., without -a or -p options)
done
retrieving current sdcard information...
/sbin/sdparted: line 637: parted: not found
script log is located @ /data/sdparted.log
---------- Post added at 06:39 PM ---------- Previous post was at 06:25 PM ----------
guelas said:
We followed all the steps, and that includes mount data and system.
Click to expand...
Click to collapse
change like this (the fist line of sdparted.txt)
#!/sbin/sh
---------- Post added at 07:04 PM ---------- Previous post was at 06:39 PM ----------
E15_nAa-06b_2.6.29.6-nAa-06b.ftf worked for me!
option: sdparted -es 512M -ss 256M -efs ext4
retrieving current sdcard information...
Model: SD H2104 (sd/mmc)
Disk /dev/block/mmcblk0: 16.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 512B 15.2GB 15.2GB primary fat32 lba
2 15.2GB 15.8GB 512MB primary ext4
3 15.8GB 16.0GB 256MB primary linux-swap(v1)
Guy how to detect that the swap partition has been activated.
I have got the complete success msg as mentioned.
It is silly question but need help on this .

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

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

Categories

Resources