yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] alapapa:
is there any reason that we can't use a swap file on /cache? does the implementation of yaffs2 and/or the kernel piece for swap not support this by design?

i did this:

/cache # dd if=/dev/zero of=/cache/swap.swp bs=1024 count=24576
/cache # mkswap /cache/swap.swp

no errors to this point...then

this fails:

/cache # swapon /cache/swap.swp
swapon: /cache/swap.swp: Invalid argument

but...if i cp the file to /system/sd and repeat the swapon w/ the new path, it works and registers in the free command.

I don't want to exclusively swap internally, but they say you see better performance if you swap on multiple devices / buses simultaneously

any ideas? any reasons i shouldn't circumvent this?

p.s. i nested an ext formatted file (loopback mounted) on /cache and was able to activate a swapfile inside it (albeit tragically slow due to the io overhead). just thought it was interesting, is all
[G1 Android Development] kkll70:
Does anything actually go into the ext2 partition that I have... ?
[G1 Android Development] andonnguyen:
Looks about right. That's what I did at first. Now I just sh userinit.sh whenever I want swap on, instead of modifying a2sd, cause I change builds so often. Looks like you are on JAC's hero build, so please advise people not to use this a2sd script for any other builds (because cyanogens is completely different, and any other build).
[G1 Android Development] engagedtosmile:
So when I type in free and it shows numbers in the swap row that means its working?
[G1 Android Development] Bavilo:
Ah yes Sorry,

I forgot to mention that I was using JACs Hero build.

So if you want to modify your a2sd script just use your current one and add the following lines to it.

if [ -e /dev/block/mmcblk0p3 ];
then
echo 20 > /proc/sys/vm/swappiness
swapon /dev/block/mmcblk0p3
fi;
[G1 Android Development] wc326:
what do you mean by cp command.???

type $su (terminal only)

# CP /sdcard/userinit.sh /system/sd/

#chmod 775 /system/sd/userinit.sh

#sh /system/sd/userinit.s

>???
[G1 Android Development] rsxtypes72:
For ppl get the cross link error us cp command instead of mv

that is correct.

Just wanted to say thanks finally got my swapon.

HTC music player runs smoother now. Web pages load a lot faster.

Thanks you all
[G1 Android Development] ccyrowski:
auto auto linux swap

This is a modified a2sd.sh from JAC 2.3.2 to auto-mount and start linux-swap partition at start up.

Follow the link!

http://xdaforums.com/showthread.php?t=532789

Note: I have only tested this on 2.3.2, but it works!
[G1 Android Development] ScottGood:
in this portion of the userinit.sh or A2SD file depending on the method used:

if [ -e /dev/block/mmcblk0p3 ];
then
echo 20 > /proc/sys/vm/swappiness
swapon /dev/block/mmcblk0p3
fi;

echo 20 > /proc/sys/vm/swappiness

sets swappiness to 20?

if this is true then:

echo 60 > /proc/sys/vm/swappiness

will set swappiness to 60 correct?
[G1 Android Development] juangil:
this is correct, if you have swapper app(make sure is off and not to turn on at boot), click "get info" and it will show your current swappiness and partition size, pls let me know if you make the auto-mount working in jac' 2.3.3
[G1 Android Development] wc326:
really i didn't work for me. Jachero 2.3.3 build lol
[G1 Android Development] wc326:
does doing this command in terminal

will allow the phone to use swapper thing in my new formatted Linus swap 32Mb partition

or is there anything i need to do for the swapper thing to do its thing in the linux swap partition ??

thank you very much

when i type #sh /system/sd/userinit.sh

i get this errior

swapon: /dev/block/mmcblk0p3: invalid argument

Help please
[G1 Android Development] juangil:
did you set up the swap partition yet, before turn swapon?

mkswap /dev/block/mmcblk0p3
[G1 Android Development] wc326:
yea

i have

fat32 7gb

EXT3 500Mb

Linux Swap 32 Mb

is it correct?

Edit

YOu are the man thank you

after typing mkswap /dev/block/mmcblk0p3 in terminal

i am able to type the following command

now when i type Free. i see 32 Mb free swap space.

THank you very much ^^

one more question

is there any advantage using this command than the swapper apk apps from market?
[G1 Android Development] juangil:
I haven't find a working solution to start swap at boot yet, so this is it, you have to run the .sh script every boot, make sure you remove the built in swapper app or uncheck the "turn on at start" box form it... you can also check if your swap partition is working by clicking "get info" (even when swapper app its off)

