Bash replace sh? - Motorola Droid 3

Id love to replace sh with bash. sh is becoming a pain. What would I have to do to complete this process? Sorry, I'm a n00b to android in many aspects as I know plenty of linux, but I've never done any deving for arm or android.
I'd also like to add support for bash profiles and the best location would be /sdcard/Android/data. To be clear, I'm not looking to add bash, but to replace sh with bash.

A very easy way to have bash is the app "Better Terminal Emulator Pro", it's included there. The app is not free, but worth the few bucks.
I guess it would be quite easy to replace sh with the files included there, but I wouldn't recommend this. I change as little as possible of the system, and for me it was always enough to be able to call bash.
It's hard to predict what could happen after a replacement of sh ...

I agree with the warning, and with the recommendation. Better Terminal Emulator is great and the most well featured terminal that I have been able to find. It also puts the extra files it needs for the enhanced shell in /data/ instead of crowding up the system directory with extra binaries etc.

actually its not that bad if I can get bash built. you can rename sh to sh0 then create a symbolic link called sh to bash. instant replacement and bash will be called instead of sh.
I just need to know how to get to that point. I don't need a better terminal, I paid for sufbs and love it. it would just be better all around to have bash instead of sh.
Sent from my DROID3 using xda premium

So just do it.. It's your phone.
I told you where you can get a bash binary. Or you could compile it, shouldn't be very hard.
I just say I wouldn't, no way. You have no rescue CD.
(OK, thanks to a few people we now can re-install the system -- most likely)

rweb said:
So just do it.. It's your phone.
I told you where you can get a bash binary. Or you could compile it, shouldn't be very hard.
I just say I wouldn't, no way. You have no rescue CD.
(OK, thanks to a few people we now can re-install the system -- most likely)
Click to expand...
Click to collapse
I actually think I may have found a way. I've never cross-compiled software before so was hoping someone who has knew what I wanted and could tell me what I need to do. I've downloaded bash and am going to give it a try. I will test it before actually applying the replacement idea, but I think I can do this
I thought cross-compiling would be harder than this, but who knows? According to this source it isn't all that bad...

And of course it doesn't work
./configure --host=arm-linux --enable-static-link --without-bash-mollac
configure: WARNING: unrecognized options: --without-bash-mollac
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-gnu
Beginning configuration for bash-4.2-release for arm-unknown-linux-gnu
checking for arm-linux-gcc... arm-none-linux-gnueabi-gcc
checking for C compiler default output file name...
configure: error: in `/home/darksurf/Downloads/bash-4.2':
configure: error: C compiler cannot create executables
See `config.log' for more details.
any ideas? I'm using a gentoo based system.

There is a binary in the link YOU posted above, this binary works on D3. What's wrong with this?
Frankly, I do not understand you. Maybe your real goal is to learn how to compile Android binaries, but then you give up way to early.

rweb said:
There is a binary in the link YOU posted above, this binary works on D3. What's wrong with this?
Frankly, I do not understand you. Maybe your real goal is to learn how to compile Android binaries, but then you give up way to early.
Click to expand...
Click to collapse
In addition to that link, I had compiled it for us about a month back: http://www.mediafire.com/?b71lcdpnqn07egj

I highly advise not modifying /system/bin. I've bricked my phone several times doing that. Best option is to put bash in /system/xbin and modify /etc/profile to set the PATH variable to /system/xbin:/system/bin:$PATH

