[Tool]Linux Script for Themers/Devs - G1 Android Development

Hey all, I wanted to share with you all this great srcript for png crushing your .png's using the Brute method which is the best method to use.
This is the script I use made by Lithid on cyanogenmod forums that he gave to me. This will only work for linux! Thanks again Lithid!
Usage:
Step 1:
First cd to your folder that you want to crush. All I do is drag the folders that I want to crush like drawable-mdpi ect to my home folder. That way the only thing I have to cd to in termial is the folder itself. /home/$cd drawable-mdpi. This can be used to boot animations as well! However I will not be having a tutorial on how to make boot animations.
Step 2:
Copy and paste this code into termial and press enter. It could take awhile for it to finish, and uses the Brute method which is the best method of compression available, enjoy!
Code:
#!/bin/sh
for png in `find $1 -name "*.png"`;
do
echo "crushing $png"
pngcrush -brute "$png" temp.png
mv -f temp.png $png
done;

You might want to make sure it doesn't touch the .9 files if they are present in the folder.
stolen straight from vendor/cyanogen/tools/opticharger...
Code:
for x in `find . -name "*.png" | grep -v "\.9.png$" | tr "\n" " "`

dumfuq said:
You might want to make sure it doesn't touch the .9 files if they are present in the folder.
stolen straight from vendor/cyanogen/tools/opticharger...
Code:
for x in `find . -name "*.png" | grep -v "\.9.png$" | tr "\n" " "`
Click to expand...
Click to collapse
actually it doesn't effect the .9.'s because it's not changing the dementions of them, just the size in megabits. I used it on my latest theme and it works fine
Sent from my HTC Dream using XDA App

Related

[UTIL] getcyan [v2.1 updated 2009-07-29] - Shell script to get a CyanogenMod ROM