edit:

type $su (terminal only)

# CP /sdcard/userinit.sh /system/sd/

#chmod 775 /system/sd/userinit.sh

#sh /system/sd/userinit.sh do only this at every boot

if there is a way to turn swapper app "on" and assign the swap-fs partition I dont know it
[G1 Android Development] wc326:
i only got 31Mb in my linux swap partition , is there going to be issue with that?? instead of 32 mb
[G1 Android Development] juangil:
it doesn't need to be an specific size, just 32 or lower is recommended
[G1 Android Development] sfcdale:
swap file vers swap partition

I have been using a swap file for a while with good performance :D.

MY ? is. does flash memory wear-leveling work a well for a swap partition as it should for a file? :confused:
[G1 Android Development] wc326:
i just found out that even when i format and create Linux Swap 1 in paraagon partition program, then it will automaticlly turn into linus swap 2..

i even did it 3 times and clicked on linux swap1.....

so what's wrong with it and is it not good to use linux swap 2?
[G1 Android Development] Chahk:
I find that Cyanogen's 3.6.x runs best when swappiness is set at 30 on a 24MB linux-swap partition.

One important note for folks on builds other than Cyanogen's recent ones who edit a2sd to either add a call userinit.sh or to turn on the swap partition directly. The a2sd script is overwritten each time you flash a new version of the build, so unless the ROM maker adds this functionality to their a2sd, your changes will get wiped off. However, don't simply save a copy of a2sd and then push it over after flashing a new build version, because the ROM author might have made changes to it. You will need to pull the latest version of a2sd script, make the changes and push it back. That way you don't end up breaking things (like yours truly did once).

Finally... Folks! Stop worrying about the lifespan of your SD cards because of using apps on SD, or swap. You will probably move on to a newer phone before the SD cards start to wear off. And even if that does happen, the cards will not suddenly die. The wear leveling mechanism will start avioding writing to bad blocks, which will manifest itself by simply showing the card as having less capacity over time.

Another point. I bought my 8GB Class 6 Micro-SD card for under $20 USD, which came with an SD adapter. When our cards do start to show their age, the new ones will probably be even cheaper, have more capacity, and be generally more advanced in terms of their lifetime. So do yourselves a favor - back up your important stuff often, and don't worry about losing the SD cards.
[G1 Android Development] MontAlbert:
just did this on cyanogen 3.6.1. worked perfectly. instead of mv i did adb push of file from my pc to /system/sd.

thanks heaps. hopefully it will still work when try out dude's build on monday (new release)...will it?
[G1 Android Development] temporizer:
Does this mean I have a swap partition?

c:\android\tools>adb shell free
total used free shared buffers
Mem: 97908 96088 1820 0 376
Swap: 32120 1384 30736
Total: 130028 97472 32556

c:\android\tools>
[G1 Android Development] free-sidux:
Yes, since the values behind swap: are bigger than 0.

My question:

It seems I have to rerun sh userinit.sh after reboot?

Do I miss something?

btw: I'm on JACHero 2.3.3
[G1 Android Development] Chahk:
Not sure if JACHero supports auto-swap partition. Pull and check its /system/bin/a2sd script. If it doesn't have it - add a call to userinit.sh at the end, push it back and reboot.

You can refer to Cyanogen's version of this script:

# call a userinit.sh script if it's present on the sdcard
if [ -e /system/sd/userinit.sh ];
then
/system/bin/sh /system/sd/userinit.sh;
fi;
[G1 Android Development] free-sidux:
Cool, thank you Chahk.

It was missing, have thrown it in and .... seems to be working

