Q: CWM Scripting Help, package_extract_dir - Verizon Droid Charge

I'm writing a CWM package that overwrites some files in /system/app and /system/framework. But, it seems that overwriting existing files in the those directories isn't working. Do I have to delete the files first in those directories then execute the package_extract_dir() function?

Related

[GUIDE] How to create a your own ROM

How to create your own ROM update.zip for the T-Mobile MyTouch 3G
Things you will need to perform this:
Java SE Dev Kit from Sun. java.sun.com
May need Cygwin with zlib0 package, from cygwin.com
This will give you Android 1.6 with all the Google applications, Root access.
I never found one place where all this information is all together, so that is why I compiled this together.
Now anyone can do this themselves.
Thanks to all the hard work others have done before this.
1.
First Root your phone and install a new Recovery image, either Amon Ra or Cyanogens Recovery image.
Instructions for one-click root: http://theunlockr.com/2009/08/22/how-to-root-the-mytouch-3g-or-g1-in-one-click/
2.
Download the Android 1.6 System image from
http://developer.htc.com/google-io-device.html
extract the contents of signed-google_ion-img-14721.zip.
3.
You now need to extract the contents of system.img using a tool called unyaffs. The source code is here:
http://code.google.com/p/unyaffs/downloads/list
Or download a prebuilt win32 version here.
http://jiggawatt.org/badc0de/android/index.html
Note you may also need cygwin1.dll and cygz.dll (zlib0 package). Found at cygwin.com
Of course if you already have Cygwin installed with the GCC packages, you can just compile it yourself. Then also
if you comment out the line 67 to "// symlink(oh->alias, full_path_name);"
then it will not create the copies of the symbolic link file, and you will not have to worry about deleting duplicate
symbolic link files later.
Now in the directory where system.img exists, create a new directory called "system"
go into the "system" directory.
type the following command:
unyaffs ..\system.img
That should extract all the files from the system.img file into the system directory.
4.
Now we just need to clean up some items. Since the system.img is a linux file system, it has symbolic
links built into it, but when we extracted it, it just created duplicate files, if you used the prebuilt unyaffs.exe.
So we can just delete the duplicates and have a script recreate the symlink on install.
So we need to delete some extra files from the system\bin directory.
Run the attached DeleteExtras.bat file from the same directory where system.img is in.
If you notice, all the files it deletes are 28 byte files, and if you open them in notepad only contain:
"!<symlink>toolbox..."
And we will remake the symbolic link when it is installed.
5.
Now from the directory where the system.img is, enter the following commands
mkdir META-INF
mkdir META-INF\com
mkdir META-INF\com\google
mkdir META-INF\com\google\android
Now copy the included file "update-script.txt" into the "META-INF\com\google\android" directory
and RENAME it to just "update-script".
This update-script gets run to recreate the symbolic links.
Not sure if these two are needed but they are in some custom ROMs here:
Copy the two files "fix_permissions" and "flash_image" to the "system\bin" directory.
6.
-- Optional --
These add root and Superuser access to the ROM, plus the Terminal Emulator application.
Copy the file "su" from Cyanogen's rom to the folder "system\bin"
Copy the file "Superuser.apk" to the folder "system\app"
Copy the file "Term.apk" to the folder "system\app"
You can also replace the "system\etc\apns-conf.xml" with a more complete one from here:
http://forum.xda-developers.com/showthread.php?t=547718
or here
http://docs.google.com/Doc?docid=0AZNbAmKkmakoZGZxZHNwMnpfMjJkaHg3ejN3eg&hl=en
Turn data roaming off by default by editing line in the build.prop file:
ro.com.android.dataroaming=false
Also to fix the Market program to show "Protected" applications change the ro.build.fingerprint line to the following:
ro.build.fingerprint=tmobile/opal/sapphire/sapphire:1.5/COC10/150449:user/ota-rel-keys,release-keys
Only phones with a fingerprint of a "released" device can access some market applications.
--------------
7.
Now we just need to create a ZIP file for the final ROM
Zip up the following file and two folders:
boot.img
META-INF
system
8.
Now sign the zip file.
See here how to sign a ZIP file for flashing it.
http://androidforums.com/developer-101/8665-how-signing-roms.html
9.
Copy it to your SD card, boot into recovery, wipe, apply the update, Reboot.
You are now running Android 1.6!
the finger print is found in build.prop is this correct and what app do you use to edit your build.prop
Yes the fingerprint is in build.prop
Make sure to use an advanced text editor like TextPad, UltraEdit, or EditPlus. It has to handle UNIX text files.
Also use this for the update_script.
how abt kernel parameters?
How would one go about customizing this with Hero? Or is that not possible at this point?
detox702 said:
How would one go about customizing this with Hero? Or is that not possible at this point?
Click to expand...
Click to collapse
Would like more info on hot to incorporate senseui
Thanks for sharing... Got nothing to do today, so I experimented on my phone... I gotta say, I'm pretty amazed w/ this feature. Was able to sort out and organize my files.
Kudos!
How does one create the system.img file once one has the system files...
What I want to do is use some of the custom roms here and put it on an AVD emulator system.
Can someone help with this please.
NOTE: I dont have linux. So if there is an alternative to mkbootimg, it will be excellent.
the ion is the 32b if I'm not mistaken?
Is there an image for the 32a or do we always have to use the ion and throw a patch over it?
Sorry if this is a stupid question
in step 5. it says
Not sure if these two are needed but they are in some custom ROMs here:
Copy the two files "fix_permissions" and "flash_image" to the "system\bin" directory.
Where do i copy the files from or download please?
thanks in advance
P.S. any tips on changing the splash screen would be much appreciated.
DeleteExtras.txt or DeleteExtras.bat doesn't work. I have to delete the extra files by myself - one by one.
codysoloman said:
DeleteExtras.txt or DeleteExtras.bat doesn't work. I have to delete the extra files by myself - one by one.
Click to expand...
Click to collapse
check this: http://forum.xda-developers.com/showthread.php?t=633246
Perhaps someone here knows or could point me to the right resources, but if the phone isn't supported by Cyanogen, how would a custom rom be made in that case?
How is a custom rom made from scratch? Since android is just linux, is it simply a matter of building it with the right drivers for the phone and installing it? How can an image be manually copied to the phone if it isn't supported by Clockwork recovery? How can it's steps be manually done?
ping pong...
Can i install my own rom on samsung ace?????
anybody knows how to make a ROM customized and make a "update.img" to run on a un-rootable device? I know when you backup a linux image for example ubuntu, this image will run on all other PCs, the image will automatically knows the new PC's drivers and adapt everything with that, is it what happening to an android too ?
---------- Post added at 08:36 AM ---------- Previous post was at 08:33 AM ----------
and pls let me know how to open/edit a "update.img" file, thnx
Question
androidcustomrom said:
How to create your own ROM update.zip for the T-Mobile MyTouch 3G
Things you will need to perform this:
Java SE Dev Kit from Sun. java.sun.com
May need Cygwin with zlib0 package, from cygwin.com
This will give you Android 1.6 with all the Google applications, Root access.
I never found one place where all this information is all together, so that is why I compiled this together.
Now anyone can do this themselves.
Thanks to all the hard work others have done before this.
1.
First Root your phone and install a new Recovery image, either Amon Ra or Cyanogens Recovery image.
Instructions for one-click root: http://theunlockr.com/2009/08/22/how-to-root-the-mytouch-3g-or-g1-in-one-click/
2.
Download the Android 1.6 System image from
http://developer.htc.com/google-io-device.html
extract the contents of signed-google_ion-img-14721.zip.
3.
You now need to extract the contents of system.img using a tool called unyaffs. The source code is here:
http://code.google.com/p/unyaffs/downloads/list
Or download a prebuilt win32 version here.
http://jiggawatt.org/badc0de/android/index.html
Note you may also need cygwin1.dll and cygz.dll (zlib0 package). Found at cygwin.com
Of course if you already have Cygwin installed with the GCC packages, you can just compile it yourself. Then also
if you comment out the line 67 to "// symlink(oh->alias, full_path_name);"
then it will not create the copies of the symbolic link file, and you will not have to worry about deleting duplicate
symbolic link files later.
Now in the directory where system.img exists, create a new directory called "system"
go into the "system" directory.
type the following command:
unyaffs ..\system.img
That should extract all the files from the system.img file into the system directory.
4.
Now we just need to clean up some items. Since the system.img is a linux file system, it has symbolic
links built into it, but when we extracted it, it just created duplicate files, if you used the prebuilt unyaffs.exe.
So we can just delete the duplicates and have a script recreate the symlink on install.
So we need to delete some extra files from the system\bin directory.
Run the attached DeleteExtras.bat file from the same directory where system.img is in.
If you notice, all the files it deletes are 28 byte files, and if you open them in notepad only contain:
"!<symlink>toolbox..."
And we will remake the symbolic link when it is installed.
5.
Now from the directory where the system.img is, enter the following commands
mkdir META-INF
mkdir META-INF\com
mkdir META-INF\com\google
mkdir META-INF\com\google\android
Now copy the included file "update-script.txt" into the "META-INF\com\google\android" directory
and RENAME it to just "update-script".
This update-script gets run to recreate the symbolic links.
Not sure if these two are needed but they are in some custom ROMs here:
Copy the two files "fix_permissions" and "flash_image" to the "system\bin" directory.
6.
-- Optional --
These add root and Superuser access to the ROM, plus the Terminal Emulator application.
Copy the file "su" from Cyanogen's rom to the folder "system\bin"
Copy the file "Superuser.apk" to the folder "system\app"
Copy the file "Term.apk" to the folder "system\app"
You can also replace the "system\etc\apns-conf.xml" with a more complete one from here:
http://forum.xda-developers.com/showthread.php?t=547718
or here
http://docs.google.com/Doc?docid=0AZNbAmKkmakoZGZxZHNwMnpfMjJkaHg3ejN3eg&hl=en
Turn data roaming off by default by editing line in the build.prop file:
ro.com.android.dataroaming=false
Also to fix the Market program to show "Protected" applications change the ro.build.fingerprint line to the following:
ro.build.fingerprint=tmobile/opal/sapphire/sapphire:1.5/COC10/150449:user/ota-rel-keys,release-keys
Only phones with a fingerprint of a "released" device can access some market applications.
--------------
7.
Now we just need to create a ZIP file for the final ROM
Zip up the following file and two folders:
boot.img
META-INF
system
8.
Now sign the zip file.
See here how to sign a ZIP file for flashing it.
http://androidforums.com/developer-101/8665-how-signing-roms.html
9.
Copy it to your SD card, boot into recovery, wipe, apply the update, Reboot.
You are now running Android 1.6!
Click to expand...
Click to collapse
Could you tell me where I can correct the fake data in the phone like the real RAM is 512 MB but it say 1GB ,can you tell me how to
correct it thanks in advance:good:

