Mac Users: hidden files on sdcard - Fascinate General

Hi,
I'm sure some if not all mac users have experienced seeing extra hidden files for every file they have transfered to their sdcard from their mac. For example, you copy desktop.jpg onto the sdcard, and along with it will be a 4kb file called ._desktop.jpg. To me that's extremely annoying, especially when I transfer a lot of files and have to delete all the hidden files. Another issue, when doing the same thing but from a mac to an external harddrive or network volume, osx creates a .DS_Store hidden file.
The solutions are here:
sdcard hidden file issue (if you don't have a .bash_profile file in your home folder, just create one and paste the code in the link)
.DS_Store issue
Salut

Actually the information in the thread I linked for 'sdcard hidden file issue' is incorrect/outdated. Here is the proper solution, depending on which version of OSX you are running:
For Mac OSX Tiger (10.4):
Code:
export COPY_EXTENDED_ATTRIBUTES_DISABLE=true
For Mac OSX (Snow) Leopard (10.5, 10.6):
Code:
export COPYFILE_DISABLE=true
In a terminal window, type:
Code:
sudo nano -w ~/.bash_profile
Put in your account's password and hit enter, then paste the applicable export line (Edit/Paste or CMD(apple)+'v'), then hit CTRL+'x' to write/save the file, hit 'y' when prompted with "Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?", then hit enter when prompted with "File Name to Write: /Users/(your_username_here)/.bash_profile".
That's it. Let me know if you have any questions.

very nice tips! do you know if it will work on lion also? I really can't stand all those 4kb hidden files!! :good:

Related

[Linux] Copy files to your phone via an adb GUI.

I just thought I'd throw this script up here in case any Linux users want something to play with. I use it for copying nightly ROMs to my phone for flashing. It simply gives a file selection dialog, allows the user to select files, and copies them via adb to a specified directory on the phone.
There's really not much to it, but it can be edited to point to any directory (I use /sdcard/Android-updates on my phone because it shows up at the top when I want to flash.)
Prerequisites:
Linux distro with gtk/gnome installed.
Zenity installed.
Working adb with normal-user privileges.
Just re-name the file, changing the extension to ".sh" and in the right-click "properties" dialog, change the permissions to make it executable.

Run Fastboot, ADB, etc. from anywhere on your PC

Had some interest in this, so I thought I'd make a quick thread about it. Not a big secret or anything, just a little time saver.
Here is how to set up your computer so that you can run a fastboot, adb, etc. command from anywhere in the file system. You will no longer have to goto the fastboot folder and the type the full file path to the file you are trying to install, push, etc. if you saved it somewhere else, or clutter up the same folder you have these important files saved in.
*These instructions are for Windows 7 (x64):
First make sure that your fastboot files, adb files, moto-fastboot files are in a folder that isn't going anywhere (give them a permanent home on your pc ).
Then do the following:
Navigate to: Control Panel -> System ->Advanced System Settings -> Advanced Tab -> Environmental Variables
Under "System variables" scroll down to the variable labeled "Path" and choose Edit.
Go to the end of the Variable Value and add a ";" (no quotes) if needed on the end of the last variable, and then add the complete file path to the location of your files (only add spaces if there are spaces in the file path). So mine would be: ....;C:\android-sdk-windows\tools
OK out of everything.
Now you can just shift + right-click in the folder you saved the file, Open command window and type the command.
*Note: If you change the location of your fastboot files, you will have to change the location in the variable path again, otherwise this wont work. Capiche?
Swiftks said:
Had some interest in this, so I thought I'd make a quick thread about it. Not a big secret or anything, just a little time saver.
Here is how to set up your computer so that you can run a fastboot, adb, etc. command from anywhere in the file system. You will no longer have to goto the fastboot folder and the type the full file path to the file you are trying to install, push, etc. if you saved it somewhere else, or clutter up the same folder you have these important files saved in.
*These instructions are for Windows 7 (x64):
First make sure that your fastboot files, adb files, moto-fastboot files are in a folder that isn't going anywhere (give them a permanent home on your pc ).
Then do the following:
Navigate to: Control Panel -> System ->Advanced System Settings -> Advanced Tab -> Environmental Variables
Under "System variables" scroll down to the variable labeled "Path" and choose Edit.
Go to the end of the Variable Value and add a ";" (no quotes) if needed on the end of the last variable, and then add the complete file path to the location of your files (only add spaces if there are spaces in the file path). So mine would be: ....;C:\android-sdk-windows\tools
OK out of everything.
Now you can just shift + right-click in the folder you saved the file, Open command window and type the command.
*Note: If you change the location of your fastboot files, you will have to change the location in the variable path again, otherwise this wont work. Capiche?
Click to expand...
Click to collapse
Thanks you as I had trouble with this for my nabi2
Swiftks said:
Now you can just shift + right-click in the folder you saved the file, Open command window and type the command.
Click to expand...
Click to collapse
It turns out you CAN learn something new every day! This is a huge timesaver. I wish I had known this years ago!
Huge thank you! I knew i could do this somehow, but havet managed to do so before. Whit this guide i managed to get it working in windows 10 enviroment.

[Q] MAC spoofing

Hi
Will this work on vibrant
Original link http://forum.xda-developers.com/showthread.php?t=917684
You require:
1.)Rooted phone.
2.)anroid sdk
1.)First pull the nvram.txt file from /etc/wl to sdcard:
in cmd(windows) goto android-sdk-windows\tools and type
adb shell
2.)Copy nvram.txt from /etc/wl to sdcard
cp /etc/wl/nvram.txt /sdcard/nvram.txt
3.) Using text editor in phone add following line at the end:
macaddr=XX:XX:XX:XX:XX:XX (replace XX:XX:.... with desired mac addr.)
4.)Save file and copy it to /etc/wl from adb shell
cp /sdcard/nvram.txt /etc/wl/nvram.txt
5.)Reboot and it is done.
To restore orignal mac address just delete the macaddr line.
Note:
1.) Tested only in stock LG rome with GNM OC kernel. In other roms or kernel the location of nvram.txt may differ according to the parameter using which driver module (wireless.ko or bcm4325.ko) just find that file and use the above process. It will work.
2.) The file cannot be edited in windows as windows has different new line character than linux. It has to be edited in some linux compactible file editor like Programmers Notepad