--> unfortunately, this seems to break com.phone.android :( weard
[G1 Android Development] madunix:
ok ladies n gents, i've officially tried out the 32mb, 64mb, and the 96mb linux-swap. from my personal experience with each one... i've come to realize 64mb is the best choice. 96mb wasn't all that bad but 64mb had less loading/lag time. keep in mind that this is with a swapiness of 30 (echo 30) soo if anyone know any other better settings, please do share as i would like to have my phone running at maximum speed. oh yeah and not to mention i have my cpu at 384 with a min of 245. i've heard this is quite faster than 528 but when i do a speed test with 384 i get about 750-850ms response time as with 384 i'd get 500-700ms response time. but i'm happy with how 384mhz is operating and i also heard that 528 with this hero rom is running a bit harder than it should be which can be potentially dangerous. soo im playing it safe rather than to be sorry. cheers hope this info helps.
[G1 Android Development] stellarman:
Battery life

I just wanted to make one observation:

I have tried CM 3.6.5 ROM both with and without swap. Subjectively, I can say that I think it is faster WITH swap. But, there seems to be a hit to battery life. Could be my imagination, but I seem to be getting 10 - 20% better battery life when I don't run swap. It seems to make some sense intuitively -- writing data back and forth, to and from the SD card has to consume some energy.

Just wanted to point this out, in case it was not on people's radar screen. If battery life is important to you (more than speed), you might want to try disabling swap. And let us all know what your results are.
[G1 Android Development] nolsen311:
This may sound completely stupid, but *thank you*! I hadn't even thought about it!

I was wondering why the battery seemed to be dying so quickly!

This would probably be faster if implemented in hardware not to mention less of a drain on battery life...

If anyone knows someone "in the biz" it's probably not a horrible idea to pass on... (HTC, Samsung, Motorola, I'm lookin at you!) seeing as how it may improve the user experience on subsequent phones without prohibitively expensive RAM. Might squeeze even more bang out of a new Tegra-based phone...

it *is* Linux(tm) under the hood.

