Related
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)
I did a backup, which is on the SD card right now, but I sort of loved the sounds it had. I don't want to restore it, can I use a computer to get it from the backup files?
The only way I know of is to copy the .img file that contains the sounds to your computer and then either mount it as a virtual drive or burn the image to an actual disc and then access the files that way.
phburks said:
The only way I know of is to copy the .img file that contains the sounds to your computer and then either mount it as a virtual drive or burn the image to an actual disc and then access the files that way.
Click to expand...
Click to collapse
Do you know which?
Code:
[email protected]:/media/2078-77E4/clockworkmod/backup/2011-09-14.02.05.43$ ls -l
total 416864
-rw-r--r-- 1 ibo ibo 8388608 2011-09-14 02:05 boot.img
-rw-r--r-- 1 ibo ibo 19008 2011-09-14 02:08 cache.img
-rw-r--r-- 1 ibo ibo 185382912 2011-09-14 02:08 data.img
-rw-r--r-- 1 ibo ibo 222 2011-09-14 02:09 nandroid.md5
-rw-r--r-- 1 ibo ibo 8388608 2011-09-14 02:05 recovery.img
-rw-r--r-- 1 ibo ibo 224594304 2011-09-14 02:06 system.img
[email protected]:/media/2078-77E4/clockworkmod/backup/2011-09-14.02.05.43$
Most likely the system.img if you're talking about system sounds and notifications.
If you're going to write it to disc then make sure you use a program that actually writes the disc image to disc. That should actually let you access the files Don't just write it as data because then you'll just end up with a disc with a system.img file on it. Lol
Android uses the yaffs2 file system. In order to access the files in a .img file you must unyaffs it.
Since I already have the files compiled, I'll attach the files necessary, just add your .img file into the folder and drag and drop it on 'unyaffs.exe' and it will extract all the files for you.
System sounds will be in located at system/media/audio/.
Hope this helps!
omarsalmin said:
Android uses the yaffs2 file system. In order to access the files in a .img file you must unyaffs it.
Since I already have the files compiled, I'll attach the files necessary, just add your .img file into the folder and drag and drop it on 'unyaffs.exe' and it will extract all the files for you.
System sounds will be in located at system/media/audio/.
Hope this helps!
Click to expand...
Click to collapse
Fantastic! Just tried it and it works beautifully.
omarsalmin said:
Android uses the yaffs2 file system. In order to access the files in a .img file you must unyaffs it.
Since I already have the files compiled, I'll attach the files necessary, just add your .img file into the folder and drag and drop it on 'unyaffs.exe' and it will extract all the files for you.
System sounds will be in located at system/media/audio/.
Hope this helps!
Click to expand...
Click to collapse
Foe reference, for Linux users: dowload this
http://code.google.com/p/unyaffs/downloads/list
Code:
[email protected]:~/Downloads$ ./unyaffs system.img
end of image
[email protected]:~/Downloads$
And to add your extracted ogg's to your current android, make these folders in the root of your SD card:
Code:
Media/Audio/alarms
Media/Audio/notifications
Media/Audio/ringtones
and put the ogg's there. Then they will show where you choose your ringtones.
How to Port same MTK6572 in JellyBean
Porting Guide for Jellybean MTK6572
Note: it must be same MTK6572 and same Jellybean
What do you need:
Stock rom
Port rom (must be MTK6572 android 4.2.2)
7zip
notepad++
apktool
knowledge about porting
Brain
Step 1: Stock and Port rom
Create a 2 folder name it as stock and port
Extract your stock rom place in stock folder same as port rom place in port folder
Step 2: bin Folder copy and replace the following files
dnsmasq
vold
sdcard
if you got a bug in sdcard mounting delete and replace whole bin folder
or if you got a bootloop try to copy and replace all files in bin folder
Step 3: etc folder delete and copy the following folder and files
firmware
dhcpcd
fmr
permissions
security
wide-dhcpv6
wifi
apns-conf.xml
vold.fstab
vold.fstab.nand
vold.fstab.fat.nand
Step 4: lib folder delete and copy the following folder
hw
modules
soundfx
Step 5: copy and replace the following files in lib folder
libaudio.a2dp.default.so
libaudio.primary.default.so
libaudiocompensationfilter.so
libaudiocustparam.so
libaudioeffect_jni.so
libaudioflinger.so
libaudio-resampler.so
libaudiosetting.so
libaudioutils.so
liba3m.so
libacdk.so
libaudioflinger.so
libc.so
libcam.camadapter.so
libcam.campipe.so
libcam.camshot.so
libcam.client.so
libcam.paramsmgr.so
libcam.utils.so
libcam_camera_exif.so
libcamalgo.so
libcamdrv.so
libcamera_client.so
libcamera_metadata.so
libcameracustom.so
libcameraservice.so
libexif.so
libfeatureio.so
libfrsdk.so
libft.so
libgoggles_clientvision.so
libgui.so
libimageio.so
libja3m.so
libcustom_nvram.so
libsensorservice.so
libvcodecdrv.so
libdpframework.so
libinput.so
libsync.so
Step 6: usr folder
usr - delete and replace
Step 7: Open build.prop search line or add
For fix density:
ro.sf.lcd_density=160 (for 3.5 inch)
ro.sf.lcd_density=240 (for 4.0 inch)
For fix rotation:
ro.sf.hwrotation=0 or
ro.sf.hwrotation=180
Step 7: META-INF folder
You can use the META-INF of Port rom
Open META-INF / com/google / android / updater-script and edit this line
Your mount point must be mmcblk0p4 for system like this:
format("ext4", "EMMC", "/dev/block/mmcblk0p4");
mount("ext4", "EMMC", "/dev/block/mmcblk0p4", "/system");
Your mount point must be mmcblk0p6 for data like this:
mount("ext4", "EMMC", "/dev/block/mmcblk0p6", "/data");
Step 8: boot and logo
Replace your stock Boot.img and logo.bin to port rom
Common bug: sdcard not mounting or reverse mount
How to fix:
1. decompile framework-res.apk
2. on res/xml folder find storage_list.xml and edit in notepad++
3. there is sdcard0 at sdcard1 just interchange the 0 change it as 1 and the 1 change it as 0
4. Recompile
if you got a bootloop prepare your original framework-res.apk from Port rom
it is easy if you have a computer
Give proper credit to Marc Kevin Flores
Hello all,
My Chinese notwellknown phone model does not have TWRP, but I have made live TWRP/CWM (yes both) backup files:
system.ext4.win (TWRP) and its md5
system.ext4.tar and (CWM) and its md5.
If one day, I have a bootloop and want to restore those file via Bootloader: (Power button & Vol-)
then: fastboot -S 130M flash system system.img
So how do I create a "system.img" from one of the files above (system.ext4.win or system.ext4.tar) ?
A) Before someone sidetrack the topic, I have done MANY TIMES SUCCESSFULLY the command: fastboot -S 130M flash system "stock-system-file.img" with this phone ( .img extracted from stock zip/tar). (* 1)
B) I didn't ask: "Is there other way to restore ?" I asked: How to convert *.ext4.win (twrp) or *.ext4.tar (cwm) files to .img files just like the ones uncompressed from a stock zip/tar.
(*1) Of course there are other ways to restore, like temporarily fastboot boot twrp.img then restore from there or from twrp>adb. But that's not what the question is asking.
........... Thank you everyone ...........
sintoo said:
Hello all,
My Chinese notwellknown phone model does not have TWRP, but I have made live TWRP/CWM (yes both) backup files:
system.ext4.win (TWRP) and its md5
system.ext4.tar and (CWM) and its md5.
If one day, I have a bootloop and want to restore those file via Bootloader: (Power button & Vol-)
then: fastboot -S 130M flash system system.img
So how do I create a "system.img" from one of the files above (system.ext4.win or system.ext4.tar) ?
A) Before someone sidetrack the topic, I have done MANY TIMES SUCCESSFULLY the command: fastboot -S 130M flash system "stock-system-file.img" with this phone ( .img extracted from stock zip/tar). (* 1)
B) I didn't ask: "Is there other way to restore ?" I asked: How to convert *.ext4.win (twrp) or *.ext4.tar (cwm) files to .img files just like the ones uncompressed from a stock zip/tar.
(*1) Of course there are other ways to restore, like temporarily fastboot boot twrp.img then restore from there or from twrp>adb. But that's not what the question is asking.
........... Thank you everyone ...........
Click to expand...
Click to collapse
Here is a thread for converting TWRP/CWM backups into a flashable zip. I know you aren't looking for how to create a flashable zip but the guide instructs how to extract the system.ext4.win and system.ext4.tar to get the system.img from the backup, this is the part that you need.
https://forum.xda-developers.com/showthread.php?t=2746044
Sent from my SM-S767VL using Tapatalk
first, system.img usually can be downloaded somewhere, no need to restore twrp backup for system. don't you think you will find a download? second, if you restore system you may required to restore vendor and boot too. boot.emmc.win can be flashed from fastboot directly, but for vendor you need to convert. the same way. third, system.img can have different formats. you need to know which file system type, partition size, and if it is sparsed image or not. file system type is EXT4 in your case because twrp backup is named system.ext4.win
for "converting" the system.ext4.win* file(s) into system.img you do it in two steps. first you need to create a empty ext4 image file. after the empty disk image is mounted somewhere, you simply unpack the backup files into the mounted disk. so it's not really converting, more like copying.
You need a linux machine for this
so let's begin with partition size
on a working device you can simply check from system or recovery. find the symlink, resolve the symlink for system, get #blocks (=size) for respective block partition, for example mmcblk0p99
for some reason xda blocks code for ls -l (lower case -L there is no space between)
Code:
find /dev/block -name by-name
ls - l /dev/block/platform/bootdevice/by-name
cat /proc/partitions
Note: the above commands need to be run on target android device only. use adb shell or terminal emulator. all other commands below need to be run on host linux pc
if gathering partition size on the device itself is not an option for you, if you have a mediatek chipset you can simply look into scatter file. OTA zip files most likely contain scatter file. if you don't have a scatter file for your ROM version, you can create your own scatter file with WwR MTK
use hex2dec calculator for partition_size: 0x9C800000 = 2625634304 bytes = 2564096 KiB (#blocks)
if you don't have mediatek device i am running out of ideas. you can boot into twrp from fastboot and check, or find a ROM and check the file size hopefully it is not a sparsed image.
Once you know the partition size, now proceed to create a empty file (avoid to do this on fat32 host if size is bigger > 4 GiB)
and format the file to ext4 (or f2fs if needed)
Code:
dd if=/dev/zero of=system.img bs=1 count=0 seek=2625634304
mke2fs -t ext4 system.img
if all went well you can create a mount point on host and mount the empty disk image. the following commands need to be run with root permissions. you can do it from sudo or as root
Code:
mkdir system
sudo -i
cd /home/$SUDO_USER
mount -t ext4 -o loop,rw,noexec,noatime system.img system
you can now unpack the tar files into system. make sure the folder structure remains intact, if the archive contains the folder /system you should unpack to ~ (this will create all files in ~/system) otherwise you need to unpack to ~/system (or cd into ~/system)
for cwm all files need to be concatenated. for twrp do not concatenate each file is a standalone tar archive. if you have android > kitkat 4.4.2+ make sure you use the proper flags for selinux context
Code:
tar --selinux --xattrs --numeric-owner -vxpf system.ext4.win000
tar --selinux --xattrs --numeric-owner -vxpf system.ext4.win001
or
Code:
cat system.ext4.tar000 system.ext4.tar001 | tar --selinux --xattrs --numeric-owner -vxp
the unpacking may produce errors malformed header or something, make sure all files extracted anyway. i have read somewhere better use star instead of tar which can handle twrp files in the right way, unfortunately haven't tested yet
to avoid any problems with permissions you should check/set for system again
Code:
chown -h 1000:1000 system
chmod 0755 system
chcon -h --reference system/bin system
after unpacking just unmount the disk image
Code:
umount system
rmdir system
exit
If you want to create a sparse image you can use the img2simg tool
Code:
sudo apt-get install android-tools-fsutils
img2simg system.img system.smg
This method is just written on the fly especially for your request, everything untested. I really don't know if this file is flashable from fastboot, do it at your own risk!
aIecxs said:
first, system.img usually can be downloaded somewhere, no need to restore twrp backup for system. don't you think you will find a download? second, if you restore system you may required to restore vendor and boot too. boot.emmc.win can be flashed from fastboot directly, but for vendor you need to convert. the same way. third, system.img can have different formats. you need to know which file system type, partition size, and if it is sparsed image or not. file system type is EXT4 in your case because twrp backup is named system.ext4.win
for "converting" the system.ext4.win* file(s) into system.img you do it in two steps. first you need to create a empty ext4 image file. after the empty disk image is mounted somewhere, you simply unpack the backup files into the mounted disk. so it's not really converting, more like copying.
You need a linux machine for this
so let's begin with partition size
on a working device you can simply check from system or recovery. find the symlink, resolve the symlink for system, get #blocks (=size) for respective block partition, for example mmcblk0p99
for some reason xda blocks code for ls -l (lower case -L there is no space between)
Code:
find /dev/block -name by-name
ls - l /dev/block/platform/bootdevice/by-name
cat /proc/partitions
Note: the above commands need to be run on target android device only. use adb shell or terminal emulator. all other commands below need to be run on host linux pc
if gathering partition size on the device itself is not an option for you, if you have a mediatek chipset you can simply look into scatter file. OTA zip files most likely contain scatter file. if you don't have a scatter file for your ROM version, you can create your own scatter file with WwR MTK
use hex2dec calculator for partition_size: 0x9C800000 = 2625634304 bytes = 2564096 KiB (#blocks)
if you don't have mediatek device i am running out of ideas. you can boot into twrp from fastboot and check, or find a ROM and check the file size hopefully it is not a sparsed image.
Once you know the partition size, now proceed to create a empty file (avoid to do this on fat32 host if size is bigger > 4 GiB)
and format the file to ext4 (or f2fs if needed)
Code:
dd if=/dev/zero of=system.img bs=1 count=0 seek=2625634304
mke2fs -t ext4 system.img
if all went well you can create a mount point on host and mount the empty disk image. the following commands need to be run with root permissions. you can do it from sudo or as root
Code:
mkdir system
sudo -i
cd /home/$SUDO_USER
mount -t ext4 -o loop,rw,noexec,noatime system.img system
you can now unpack the tar files into system. make sure the folder structure remains intact, if the archive contains the folder /system you should unpack to ~ (this will create all files in ~/system) otherwise you need to unpack to ~/system (or cd into ~/system)
for cwm all files need to be concatenated. for twrp do not concatenate each file is a standalone tar archive. if you have android > kitkat 4.4.2+ make sure you use the proper flags for selinux context
Code:
tar --selinux --xattrs --numeric-owner -vxpf system.ext4.win000
tar --selinux --xattrs --numeric-owner -vxpf system.ext4.win001
or
Code:
cat system.ext4.tar000 system.ext4.tar001 | tar --selinux --xattrs --numeric-owner -vxp
the unpacking may produce errors malformed header or something, make sure all files extracted anyway. i have read somewhere better use star instead of tar which can handle twrp files in the right way, unfortunately haven't tested yet
to avoid any problems with permissions you should check/set for system again
Code:
chown -h 1000:1000 system
chmod 0755 system
chcon -h --reference system/bin system
after unpacking just unmount the disk image
Code:
umount system
rmdir system
exit
If you want to create a sparse image you can use the img2simg tool
Code:
sudo apt-get install android-tools-fsutils
img2simg system.img system.smg
This method is just written on the fly especially for your request, everything untested. I really don't know if this file is flashable from fastboot, do it at your own risk!
Click to expand...
Click to collapse
Cygwin works as well, it doesn't necessarily "have" to be Linux.
There is a post for using Cygwin as well in the thread that I linked.
More than one way to "skin this cat", so to speak. I'm sure they'll figure it out with the information they've been provided.
Sent from my SM-S767VL using Tapatalk
i don't think so, twrp archive doesn't contain a system.img it only contains folder /system. therefore you can't extract system.img but only the files inside, which have to be extracted in the right way including metadata. the cygwin untar.exe won't handle secontext flag. besides this it is generally bad idea to extract linux files to windows file system. ntfs is case insensitive and not all ascii chars allowed in file names, you will lose all file permissions owner/group and selinux context (except you untar it directly to ext4 image like i said). This might not be important for flashable zip because everything is lost inside a zip anyway (that's why META-INF is needed) but for creating a working ext4 image you must set everything to drw(x)r-(x)r-(x) system system ubject_r:system_file:s0 (i can be wrong always double check for your ROM) things become more complicated when we talking about data.ext4.win or vendor.ext4.win
even if you compile star or gnu tar and all other binaries for windows like mke2fs chcon or so, you won't be able to mount the ext4 disk image r/w in the right way on windows..
anyway thanks for suggesting cygwin, might be a simple alternative for windows freaks. i personally prefer booting live distro from usb stick
aIecxs said:
i don't think so, twrp archive doesn't contain a system.img it only contains folder /system. therefore you can't extract system.img but only the files inside, which have to be extracted in the right way including metadata. the cygwin untar.exe won't handle secontext flag. besides this it is generally bad idea to extract linux files to windows file system. ntfs is case insensitive and not all ascii chars allowed in file names, you will lose all file permissions owner/group and selinux context (except you untar it directly to ext4 image like i said). This might not be important for flashable zip because everything is lost inside a zip anyway (that's why META-INF is needed) but for creating a working ext4 image you must set everything to drw(x)r-(x)r-(x) system system ubject_r:system_file:s0 (i can be wrong always double check for your ROM) things become more complicated when we talking about data.ext4.win or vendor.ext4.win
even if you compile star or gnu tar and all other binaries for windows like mke2fs chcon or so, you won't be able to mount the ext4 disk image r/w in the right way on windows..
anyway thanks for suggesting cygwin, might be a simple alternative for windows freaks. i personally prefer booting live distro from usb stick
Click to expand...
Click to collapse
Yeah, that is true, it should only be the system folder.
Since they must use TWRP/CWM to create the backups, maybe it would have been better to suggest that they should instead, boot into TWRP then connect to adb to use adb shell commands or to use the terminal emulator that is built into TWRP to run a system dump or dd commands to dd a copy of the system.img over to PC.
Or maybe there is a way to mount/run the extracted system folder in terminal then using terminal to dump/dd a .img from that. I don't even know if that is possible(never heard of it, but it's a thought) but it seems to me that if the system.img is what is written to the system partition when flashed and this is what creates the system folder, there "should" be a way to pack the contents of the system folder back into what was originally contained in the system.img. It might miss a few things though, like the kernel for one, the kernel is sometimes part of the system.img but I don't know if that necessarily means that the kernel will be in the system partition/folder when the system.img is flashed. Thus, making it impossible to reverse engineer back into a proper system.img using only the contents of the system folder obtained from a nandroid backup.
A system dump, dd the .img or extract the system.img from the stock firmware file are the way to go, preferably, extracting from the stock firmware file, because that is easier and less risky than using shell, terminal and Linux for the uninitiated.
Sent from my SM-S767VL using Tapatalk
---------- Post added at 03:52 PM ---------- Previous post was at 03:47 PM ----------
aIecxs said:
i don't think so, twrp archive doesn't contain a system.img it only contains folder /system. therefore you can't extract system.img but only the files inside, which have to be extracted in the right way including metadata. the cygwin untar.exe won't handle secontext flag. besides this it is generally bad idea to extract linux files to windows file system. ntfs is case insensitive and not all ascii chars allowed in file names, you will lose all file permissions owner/group and selinux context (except you untar it directly to ext4 image like i said). This might not be important for flashable zip because everything is lost inside a zip anyway (that's why META-INF is needed) but for creating a working ext4 image you must set everything to drw(x)r-(x)r-(x) system system ubject_r:system_file:s0 (i can be wrong always double check for your ROM) things become more complicated when we talking about data.ext4.win or vendor.ext4.win
even if you compile star or gnu tar and all other binaries for windows like mke2fs chcon or so, you won't be able to mount the ext4 disk image r/w in the right way on windows..
anyway thanks for suggesting cygwin, might be a simple alternative for windows freaks. i personally prefer booting live distro from usb stick
Click to expand...
Click to collapse
I use VM, Live USB and dual boot, depending on which system I'm on(I have more than one rig) and depending on what I'm doing. In some cases, using Windows running Linux in VM is handy because some things are easier in Windows and some are easier in Linux, VM allows switching back and forth between Windows and Linux "on the fly" instead of having to move back and forth between two different systems. Another advantage to VM, your actual system is effectively immune to viruses when browsing the web inside the VM, only the OS installed in the VM is vulnerable, if infected, just wipe that OS and reinstall in the VM and you're clean again, your actual system that the VM is running on, never gets effected.
Sent from my SM-S767VL using Tapatalk
yeah i wonder how did create twrp backup without actually having twrp. busybox tar isn't able to do it, at least full tar binary is required. would be better to create backup in desired format from the very beginning. easiest way is adb pull /dev/block/bootdevice/by-name/system system.img (with proper path of course)
aIecxs said:
yeah i wonder how did create twrp backup without actually having twrp. busybox tar isn't able to do it, at least full tar binary is required. would be better to create backup in desired format from the very beginning. easiest way is adb pull /dev/block/bootdevice/by-name/system system.img (with proper path of course)
Click to expand...
Click to collapse
They booted a live temporary session of TWRP without actually flashing it to the recovery partition. I've done the same on an Intel tablet and a couple of RCA tablets. Booting it directly instead of flashing it onto the device doesn't trigger the locked bootloader. The locked bootloader won't allow booting unverified software that has been installed in the device's hardware itself, but it does not block booting unverified software from an external source.
Sent from my SM-S767VL using Tapatalk
After reading other source, someone said the ext4.win are just tar. One only needs to rename them to ext4.win.tar and you uncompress to img.
I guess the truth is more complicated than that because img (from stock, ready to be ODINed/Bootloader Fastboot) are raw images, including zeros. That's the difference.
In the end, if I had to do it again, I would have to dd the whole /mmcblkxxx(system) to a microSD. Yes 16-20Gb takes a much longer time than 2-3Gb (system.ext4.win) but that what <fastboot flash system system.img> requires (raw data and zeros).
sintoo said:
After reading other source, someone said the ext4.win are just tar. One only needs to rename them to ext4.win.tar and you uncompress to img.
Click to expand...
Click to collapse
Thats exactly how it works see post #3
if you add entry with file system type "emmc" in /etc/recovery.fstab TWRP produces flashable disk image system_image.emmc.win* instead of tar archive (which you can probably concatenate into system.img)
Code:
/system_image emmc /dev/block/platform/mtk-msdc.0/by-name/system flags=display="System Image";backup=1;flashimg=1
Hello,
i'm trying to unpark boot.img
But then i got this error here. how can that be fixed? (Android-Kitchen-0.224)
Copy boot.ing into -> bootimg_040621_161723
Code:
Creating folder /home/fredy/Desktop/Android-Kitchen-0.224/bootimg_040621_161723 ...
---> Place boot.img/recovery.img into the folder mentioned above <--
Press Enter to continue
Kernel found at offset 2048 in boot.img
Extracting kernel ...
Extracting ramdisk ...
Error: No ramdisk folder found!
Contents of bootimg_040621_161723:
total 9476
-rw-rw-r-- 1 fredy fredy 9701434 Apr 6 16:17 zImage
Press Enter to continue
Thanks for your time
007fred62 said:
Hello,
i'm trying to unpark boot.img
But then i got this error here. how can that be fixed? (Android-Kitchen-0.224)
Copy boot.ing into -> bootimg_040621_161723
Code:
Creating folder /home/fredy/Desktop/Android-Kitchen-0.224/bootimg_040621_161723 ...
---> Place boot.img/recovery.img into the folder mentioned above <--
Press Enter to continue
Kernel found at offset 2048 in boot.img
Extracting kernel ...
Extracting ramdisk ...
Error: No ramdisk folder found!
Contents of bootimg_040621_161723:
total 9476
-rw-rw-r-- 1 fredy fredy 9701434 Apr 6 16:17 zImage
Press Enter to continue
Thanks for your time
Click to expand...
Click to collapse
The ramdisk is likely in the recovery.img
sd_shadow said:
The ramdisk is likely in the recovery.img
Click to expand...
Click to collapse
ok
sd_shadow said:
The ramdisk is likely in the recovery.img
Click to expand...
Click to collapse
Hello,
can you help me with this? recreate boot.img
Code:
Boot image tools
----------------
Enter a choice:
a = Extract kernel+ramdisk from boot.img/recovery.img in any folder
x = Exit
NOTE: Other options may not be shown in this menu *until* a specific
action above is selected or a specific working folder is created.
(A working folder is created with Option 1 of the kitchen main menu!)
e.g. You won't see the option to re-pack a boot.img unless you unpack
the boot.img first! For re-packing you also need a working folder
with the original boot.img so that the kitchen can use its header
information to construct the new boot.img.
But there can i copy files too.. only a = extract no working folder