Darksurf said:
And of course it doesn't work
./configure --host=arm-linux --enable-static-link --without-bash-mollac
configure: WARNING: unrecognized options: --without-bash-mollac
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-gnu
Beginning configuration for bash-4.2-release for arm-unknown-linux-gnu
checking for arm-linux-gcc... arm-none-linux-gnueabi-gcc
checking for C compiler default output file name...
configure: error: in `/home/darksurf/Downloads/bash-4.2':
configure: error: C compiler cannot create executables
See `config.log' for more details.
any ideas? I'm using a gentoo based system.
Click to expand...
Click to collapse
I use gentoo myself, I recognize that error "C compiler cannot create executables" as one caused by gcc upgrades (changing gcc versions w/out updating environment variables etc but I've only seen it when not cross-compiling). Also, are you trying to use crossdev or Codesourcery? Codesourcery seems to generate less errors and there are many many guides for it available on google (I always get errors w/crossdev but the same code will compile error free w/codesourcery).

thanx, im using crossdev. ill give code sourcery a try. im asking because im not near my computer now, but is there an ebuild.
Sent from my DROID3 using xda premium

No, you have to grab the files off their website. Codesourcery.com or wget http://www.codesourcery.com/sgpp/li...-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 if you need a quick link, I think this is the version I have installed..

dude, u r my hero thanx.
Sent from my DROID3 using xda premium

Darksurf said:
dude, u r my hero thanx.
Sent from my DROID3 using xda premium
Click to expand...
Click to collapse
I assume it's compiling or your at least beyond your previous error. Glad to hear it.

Shenanigans?
I'm thinking... maybe you *don't* know a lot of Linux. But I admire your courage. We're here to help. And when you figure out how to push bash there, try ksh next.
--#

7April said:
I'm thinking... maybe you *don't* know a lot of Linux. But I admire your courage. We're here to help. And when you figure out how to push bash there, try ksh next.
--#
Click to expand...
Click to collapse
And ohh how helpful and informative that post was! Pretty sure pushing files to your phone has nothing to do with linux all. Pretty sure your not here to help at all but just to ridicule and also play the fool. When you figure out the difference between push and compile ....
Anyways, i just noticed that codesourcery is in portage now though i do know that some versions will cause compile errors where others wont not sure why, probably because i'm not a 31337 linux guru like april7, sigh someday

Related

**UPDATE**SuperG1-Computer 9/8/09 4:03am

Here is basic program for your windows computer that just does basic stuff.
It can reboot your phone to wherever you want like recovery, bootloader.
It will wipe your ext2/3 from recovery if you choose and it will repair your ext2/3.
This is still beta, so far everything that is on the app works. But when I say beta I mean I still to implement alot more features so just use it and then tell me what you guys want. I am working on implementing switchrom into it.
This is just about 3 hours of work so you will see alot more in the future.
Screenshots Below!
*(For those of you wondering it is writen in a mix of C++,vb.net,python,and MS-DOS)*
Twitter: http://twitter.com/kickfliprock13
** Oh I forgot to mention you need to have adb set up for this to work if you don't have it set up than it wont work. So if you want to set up just go here: http://punk-in.com/driver_vista.html
Continued
Changelog:
9/8/09: Added a link to tell you how to install usb drivers for your phone
Added links to our twitter's and plurk's
Fixed a few small bugs
Continued Again
This is for problems and things I am changing!
Problems:
Can't get it to put arguments into adb commands, for example adb shell sh /system/sd/switchrom -s (then the name they want to name it)
I suck with ShellExecute commands so I need to get better at those
Need to learn how to add .exe's and other files into a C++ file and then run it.
Changing:
I will probably be changing the layout in the next update
I will be learning ShellExecute commands hopefully. So then it can set up adb for you and do a switchrom.sh for you
looks good dling now btw how many programming languages do you know lol
Languages
I know a couple. This program is written in C++. I have only done C++ for about a week so I am still kind of a noob. But other than that I know: html, MS-DOS,Python, I am learning java, I know some C and C#.
I am taking some visual stuff right now, like blender and game development.
After that I want to learn CSS, and learn the reset of java and C++
do you think you can make it that the program can flash the new spl and radio so the phone won't brick. Anyway awesome program
It looks like it's just issuing the non-response ADB commands. Do you have anything there to capture the commandline output from ADB? I'm trying to get the push and pull confirmations for mine. It seems the stream is immedately written as blank and then changed to the confirmation but the change is not rewritten to the stream.
Also ADB does not have to be in a specific directory in order to work. Just change the working direcory of your process to the folder where you have them stored. I bundled the files with mine so I didn't have to worry about if someone didn't have them in the right place.
M..N said:
do you think you can make it that the program can flash the new spl and radio so the phone won't brick. Anyway awesome program
Click to expand...
Click to collapse
Yes, we are working on making that happen very soon. It is difficult but yeah, we already figured out a way to apply new radio,spl and get to hero in about a minute now we just need to implement that into the app but I just can't figure out exactly how to include multiple files in my C++ project but once I figure that out I will tell you.
Excellent thanks very much
Hi so how is this program coming along
Very well I almost have rooting figured out
Cool would this work on uk phones and when is the estimated release time

Noob question about guide

I am wondering if there is any literature online about a simple guideline or something of that nature about the adb shell and commands and all that. I have rooted my phone and used the adb, but dont really understand it just basically copying off guides that were on here. also like loading apks through the shell and taking apks off, and having to rename zips all this stuff im kinda gray on but if someone could maybe point me in the direction of a good place to understand all this i would be very grateful....i am new to this but am very addicted to xda now modifying my phone I am currently using darch's 2.1 and really want to add all the additions but need to know about using the shell thanks in advance guys...people on xda rule the world
aauussttiinn88 said:
I am wondering if there is any literature online about a simple guideline or something of that nature about the adb shell and commands and all that. I have rooted my phone and used the adb, but dont really understand it just basically copying off guides that were on here. also like loading apks through the shell and taking apks off, and having to rename zips all this stuff im kinda gray on but if someone could maybe point me in the direction of a good place to understand all this i would be very grateful....i am new to this but am very addicted to xda now modifying my phone I am currently using darch's 2.1 and really want to add all the additions but need to know about using the shell thanks in advance guys...people on xda rule the world
Click to expand...
Click to collapse
Well id say if your very addicted to xda then you should know there's these things called Sticky's at the top of page very useful info could of answered your own question.
forum.xda-developers.com/showthread.php?t=603052
When you use the command "adb shell", that is simply dropping you into the shell of the phone. The phone runs Android, which is a version of Linux. Since almost EVERY ROM has "busybox" installed, you are able to run Linux shell commands on the phone, just as if you were on a Linux install on a computer. So just learn basic Linux commands, and you'll be fine
yea bertman in the stickies there is nothing what im asking about but thanks for your help anyway....mrhinehart so instead of running the cmd promt from my pc i can just run busy box or do i run busy box from reboot recovery?......................ohh snap i found it in the stickes thanks bertman that actually exactly what i was looking for just didnt think it would be in something that had to do with rooting....thanks a bunch man
ADB / 101 Info from Nexus One Forum
Here's some information from the Nexus One forum. Hopefully you'll find it useful.
http://forum.xda-developers.com/showthread.php?t=619153
I seriously apreesh all the help that last post was like the icing on the cake.Roundaway i see that you have darch's 2.1 seriously a badd ace rom. i have v3 of the rom and the aosp 2.1 kernal and thats all and i have really been wanting to add the jit and fix the whitelist etc etc all that awsome stuff that people have been finding at that thread and i would real remount this or rename the zip to this and just never understood why but that clears up alotta things and connects alot of bridges for me so no on to playing with the adb thanks again everyone

AdbTool: The Automated Life

Ok so this started out as a small project to make my day to day phone functions easier and quicker but I thought I might share it incase anyone thought my AdbTool was helpful or just nice to have.
Functions so far:
1. Check for device
2. Push or Pull a File
3. Install .apk
4. Reboot
5. Root your Droid X
6. Change bootanimation
7. Push framework (specifically for framework)
8. issue whatever adb command you need to with out the extra typing
9. Set project
10. Error log
11. Clean up folder
There are more functions to come in the future so let me know if you like this script and what you wanna see added. There is no install just unzip and open the .bat file.
This sounds great! Though I'm on Linux machine, so I don't think ill be able to use it :/
Sent from my DROIDX using XDA App
No sorry, I should have specified. It is a Windows script... Just wait though, because Sunday I will be getting a desktop that is already running linux. If you really want I will take the time to make a script to run for linux?
Sent from my DROIDX using XDA App
rooting the dx doesnt work for me :/
Huh... what is happening when you enter that option? Sorry for the long time for me to post I missed the email alert.
Sent from my DROIDX using XDA App
I'm assuming this doesnt allow root for 2.3.3 ota correct?
since all I see is rageagainstthecage in the files
This looks like a really useful program! I might do some work this weekend on it and see if I can get it working for the DROID 2 and port it over to UNIX machines.
If I set it up for unix I will add an SBF option too.
Woa just realized this is a really old thread
ljbaumer said:
This looks like a really useful program! I might do some work this weekend on it and see if I can get it working for the DROID 2 and port it over to UNIX machines.
If I set it up for unix I will add an SBF option too.
Woa just realized this is a really old thread
Click to expand...
Click to collapse
Yeah, this thread is quite old (almost a year) and I am sure the program/script needs to be updated to work.
It is a good idea though (if it can be updated)
D.
I'd like to make a request for a Mount and UnMount command.
fyi....you spelled Folders wrong in the main menu "Floders"
.
I can make the program for yall. Yall just need something for shell or a gui for windows?
whatever's easier for you, either would be appreciated it
i have adb properly installed by doing adb devices in cmd it shows my dx
but when i use your tool it says it cannot find the path specific

[APP] SuperWipe for Mac [ALPHA]

Ok so here's this application that I made in Automator for myself and I figured that if anyone wants it, it's here. This is a Mac OS X only app. What does this app do? It wipes the data and dalvik cache on the phone twice. It is quite quick and easy. What will you need to do to your Mac before running this application? You simply need to add adb to the .bash_profile path settings. (This means that from anywhere in terminal, you can type adb and run adb.) Then just put your phone into recovery mode and run this app. This is an alpha build as I have not tried it on my own phone yet. However it should work as I've coded it and it has NO potential to brick the phone
Download Here!
EDIT: Currently the program is not working, I will make a new one and upload ASAP.
CPCookieMan said:
Ok so here's this application that I made in Automator for myself and I figured that if anyone wants it, it's here. This is a Mac OS X only app. What does this app do? It wipes the data and dalvik cache on the phone twice. It is quite quick and easy. What will you need to do to your Mac before running this application? You simply need to add adb to the .bash_profile path settings. (This means that from anywhere in terminal, you can type adb and run adb.) Then just put your phone into recovery mode and run this app. This is an alpha build as I have not tried it on my own phone yet. However it should work as I've coded it and it has NO potential to brick the phone
Download Here!
EDIT: Currently the program is not working, I will make a new one and upload ASAP.
Click to expand...
Click to collapse
Nice job CP... with a little editing, could I get this to work on Linux?
workshed said:
Nice job CP... with a little editing, could I get this to work on Linux?
Click to expand...
Click to collapse
Hmmm, thats a good question. (I'm just hopping in with what I know, so OP feel free to correct me if I'm wrong, which I probably am.)
From what I know, Automator is basically a workflow creation/utilization program. Do most Linux distros come packaged with anything like that, or does one exist?
This might be an alternative:
"GNU Xnee is a suite of programs that can record, replay and distribute user actions under the X11 environment. Think of it as a robot that can imitate the job you just did."
http://askubuntu.com/questions/343/alternative-for-mac-os-x-automator

Interested in a better lagfix?

INTERESTED IN A BETTER LAGFIX?
Here is a small script which goes a little further than the Lagfix app in the PlayStore. This was originally posted in a different thread dedicated to a ROM so I'm trying to clean this post up as much as possible.
Caution!
A quick word of warning. Take the same safety precautions with this as you would the LagFix app. Both use the same utility which has been found to brick some devices. This was originally written for the VS980 (LG G2) and for a 4.2.2 ROM (fstrim support is native in 4.3+) though it should work fine as long as your device is compatible with the LagFix app (although you may need to tweak a few things)
Prerequisites
To begin with, you'll need a fstrim binary located in one of your device's PATH directories. A safe bet would be to drop it in /system/bin/ or /system/xbin/. Don't forget to change the permissions as well so it can run. If in doubt it's safe to give it full read/write/execute (I vouch for the one I link to at least...)
If you'd like the script to run on boot, then having init.d support on your ROM is ideal. If you don't have native init.d support, search xda as I've seen a "How to Enable init.d on Any Device Even Stock" how to floating around somewhere.
Finally, you'll need the filesystems-fstrim script that's also linked to at the end. The script basically performs three actions. First, it remounts all the filesystems (see note at the end if not on a LG G2) without the 'discard' flag. Since we will be running the fstrim utility on boot (or manually of you desire), having the OS clean up after deleted/moved files on the fly isn't necessary at all and just slows performance down noticeable. After that it attempts to trim each mounted volume oo your device (think defragment), then finally it writes all output to /$ANDROID_USER/logs/ (bytes trimmed from each mount, etc).
This script will trim other mounts besides /system, /cache, and /data. That and the fact that it removes the 'discard' flag is why I wrote it for personal use instead of using the app in the PlayStore (also nice having a record I'm /data/logs as well).
How to Run At Boot
With the fstrim utility in .../bin or .../xbin (with proper permission, and init.d support on your ROM and the 03-filesystems-fstrim script you're ready to go. Drop the 03-filesystems-fstrim script into your init.d directory and set permissions (it's safe to give it full read/write/execute access if unsure) and you're ready to go. Your init.d directory may vary depending on ROM. I'm used to always using /system/etc/init.d, but some ROMS (CyanogenMod for example) uses a different path. Ensure that it runs after any other scripts you may have in init.d which remount the filesystems to ensure that the filesystems aren't remounted elsewhere with the 'discard' flag. You can do this by appending a number to the beginning of the filename that's higher then the others (for example you could rename it 99-filesystem-fstrim and it will run after 01tweaks or whatever might be there already). More information on init.d can be found with a Google search as it's covered everywhere.
Now, at this point on next boot the script should run and if there are logs in /data/logs/ you can read them to determine if it succeeded or not. If successful, you won't see any error messages and on the mounts that were trimmed it will let you know how many bytes off each.
Notes
I wasn't expecting this post to get moved into its own thread and was sharing this to oothers using the same ROM I was. The section of code that remounts all the filesystems is hardcoded, so that section may fail on other devices that have a different structure {and having a filesystem mounted with 'discard' flag kind of defeats the purpose of trimming to begin with ), so you may need to change this section. If editing, use a text editor that allows you to turn word wrap off as for one, it can create nasty messes in the code with strange like breaks/etc and two, it's good habit anyways when dealing with any script or programming language. I used 920 Text Editor which is pretty decent but there are plenty other good ones in the Play Store. Running the 'mount' command with no arguments after it at the command prompt can help you map the filesystem on your device with the corresponding LG G2 one.
Files are currently hosted on my Drive until I find another browser that works or get on a PC. If you already have the fstrim binary you don't need this one..Feel free to PM Amy questions or ask here.
download ~ fstrim binary (rename to 'fstrim' without any extension
download ~ filesystems-fstrim script (again, strip off any extensions in the file name
MidnightHarvester said:
INTERESTED IN A BETTER LAGFIX?
Why would you want to use this (especially if using the LagFix in the PlayStore)? Good question!
Optimized Filesystem Mounts
If you use the lagfix app off the PlayStore (or any script/app/utility/etc that uses fstrim) then mounting the filesytems with the 'discard' option is not only redundant, but also gives a performance penalty since with 'discard', the file index AND OS are both made aware immediately when memory is free up to enable garbage collection. This sounds fine, except that doing this on the fly like this also slows things down a lot. Since we will he using fstrim ourselves we don't need this extra overhead. In the script is a good link to read that explains things better than I can.
More Thorough!
Every other method I've seen so far only trims /system, /data, and /cache. There are many other mounts that can be trimmed, and some are written to quite frequently (/persist as an example).
Maintains Lots of All Activity
All activity is logged and sent to $ANDROID_DATA/logs/ where it's then saved. That way you can tell if it's running on boot or on the schedule as it's supposed to he running.
OK well, there's not a lot going on here, just felt like being overly dramatic as it's boring over here at the moment. All of the above is true, and after deciding to post it in here I cleaned it up quite a bit so even the most novice at BASH (any language really) can understand what's going on and change it to suit your needs.
A few things to point out. You WILL need to have the fstrim binary located somewhere in one of your environment paths. A good spot for it is always /system/bin or /system/xbin of you are having trouble deciding where You will probably want to also ensure that the fstrim binary has the correct permissions. If you are unsure of what those are, just give it all read/write/execute.
Second, you will need the script and figure how out how you'll be using it. You need to keep in mind that in the /system/init.d/ directory there is a script there called 03filesystem (something like that) which also mounts the fileaystems. If you like, you can move that script to you sdcard (don't keep it in init.d though or it'll be run..I don't know if having a .bak file extension will stop it as I've never tried) and copy this script over. This script's mounts are EXACTLY the same (even includes the break lease at the end) as what Jake uses as default except without the 'discard' flag. Replacing the default 03filesystems with this one is a perfect place to run the script if you reboot your phone at least once every few days (can always run it manually as well if needed). If you leave Jake's in and still use this, then ensure this one is named appropriately so that it runs after his does, or his script will remount the filesystems again with 'discard'.
There are plenty of explanations in the script as well. Point is, just he aware that of it runs before Jake's filesystem mounts do his will overwrite this one's and you'll lose the advantage of trimming on startup (or a schedule).
Check the /data/logs/ directory for output from the script, and be sure to also give this script the correct permissions as well. If in doubt just give it all read/write/execute permissions (well that's what I've been using on both this and the fstrim binary. I've linked both of the files below. I couldn't upload as an attachment so I uploaded to my Drive. Enjoy.
Edit: This was written for and intended for the VS980 (Verizon G2). Other G2s should he perfectly fine and any device that is compatible to run LagFix off the Play Store (you don't need to use LagFix either BTW if using this). Just be sure that you device is on the compatible list before using, otherwise there is a possibility of bricking your device. If using a G2 you're fine, but I never know who else reads these threads.
download ~ fstrim binary
download ~ filesystems-fstrim script
Sorry everyone, I posted this late last night and didn't realize that the directory I uploaded the files to was private. The links should work now as I've set them to be Public.
If you have any questions, feel free to PM me.
Click to expand...
Click to collapse
Can someone chime in on what he's talking about in this very long winded post.
Sent from my VS980 4G using Tapatalk
friguy3 said:
Can someone chime in on what he's talking about in this very long winded post.
Sent from my VS980 4G using Tapatalk
Click to expand...
Click to collapse
If you can't be bothered to read it, it's probably not for you.
Dearborn1977 said:
If you can't be bothered to read it, it's probably not for you.
Click to expand...
Click to collapse
I did read it thank you very much sir. But, not all of us are devs or in the tech industry and understand this. Someone posts something, sometimes its nice to have others chime in or get a more simplified explanation. He posted it last night and nobody really commented on it (one maybe?)....makes you be cautious.
Sent from my VS980 4G using Tapatalk
The information is useful and should be in a thread of its own or maybe okibi can incorporate in 1.2.3
VS980 4G
friguy3 said:
Can someone chime in on what he's talking about in this very long winded post.
Sent from my VS980 4G using Tapatalk
Click to expand...
Click to collapse
It's a utility for trimming (defrafmenting) certain filesystems. This is built into 4.3+ and tries to run at least once every day or two, but we don't have it on 4.2.2 ROMs. The fstrim file is the binary that can run at the command prompt -
Code:
# usage
# fstrim [-v] {/mount-to-trim} // -v flag runs fstrim and sends output to stdout
#
# Example for trimming /data
fstrim -v "/data"
So fstrim goes into /system/bin or /system/xbin (set the permissions correctly so it can run. The other file is a script that I use to replace the /system/etc/init.d/03filesystems file that runs at boot that's included with the ROM (its named something like that, can't check at the moment). First it remounts all the filesystems just like the one in ROM does except they are mounted without 'discard' since we are trimming and don't need it. Then the script runs fstrim on all mounted volumes that it can run on and logs output to /$ANDROID_DATA/logs (/data/logs). Need to be sure to give this script the correct permmisions as well.
There's an app in the PlayStore that does the same thing except it doesn't tell all the filesystems or remount all your filesystems without the 'discard' flag which is really easy to use. This is just a more thorough method of trimming what that app doesn't and optimizing your mounts accordingly to take advantage of it (using trim on filesystems with 'discard' is redundant and using 'discard' slows performance down as the OS notifies in real time what files in the file index have been deleted/moved..
---------- Post added at 05:04 PM ---------- Previous post was at 05:01 PM ----------
smacklayer said:
What does this have to do with this ROM/Thread?
Click to expand...
Click to collapse
Well, it is meant (as is) to replace the 03filesystems script in the /system/etc/init.d folder. Or it can be noticed and set to run on a schedule. It was to written on a vs980 running this ROM, so that's where I'm sharing it.
Will the script trim on its own?
VS980 4G
veloct said:
The information is useful and should be in a thread of its own or maybe okibi can incorporate in 1.2.3
VS980 4G
Click to expand...
Click to collapse
Hopefully soon we won't have to worry about it since it's built into 4.3+. I might post it in the G2 (all) development area later this evening if it proves helpful to anyone.
This should really be the Themes and App thread not in a Rom thread.
Link to where it should be below.
http://forum.xda-developers.com/lg-g2/themes-apps
MidnightHarvester said:
INTERESTED IN A BETTER LAGFIX?
Why would you want to use this (especially if using the LagFix in the PlayStore)? Good question!
Optimized Filesystem Mounts
If you use the lagfix app off the PlayStore (or any script/app/utility/etc that uses fstrim) then mounting the filesytems with the 'discard' option is not only redundant, but also gives a performance penalty since with 'discard', the file index AND OS are both made aware immediately when memory is free up to enable garbage collection. This sounds fine, except that doing this on the fly like this also slows things down a lot. Since we will he using fstrim ourselves we don't need this extra overhead. In the script is a good link to read that explains things better than I can.
More Thorough!
Every other method I've seen so far only trims /system, /data, and /cache. There are many other mounts that can be trimmed, and some are written to quite frequently (/persist as an example).
Maintains Lots of All Activity
All activity is logged and sent to $ANDROID_DATA/logs/ where it's then saved. That way you can tell if it's running on boot or on the schedule as it's supposed to he running.
OK well, there's not a lot going on here, just felt like being overly dramatic as it's boring over here at the moment. All of the above is true, and after deciding to post it in here I cleaned it up quite a bit so even the most novice at BASH (any language really) can understand what's going on and change it to suit your needs.
A few things to point out. You WILL need to have the fstrim binary located somewhere in one of your environment paths. A good spot for it is always /system/bin or /system/xbin of you are having trouble deciding where You will probably want to also ensure that the fstrim binary has the correct permissions. If you are unsure of what those are, just give it all read/write/execute.
Second, you will need the script and figure how out how you'll be using it. You need to keep in mind that in the /system/init.d/ directory there is a script there called 03filesystem (something like that) which also mounts the fileaystems. If you like, you can move that script to you sdcard (don't keep it in init.d though or it'll be run..I don't know if having a .bak file extension will stop it as I've never tried) and copy this script over. This script's mounts are EXACTLY the same (even includes the break lease at the end) as what Jake uses as default except without the 'discard' flag. Replacing the default 03filesystems with this one is a perfect place to run the script if you reboot your phone at least once every few days (can always run it manually as well if needed). If you leave Jake's in and still use this, then ensure this one is named appropriately so that it runs after his does, or his script will remount the filesystems again with 'discard'.
There are plenty of explanations in the script as well. Point is, just he aware that of it runs before Jake's filesystem mounts do his will overwrite this one's and you'll lose the advantage of trimming on startup (or a schedule).
Check the /data/logs/ directory for output from the script, and be sure to also give this script the correct permissions as well. If in doubt just give it all read/write/execute permissions (well that's what I've been using on both this and the fstrim binary. I've linked both of the files below. I couldn't upload as an attachment so I uploaded to my Drive. Enjoy.
Edit: This was written for and intended for the VS980 (Verizon G2). Other G2s should he perfectly fine and any device that is compatible to run LagFix off the Play Store (you don't need to use LagFix either BTW if using this). Just be sure that you device is on the compatible list before using, otherwise there is a possibility of bricking your device. If using a G2 you're fine, but I never know who else reads these threads.
download ~ fstrim binary
download ~ filesystems-fstrim script
Sorry everyone, I posted this late last night and didn't realize that the directory I uploaded the files to was private. The links should work now as I've set them to be Public.
If you have any questions, feel free to PM me.
Click to expand...
Click to collapse
veloct said:
Will the script trim on its own?
VS980 4G
Click to expand...
Click to collapse
The script needs the fstrim binary, which you can grab elsewhere if worried about this one. I also went in and made the script as readable as I could. Without the fstrim binary, all this script does is remount all the filesystems without the 'discard' flag. If you are using the LagFix app then that's still useful as we don't need discard if manually trimming.
---------- Post added at 05:27 PM ---------- Previous post was at 05:14 PM ----------
Jimi Mack said:
This should really be the Themes and App thread not in a Rom thread.
Link to where it should be below.
http://forum.xda-developers.com/lg-g2/themes-apps
Click to expand...
Click to collapse
I need to clean it up in a proper text editor first before sharing to everybody. The built in text editor is not to useful when scripting because of the screen sizes and blocks of text often become mangled (especially in the comment). I'm going through it now and reediting with the proper text encoding. Won't take long but in the meantime I need to fix the encoding. I added the commenting in last night using the built in editor with Root Explorer which .. Well .. not too useful lol.
Once I'm sure the encoding will work across the board I'll post in that forum.
friguy3 said:
I did read it thank you very much sir. But, not all of us are devs or in the tech industry and understand this. Someone posts something, sometimes its nice to have others chime in or get a more simplified explanation. He posted it last night and nobody really commented on it (one maybe?)....makes you be cautious.
Sent from my VS980 4G using Tapatalk
Click to expand...
Click to collapse
I didn't mean to sound like a jerk, was just trying to say that given this mod has you replacing a script and adding a binary, if it's over your head I wouldn't mess with it.
Dearborn1977 said:
I didn't mean to sound like a jerk, was just trying to say that given this mod has you replacing a script and adding a binary, if it's over your head I wouldn't mess with it.
Click to expand...
Click to collapse
Went in and cleaned the formatting up using 920,l text editor and updated the original post I made with the updated link. If downloading, use the links on my posts and not any of the links from the quotes. If editing, it's best to use an editor that doesn't have word wrap enabled or at least an option to turn it off. That applies to any type of scripting or programming language. Otherwise, be careful that commented text doesn't get cut and interpreted code.
Anyways, he's right. If something looks like a foreign language to youz be sure to study up on it or bring along a good translator/guide before going to visit for a while. There's nothing complicated going on but the terminology obscufcates even the simplest of sentences. See? Malladus doesn't (I should say stock 4.2.2) doesn't include fstrim, a feature that's in 4.3+. You won't replacing any binaries unless you've already added fstrim yourself, in which case all you'd need is the script.
I think this is definitely a useful post for those interested, but has anyone actually verified that running fstrim on the G2 is 100% safe from the EMMC corruption issues that had plagued other devices in the past? Downloading Lagfix wouldn't be a good test as that program hasn't been updated since long before the G2 release (March 2013).
Just reporting back, I'm generally dubious of mods promising to smooth out the ui and have found things like entropy seeders to be more trouble than they're worth, but this mod works, plain and simple. Not that the G2 needs much smoothing out but if you've ever tried a CM based ROM on the G2, you can tell stock based ROMs aren't as smooth.
I was under the impression fstrim was only useful on older hardware.
Sent from my VS980 4G using Tapatalk
soapinmouth said:
I was under the impression fstrim was only useful on older hardware.
Sent from my VS980 4G using Tapatalk
Click to expand...
Click to collapse
The fstrim utility is built into Android 4.3/4.4 ROMs by way of baking it in the vold deamon. For more information you can read this page. Basically it's responsible for mounting the /system and /data, ... on start and running the init startup stuff (init.rc for example). They use analgorithm for fstrim as to attempt to have it run at least once every 24-48 hours.
On 4.2.2 we don't have fstrim and instead volumes are mounted so that the OS and disk are both kept up to date on which blocks of memory are free and that can be used. Doing this on the fly slows down performance, and that's why I remount the volumes without that option at the beginning of the script, so we can take advantage of the performance gains and run fstrim ourselves on all volumes (ffilesystem's that are able to be trimmed at least...if the file system doesn't support it then it won't be trimmed).
By placing this script in our init.d folder we can run keep our volumes 'defragmented' without having that extra process run all the time (simple way of pitting it). It should run at least once every 5 days or so at the least. Fstrim is relevent for ext4 volumes (and a handful of other types) and therefore relevant to any device where all filesystem layers support it. One other advantage of fstrim is that it returns a value whereby setting the 'discard' does not. If you run fstrim in verbose more or assign the result to a variable and it returns either "0 bytes were trimmed..." or "xxxx bytes were trimmed..." then you know it's supported and relevant. You can also check your mounts by typing 'mount' at a command prompt. There you can check and see if your filesystems are using discard or not.
Devices that mount their filesystems without discard and without the fstrim utility eventually can and will become intolerably slow or usable due to a process called "write amplification". Eventually it will become hard for the disk to find blocks of memory to erase. Only empty blocks of memory can be deleted. When writing to memory, the smallest is a page. A block holds many pages, so eventually space becomes a premium and it becomes difficult to find empty blocks to erase so that a page in the block can be used to write something do. The more complicated mappings and having to shuffle data around is a huge culprit of 'lagging' ones' device.
It gets confusing, especially when I'm deciding what's important enough to work on and use as there are a lot of tweaks out that don't actually do anything but are still used for some reason (probably out of habit over time). This is definitely one of the more useful tweaks to make on 4.2.x for improving performance (as long as the filesystem mount changes are used alongside it).
I'm not familiar with all the G2 ROMs (as in I've only used one and I use that as a base to build on), and this could possibly be built in in the form of init.d scripts or built into vold if on AOSP (though I haven't seen any AOSP 4.2.x ROMs for the G2 considering the newer versions). In that ca
xdabbeb said:
I think this is definitely a useful post for those interested, but has anyone actually verified that running fstrim on the G2 is 100% safe from the EMMC corruption issues that had plagued other devices in the past? Downloading Lagfix wouldn't be a good test as that program hasn't been updated since long before the G2 release (March 2013).
Click to expand...
Click to collapse
is just dared to try lagfix and it worked like a charm!
This is only good for Android 4.2.2 builds and older
Sent via Crossbreeded, 100% V6 Supercharged. KT747'd and Linaro Built Paranoid Android 3.10
I've been running LagFix Premium since the first day the G2 was rooted. Every morning at 5AM. Overkill, perhaps, but this is what kept me sane with the old Galaxy Nexus. When I first used LagFix on the GNex it changed my world.
luv2increase said:
This is only good for Android 4.2.2 builds and older
Click to expand...
Click to collapse
That's exactly what the OP said in the long post two above yours.
---------- Post added at 09:47 AM ---------- Previous post was at 09:45 AM ----------
MidnightHarvester said:
You can also check your mounts by typing 'mount' at a command prompt. There you can check and see if your filesystems are using discard or not.
Click to expand...
Click to collapse
What specifically should we see when we type "mount" if the filesystems are using discard?

Categories

Resources