[GUIDE] Customizing ROMs for your needs.

At the request of others, I have decided to write this guide pertaining to ROM customization. I found that in most of the current custom Jelly Bean ROMs for the TF101, that the GPS configuration has been changed, at least compared to the stock Asus ICS ROMs for the TF101 and the stock Asus Jelly Bean ROM for the TF300T, and they are using modified user / group and permissions settings. They all say that it is because those items have changed in Jelly Bean. They are also using a custom /etc/gps.conf file. The problem is that I, along with several others, aren't seeing very good GPS response and some claim not to see any. The ones that do see something, see that the first initialization takes forever and then is likely to not hold a fix, only seeing a few satellites. I made some changes in the ramdisk and /etc/gps.conf file and tested with a few of the Jelly Bean ROMs for the TF101 and found that settings matching the stock Asus settings performed quite well and was asked to share the process that I used. While it would be easier probably to just post the modded kernels for others to reflash, I'll give it a go at explaining what I've done.
1) This guide will require either a working native Linux install or can probably be used with a virtual machine Linux install. I'm using Ubuntu 12.04-x86_64 LTS as Ubuntu is usually used in most of the guides I've found. You may be able to make things work with other Linux flavors, but YMMV. I'm going to assume, at least, a basic knowledge of Linux file systems and the ability to copy and paste to a terminal and follow instructions.
2) You may need to install the Android SDK and at least one platform in order to get a working "adb" command, which will be needed. You may be able to get the "adb" binary from other sources that will work and "adb" will require some setup in udev rules to allow your normal user to access the tab with it. I'm going to assume that you have all of these things in place and working and that "adb" is in your path. If not, then Google is your friend.
3) For good measure, it would help and definitely won't hurt anything to have some build environment files in place. In a terminal, copy and paste the following:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
Let that install and when it is finished, copy and paste the following:
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
4) Now we need to grab dsixda's Android Kitchen, which is where some of the magic can happen. Go here to read up on how to use it and to find the download link. While the TF101 isn't specifically supported, there are a lot of things that we can still use it for. Just don't try to build a ROM and flash it with this before you have read dsixda's thread thoroughly or you may wind up with a brick. I'm only going to describe things that I've done and tested and that I know will work. For ease of this guide, I'm going to assume that you read the instructions there and that you unzip the downloaded file to "/home/'yourname'/android/kitchen/".
http://forum.xda-developers.com/showthread.php?t=633246
5) Now we need to build the blob tools used to pack and unpack the .blob files. Here we will download the source code for these tools and build them on the local machine. Go here:
https://github.com/AndroidRoot/BlobTools
6) Download the .zip file and extract to "/home/'yourname'/blob_tools/", where 'yourname' is your home directory name. Then, in a terminal, type "cd ~/blob_tools", without the quotes. Then type "make". When this is finished, type "mkdir ~/bin", if it doesn't already exist, and then type "cp ./blobpack ~/bin/;cp ./blobunpack ~/bin/". Now we need to make sure that "~/bin/" is in our PATH. Type "cat ~/.profile" and make sure that there are lines matching the below there:
Code:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
If not, use an editor like gedit, to add them just before the last line which should say "fi". For basic instructions on the blob tools, see here:
http://forum.xda-developers.com/showthread.php?t=1068548
That should be all for the tools and setup. Now reboot your PC to Linux, for good measure.
I'm going to use as an example, the changes I made for the GPS permissions and settings. Anything else will be up to your own personal study and research and experimentation. I assume no responsibility if you do something mentioned here or not or if you should brick your device.
1) Download the CWM flashable custom ROM of your choice. I'm not going to deal with Asus stock ROMs here because there are extra steps to do to look into those completely. Extract the ROM to a directory under your home directory. You will have to create it, such as "Team_EOS3" or whatever. I'm going to use the graphical file manager Nautilus and the graphical text editor gedit to work with files and directories and to edit files. When using Nautilus be sure to go to the "View" menu and select "Show hidden files". Some work will also be done in a terminal. I use Gnome terminal.
2) For example, I have a folder "K900_AOKP_JB", where I extracted K900's ROM. So if I look at that in Nautilus, I see 2 folders, "META-INF' and "system" and 2 files, "boot.blob" and "boot.img". Most of the custom roms will not have the boot.img file, only the *.blob file. The blob file and the boot.img file should be the same thing. Each contains the compressed kernel image and the initial ramdisk.
3) From a terminal, type, for example, "cd ~/K900_AOKP_JB". Then type, "blobunpack ./boot.blob", substituting the appropriate names for your particular files. In Nautilus, you will see that 1 more file was created, in my case, "boot.blob.LNX". Right click and copy this file to your Kitchen WORKING_DIRECTORY which you should have created from following the kitchen instructions. For me it is "~/android/kitchen /WORKING_091312_142859/", where "~" is shorthand for "/home/'yourname'", i.e. your personal home directory. Right click and delete or move to trash the boot.img file that is there already. Right click the file you just copied, i.e. "boot.blob.LNX" and rename it to "boot.img". Upper and lower case matters, so pay attention.
4) From a terminal, type "cd ~/android/kitchen". Then type "./menu". Choose option "0", then choose option "20", then choose option "w". Follow any instructions that come up. These actions will create a new directory, "~/android/kitchen/BOOT-EXTRACTED/", which is where the kitchen just extracted your renamed blob file (boot.img). Inside, you will see a "boot.img-ramdisk" folder, which contains the ramdisk files and a "zImage" file, which is the compressed kernel.
5) Inside the ramdisk folder, we are going to edit only the "init.ventana.rc" file to change some GPS settings. Open the file with gedit and scroll down to the #GPS section. Change it to read the following:
Code:
# GPS
mkdir /data/gps
chown system system /data/gps
chmod 770 /data/gps
chown root system /dev/ttyHS1
chmod 0664 /dev/ttyHS1
Scroll down to the #GPS init section and change it to read the following:
Code:
# GPS init
write /sys/class/gpio/export 203
write /sys/class/gpio/gpio203/value 0
write /sys/class/gpio/gpio203/direction out
chown root system /sys/class/gpio/gpio203/value
chmod 0664 /sys/class/gpio/gpio203/value
Scroll down to the # Start GPS daemon section and change it to read the following:
Code:
# Start GPS daemon
on boot
service gps-daemon /system/bin/glgps -c /system/etc/gps/gpsconfig.xml
user root
group root
class late_start
Save the file. Right click and delete "init.ventana.rc~", which will only show up if you selected to "Show hidden files" in the "View" menu. In Nautilus move back to your kitchen WORKING directory.
6) In the terminal that should still be running the kitchen menu, choose option "b" to rebuild the boot.img. You can now exit out of the kitchen menu. Back in Nautilus, right click and rename the "boot.img" file to "boot.blob.LNX" or whatever your original extracted blob file was called. Right click and copy to the folder where your ROM was extracted. Choose to replace the original file if asked.
7) In a terminal, type "cd ~/K900_AOKP_JB", substituting "K900_AOKP_JB" with whatever your extracted ROM folder is called. Then type "blobpack ./boot.blob LNX ./boot.blob.LNX", substituting your file names for "boot.blob" and "boot.blob.LNX".
8) In Nautilus, in the folder where your ROM was extracted, double click the "system" folder, then double click the "etc" folder. Then double click the "gps.conf" file. It should open up in gedit, if you were using that before, if not then choose to display it. Change it's contents to read the following:
Code:
#
# IMPORTANT:
# this file is only used by NetworkTimeUpdateService.java
# DO NOT make any GPS related settings here.
#
NTP_SERVER=xtra1.gpsonextra.net
Save and close the "gps.conf" file.
9) In Nautilus, in the folder where your ROM was extracted, left click on the "META-INF", "system" folders and the *.blob and boot.img file, if present, while holding down CTRL key, to highlight all 3 or 4 items. Right click on 1 of the highlighted items and choose "Compress". Rename the file if desired, especially if you have the original zip in that folder by the same name and want to preserve it, and then click "Create". The new zip file, with your custom name, will be created in the same folder after a few seconds. In my case, I chose to name it "K900_AOKP_JB-test.zip".
10) You now have created your own customized version of someone else's ROM, modified for your needs or experimentation. Now it's time to push it to your device. You can use Dropbox, if desired to do this, but the easier way is to use adb. I'm going to assume that you have a working Custom Recovery, preferably one that can read both internal sdcard and external MicroSD and that you have adb setup and working.
11) Plug your charging cable into the computer first and then plug the other end into the TF101.
12) In a terminal, type "cd ~/K900_AOKP_JB", substituting "K900_AOKP_JB" with the folder name where you extracted your ROM and where the new zip file resides. Type "adb devices" and after a second or two, you should see something similar to the following:
Code:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
03806245421f9417 device
If you get something looking like that, then adb is working.
13) In the same terminal, type "ls", which will list all the files and folders in your extracted ROM directory (or whatever your current directory is). If your recovery can read only the internal sdcard or both, then you can type "adb push ./K900_AOKP_JB-test.zip /sdcard/Download/", substituting "K900_AOKP_JB-test.zip" with whatever you named your zip file. After a few minutes you should get a confirmation that the transfer completed and can verify that it did with a file manager on the device.
14) If your recovery only reads from the external MicroSD card, then type "adb shell", then type "ls". You will get a list of all files and folders in the root directory of your device's file system. If you are running ICS or older, then you should see a "Removable" directory. If you are running one of the custom JB ROMs, then you may not have the "Removable" folder, but most likely a "storage" folder. For ICS or older, your external MicroSD should be located at "/Removable/MicroSD/". In the latter case, it should be located at "/storage/sdcard1/". In any case, once you have verified where the external card is mounted, then type "exit". Now type either "adb push ./K900_AOKP_JB-test.zip /Removable/MicroSD/" or "adb push ./K900_AOKP_JB-test.zip /storage/sdcard1/", depending on your results from adb shell. After a few minutes you should get a confirmation that the transfer completed and your new zip should now be on the root directory of your external MicroSD card.
15) Now you should be able to reboot to your recovery and flash the zip you created just like you would flash any ROM. Reboot and enjoy, from this example, working as intended GPS.