How do I make my own update.zip from my Nexus S ROM?

How do I make a update.zip on my phone from my whole system folder?
I want to start making cyanogenmod ROMs
Can I edit their update.zip's ? Or do I have to resign them? I used to make odin roms...
1) Create an empty folder (eg. C:\workdir)
2) Create C:\workdir\system\app folder
-- load all your apks in here
3) Create C:\workdir\system\lib folder
-- if the apk needs libraries referenced
4) Create C:\workdir\META-INF\com\google\android folder
5) Create the update-script script and put that in the \com\google\android folder ^
Code:
show_progress 0.1 0
copy_dir PACKAGE:system SYSTEM:
show_progress 0.1 10
oneblanklinethatdoesn'tparseinthiscodeblock...
Put the extra white line at the bottom of the update-script.
6) Compress the contents of C:\workdir folder to a zip
7) Sign the workdir.zip file
Code:
java -jar signapk.jar certificate.pem key.pk8 myupdate.zip update.zip
If you don't know howto sign your zip file: http://www.londatiga.net/it/how-to-sign-apk-zip-files/
Now you have a workdir.zip file (rename it to update.zip if you want). You can flash this through CWM, it will replace the contents of your workdir/system/app with the files in /system/app.
Greetz
Dude i get update failed to flashh....i think its becuz of the script and put the white line staff...........im trying to install more than one app ...any help on the script for more than one app