*** v2.1 Updated 2009-Jul-29 : Integrated into CyanogenMod ROM v3.9.3 (experimental) ***
WHAT IT DOES:
Gets ROMs: Gets a particular version of the CyanogenMod series of ROMs, verifies the MD5sum of the downloaded ROM file and sticks it on your SD card as update.zip, ready for you to flash. You can even fetch experimental and test versions of CM ROMs with this script.
List ROMs: You can list available ROMs on cyanogen's server. You can choose to list the latest available, the latest 5, or all available ROMs in the STABLE, EXPERIMENTAL and TESTING branches on cyanogen's server.
Automatically Reboot into recovery: It has an option to automatically reboot into recovery mode after a successful ROM download, to ease the flashing process. If you use this option, it counts down 10 seconds to give you a chance to change your mind in case you decide you do not want to reboot. During this countdown, you can ctrl+c out of the script (If you're doing this on the phone, to type "ctrl+c" you press the trackball, then hit the "c" key). I recommend that you install cyanogen's Recovery image
Backward compatibility mode: For those who prefer the way the old 1.0 script behaved, and fetch a ROM with a minimum of fuss without messing with pesky command line parameters
PRE-REQUISITES:
Busybox (for all the script goodness)
Root access (makes life easier)
Apps2SD (not mandatory)(the script goes on your ext2 partition)
HOW TO INSTALL:
In case the script is not already present in your CM ROM (or if you want to upgrade), simply follow the steps below to install/upgrade it.
Unzip the attached zip file
Push the "getcyan" script to your SD card, onto the ext2 partition. This is usually at "/system/sd". You can use adb push as follows:
Code:
adb push <PATH_TO_EXTRACTED_SCRIPT>/getcyan /system/sd
If you want to create a softlink to the getcyan script so you don't have to keep typing the full path to the script, do the following on the phone (or after running "adb shell"):
Code:
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
rm -f /system/bin/getcyan
ln -s /system/sd/getcyan /system/bin/getcyan
mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system
OR
Note that from adb, instead of typing in the whole mount command as above, you could also do the following
Code:
adb remount
adb shell
rm -f /system/bin/getcyan
ln -s /system/sd/getcyan /system/bin/getcyan
(thanks to Karolis for this tip)
Change the permissions on the script:
Code:
su
chmod 755 /system/sd/getcyan
USAGE:
You really should open up terminal and get a root shell using "su" before running the script. It has the following options:
Code:
OPTIONS :
-g VER - get/fetch CM ROM with version VER.
VER can be (see NOTE below):
latest - The latest available
x.x[.x]* - A particular version number
like 3.4 or 3.6 or 3.6.8.1
-G - get latest version. Shorthand for "-g latest"
-x - Get/list ROM(s) from experimental branch
-t - Get/list ROM(s) from testing branch
-l NUM - list/show NUM number of ROM(s).
NUM can be (see NOTE below):
latest - Show latest available ROM
some - Show the 5 latest ROMs
all - Show all available ROMs
-L - list latest. Shorthand for "-l latest"
-r - reboot into recovery after fetch
-f - override filename
-h - Help/usage (This message)
-v - Show version number of this script
NOTE:
For both the -g and the -l options above:
The ROMs listed/fetched depend on whether -t or -x
were passed in or not.
If -t was specified, then ROMs from the testing
directory will be shown/fetched
If -x was specified, then experimental ROMs will
be shown or fetched
If neither -x or -t was specified, then stable ROMs
are fetched
SHORTCUTS :
-6 - Get latest stable ROM and reboot into recovery
shorthand for "-g latest -r"
-8 - Get latest experimental ROM and reboot into recovery
shorthand for "-g latest -x -r"
EXAMPLES:
To see what the latest stable ROM is
Code:
getcyan -l latest
OR
Code:
getcyan -L
To see the last 5 experimental ROMs
Code:
getcyan -l some -x
To see all testing ROMs
Code:
getcyan -l all -t
To see what the latest experimental ROM is
Code:
getcyan -l latest -x
OR
Code:
getcyan -L -x
To get the latest stable ROM
Code:
getcyan -g latest
OR
Code:
getcyan -G
To get the latest stable ROM and automatically reboot into recovery mode
Code:
getcyan -g latest -r
OR
Code:
getcyan -G -r
OR
Code:
getcyan -6
To get the latest experimental ROM and automatically reboot into recovery mode
Code:
getcyan -g latest -x -r
OR
Code:
getcyan -G -r -x
OR
Code:
getcyan -8
To get a particular version of a ROM - say 3.6
Code:
getcyan -g 3.6
To get a particular version of a ROM - say 3.9 from the experimental branch, then reboot into recovery
Code:
getcyan -g 3.9 -x -r
To get a ROM with a particular filename. In this example, we get the "donuthole-20090725.zip" ROM from the testing branch (Notice the use of the "-f" parameter to force the filename override)
Code:
getcyan -g donuthole-20090725.zip -f -t
Backward Compatibility Mode - For that old-timey feeling. In this example, we get CM ROM version 3.6
Code:
getcyan 3.6
ACKNOWLEDGEMENTS:
ttabbal - For the md5sum idea
spacezorro - For the "latest" idea
Cyanogen - For the ROMs, man, for the ROMs
CHANGELOG:
2.1
Added (actually fixed) backward compatibility mode
Added version number (with option to display it, for scripting)
Cleaned up help message to remove irrelevant faff
This script is present in CyanogenMod Experimental ROM 3.9.3
2.0
List available ROMs - latest, latest 5 or all
Listing/fetching ROMs from stable, experimental and testing branches
Get latest ROM or a particular version
Ability to fetch an unconventionally-named ROM by specifying the filename on the command line
Automatically reboot into recovery mode after a successful fetch
This script is present in CyanogenMod Experimental ROM 3.9.2
Excellent job. Can't wait till Cyanogen just packages it with his mods.
beast.in.black said:
Apps2SD (the script goes on your ext2 partition)
Click to expand...
Click to collapse
Wouldn't it also work to stick this into /data/local/bin, which is already in the PATH variable by default (at least on cyan's ROMs). Of course, that way it would disappear on wipe, but it would be easier to run the script.
I tried adding a 'export PATH="$PATH:/system/sd/bin"' line to my userinit.sh, but it didn't have any effect. It probably runs too early...
@firetech : Yes, you could definitely stick it in your /data/local/bin...but as you pointed out, it will be lost on wipe. In case you don't have (or want) apps2sd, then this is an option for you. I would, however, recommend apps2sd along with the symlink method I outlined in the "How to install" section.
@overpower: Thanks
Used your original one from CM thread. Great that you added the experimental version download option.
When I came to read this post, I thought you were talking about switching between multiple versions of ROMs from cyano.
Do you think this can be extended to other ROMs as well?
Do you think writing peripheral code for really installing/reinstalling a ROM version would be a good idea to add to this script? For example:
1. Backup current /system/sd, along with the nandroid backup of the system and the ROM ZIP.
2. Mark the above with a ROM version and create a folder for it on /sdcard.
3. Provide the reverse to go back and forth between ROM versions. Make the nandroid backup from the selected ROM folder the latest so that recovery can restore it, copy the ZIP file in /sdcard as update.zip in case a wipe is needed.
Right now, this is a painstaking job to toggle between 2 ROMs.
If you are doing these steps in ADB, step #3 can be done much easier. Just type adb remount and that's it!
Also, at least on my phone it does not seem to want to work unless I su first.
Otherwise great script! Makes life much more easier. I like taking risks and downloading experimental ROM 15 minutes before my flight to foreign country, where if my phone is dead, I'm dead. This script will definitely allow me to do crazy stuff with more confidence
Oh, and I wish Cyanogen would add it to the ROM itself. At least until the OTA updater is built.
devsk said:
Do you think writing peripheral code for really installing/reinstalling a ROM version would be a good idea to add to this script?
Click to expand...
Click to collapse
devsk, interesting idea indeed...Let me put some thought into this
Karolis said:
If you are doing these steps in ADB, step #3 can be done much easier. Just type adb remount and that's it!
Also, at least on my phone it does not seem to want to work unless I su first.
Click to expand...
Click to collapse
Karolis, the script needs to run as root since otherwise wget has problems. I'll make this explicit in the instructions. Also, thanks for pointing out the "adb remount" command, I've added it to the instructions
I will try this, sounds like a great idea... thanks
Is there any way to add this to gscript? Since there needs to be interaction from the user, I would guess you would have to edit each time to make it work.
Yeah I will put it in 3.9.1 until we get a proper OTA updated finished.
cyanogen said:
Yeah I will put it in 3.9.1 until we get a proper OTA updated finished.
Click to expand...
Click to collapse
Sweet! Thank you.
Also, I know you must be sick of questions like this, but: is there an ETA for 3.9.1. I've seen you are playing with donut. Hopefully that won't postpone 3.9.1. too much...
You're the best!
beast.in.black, I've just had an idea for the future of this script. How about posting "a call to action" ir development and theme forums asking for all devs to use the same naming convention for their roms and themes + provide checksums. That way you could expand the script beyond CM's ROMs (that is if you want).
Of course not everyone would join this cause as some people don't have server resources to post stuff and it wouldn't work with file sharing services, but hey, it's worth a try.
What do you think?
Gscriptable getcyan
pixel-painter said:
I will try this, sounds like a great idea... thanks
Is there any way to add this to gscript? Since there needs to be interaction from the user, I would guess you would have to edit each time to make it work.
Click to expand...
Click to collapse
I hacked mine to use...
Code:
wget -q -O- http://n0rp.chemlab.org/android/ |grep "${FNAME_PREFIX}.*${FNAME_SUFFIX}\""|sed "s/.*<a href=\"//;s/\".*//"|tail -n1
Then I got the "scripting bug" and I rewrote it a bit so it wasn't hacked up.
Code:
#!/system/bin/sh
FNAME_PREFIX="update-cm-"
FNAME_SUFFIX="-signed.zip"
MD5NAME_SUFFIX="${FNAME_SUFFIX}.md5sum"
SAVEFNAME=/sdcard/update.zip
MD5CMD="md5sum -c"
MOD_FILENAME=""
MOD_MD5NAME=""
MIRROR="http://n0rp.chemlab.org/android/"
usage()
{
echo
echo "Usage : $0 ( [VERSION] [-x] | -h )"
echo " Gets a particular version of the CyanogenMod"
echo " series of ROMs, and sticks it on your SD card"
echo " as update.zip, ready for you to flash."
echo
echo "Args :"
echo " -h - Help (This Message!)"
echo " VERSION - The CM ROM version to fetch."
echo " -x - Specify that the version you want to fetch"
echo " is an EXPERIMENTAL version."
echo
exit
}
cleanup()
{
rm -f ${SAVEFNAME}
rm -f ${MOD_FILENAME}
rm -f ${MOD_MD5NAME}
}
latest()
{
wget -q -O- ${MIRROR}${EXPER} |grep "${FNAME_PREFIX}.*${FNAME_SUFFIX}\""|sed "s/.*<a href=\"//;s/\".*//"|tail -n1
}
if [ "$1" = "-h" ];
then
usage
fi
# check if user wants an experimental build
EXPER=""
if [ "$1" == "-x" ];
then
EXPER="experimental/"
echo "Experimental build specified"
elif [ "$2" == "-x" ];
then
EXPER="experimental/"
echo "Experimental build specified"
fi
if [ -z $1 ];
then
MOD_FILENAME=`latest`
MOD_MD5NAME=${MOD_FILENAME}.md5sum
VER="Latest"
elif [ "$1" == "-x" ];
then
MOD_FILENAME=`latest`
MOD_MD5NAME=${MOD_FILENAME}.md5sum
VER="Latest Experimental"
else
MOD_FILENAME=${FNAME_PREFIX}${1}${FNAME_SUFFIX}
MOD_MD5NAME=${FNAME_PREFIX}${1}${MD5NAME_SUFFIX}
VER="${1}"
fi
cd /sdcard
echo "Deleting any previous update.zip..."
cleanup
# Download update ROM and MD5Sum
echo "Getting CyanogenMod ROM version $VER : ${MOD_FILENAME}"
echo
wget ${MIRROR}${EXPER}${MOD_FILENAME}
RES=$?
if [ ${RES} -ne 0 ];then
echo "Could not download ${MOD_FILENAME}"
echo "If you want to fetch an experimental version,"
echo "specify -x in the call to this script"
echo
echo "Nothing downloaded, exiting"
cleanup
exit
fi
# get the md5sum file
echo "Getting CyanogenMod ROM MD5 version $VER : ${MOD_MD5NAME}"
echo
wget ${MIRROR}${EXPER}${MOD_MD5NAME}
RES=$?
if [ ${RES} -ne 0 ];then
echo "Could not download ${MOD_MD5NAME}, exiting"
cleanup
exit
fi
# Verify downloaded ROM
echo "Checking ${MOD_FILENAME} MD5..."
MD5SUM_RESULT=`${MD5CMD} ${MOD_MD5NAME} | cut -d":" -f2 | grep OK`
echo " md5sum result : $MD5SUM_RESULT"
if [ ! -z $MD5SUM_RESULT ]
then
echo "${MOD_FILENAME} Downloaded Successfully"
mv ${MOD_FILENAME} ${SAVEFNAME}
rm ${MOD_MD5NAME}
echo "You may now reboot and flash"
else
echo "ERROR : ${MOD_FILENAME} Download Unsuccessful"
echo "Deleting bad download and exiting..."
cleanup
fi
So there it is...
I haven't try this yet but so far the only think I woudl ask for besides an GUI is to be able to know what versions are out there. What if i don't know what's the new version. i woudl have to go and check online. but if we have a command on the script to tell us the roms available it woudl be easier and great. I wouldn't even ask for a GUI then.
Rafase282 said:
I haven't try this yet but so far the only think I woudl ask for besides an GUI is to be able to know what versions are out there. What if i don't know what's the new version. i woudl have to go and check online. but if we have a command on the script to tell us the roms available it woudl be easier and great. I wouldn't even ask for a GUI then.
Click to expand...
Click to collapse
Until there is a way to do something like LucidREM has done with his script (such as lucid -u), I think your only options are
Subscribe to his Twitter page
Bookmark his server where his updates are stored.
Subscribe or check back frequently here on XDA.
I personally do all three.
beast.in.black said:
[*]Fetching Experimental builds: to fetch an experimental build from Cyanogen (Applicable from CyanogenMod v3.9 onwards), simply add the "-x" command line option to the script, after specifying the VERSION. Like so:
Code:
getcyan 3.9 -x
Click to expand...
Click to collapse
Recommendation
Add a "-t" for his testing builds as well.
They are not anywhere near as frequently used as experimental... but nonetheless it is still available on his server.
I added this on to the end so that the completed build would be flashed\
Code:
#Flash the Rom
echo "Rebooting and flashing update..."
echo "boot-recovery --update_package=SDCARD:update.zip" > /cache/recovery/command
reboot recovery
Sounds coll that you can do that, but still, I prefer making a backup first
This is amazing, thank you for making cyan updates even easier! Got it set up and running in no time!
Karolis said:
How about posting "a call to action" ir development and theme forums asking for all devs to use the same naming convention for their roms and themes + provide checksums.
Click to expand...
Click to collapse
Karolis, this is a great idea. I'll put the call to action out
spacezorro said:
I hacked mine to use...
So there it is...
Click to expand...
Click to collapse
spacezorro, you have already done what was on my roadmap for this script Thank you very much indeed. I am right now hacking the script up to recognize "latest" as a keyword and testing the changes now, and will update the script and post a fresh download (in the original post) once i've tested it out.
Rafase282 said:
What if i don't know what's the new version. i woudl have to go and check online. but if we have a command on the script to tell us the roms available it woudl be easier and great
Click to expand...
Click to collapse
Rafase282, I've put this on the roadmap as the next thing to work on.
Binary100100 said:
Recommendation
Add a "-t" for his testing builds as well.
They are not anywhere near as frequently used as experimental... but nonetheless it is still available on his server.
Click to expand...
Click to collapse
Excellent recommendation, will add it to the script.
indiekid97 said:
I added this on to the end so that the completed build would be flashed
Click to expand...
Click to collapse
Nice, will make it an option in the script to automatically reboot and flash if the md5sum checks out OK.
Thanks to everyone for all the great ideas
@cyanogen: Since you'll be adding this to your ROM, how do I keep you informed of changes to the script? PM you or something?