[HOWTO] Customizing webtop

For sometime now I have been meaning to write-up some of my notes and share some of the things I found can be done with webtop. I have a lapdock that I use it with my Atrix, I also have a HD dock connected to a monitor/keyboard/mouse/speakers.
Much of the following is just documenting the linux programs that are installed on the webtop and how they can be configured. You will need to have a terminal program to do most things covered in this post (not the android terminal program, but either lxterminal or xterm) and a text editor.
I use SystemR89's webtopMod to run a full debian distribution in a chooted jail (http://forum.xda-developers.com/showthread.php?t=1093790), this is not necessary for most of what this post will cover but it does install lxterminal and a lightweight text editor (leafpad) into your webtop.
AWN (the menu at the bottom of the webtop screen)
awn-manager is included in webtop and it allows you add/delete programs from the menu at the bottom of the screen. Before you use awn-manager the first time you will need to type the following command at the terminal prompt:
sudo chmod 777 /usr/share/applications/*​
Then you can just type in awn-manager and click on launchers and start changing/adding/deleting things. Alternatively you can modify the appropriate files manually.
The configuration file that has the list of menu items is:
~/.gconf/apps/avant-window-navigator/window_manager/%gconf.xml​
If you make manual changes to this file you will need to reboot for the changes to take effect (if you use awn-manager all changes take effect immediately).
As you will notice the menu configuration file references “.desktop” files. I am not going to cover the structure of the desktop files, there are a lot of good references out there covering this, just take a look at what is in them, the structure it is pretty straightforward. A number of the desktop files are found here:
/usr/share/applications​
but the ones created by awn-manager will be put here:
~/.config/awn/launchers​
If the program or command will only be run from the awn menu this directory is probably the best place to put the desktop file. If you are going to associate the program with a file type (more on this latter) you may want to put the desktop files in the following directory:
~/.local/share/applications​
any weblinks that you create by using the plus in the right hand side of the bottom awn menu bar will be put here:
~/.config/webtop-icon​
and a good place to stick any custom icons that you are going to be using is here:
~/.config/awn/custom-icons​
the default set of icons that awn-manager accesses are found here
/usr/share/pixmaps/​/usr/share/icons​
to launch an android program in the mobileview window (aka aiw) you will need to use androidlauncher, here are a couple examples of how to do this:
androidlauncher --action "android.intent.action.VIEW" --uri "content://com.android.contacts/contacts"​/usr/local/bin/androidlauncher --action "android.intent.action.MAIN" --cmp "uk.co.nickfines.RealCalc/.Calculator"​
you can look in the desktop files found in the /usr/share/applications directory to see some examples of how to launch various android programs you can also use the android app alogcat from the market to see what command is executed when you launch an android app on your phone.
Nautilus (the file manager)
Nautilus is filemanager used by webtop, it has been significnatly modified by Motorola so don't expect all of the normal features to work. If you look at the entry for the file manager using awn-manager you will see that the following command is used to launch the program:
nautilus --no-desktop --browser /mnt/sdcard​
In webtop the default preferences for nautilus are set up so that you can leave out the -no-desktop and -browser switches if you want. The /mnt/sdcard entry specifies which directory nautilus should start in. You can specify nautilus to start in the root (/) directory, but it won't have root privileges, so it is not a replacement for root explorer (or similar). If gksu was included in webtop you should have been able to run nautilus with root privileges by typing in:
gksu nautilus --no-desktop --browser /​
but when I installed gksu and tried this it did not work.
If you want to have additional directories listed on the left panel in nautilius you can edit the file:
~/.gtk-bookmarks​
You can add some functionallity to nautilus by creating scripts. After you create a script an option to run the script will appear under the files menu and come up when you right click. The scripts files are kept in the following directory:
~/.gnome2/nautilus-scripts​
I have attached a couple of scripts that I use, you can also check out:
http://linux.about.com/library/gnome/blgnome6n13a.htm
http://g-scripts.sourceforge.net/faq.php​
You can view the preferences that are set for nautilus by using:
gconftool-2 -R /apps/nautilus/preferences​
I played around with changing some of the preferences, I tried to turn on an address bar but the bread crumbs disappeared instead, I found that you can enable move-to-trash but it only works for linux filesystems (i.e. it works for your home directory but not for FAT filesystems like sdcard or sdcard-ext, although you might be able to fix this by putting appropriate entries in fstab with uid=1000 in the entry, I wrote a move to trash script instead)
It does not appear that the motorola webtop nautilus directly supports accessing network files, but if you are using a kernel with cifs support (or cifs manager from the market) you can mount network directories and then access them through nautilus.
Nautilus has saved searches built in (ctrl-f), search by name works but search by filetype does not work (you can search by file name, such as mp3, but it you tell it to find all audio files it does nothing). I guess they figured they have their smartfolders for that (Phone Music, Phone Images, Phone Video). By the way if you freeze or remove webtop connector then items will no longer be added to the smartfolders.
pcmanfm (an alternative filemanager in webtop)
There is a lightweight alternative to the nautilus file manager included in webtop called pcmanfm. To launch it with the sdcard directory showing type the following:
pcmanfm --no-desktop /mnt/sdcard​
if you want to launch it with root privileges in the root directory type the following
sudo pcmanfm --no-desktop /​
(I know you should be using gksu instead of sudo, but this works and gksu is not included with webtop).
Some of the nice features of pcmanfm:
It can run with root privileges (see above)
It has an address bar, so you can just type in the directory you want to instead of navigating the directory tree
It has an open terminal window here function built in (tool – open terminal)
There is a bookmarks menu where you can change the directories shown in the left pannel without having to edit ~/.gtk-bookmarks
File associations
If you want a specific application to launch when you double click on an item in the file manager you can change the entries in the following files:
~/.local/share/applications/defaults.list
~/.local/share/applications/mimeapps.list​
To have several “open with” options when you right click on a file you can put several entries on a line. The following is an example of an entry:
image/jpeg=gpicview.desktop;MobileView.desktop;firefox.desktop​
This enrty is telling the file manager to use gpicview.desktop to open the file if you double click on a jpep and to offer the options “open with gpicview”, “open with Mobile View” and “open with firefox” if you were to right click on a jpeg file.
The file manager will use gpicview.desktop that is found in /usr/share/applications/ unless there is a gpicview.desktop file in ~/.local/share/applications/
I have attached the files that I use for
~/.local/share/applications/defaults.list
~/.local/share/applications/mimeapps.list​
You will probably have to edit these file because some of the file associations I have set up launch programs in the chrooted linux environment.
Linux applications included with webtop
Functional and useful linux programs included in webtop
nautilus: file manager
pcmanfm: file manager
firefox: web browser
awn-manager: menu editor
xarchiver: file archive manager (zip/tar)
gpicview: a simple image viewer
epdfview: pdf viewer​
Gnome programs - most of the gnome programs are crippled/semi-functional, but the following two seem to work well:
gnome-dictionary: online dictionary
gnome-screenshot: screenshot/capture utility​
If you look at the "exec" entry in the desktop files located in /usr/share/applications you can see what other programs are included in the webtop distribution.
Swap
I am not certain if the stock atrix kernel has swap support, I am using faux123's kernel, perhaps someone could comment on if the stock kernel's swap support.
I find that I need to set up swap space if I want to use the webtop for anything more than occasional web browsing. Before I enabled swap webtop was regularly warning me that I had low memory (and you can't close the warning message, which is really annoying).
The first thing I tried was using zram for swap (fuax123's kernel supports this). I DO NOT recommend using zram for swap.
BEWARE, ZRAM CAUSES YOUR PHONE TO CRASH REGULARLY​
Next I looked into setting up a swap partition; however, after a little research I found out that the complexity of setting up a swap partition is a waste of time, you can get the same performance using a swapfile. Accordng to Wikipedia (http://en.wikipedia.org/wiki/Paging#Linux):
From a software point of view with the 2.6 Linux kernel, swap files are just as fast[14][15] as swap partitions. The kernel keeps a map of where the swap file exists, and accesses the disk directly, bypassing caching and filesystem overhead.[15] Red Hat recommends using a swap partition.[16] With a swap partition one can choose where on the disk it resides and place it where the disk throughput is highest. The administrative flexibility of swap files can outweigh the other advantages of swap partitions. For example, a swap file can be placed on any drive, can be set to any desired size, and can be added or changed as needed. A swap partition, however, requires that it be set for the entire hard drive, and once the size of a swap partition is set, it can't be changed without using tools to resize the entire drive.​
To create a 512MB swapfile, type the following commands in the terminal:
dd if=/dev/zero of=/sdcard-ext/.swapfile bs=1M count=512
sudo mkswap /sdcard-ext/.swapfile​
This is probably bigger than I need, I don't think I have ever used more than 100MB of swap. I use a "." as the first part of the filename, this makes the file a "hidden" file in linux and therefore the file is less likely to get accidentally deleted or moved.
Next, turn on the swap:
sudo swapon /sdcard-ext/.swapfile​
and make sure it is working:
free​
You will want to add the following line to the file /etc/fstab:
/sdcard-ext/.swapfile swap swap defaults 0 0​
and the following line to /etc/sysctl.conf
vm.swappiness=10​
(you may actually want to try a value less than 10, the lower the value the less the phone will swap)
Running full debian in a chooted jail (webtopMod)
As I mentioned in the first post I use SystemR89's webtopMod to run a full debian distribution in a chooted jail (http://forum.xda-developers.com/showthread.php?t=1093790)
You can install a number of very useful and fully functional linux programs in the chrooted environment and then access them from the awn menu (or if you have the file associations set up properly in defualts.list and mimeapps.list you can launch the files by double clicking on a file in the file manager).
*IMPORTANT* Some of the commands must be executed in the chrooted environment and some must be executed in the non-chrooted environment (i.e. the normal webtop environment). The following instructions tell you which environment you need to use for each command.
Once you have webtopMod installed I would recommend that the first thing you do is open an xterm window in the chrooted environment (click on the penguin and select the proper menu item for xterm) and install synaptic in the chrooted environment:
apt-get install synaptic​
You can then use synaptic to install other linux programs/packages, such as lxterminal, OpenOffice, mtpaint (gimp runs but it is really slow).
I have modified the script that SytemR89 uses to launch the chrooted environment (attached), you can replace the original script by following these steps in the non-chrooted environment:
Save the attached file,
Rename it from linux.txt to linux
Copy it to /usr/sbin
Set the permissions properly (sudo chmod +x /usr/sbin/linux)​
If you want to launch a program in the chrooted environment you can do it by typing the following in the non-chrooted environment:
linux oocalc​
where oocalc is the name of a program that you have installed in the chrooted environment.
A couple of final things, you may want to setup a symlink in the chrooted environment for /sdcard (and sdcard-ext). If I recall correctly, SytemR89 was just mounting /sdcard (and /sdcard-ext) in the chrooted environment and I changed the script to mount /mnt/sdcard instead (why? so that the chrooted directories would be set up the same as the non-chrooted environment). To make a symlink between /mnt/sdcard and /sdcard in the chrooted environment. First launch an xterm window for the chrooted environment, then type in the following commands:
sudo umount /sdcard
sudo umount /mnt/sdcard
sudo mkdir /sdcard
sudo mkdir /mnt/sdcard
sudo ln -s /mnt/sdcard /sdcard
sudo umount /sdcard-ext
sudo umount /mnt/sdcard-ext
sudo mkdir /sdcard-ext
sudo mkdir /mnt/sdcard-ext
sudo ln -s /mnt/sdcard-ext /sdcard-ext​
You may get some errors telling you that something was not mounted or that a directory exists, just ignore the error(s).
Then reboot.
I also created a directory /usbdrive in the chroot'd linux environment and use the following command to mount a usb drive so that the chrooted environment can access it (run this command from the non-chooted environment)
sudo mount -t vfat /dev/block/sda1 /osh/opt/WebTopMOD/root/usbdrive​
Many thanks for posting this, it's an excellent guide.
tamuin said:
I am not certain if the stock atrix kernel has swap support, I am using faux123's kernel, perhaps someone could comment on if the stock kernel's swap support.
I find that I need to set up swap space if I want to use the webtop for anything more than occasional web browsing. Before I enabled swap webtop was regularly warning me that I had low memory (and you can't close the warning message, which is really annoying).
The first thing I tried was using zram for swap (fuax123's kernel supports this). I DO NOT recommend using zram for swap.
BEWARE, ZRAM CAUSES YOUR PHONE TO CRASH REGULARLY​
Next I looked into setting up a swap partition; however, after a little research I found out that the complexity of setting up a swap partition is a waste of time, you can get the same performance using a swapfile. Accordng to Wikipedia (http://en.wikipedia.org/wiki/Paging#Linux):
From a software point of view with the 2.6 Linux kernel, swap files are just as fast[14][15] as swap partitions. The kernel keeps a map of where the swap file exists, and accesses the disk directly, bypassing caching and filesystem overhead.[15] Red Hat recommends using a swap partition.[16] With a swap partition one can choose where on the disk it resides and place it where the disk throughput is highest. The administrative flexibility of swap files can outweigh the other advantages of swap partitions. For example, a swap file can be placed on any drive, can be set to any desired size, and can be added or changed as needed. A swap partition, however, requires that it be set for the entire hard drive, and once the size of a swap partition is set, it can't be changed without using tools to resize the entire drive.​
To create a 512MB swapfile, type the following commands in the terminal:
dd if=/dev/zero of=/sdcard-ext/.swapfile bs=1M count=512
sudo mkswap /sdcard-ext/.swapfile​
This is probably bigger than I need, I don't think I have ever used more than 100MB of swap. I use a "." as the first part of the filename, this makes the file a "hidden" file in linux and therefore the file is less likely to get accidentally deleted or moved.
Next, turn on the swap:
sudo swapon /sdcard-ext/.swapfile​
and make sure it is working:
free​
You will want to add the following line to the file /etc/fstab:
/sdcard-ext/.swapfile swap swap defaults 0 0​
and the following line to /etc/sysctl.conf
vm.swappiness=10​
(you may actually want to try a value less than 10, the lower the value the less the phone will swap)
Click to expand...
Click to collapse
Thanks a lot, I was just starting to configure zram right before reading your post. :good:
Please explain just two things to me:
- Did you automated this to always enable swap? If so, how (init.d scripting)? EDIT: forget about... I didn't realize what changes in /etc/fstab will do...
- You've created the swap file in the external SDCard. Isn't better to create it on EMMC? EDIT: I've created the file on EMMC cause it's much faster and seems to be Ok!!!
Regards...

Categories

Resources