python trouble need help

so i wanted to use python through my terminal and not sl4a. I went and downloaded pythonforandroid from google. and installed it on my phone. Which is now on the sd card. Inside of the com.googlecode.pythonforandroid folder is the python module, the lib folder with the .so files and the py programs. i cp'd the module to the system/bin/ dir now i need to place the .so files in the correct place.
The error i receive is:
Code:
# python
Link_image[1962]: 31081 could not load needed library 'libpython2.6.so' for 'python' (load_library[1104]: Library 'libpython.6.so' not found)CANNOT LINK EXECUTABLE
#
i recursively cp'd (cp -R) the entire lib
file into system/lib folder on my droid. It still is not working.
What am i doing wrong?

[TOOL] odexer

I made this shell script to automatize the odexing process and maybe it could be useful to someone else.
It should be universal, but I only tested it on my phone.
It's not to re-odex a deodexed rom, but to make stock roms compatible odexed files from deodexed files.
Some mods won't work (signature issues I think)
How to use it:
Extract the attached zip wherever you want on your phone.
In the same directory of the script 'odexer.sh' and the directory 'odextools', make a directory named 'deodexed' (actually, it's already there). Inside 'deodexed' create two directories: 'framework' and 'app'. Put there your modded files, each in the respective directory.
You need the original stock odexed files (apk and odex) and all the '$BOOTCLASSPATH' files (see the note below). The script was intended to be used on odexed rom, but I made it adaptable: in the script change the variable 'moddedpath' with the path to the directory with the original odexed files, each inside 'app' or 'framework (you can directly copy '/system/framework/' and '/system/app/' from a stock rom if you are too lazy).
(I only tested this script on my odexed stock rom using /system as 'moddedpath')
Here how the directory tree should look like:
Code:
/some/random/path/
|-[COLOR="BLUE"]deodexed[/COLOR]
|---[COLOR="BLUE"]app[/COLOR]
|-----[COLOR="RED"]SystemUI.apk[/COLOR]
|---[COLOR="BLUE"]framework[/COLOR]
|-----[COLOR="RED"]framework.jar[/COLOR]
|-[COLOR="GREEN"]odexer.sh[/COLOR]
|-[COLOR="BLUE"]odextools[/COLOR]
|---[COLOR="GREEN"]busybox[/COLOR]
|---[COLOR="GREEN"]dexopt-wrapper[/COLOR]
|---[COLOR="GREEN"]zip[/COLOR]
You need to run the script as root from 'adb shell' or 'Terminal emulator'.
If you put the script in your vfat formatted sdcard, you won't be able to change its permissions, so, in order to run it, you need to pass its path to 'sh' as argument:
Code:
sh /sdcard/somepath/odexer.sh
It will create in the same directory a directory named 'odexed-DD-MM-hh.mm.ss'.
The script will automatically skip files with no odex (framework-res.apk should be always skipped, I think).
It's important to keep everything in the same place, because I used relative paths in the script.
Enjoy
________
To see your $BOOTCLASSPATH files, run from 'adb shell' or 'Terminal emulator:
Code:
echo $BOOTCLASSPATH
or open your /init.rc
Thank you
Thank you for guide. But some points were gone over my head
I found this one. Its one of the simplest method.
forum.xda-developers.com/showthread.php?t=1348062
vishal24387 said:
Thank you for guide. But some points were gone over my head
Click to expand...
Click to collapse
Which point? This?
It's not to re-odex a deodexed rom, but to make stock roms compatible odexed files from deodexed files.
Click to expand...
Click to collapse
loSconosciuto said:
Which point? This?
Click to expand...
Click to collapse
actually I am noob in case of android's coding technical language. Its not ur fault

[TOOL/GUIDE]1by1_ReOdexer - Make a new ODEX file

WHAT IS THIS, AND WHAT IS IT FOR?
This is a guide for creating a new odex file from a deodexed file, one at a time – manually, or with the tool provided. There are tools/methods for doing the entire system at once, but I have not had any luck with those. Plus, typically, one does not need the entire system re-odexed. This is more for those who want to personally mod their stock odexed systems, or create an odexed ROM maybe.
For starters, you can get away with modding a lot on an odexed system, without needing to deodex. You really only need to deodex in order to edit the smali files within the classes.dex (which is required to achieve the cooler mods). See cogeary’s great guide for deodexing tips.
-------------------------
SCRIPT METHOD (using the 1by1_ReOdexer):
I made this script to speed up the process a little bit (thanks! to jimbridgman and cogeary for their input).
NOTE: This could hurt your phone if you don't place your original files (the ones that are currently running on your odexed system) in the 'orig-odexed' folder…
Requirements:
Windows OS (for now – Linux coming soon)
odexed system
root
busybox installed
DOWNLOAD the 1by1_ReOdexer_v2.0.zip for Windows
Unzip it on your desktop or other convenient place (with no spaces in the file path), and read the README.txt.
NOTES
-It will show a few failed processes right when the script starts - it's just trying to clean stuff that isn't there..
-This will not push the new modded files to your phone - but, the re-odex process needs to take place in the /system, so this script does a quick switcheroo by pushing the deodexed file to your running odexed system, then replaces the originals (that's why you must place copies of the odexed ones from your system to the 'orig-odexed' folder - I plan on automating that too eventually) - that's also why you may need to reboot afterwards to straighten things out
-It still needs A LOT of work... but it does the job
MAJOR NOTE: The script is currently set up based on Motorola’s ICS bootclasspath.
To change the file name/path and/or the bootclasspath, right-click on the .bat file and open with a text editor (preferably something like Notepad++) and edit accordingly. The bootclasspath was taken from /init.rc.
-------------
MANUAL METHOD:
I will use the services.jar in this example. Just change the file name and path to existing .odex accordingly for other files. (thanks! to jhotmann for helping me to nail down this method)
Requirements:
odexed system
root
adb
busybox installed
dexopt-wrapper
Put this dexopt-wrapper file in /system/bin with 775 permissions:
X X X
X....X
X....X
Put the deodexed services.jar (or other jar/apk file you want to make a new odex of) on the root your /sdcard (on some phones that means internal storage).
Make sure USB Debugging is enabled.
Put your USB connection to MTP or PTP mode.
The bootclasspath is located in the /init.rc file at the root of your phone. Just make sure that all jars listed in init.rc are actually in your /system/framework folder and only include those in your bootclasspath in the command below. The one from Moto A2/Razr/other ICS is used below (minus the extra jar paths). To replace it with that of a different device, change the word bootclasspath with yours, using the path style as shown in the example below: dexopt-wrapper services.jar new.odex bootclasspath...
Connect with adb (do a adb devices check to make sure you're all good).
To create the new odex, enter the following one line at a time:
Code:
adb shell
su
cd /sdcard/
dexopt-wrapper services.jar new.odex /system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework-ext.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/filterfw.jar:/system/framework/com.motorola.android.frameworks.jar:/system/framework/com.motorola.android.widget.jar:/system/framework/com.motorola.frameworks.core.addon.jar
To copy the signature from the existing odex (change path to /system/app/.. if necessary):
Code:
busybox dd if=/system/framework/services.odex of=new.odex bs=1 count=20 skip=52 seek=52 conv=notrunc
Done! Rename new.odex (created on your /sdcard) to services.odex since that is your new signed odex file... and move to your phone using the method of your choice.
---------------------
CHANGE LOG:
Code:
11/7/12 (v2.0)
-more automated
-changed the location where the new odex is made
-thanks to [URL="http://forums.acsyndicate.net/showthread.php?113-Re-Odexing-script&p=1369&viewfull=1#post1369"]tanimn[/URL] for the hint
-thanks to [URL="http://forum.xda-developers.com/showthread.php?t=1879128"]alkhafaf[/URL] for his bat files that I got ideas from (his script didn't work for me)
8/25/12 (v1.0)
-initial release
Thanks to the following for testing!:
-A2Trip (formerly DX2Trip) on the A2 ICS
-RETIEF on the RAZR Maxx ICS
-iwabashu on the RAZR ICS
(I tested it on GB - but I am not high-fiving myself :D)
-----------------
Some vague notes on what to do next:
Depending on what you are after by re-odexing, there are different routes. For example, if you only edited or copied smali files, then you only need the new.odex file. Meaning that all of the smali code was inside of that classes.dex of the deodexed file on your sdcard, and you just made that into a new odex file (and copied the signatures from the existing .odex in /system).
If you have a deodexed apk with more edits than just smali (you could really just copy those edits over to your existing odexed apk with 7-zip or similar), but – if you want to, you will need to remove the classes.dex from the deodexed apk, and make sure that the signatures (/META-INF folder) and AndroidManifest.xml are the same as your existing apk (check, and or copy with 7-zip or similar).
.
.
.
Good job on this!
Mods, am I crazy or are we in need of a separate "stickied" section here"?
Please stickify...
An Edit: I'm glad were seeing so many great guides here in this forum, before long, we'll have a directory that other forums will envy -if not already.
Sent from my SAMSUNG-SGH-I747 using xda premium
Updated the tool (not the guide).. eh, it's still a work-in-progress but gets the job done

Categories

Resources