EDIT: speaking of which (since we're not) would any of the ROM builders mind putting NAM AT&T Wireless Data settings in the apns.xml (? or whatever ?) file. I've been rocking all of these ROMs with "updated" apns...and I still have to enter the AT&T settings by hand. what a painintheass. by the way, this phone is less-than-stellar on EDGE. but still more fun than a Diamond on HSDPA.
[G1 Android Development] osho741:
does this effect adb when you try to push an app to the sd card? i am getting an error saying sd card cannot be acessed, device is busy, when i try to mount the sd card from adb.
[G1 Android Development] DOHCtor:
What do I have to edit in JF's 1.51 US Rom so it can load on boot?
[G1 Android Development] nextlevel_44:
I'm sorry stupid question but can someone explain or tell me where to go to find out what exactly is this whole swapping thing about and what are the pros and cons to doing so .
[G1 Android Development] novafluxx:
Thank you very much for this, I only had 1 problem, instead of using the move (mv) command I had to use copy (cp) that was all though, and I was successful, thank you!
[G1 Android Development] Binary100100:
I use custom mp3 in the /system/media/ directory for individuals in my contacts.

I don't mind the space in the system because the few rmp3's are compressed and it doesn't take up much space. I don't to store them on my sdcard (fat partition) because my phone doesn't ring when it's mounted.

Looking over this script it would seem that the directory gets moved to the ext partition and I would be fine with that. But my problem is when my sdcard is mounted and I select the ringtone the only thing I get is "Default ringtone" option.

Can you make this script without the modifications to the system/media directory please?

I've tried but I don't know much about it and my attempts keep ving me a Syntax error: "fi" unexpected (expecting "then").
[G1 Android Development] scrappyabs2:
auto swap bad for sd card?

A while ago I read that swapping adversely affects the life of your sd card. Is this true for the auto swapping method described in this thread, or am I thinking of a different swapping method?
[G1 Android Development] Chahk:
Short version:

Don't worry about it.

Long version:

It's true that any swapping method will adversely impact the life of the SD card. However the benefits gained from using swap (speed, stability and smooth app switching) are well worth it. Most newer cars are also made with a controller that handles wear leveling. Besides attempting to use the card's surface evenly, when it detects sectors on the card that are starting to show wear it marks them as "bad" so that the system avoids writing there at all. This means that even if your card does develop problems, it will not die suddenly. Instead its capacity will slowly start to diminish without other adverse effects.

Besides, the SD cards are very cheap these days. By the time your current one starts to give in, new even cheaper ones with better capacity will be out.
[G1 Android Development] DAP420:
I have my card with an ext3 already so can I still do swap afterwards. Because I tried it and it didn't work. I downloaded the file and placed it in sd the followed directions but after I typed in terminal the chmod 775 part it says file or directory not found. What went wrong?
[G1 Android Development] mfrey0118:
Ok I guess I'm a semi-noob, only Linux commands I know are ones I had to learn to hack my G1...so about this swap stuff...I redistributed free space on my FAT32 partition, using Paragon Partition Manager, to allow for a 3rd Linux-swap partition. Paragon has this option so I figured this would be vanilla...however, Cyanogen recommends the swap partition to be 18, 24, or 32 megs and not over. But Paragon uses a stupid slide rule to allocate the size of the partition and the smallest it will allow is 68MB...so what do I do? There's no way to manually input the size of the partition.

After I do set it up, then what? What's all this "init" script stuff I am reading? Do I need this? How do I set the swappiness? Should I just use Ubuntu? I have it on a separate partition on my HDD...help?

Edit: I think I got it: Used Gparted in Ubuntu on the ext2 partition of my laptop with SD card in my G1, hooked up via USB. For some reason when I used the card reader it would say unable to mount and only show the FAT32. I mounted /system/sd in Terminal on phone and also made drive rewritable (don't have to write out that "yaffs2" stuff anymore, just type "lucid -m3"..tks Lucid)... Gparted saw the ext3 and the linux-swap partitions. I was able to shrink it to 24mb and set the swappiness to 20 (first with command and then I installed the modified "userinit.sh" file from the thread. Rebooted and checked <free> and it's on their with about 10% currently being used in swap partition. That sound right to the experts on here?
[G1 Android Development] AsaSpades:
I just created a Linux Swap partition on my sd card, its 31mb, and now when I boot my phone it gets stuck on the boot screen, any ideas?

Edit:Nvm I fixed it
[G1 Android Development] Denkai:
dap420 check your spelling. and write out exactly what you did and what the phone tells you.
[G1 Android Development] mfrey0118:
I used Gparted with the sd card in the phone, connected and mounted via USB...then Gparted saw the ext3 partition and I was able to format and resize.
[G1 Android Development] mookie3three:
Hi guys,

I'm running this at the recommended 32mb swap and default swappiness of 20 and while this makes the phone run smooth, it is not enough to run Debian. I have tried changing the swappiness to 60 which improves the performance slightly it still reboots, I think it needs more swap space.

What I was thinking if I made the Swap space larger to say 64mb, is there anyway to only allocate it 32mb and then switch it 64mb when needed?

Cheers
[G1 Android Development] Meleeeee:
hey guys..

kinda got a problem copying the script.

short:

if i try "mv /sdcard/userinit.sh /system/sd/" via adb/term it says cross-device link.

if i try "cp /sdcard/userinit.sh /system/sd/" via adb/term it says "failed to copy [..] : read-only file system

if i do adb push it works, the file is on /system/sd and executable, afterwards "free" shows me a running swap. but after reboot the file is gone and the swap disabled.

if i try to manually enable by mkswap and swapon (like here: http://xdaforums.com/showpost.php?p=4029519&postcount=145), mkswap works, but it says that it doesnt know "swapon". this step i only tried with adb because i dont have a physical keyboard and on my magic the numbers on the virtual keypad dont work in the terminal (so i cant type mmcblk0p3 f.e.)

guys...did i miss something? im on a sapphire as i said, but that shouldnt make a difference in this terms, does it?
[G1 Android Development] mookie3three:
Can anyone help with this?
[G1 Android Development] b1czu:
First idea that is coming to my mind is making 2 swap partitions(but u will loose more space from sd):

-first 32mb

-second 64mb

Than u can write 2 srcipts for mounting first and second as swap and u wil use this which u need at moment. sory for my english i know its bad :D
[G1 Android Development] snyper2k2:
b1czu is right. make 2 partitions, one size 32 and one size 64. Fix the auto boot for say the 64mb partition with whatever swappiness you want. And whenever you want to switch back to the 32 just stop it and run the 32 from terminal.
[G1 Android Development] snyper2k2:
I been thinking that I want to make my linux swap 96mb. Its at 32 right now. How would I go about doing that without reformatting?
[G1 Android Development] alnzbail:
ive been trying to set up swap but i get this error

swapon: /dev/block/mmcblk0p3: device or resource busy

any help plz
[G1 Android Development] Auctionedllama:
This makes my swap work, but requires me to type it in everytime I reboot. How can I avoid this?
[G1 Android Development] snyper2k2:
make sure u do swapoff and then mkpart and then set swap
[G1 Android Development] Auctionedllama:
I don't know what that means? Sorry for being noobish, but that I don't really know what that means. I have fat32, ext3, and linux-swap partitioned correctly.
[G1 Android Development] Jason_V:
I got swap working with a bit of help (wiki.cyanogenmod.com and #cyanogenmod on IRC) and wanted to share my experiences....

I'm running the latest CyanogenMod (4.2.14.1 currently) on my myTouch3g. For my 8GB Class 6 SD card, I setup a 96MB linux-swap and left the rest for fat32.

I created a userinit.sh file in TextWrangler on OSX with this content:

#!/system/bin/bash
#

partition=2 #partition number of swap partition. Change if swap is not partition 2.
swappy=28 #swappiness. larger number = more likely to swap, smaller number = less likely to swap

swapon /dev/block/mmcblk0p$partition;
sysctl -w vm.swappiness=$swappy;

exit 0;

Then in Terminal I used adb with the following commands.

adb remount
adb push userinit.sh /system/sd/
adb reboot

After reboot I confirmed that swap is enabled...

adb shell free
total used free shared buffers
Mem: 97900 83932 13968 0 308
Swap: 93744 20292 73452
Total: 191644 104224 87420

This will be lost after each update, so I am maintaining a duplicate 'userinit.sh' that is stored on my SD card so that I may push it back over to '/system/sd/'.

Hope this helps anyone else that is trying to enable swap w/o a2sd.
[G1 Android Development] Vermithrax:
If you are using Amon Ra's recovery, you can do as I did...

http://xdaforums.com/showpost.php?p=5680760&postcount=1198

Still working without any problems... I am also using BART to switch between multiple ROMS...
[General Questions and Answers] dimkasmir:
I am wondering how it is possible to play an audio file during a call on a WinMo phone so that both parties can hear the audio. All help is appreciated.
[Touch HD General] hoss_n2:
does htc hd has the ability to run 720p videos on it or not and if not is there any application to run 720p videos
[Touch HD General] lpaso:
nop, the HD can't play HD videos :D
[Touch HD General] tweaker:
How ironic. LOL

It doesn't seem logical to play 720p videos on the Touch HD anyway. First of all, the max resolution on device is 800x480 and secondly 720p videos take quite a bit of space.

If you really want clarity, focus on encoding the video at the screens native res or even a bit lower resolution. What's more important is the bitrate and the codec.
[Touch HD General] hoss_n2:
but my old nokia device n95 8gb plays 720p videos but not in full screen
[Touch HD General] hoss_n2:
can we play mp4 videos on htc hd with high frame rate and without the need of video encoder [with program on device ] like nokia devices
[Touch HD General] Rudegar:
don't you think the nokia software somehow converted it ?

i mean a device with a

240 x 320 res playing media in 1280_720 and then resizing it even more ?

would not make much sense as it would have to process that huge amount

of data from 1280_720 to resize it down
[Touch HD General] hoss_n2:
i don;t think it converts it but it played it in about quarter of the screen with very bad image but smoothly with normal frame rate but my htc run mp4 with very low frame rate i don;t know why
[Touch HD General] gregy74:
HD videos are also 720*480 (480p) videos. And Blackstone can play videos with resolution 800*480. But just mp4 format. So, if you ask me, HTC Hd can play HD videos 480p in mp4 format.

HTC HD, Xperia and maybe some newest HTC devices are only devices that can play HD videos.

You can also watch HD videos on youtube with inbuilt youtube player.
[Touch HD General] hoss_n2:
but when i tried these mp4 files at vga resolution it runs at very low frame rate also it is said in the specifications that it can run up to vga at 30 frames per second what is the problem
[Touch HD General] -PiLoT-:
remember that you cant use coreplayer to play mp4 files and expect a result

the htc albujm app is the best for mp4

i myself prefer 400x240 divx videos
[Touch HD General] ilordvader:
I have Att Fuze(touch pro)

with Coreplayer where i can use the Pad to click forward on movie Videos

like a que forward while watching movies

Was wondering can we Set it on Volume control to forward Video ?

Cos will get a phone HD2

Please if anyone has Coreplayer on there phone
[Touch HD General] stoolzo:
lol

lol, i nearly pissed myself. First of all 720p is 1280x720, secondly a nokia n97 hasnt got a chance in hell of running this video, as stated before it doesnt have the native screen res or the power to pump that many pixels. There are only one oe two phones that will process this resolution but none of them can show them in native resolution and so they are pointless anyway unless they have a HDMI tv out. ( a couple do).

The touch hd can barely play a DVD rip in 480p without losing frames for god sake.

If you want clear smooth video you have to re-encode at the native res of the device and use a code the phone can hardware accelerate, the touch HD can only accelerate MP4 codec and so you are limited to that.

Now the touch HD2... well I was going to get all exited about that until i found it had no TV or mini hdmi out, what a waste of F@cking time that it. HTC dropped the ball again in my humble opinion.

Tegra is where it is at, bring on the phones, build it and I will come
[Touch HD General] Madcypher:
Get the facts right bub...

NOT! HD starts at 720p! 480p is not and never has been HD!