So, as the title says a simple bash script to convert a dream rom to a sapphire rom.
To make this work you need unpack / repack boot img utilities from here:
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
testsign.jar from here:
http://forum.xda-developers.com/showpost.php?p=4008431&postcount=15
mkbootimg from here:
http://forum.xda-developers.com/showpost.php?p=3387504&postcount=26
since I'm a nice guy I've included these in the attached zip file.
extract the attached zip file into a folder (warning: make sure there's no spaces in the folder name!!) then run:
Code:
./convert.sh your_dream_rom.zip
this will:
extract the boot.img from the zip
unpack the boot image
rename init.trout.rc to init.sapphire.rc
repack the boot image
put the boot image back into a copy of the dream rom zip
NEW!! in v3: add anything in the 'addin' folder into the zip (see below)
resign the new zip
you'll be left with your_dream_rom-sapphire.zip which should (hopefully) work on the sapphire.
v3: new addin folder. Anything in this folder will be added to the resulting zip, overwriting if needed. So if you want to replace (for example) /system/etc/AudioPara4.csv just put the file in /addin/system/etc and it will automagically be merged in.
Deicist said:
So, as the title says a simple bash script to convert a dream rom to a sapphire rom.
To make this work you need unpack / repack boot img utilities from here:
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
testsign.jar from here:
http://forum.xda-developers.com/showpost.php?p=4008431&postcount=15
since I'm a nice guy I've included these in the attached zip file.
You'll also need to compile the mkbootimg executable that (I think!) comes with the android source.
extract the attached zip file inot a folder then run:
Code:
./convert.sh your_dream_rom.zip
this will:
extract the boot.img from the zip
unpack the boot image
rename init.trout.rc to init.sapphire.rc
repack the boot image
put the boot image back into a copy of the dream rom zip
resign the new zip
you'll be left with your_dream_rom-sapphire.zip which should (hopefully) work on the sapphire.
attached is a zip file containing everything you need except mkbootimg, since that needs to be compiled for your system.
Please note, I don't have a compiled copy of mkbootimg for my system, so I haven't been able to try the full process... but extracting and repacking the zip works, signing seems to work... and it's a pretty simple script so I can't see why it wouldn't work.
Enjoy!
Click to expand...
Click to collapse
Thanks! Do I need a boot.img and wlan.ko for pvt32A if I want it to work?
it won't work for 32a, but I'm sure you can mod the script to add in a new boot.img and radio thingy.
updated initial post with new attachment:
added mkbootimg to zip file
changed script slightly.
in case anyone was wondering, I tried this script on Drizzy's "superlight hero" rom from the dream forum and it worked perfectly.
[email protected]:~$ /home/ubuntu/Desktop/a/convert.sh Personal.zip
unzip: cannot find or open ./Personal.zip, ./Personal.zip.zip or ./Personal.zip.ZIP.
/home/ubuntu/Desktop/a/convert.sh: 3: ./unpack-bootimg.pl: not found
rm: Entfernen von „boot.img“ nicht möglich: No such file or directory
mv: Aufruf von stat für „./boot.img-ramdisk/init.trout.rc“ nicht möglich: No such file or directory
/home/ubuntu/Desktop/a/convert.sh: 6: ./repack-bootimg.pl: not found
cp: Aufruf von stat für „./Personal.zip“ nicht möglich: No such file or directory
zip warning: name not matched: boot.img
zip error: Nothing to do! (update.zip)
/home/ubuntu/Desktop/a/convert.sh: 9: java: not found
rm: Entfernen von „./boot.img-ramdisk“ nicht möglich: No such file or directory
rm: Entfernen von „boot.img-kernel.gz“ nicht möglich: No such file or directory
rm: Entfernen von „boot.img-ramdisk.cpio.gz“ nicht möglich: No such file or directory
rm: Entfernen von „update.zip“ nicht möglich: No such file or directory
Click to expand...
Click to collapse
What do i wrong ... ?
No idea, according to the error message it says it can't find 'Personal.zip'... is that file present in the same directory as 'convert.sh' ?
yes it is ...
can anyone convert this boot.img ... so that i can use on 32b?
you need to actually change directory to the directory containing the utility to run it.
try:
cd /home/ubuntu/Desktop/a/
./convert.sh Personal.zip
is ist possible that it doesn't work because i'm using the live cd now?
now it says
Archive: ./Personal.zip
inflating: ./boot.img
kernel written to ./boot.img-kernel.gz
ramdisk written to ./boot.img-ramdisk.cpio.gz
472 blocks
extracted ramdisk contents to directory ./boot.img-ramdisk/
472 blocks
sh: mkbootimg: not found
repacked boot image written at ./boot.img-ramdisk-repack.img
zip error: Nothing to do! (update.zip)
Click to expand...
Click to collapse
but mkbootimg is in this directory
This is what I end up getting. I ended up using a precompiled binary of mkbootimg for OSX since it didn't work on my Linux box.
./convert.sh NewVision_2.8.zip
Archive: ./NewVision_2.8.zip
inflating: ./boot.img
kernel written to ./boot.img-kernel.gz
ramdisk written to ./boot.img-ramdisk.cpio.gz
extracted ramdisk contents to directory ./boot.img-ramdisk/
usage: cpio -o [-aABcLvVzZ] [-C bytes] [-H format] [-O archive]
[-F archive] < name-list [> archive]
cpio -i [-bBcdfmnrsStuvVzZ6] [-C bytes] [-E file] [-H format]
[-I archive] [-F archive] [pattern...] [< archive]
cpio -p [-adlLmuvV] destination-directory < name-list
repacked boot image written at ./boot.img-ramdisk-repack.img
updating: boot.img (deflated 1%)
Exception in thread "main" java.lang.UnsupportedClassVersionError: testsign (Unsupported major.minor version 50.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
Hello,
MarcoNieddu said:
extracted ramdisk contents to directory ./boot.img-ramdisk/
472 blocks
sh: mkbootimg: not found
Click to expand...
Click to collapse
You have to modify the script repack-bootimg.pl at line 19 :
replace : system ("mkbootimg ...
by : system ("./mkbootimg ...
Note the ./ before mkbootimg
Scargoll.
Got everything working.
1. Add ./ to the repack script before mkbootimg
2. make sure you have a 32bit OS, as the binary provided was compiled for it. I made an Intrepid machine on my VM server.
3. Use the latest version of Java. Even Karmic Koala Ubuntu doesn't have it. The class file in the jar was compiled with a very recent version of Java, so you'll error out since the jre version isn't equal to or above whats needed. You can simply do "export JAVAHOME=pathtojava" if you don't want to keep that version permanently.
4. Have fun!
Bugfixes:
removes boot.img when script is done
added ./ before mkbootimg (sorry!)
the provided mkbootimg *should* work on a 64bit machine, it does on my 64 bit arch linux box...as with all things linux though, YMMV.
I ve tried to convert a dream rom but it didn't work, does this method can be applied from a windows command shell ?
EDIT: can I take a dream rom, flash it, and push a boot.img from a hero 32B rom ?
EDIT2: Ok now that I have read the name of the topic I understand it wont work in windows. So here's my new question...
Is there a way to adapt this script (or to create something similar) so it works with windows ?
updated with 'addin' feature
ElChouch said:
Is there a way to adapt this script (or to create something similar) so it works with windows ?
Click to expand...
Click to collapse
A windows version would be great!
Nice work Deicist. Thanks for sharing.
some facts:
- i'm running Windows 7 RC (64-bit)
- i installed Cygwin and executed it as administrator
- i browse out to the correct folder where the rom zip file is located
i get the following errors. any suggestions?:
$ ./convert.sh modaco_hero.zip
unzipping...
./convert.sh: line 3: unzip: command not found
unpacking boot image
./convert.sh: ./unpack-bootimg.pl: /usr/bin/perl: bad interpreter: Permission de
nied
moving trout to sapphire
mv: cannot stat `./boot.img-ramdisk/init.trout.rc': No such file or directory
repacking boot image
./convert.sh: ./repack-bootimg.pl: /usr/bin/perl: bad interpreter: Permission de
nied
re-zipping
./convert.sh: line 12: zip: command not found
rm: cannot remove `boot.img': No such file or directory
Addin files found....
./convert.sh: line 18: zip: command not found
Re-signing zip (this may take a while)
tidying up
rm: cannot remove `./boot.img-ramdisk': No such file or directory
rm: cannot remove `boot.img-kernel.gz': No such file or directory
rm: cannot remove `boot.img-ramdisk.cpio.gz': No such file or directory
all done
Make it work on Fedora
Was having problems with this script working at the java part on a FC10 box.
Was able to get it to work by installing java-1.6.0-openjdk:
Code:
$ yum install java-1.6.0-openjdk
just posting that here in case anyone who needs it stumbles by.
Thanks for your great script Deicist
I'm getting this error. What am I doing wrong?
Exception in thread "main" java.lang.NoClassDefFoundError: testsign
at java.lang.Class.initializeClass(libgcj.so.90)
Caused by: java.lang.ClassNotFoundException: sun.security.x509.AlgorithmId not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:testsign.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.90)
at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.90)
at java.lang.ClassLoader.loadClass(libgcj.so.90)
at java.lang.ClassLoader.loadClass(libgcj.so.90)
at java.lang.Class.initializeClass(libgcj.so.90)
Trying to flash my aosp rom to test it, but my updater script is funking up every time...
The recovery log shows that there is an unexpected symbol/character...then syntax errors. I know it boils down to me using a text editor to edit these files. I have used nano, TextEdit, and Text Wrangler (on mac), all to no different result.
I'm officially stuck. Help?
Code:
// recovery.log //
-- Installing: SDCARD:deepfreeze.zip
I:Set boot command "boot-recovery"
Finding update package...
I:Update location: SDCARD:deepfreeze.zip
Opening update package...
I:Update file path: /sdcard/deepfreeze.zip
Installing update...
I:Trying update-binary.
1 parse errors
line 3 col 34: syntax error, unexpected STRING, expecting ',' or ')'
E:Error in /sdcard/deepfreeze.zip
(Status 6)
Installation aborted.
edit: if i use the updater-script from a cyanogenmod nightly (unedited) I get no errors...Am I using the wrong editor?
So, in a stroke of pure genius, I found the solution. Edit with Eclipse, problem solved. Hope this helps someone
[phone info] Nexus 5, D820, Android 6.0 MRA58K , rooted , TWRP
I sideload a zip file (55f77e7f2512b8759b3ff14cd9be04cbdeb7274e.signed - hammerhead-MRA58N-from-MRA58K1) in TWRP , but return error. "Error executing updater binary in zip", " this device has google/omni_hammerhead/hammerhead:5.0.2/LRX22G/2:eng/test-keys" ...
I can't post all the recovery.log content, as the outside link rule. Amazing~
this message was pulled from the recovery.log
script aborted: Package expects build fingerprint of google/hammerhead/hammerhead:6.0/MRA58K/2256973:user/release-keys or google/hammerhead/hammerhead:6.0/MRA58N/2289998:user/release-keys; this device has google/omni_hammerhead/hammerhead:5.0.2/LRX22G/2:eng/test-keys.
Package expects build fingerprint of google/hammerhead/hammerhead:6.0/MRA58K/2256973:user/release-keys or google/hammerhead/hammerhead:6.0/MRA58N/2289998:user/release-keys; this device has google/omni_hammerhead/hammerhead:5.0.2/LRX22G/2:eng/test-keys.
I:Legacy property environment disabled.
E:Error executing updater binary in zip '/sideload/package.zip'
I:Signaling child sideload process to exit.
sideload_host finished
I:Waiting for child sideload process to exit.
Can't install a modified app using ADB "A problem occured during package analyze"
Hello,
I have modify an app (actually a simple .txt file) and I package it again.
Then I move the base.apk in the original folder in /data/app/app_folder and when I hit base.apk, an error message appears :
"A problem occured during package analyze"
Have you got any idea where I am wrong ?
Thanks
probably corrupted signature - Did you re-sign it?
DSA said:
probably corrupted signature - Did you re-sign it?
Click to expand...
Click to collapse
In the installation folder there was : "lib" folder, "oat" foolder and the base.apk
I only modified the base.apk using an extractor like 7-zip and pack it again after in .apk
How do I sign it again ?
Error log:
"C:\Program Files (x86)\Minimal ADB and Fastboot>adb install D:\app\com.toyquest.Cayla.fr-1\base.apk
Failed to install D:\app\com.toyquest.Cayla.fr-1\base.apk: Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: Failed to parse /data/app/vmdl1492354494.tmp/base.apk: AndroidManifest.xml]"
I sign it using :
keytool -genkey -v -keystore my-release-key.keystore -alias CAYLA -keyalg RSA -keysize 2048 -validity 10000
sudo jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore base.apk CAYLA
sudo jarsigner -verify -verbose -certs base.apk
Right method ?
Session 'app': Installation did not succeed.
The application could not be installed: INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION
Retry
i cant install , if i do push abb can i ?
The error reported has NOTHING to do with APK's signature:
Error log:
"C:\Program Files (x86)\Minimal ADB and Fastboot>adb install D:\app\com.toyquest.Cayla.fr-1\base.apk
Failed to install D:\app\com.toyquest.Cayla.fr-1\base.apk: Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: Failed to parse /data/app/vmdl1492354494.tmp/base.apk: AndroidManifest.xml]"
Click to expand...
Click to collapse
APK's AndroidManifest.xml is the culprit! Wondering why you don't carefully read error messages?
it's just that you removed or modify some line in xml file which is causing problem. just search for it alternatively if you want to change image file you can swamp it with another file with same name. hope it helped
I'm trying to create rsync to my andorid / TWRP So i can backup android folder
My code for compile:
Code:
Downloaded from (https://github.com/WayneD/rsync/releases)
./configure --host=arm-linux-gnueabi CFLAGS="-static" --disable-xxhash --disable-zstd
make
make prefix=/home/fredy/Desktop/rsync install
i copy the file ("rsync", "rsync-ssl") into /sbin
But i got this error here and testet with command "rsync":
Code:
/sbin/rsync: line 1: syntax error: unexpected "("
Can you help me out?
Thanks for your time