[HOWTO] Create your own AOSP 100% stock

EDIT: Just updated post 2 you probably want to read both this post and that post before trying to build.
you can skip the part of getting the official source and the cyanogen source by just doing
Code:
repo init -u git://github.com/CyanogenMod/android.git -b froyo
First some prereqs You must be using linux and building for an evo 4G aka htc_supersonic
Install the android SDK as instructed here: http://developer.android.com/sdk/installing.html
You will need JDK most linux distros have this in the respositorys.
Then just follow step 2 and make sure that you can run adb from any directory in terminal.
Now to the good stuff.
You will now need to open a terminal window and run the following as root
Code:
cd /usr/bin/; curl http://android.git.kernel.org/repo > repo; chmod a+x /usr/bin/repo
now as user do the following
Code:
mkdir ~/android
cd ~/andoid
repo init -u git://android.git.kernel.org/platform/manifest.git
repo sync
This can take FOREVER like 4-5 hours so you might want to let it go when you go to sleep.
Depending on how fast your computer is the following step can take a long time too
Code:
cd ~/andoid
make
This will build the source code for a generic device it should build everything correctly if you have all of the compilers and what not. If it fails just install the app that it is complaining about.
Now for the EVO specific stuff
Code:
cd ~/android/device/htc
git clone http://github.com/CyanogenMod/android_device_htc_supersonic.git supersonic
That will get the build files however you are going to have to edit them to get it to work.
~/android/device/htc/supersonic/BoardConfig.mk needs to be edited
Code:
TARGET_RECOVERY_UI_LIB := librecovery_ui_supersonic librecovery_ui_htc
TARGET_RECOVERY_UPDATER_LIBS += librecovery_updater_htc
should be
Code:
#TARGET_RECOVERY_UI_LIB := librecovery_ui_supersonic librecovery_ui_htc
#TARGET_RECOVERY_UPDATER_LIBS += librecovery_updater_htc
Some other files may have to be edited to your liking. Personaly I changed ADWLauncher to launcher2 and removed all of the cyanogen stuff.
Now to setup the build enviroment.
Code:
cd ~/android
cp ./vendor/cyanogen/products/cyanogen_supersonic.mk ./buildspec.mk
. build/envsetup.sh
lunch cyanogen_supersonic-eng
Now to do the building.
Code:
make CYANOGEN_WITH_GOOGLE=true otapackage ## if you want google apps (market etc.)
make otapackage ## 100% Open Source only!
By the way for some reason you have to inclued the otapackage even if you just want the .img files because otherwise it crashes at least for me.
Let me know if you encounter any problems and I will try to help.
UPDATES
Copy your ~android folder somewhere and replace ~/android in this tutorial with the directory that you copied it to. This will allow you to update the overlay when needed.
To add google files you will need to do this
Code:
cd ~/android/vendor/cyanogen
./get-google-files
This gets the htc files and I think taht it might be required.
Code:
cd ~/android/device/htc/supersonic
./extract-files.sh
To make a clean rom like mine do the following:
Edit the file ~/android/vendor/cyanogen/products/common.mk to your liking. I just changed the build name and rom version.
I added the files sysrw and sysro ad you can see in the file just put them in a directory and tell it where they are and where you want them. Also I commented out rommanager.apk as I don't like or use it. Also I use RA recovery so it wont work for me anyway.
Also edit the file ~/android/vendor/cyanogen/products/cyanogen_supersonic.mk
I chaged teh build number to the latest spring and removed the boot animation as I like the stock android one better (and it is faster).
YOU NEED TO do this if you want a keyboard...
edit ~/android/vendor/cyanogen/Android.mk and remove LatinIME!
Now we delete some files.
go to ~/android/packages/apps
delete any application that you don't want. You can optionally add program source code that you do want.
I deleted CM* and Protips
I also edited some code in Settings to remove Cyanogen stuff. Actually I took the stock android stuff an edited that with one little fix but I forgot what it was. Just try to build and it will tell you in an error message.
another reserved post
Really cool
Awesome! Thanks so much for posting this.
thanks dude!!
Thanks man.
question...
im having an issue with this step
Code:
cd ~/adnroid
cp ./vendor/cyanogen/products/cyanogen_supersonic.mk ./buildspec.mk
. build/envsetup.sh
lunch cyanogen_supersonic-eng
specifically (lets ignore the type in the instructions
Code:
$ cp ./vendor/cyanogen/products/cyanogen_supersonic.mk ./buildspec.mk
cp: cannot stat `./vendor/cyanogen/products/cyanogen_supersonic.mk': No such file or directory
$ find ~/android -name "cyanogen_supersonic.mk"
$ echo $?
0
anyone else having this issue?
So what is the difference between this and running CM6?
Will this avoid the market issues with CM6?
Once it's built, how do you get it installed on the phone?
Here is the link to cyanogens wiki how too......
http://wiki.cyanogenmod.com/index.php?title=Compile_CyanogenMod_for_Supersonic
Anyway to do this on Windows 7? Another question, would this still work if I just ran Ubuntu from disk?
Thanks, will def.ly give this a try soon...
Sent from my PC36100 using Tapatalk
onicrom said:
question...
im having an issue with this step
Code:
cd ~/adnroid
cp ./vendor/cyanogen/products/cyanogen_supersonic.mk ./buildspec.mk
. build/envsetup.sh
lunch cyanogen_supersonic-eng
specifically (lets ignore the type in the instructions
Code:
$ cp ./vendor/cyanogen/products/cyanogen_supersonic.mk ./buildspec.mk
cp: cannot stat `./vendor/cyanogen/products/cyanogen_supersonic.mk': No such file or directory
$ find ~/android -name "cyanogen_supersonic.mk"
$ echo $?
0
anyone else having this issue?
Click to expand...
Click to collapse
there was a typo in my code I edited the post and it should work now.
cteneyck said:
Here is the link to cyanogens wiki how too......
http://wiki.cyanogenmod.com/index.php?title=Compile_CyanogenMod_for_Supersonic
Click to expand...
Click to collapse
So really, this is just CM6 built on your own Linux box?
Sent from my PC36100 using Tapatalk
Can this be done from ubuntu on a virtual machine?
And what's the difference between this and cm6 ?.....
how do you replace the adw launcher ?
how can you add additional applications?
onicrom said:
how do you replace the adw launcher ?
how can you add additional applications?
Click to expand...
Click to collapse
in vendor/cyanogen/products
replace this
Code:
#PRODUCT_PACKAGES += ADWLauncher
PRODUCT_PACKAGES += Launcher2
also all of the people asking what the differnece between this and cm is nothing unless you change the source files or add remove packages. they can be found in the packages directory.
Igotsanevo4g said:
Can this be done from ubuntu on a virtual machine?
And what's the difference between this and cm6 ?.....
Click to expand...
Click to collapse
yes you can do this in VM but i don;t know the exact steps to set that up just once you get into your linux VM follow the tutorial.
nice tut. thanks for this...sure it will help MANY
l33tlinuxh4x0r said:
in vendor/cyanogen/products
replace this
Code:
#PRODUCT_PACKAGES += ADWLauncher
PRODUCT_PACKAGES += Launcher2
also all of the people asking what the differnece between this and cm is nothing unless you change the source files or add remove packages. they can be found in the packages directory.
Click to expand...
Click to collapse
Thanks much

How to get no adds (hosts file) without rooting a device (samsung only)

I thought of this a few days ago, the concept is pretty easy. and doesn't require root. Of course I recommend everyone to root but this is just for the die-hard no root people that want no adds, this is no absolute beginner tutorial. you must have some knowledge about the kitchen.
Requirements:
- Linux or Cygwin
- Dsixda's Android Kitchen
- Windows
- Odin
- Your stock rom (or boot.img if you have it separately)
1. Install the kitchen on linux/cygwin, go inside the kitchen folder and make a folder called "WORKING_NOADDS" (or so).
2. Place the boot.img from your stock rom inside it
3. now open up ./menu and enter: 0 > 12 > w, this will extract the boot.img
4. now get a hosts file, one that is up to date preferably, place it in the root of the ramdisk
5. open init.rc and add these lines to the bottom:
Code:
service mountster /system/bin/toolbox mount -o remount,rw /system
class main
service copyster /system/bin/toolbox cp -f hosts /system/etc/hosts
class main
service modester /system/bin/toolbox chmod 644 /system/etc/hosts
class main
6. now go back to kitchen and press b to build the boot.img, after this is complete navigate in shell to the working folder and enter:
Code:
tar -c boot.img > noadds.tar
md5sum -t noadds.tar >> noadds.tar
mv noadds.tar noadds.tar.md5
7. Save the file to somewhere where windows can access it. and reboot in windows
8. Open up odin, flash the tar as a one package, and enjoy no adds, without touching root :good:
:thumbup: thanks
Does this blocks ads in app and web pages or either one ?
sharp87 said:
:thumbup: thanks
Does this blocks ads in app and web pages or either one ?
Click to expand...
Click to collapse
This blocks ads on both ways, on apps and on webpages

[TUTORIAL] Find out which shared libs (.so) are missing

While porting features or ROMs from one Android device to another, some of us frequently encounter missing shared libs error. The process of finding missing shared libraries (.so files) might be a bit trivial, and time consuming. This tutorial is going to demonstrate a one-command way of finding all the dependencies of an executable, or another shared library.
FIRST TIME CONFIGURATION
Open up your terminal, type in:
Code:
$ echo 'readelf -d $1 | grep "\(NEEDED\)" | sed -r "s/.*\[(.*)\]/\1/"' | sudo tee -a /usr/local/bin/ldd-arm
$ sudo chmod +x /usr/local/bin/ldd-arm
[Member @_that told about this (better) way of performing this, without NDK and a more readable output. Thanks!]
FINDING MISSING LIBS
Basic usage is very easy. In your terminal:
$ ldd-arm PATH_TO_YOUR_EXECUTABLE_OR_LIBRARY
Click to expand...
Click to collapse
Say, for example, we want to find out the dependecies (which shared libraries are required) of my sensor HAL. I would type in terminal,
Code:
$ ldd-arm sensors.msm7x27a.so
And, I get the desired output!
Code:
liblog.so
libutils.so
libcutils.so
libhardware.so
libdl.so
libmemalloc.so
libc.so
libstdc++.so
libm.so
And that's how you can find out the libraries you are missing!
Nice tutorial Thanks a lot :fingers-crossed:
Wow. For the tutorial
Awesome tutorial! But are you sure
Code:
echo 'export PATH=$PATH:LOCATION_OF_NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin' > ~/.bashrc
shouldn't be
Code:
echo 'export PATH=$PATH:LOCATION_OF_NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin' >> ~/.bashrc
with >> instead of >? You don't want to override your complete ~/.bashrc, right?
dummie999 said:
Awesome tutorial! But are you sure echo
Code:
'export PATH=$PATH:LOCATION_OF_NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin' > ~/.bashrc
shouldn't be
Code:
echo 'export PATH=$PATH:LOCATION_OF_NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin' >> ~/.bashrc
with >> instead of >? You don't want to override your complete ~/.bashrc, right?
Click to expand...
Click to collapse
I just noticed the typo, thanks for pointing it out. Post updated.
Regards
In my experience, the native (amd64) readelf worked just as well with ARM binaries. I'm using this command line in my script:
Code:
readelf -d $1 | grep '\(NEEDED\)' | sed -r 's/.*\[(.*)\]/\1/'
The final sed leaves only the bare library names in the output.
In there any way to use this in windows?
LEGEND!
just the sort of thing i was looking for!
you should just make binary for this, the "lib dependancy viewer"
it should be called by something like
libdepv PATH/TO/LIB
---------- Post added at 10:24 PM ---------- Previous post was at 10:20 PM ----------
migui0401 said:
In there any way to use this in windows?
Click to expand...
Click to collapse
maybe adb shell with busybox installed..
Thanks @_that! Post updated
Sent from my Walton Primo H1 using XDA Free mobile app
good one indeed....ok now say how we can find for ported app's missing or shared libs and its dependency? is this also work?
Nice job
ricky310711 said:
you should just make binary for this, the "lib dependancy viewer"
it should be called by something like
libdepv PATH/TO/LIB
Click to expand...
Click to collapse
Why a binary? Rename the script to libdepv and you can call it already exactly like that.
jazzespresso said:
good one indeed....ok now say how we can find for ported app's missing or shared libs and its dependency? is this also work?
Click to expand...
Click to collapse
For finding native library dependencies of apks, you need to decompile them, search the smali files for invokes of "loadLibrary" and trace the argument back to the string constant (usually it's just a few lines above the loadLibrary call). Prepend "lib" to the string constant and append ".so", that's the name of the required native library.
An example could look like this:
Code:
const-string v0, "defcontainer_jni"
invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V
So we know that this app requires libdefcontainer_jni.so.
I'm using the latest r9d NDK and there are some ld* binaries, but no ldd-arm .
Also my NDK is "Linux 64-bit" so my prebuilt files are under:
$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/
While I'm at it, not all libraries or binaries are explicitly linked to their SO targets. I use dynamic loading in several of mine and so does android for HAL libraries. Best way to find these is by using "strings", assuming there's an explicit string in there, or at least a partial one.
tuxboy said:
While porting features or ROMs from one Android device to another, some of us frequently encounter missing shared libs error. The process of finding missing shared libraries (.so files) might be a bit trivial, and time consuming. This tutorial is going to demonstrate a one-command way of finding all the dependencies of an executable, or another shared library.
FIRST TIME CONFIGURATION
Open up your terminal, type in:
Code:
$ echo 'readelf -d $1 | grep "\(NEEDED\)" | sed -r "s/.*\[(.*)\]/\1/"' | sudo tee -a /usr/local/bin/ldd-arm
$ sudo chmod +x /usr/local/bin/ldd-arm
[Member @_that told about this (better) way of performing this, without NDK and a more readable output. Thanks!]
FINDING MISSING LIBS
Basic usage is very easy. In your terminal:
Say, for example, we want to find out the dependecies (which shared libraries are required) of my sensor HAL. I would type in terminal,
Code:
$ ldd-arm copybit.msm7x27a.so
And, I get the desired output!
Code:
liblog.so
libutils.so
libcutils.so
libhardware.so
libdl.so
libmemalloc.so
libc.so
libstdc++.so
libm.so
And that's how you can find out the libraries you are missing! If your device uses MIPS, just use the mipsel toolchain instead. (Don't forget to hit Thanks if this helps you!)
Click to expand...
Click to collapse
I love you so much.
Trying to work out bugs with M8VZW...this might just be what I needed.
mikereidis said:
I'm using the latest r9d NDK and there are some ld* binaries, but no ldd-arm .
Also my NDK is "Linux 64-bit" so my prebuilt files are under:
$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/
Click to expand...
Click to collapse
ldd-arm is actually a little command we created at the very beginning of the post.
mikereidis said:
While I'm at it, not all libraries or binaries are explicitly linked to their SO targets. I use dynamic loading in several of mine and so does android for HAL libraries.
Click to expand...
Click to collapse
True.
Fabulous! Useful info indeed. Thanks a lot.
Sent from my Lenovo A369i using Tapatalk
tuxboy said:
ldd-arm is actually a little command we created at the very beginning of the post.
Click to expand...
Click to collapse
Ah, yes... readelf...
i was looking for something like this about 2 months ago
excellent thread
_that said:
In my experience, the native (amd64) readelf worked just as well with ARM binaries. I'm using this command line in my script:
Code:
readelf -d $1 | grep '\(NEEDED\)' | sed -r 's/.*\[(.*)\]/\1/'
The final sed leaves only the bare library names in the output.
Click to expand...
Click to collapse
Yep. Same here - my system readelf seems fine when used on ARM binaries for this purpose.
(fairly old trick, but the sed stuff makes it a lot nicer.)
Obviously another approach to this is to take the above command and paste it into a text editor, save it, and chmod +x it
Rather than use /usr/local/bin/ I use ~/bin and add it to my PATH
Can this be used to port apps? I am wanting to install some S5 apps on my Galaxy S4, but don't know what libs etc are needed. Could this be used to find out?

[GUIDE][14.10][15.04][15.10]APKTool for Ubuntu (Automate Installation)

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Intro​
This little guide was accessed by many people,and this thread already got one year from it's release, so in order to make it even more simple for the users and continue to use and install APKTool to their Linux distributions i created an automated script, which it will upgrade an existing APKTool with a new version or install everything for the user.
So basically if you saw my thread sometimes now you absolutely don't need anymore to write the commands and do all these stuff manually cause the script will now do it for you.
For download, now you get the zip containing everything from the attachments.
How to run the script​
To run the script is very simple, just download the zip, unpack it to your desktop for example and finally now open a terminal window from the folder where the script is located, and now type:
Code:
./Script.sh
If for some reason fails, just open the proprieties of the file, and make it executable... It will work.
How does it work?​
The basic commands are this :
apktool if framework-res.apk: This command is recommended to be done at the first run, because this will allow to install the framework-res of your ROM which will be used in future to decompile the APKs based on that API level
apktool d SystemUI.apk OUT: This command will decompile an apk to the OUT folder but if you want to choose an other name, you're freely to do it.
The command also can be wrote in this manner: apktool d SystemUI.apk and the apk will be decompiled into a folder with the same name of the app, in this case SystemUI
apktool b SystemUI: When you will finish to work on an APK obviously you will also need to recompile the apk with the changes so to do that you will need to use this command which as stated will recompile the apk with the changes.
java -jar signapk.jar testkey.x509.pem testkey.pk8 name_of_app.apk name_of_app-signed.apk: This command will allow you to sign your apk once it's compiled, and i suggest you to do it every time you made some changes because on Android when you will try to install it or push it to system for example it will not work in most of the cases so it's better always to sign the apk always. The command is very simple to use it, just write it into a terminal window and the signed apk will be made in a few seconds.
So pretty much that's it
If you find any kind of problem during the recompilation of an APK don't panic, just watch again the sources and the guide you are following to see if you made good the steps, or search on Google, your best friend for these things
You can also write it here if you want and I or some other user will help you out with your problem
Thanks, and i hope this will help some people
Nice guide :good: Think its the best Ive seen for installing on Linux. Wish I found this the first time I installed it on Linux.
Im lazy, hate typing, and change distros often so i turned it all into a script a while back. But think this is great for newbies.
Great work bud.
edit-
Posted 2 weeks ago and only 3 thanks? Come on people. Be thankful for this. Not too long ago you could barely even find one guide for this let alone one put together well. Hit the thanksssssss.
I already searched for it but didn't find an answer: How do I sign an apk on ubuntu?
Nice guide, will do it AS soon AS I have time.
Sent from my Nexus 5 using XDA Free mobile app
ShinySide said:
Nice guide :good: Think its the best Ive seen for installing on Linux. Wish I found this the first time I installed it on Linux.
Im lazy, hate typing, and change distros often so i turned it all into a script a while back. But think this is great for newbies.
Great work bud.
edit-
Posted 2 weeks ago and only 3 thanks? Come on people. Be thankful for this. Not too long ago you could barely even find one guide for this let alone one put together well. Hit the thanksssssss.
Click to expand...
Click to collapse
Thanks man )
I will add also a mini guide for signing this afternoon
edit. added mini guide also for signing
great work, very useful for noobs
If You install oracle's java You don't need the open jdk
This is user's choice
Why not the 7 instead of 6th?
Code:
sudo apt-get install openjdk-7-jre
It's possible also to make this process faster by adding a wget instead of downloading all apktool things from the website
for example i uploaded apktool files on my dropbox and I download everytime I have to install apktool by simply running
Code:
wget https://www.dropbox.com/s/6s9bxszxjl7wclz/apktool.tar.gz
then
Code:
tar -zxvf apktool.tar.gz
then
Code:
cd apktool
You can also run single commands to make the installation process faster
Code:
sudo chmod +x aapt apktool apktool.jar
Code:
sudo chown -R [COLOR="red"][B]yourusername[/B][/COLOR] aapt apktool apktool.jar
enricod@enricod-Aspire-5920G:~/Scrivania/apktool$
Code:
sudo cp aapt apktool apktool.jar /usr/local/bin
just hints
Yeah sure it can be done also in this way
ubuntu 14.04 ia32libs
in ubuntu 14.04 (64bit) the ia32libs aren't available.
Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source
However the following packages replace it:
lib32z1 lib32ncurses5 lib32bz2-1.0
Package 'ia32-libs' has no installation candidate
paulle said:
in ubuntu 14.04 (64bit) the ia32libs aren't available.
Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source
However the following packages replace it:
lib32z1 lib32ncurses5 lib32bz2-1.0
Package 'ia32-libs' has no installation candidate
Click to expand...
Click to collapse
These are required optionally just in case the APKTool may fail during his running
but if they are necessary type the following commands:
Code:
sudo -i
cd /etc/apt/sources.list.d
echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list
apt-get update
apt-get install ia32-libs
I ve got Android sdk, Java and adb already on my 64 bit system, is it ok to leave out installation of those bits and just start by installing the APK tool, but miss out the 32bit libs cos I already have them ? Thanks
typos1 said:
I ve got Android sdk, Java and adb already on my 64 bit system, is it ok to leave out installation of those bits and just start by installing the APK tool, but miss out the 32bit libs cos I already have them ? Thanks
Click to expand...
Click to collapse
Yeah just skip what you already have and install what you don't have
Excellent. Many users should find this very useful.
:highfive:
One thing I want people to note is that I have successfully been using 14.04 ubuntu with java 8 and apktool v2.0.0b9 installed. Granted I only build kernels from source and not AOSP...but figured I would let people know.
brymaster5000 said:
Excellent. Many users should find this very useful.
:highfive:
One thing I want people to note is that I have successfully been using 14.04 ubuntu with java 8 and apktool v2.0.0b9 installed. Granted I only build kernels from source and not AOSP...but figured I would let people know.
Click to expand...
Click to collapse
Mine will decompile and recompile just fine with Oracle 8 but if say the apk is framework or system ui phone won't boot. If a non critical apk it won't show/install after pushing or flashing to device
Nice guide :good:
thank you... it saved me alot of time
When I want to decompile say a jar file (framework.jar) where does it go? I'm use to using apktool for windows and I'm new to using linux and this is kinda different for me. Sorry for the noobness. Where do the files downloaded go. Are they all suppose to be in one folder?
shakim24 said:
When I want to decompile say a jar file (framework.jar) where does it go? I'm use to using apktool for windows and I'm new to using linux and this is kinda different for me. Sorry for the noobness. Where do the files downloaded go. Are they all suppose to be in one folder?
Click to expand...
Click to collapse
Are you talking about apktool.jar,apktool, and aapt? They are moved to usr/local/bin in the system directory. After you have done the guide you can make a folder anywhere you want, put your apks you want to mod in it and type the commands. Its not like windows where you have to put apktool.jar, apktool, and aapt in a folder on C and had to work in that folder.
ShinySide said:
Are you talking about apktool.jar,apktool, and aapt? They are moved to usr/local/bin in the system directory. After you have done the guide you can make a folder anywhere you want, put your apks you want to mod in it and type the commands. Its not like windows where you have to put apktool.jar, apktool, and aapt in a folder on C and had to work in that folder.
Click to expand...
Click to collapse
OK. I put my aapt in the home directory. Need to do the process all over. When I ran the sudo command that's in the OP for the apktool and the apktool.jar it said command not found until I put it in the home directory and extracted it, they were in the downloads directory. Wasn't really sure where they went. The directions in the OP wasn't to articulate when it came to actually where the folders went.
shakim24 said:
OK. I put my aapt in the home directory. Need to do the process all over. When I ran the sudo command that's in the OP for the apktool and the apktool.jar it said command not found until I put it in the home directory and extracted it, they were in the downloads directory. Wasn't really sure where they went. The directions in the OP wasn't to articulate when it came to actually where the folders went.
Click to expand...
Click to collapse
I'll make it super duper easy for you hold on a second
Here, make a new document in your home folder, name it apkt , and paste this in it
#!/bin/bash
# Install apktool
cd ~/Desktop
wget https://android-apktool.googlecode.com/files/apktool1.5.2.tar.bz2
wget https://android-apktool.googlecode.com/files/apktool-install-linux-r05-ibot.tar.bz2
tar jxf apktool1.5.2.tar.bz2
tar jxf apktool-install-linux-r05-ibot.tar.bz2
cd apktool1.5.2
mv apktool.jar ../
cd ../
cd apktool-install-linux-r05-ibot
mv aapt apktool ../
sudo chown -R USERNAME:USERNAME /home/USERNAME/Desktop/aapt
sudo chown -R USERNAME:USERNAME /home/USERNAME/Desktop/apktool
sudo chown -R USERNAME:USERNAME /home/USERNAME/Desktop/apktool.jar
sudo chmod +x /home/USERNAME/Desktop/aapt
sudo chmod +x /home/USERNAME/Desktop/apktool
sudo chmod +x /home/USERNAME/Desktop/apktool.jar
sudo mv /home/USERNAME/Desktop/aapt /usr/local/bin/
sudo mv /home/USERNAME/Desktop/apktool /usr/local/bin/
sudo mv /home/USERNAME/Desktop/apktool.jar /usr/local/bin/
rm -rf /home/USERNAME/Desktop/apktool1.5.2
rm -rf /home/USERNAME/Desktop/apktool1.5.2.tar.bz2
rm -rf /home/USERNAME/Desktop/apktool-install-linux-r05-ibot
rm -rf /home/USERNAME/Desktop/apktool-install-linux-r05-ibot.tar.bz2
Replace all the USERNAMES with your user name. And save it. Close it, right click it, select permissions and tick execute. Open your terminal and type sudo ./apkt and put oyur password in, itll do it all for you.
ShinySide said:
I'll make it super duper easy for you hold on a second
Here, make a new document in your home folder, name it apkt , and paste this in it
#!/bin/bash
# Install apktool
cd ~/Desktop
wget https://android-apktool.googlecode.com/files/apktool1.5.2.tar.bz2
wget https://android-apktool.googlecode.com/files/apktool-install-linux-r05-ibot.tar.bz2
tar jxf apktool1.5.2.tar.bz2
tar jxf apktool-install-linux-r05-ibot.tar.bz2
cd apktool1.5.2
mv apktool.jar ../
cd ../
cd apktool-install-linux-r05-ibot
mv aapt apktool ../
sudo chown -R USERNAME:USERNAME /home/USERNAME/Desktop/aapt
sudo chown -R USERNAME:USERNAME /home/USERNAME/Desktop/apktool
sudo chown -R USERNAME:USERNAME /home/USERNAME/Desktop/apktool.jar
sudo chmod +x /home/USERNAME/Desktop/aapt
sudo chmod +x /home/USERNAME/Desktop/apktool
sudo chmod +x /home/USERNAME/Desktop/apktool.jar
sudo mv /home/USERNAME/Desktop/aapt /usr/local/bin/
sudo mv /home/USERNAME/Desktop/apktool /usr/local/bin/
sudo mv /home/USERNAME/Desktop/apktool.jar /usr/local/bin/
rm -rf /home/USERNAME/Desktop/apktool1.5.2
rm -rf /home/USERNAME/Desktop/apktool1.5.2.tar.bz2
rm -rf /home/USERNAME/Desktop/apktool-install-linux-r05-ibot
rm -rf /home/USERNAME/Desktop/apktool-install-linux-r05-ibot.tar.bz2
Replace all the USERNAMES with your user name. And save it. Close it, right click it, select permissions and tick execute. Open your terminal and type sudo ./apkt and put oyur password in, itll do it all for you.
Click to expand...
Click to collapse
All the apktool files I downloaded go in that folder or stay in the usr/local/bin?
Edit: just noticed it's in the proper place. Thanks man really appreciate it. One last question. What other files go in the usr/local/bin besides aapt and apktool? The apktool ibot tar or the apktool1.5.2 tar? I asked because when I ran the sudo cp command it gave me a error on the apktool1.5.2. Said it was omitting it. I can always put it in manually in the right directory. Just wanted to know why it did that.
shakim24 said:
All the apktool files I downloaded go in that folder or stay in the usr/local/bin?
Edit: just noticed it's in the proper place. Thanks man really appreciate it. One last question. What other files go in the usr/local/bin besides aapt and apktool? The apktool ibot tar or the apktool1.5.2 tar? I asked because when I ran the sudo cp command it gave me a error on the apktool1.5.2. Said it was omitting it. I can always put it in manually in the right directory. Just wanted to know why it did that.
Click to expand...
Click to collapse
If you ran the script I just gave you it did everything for you and you have to do nothing else.
Just apktool apktool.jar and aapt the tar files are deleted. Named just like that. Im not sure what you did.

Categories

Resources