[HELP] How to make a binary executable in Ubuntu - General Questions and Answers

Please whosoever reads this post and has got a solution to this please reply as i need a solution desperatly.This is my third post of the same help and till now i have not got any help.Is this is what xda all about????
Click to expand...
Click to collapse
hello,
I am using a virtual box with Ubuntu 16.04 as guest and Windows 10 as host
I have downloaded the binaries such as simg2img img2simg,etc...But whenever i am using the command
Code:
sudo ./simg2img system.img sys.raw
i am getting the error
Code:
[email protected]:/media/htc_desire$ sudo ./simg2img system.img sys.raw
sudo: unable to execute ./simg2img: No such file or directory
I have also tried the command
Code:
sudo chmod +x simg2img
but still i am getting the same error.
Is there any other way to make the binaries executable and is there any other way to extract a raw image of out a spare image and then mount the raw image inorder to obtain the system folder so that i can access files and folders such as apks and jars.
Can anyone please help me how to use the binaries such as simg2img,img2simg,make_ext4fs,etc... relations to extracting a rom in Ubuntu 16.04. I have been trying to get the system folder out of the sparse image since a week but i a unable to do so.And i have a system.img file in the rom folder but i do not know weather its a sparse image or a raw image.So can anyone please tell me how to differentiate between a Sparse image and a Raw image so that i can extract it accordingly.

Are the files in the same directory as your terminal is? If not you can use the CD command to change folders or you can use a file explorer and right click open terminal here, and then try running the above commands. Also right click on the files your executing and go to permissions tab and tick the box that says something along the lines of "allow execution of file" (sorry can't remeber of the top of my head).
Also another you can try is using the mount command to mount the system .img to a directory of your choosing and then modify the files. A general example can be
Code:
mkdir /temp-sys
mount -o loop auto system.img /temp-sys/
Note: don't use that exact code but do some research as that was also off the top of my head. Good luck.

Related

[Q][Help] unpacking ext.img lose data

hello i tryed yesterday to unpack system.ext4.img but the problem is the file was 467 miga and become 200 miga (i flashed it in my mobile but no hope ) "" so it lose data ""
what system i can install in my computer to open ext4.img to edit all data inside it ? read and write
i searched in the other topics but i didnt understand good so i make it dirct
to know why i want to edit ext4.img look to my other topic
http://forum.xda-developers.com/showthread.php?p=49175577#post49175577
al2rhabyy said:
hello i tryed yesterday to unpack system.ext4.img but the problem is the file was 467 miga and become 200 miga (i flashed it in my mobile but no hope ) "" so it lose data ""
what system i can install in my computer to open ext4.img to edit all data inside it ? read and write
i searched in the other topics but i didnt understand good so i make it dirct
to know why i want to edit ext4.img look to my other topic
http://forum.xda-developers.com/showthread.php?p=49175577#post49175577
Click to expand...
Click to collapse
This requires linux (Ubuntu) other wise you are out of luck.
And it requires linux knowledge.
You could rename it to system.img then loop mount it under linux.
Code:
sudo mkdir /mnt/sys
sudo mount -o loop system.img /mnt/sys
cd /mnt/sys
nautilus .
Run that in a linux shell.
Then unmount once you are done reading and writing the image.
Code:
sudo umount -R /mnt/sys
Then copy the system.img to a windows machine again and if you have a samsung phone you could flash the image with odin packed into a tar.
Or rename it back to system.ext4.img then flash it how you were going to.
can you make a video please ? :cyclops:
but with my system file

[GUIDE][Linux/Win] How to unpack system_1.img+system_2.img+...+system_*.img | 2019

A youtube video on this guide
Watch video
Hello guys,
I rarely write guide and tutorials .so neglect my typos and gramatical mistakes
Today im gonna show you how to unpack sparsed system.img files (system_1.img+system_2.img+............+system_*.img)
supports system / cache / userdata / persist / vendor / cust / odm /oem partitions from QFIL firmwares
Lets get started
LINUX
Things Needed:
1) Packsparseimg
2) Imgextractor.exe -Need wine for this
Procedure:
1) First of all extract you device firmware in which you have sparse system.img files in a folder.
(folder path ex:~/Desktop/firmware)
2) Copy the downloaded packsparseimg_v1.1 and Imgextractor.exe in the same folder where you extracted your firmware
(ex:~/Desktop/firmware)
3) Open terminal and enter below commands.
4)
Code:
chmod 0755 packsparseimg_v1.1
5)This command will pack sparse system_1.img....files to system.raw
Code:
./packsparseimg_v1.1
you can use these commands to pack sparse cache and userdata persist,vendor,cust,odm partitions
Code:
Usage of ./packsparseimg_v1.1:
-o string
output dir path (default "./")
-t string
image to unsparse: system / cache / userdata / persist / vendor / cust / odm / oem (default "system")
-x string
xml file to load (default "./rawprogram_unsparse.xml")
6) After joining of sparse system.img's finishes you will get system.raw file
7) Use below commands to unpack system.raw to system folder
Note: You need wine on your linux to run imgextractor.exe
Code:
wine imgextractor.exe system.raw
8) Hell Yeah! you have successfully unpack those system_1,2,3,4....imgs
now you can make your own stock deodexed rom
Downloads For linux:-
[MOD EDIT: URL REMOVED]
Password:innfinite4evr
Imgextractor.exe
WINDOWS
Things Needed:
1) packsparseimg_v1.1
2) Imgextractor.exe
Procedure:
1) First of all extract you device firmware in which you have sparse system.img files in a folder.
(folder path exesktop/Myfirmware)
2) Copy the downloaded packsparseimg_v1.1 and Imgextractor.exe in the same folder where you extracted your firmware
(exesktop/Myfirmware)
3) Open Command Prompt (cmd.exe) and enter below commands.
PS: you can open command propmt by any of these methods. Here method 1 is preferred
Method 1: Most suitable method for this guide
hold down shift key while pressing the right mouse onto the folder you want to open "command prompt" then a new menu item will appear in your context menu offering you exactly that: "open command prompt here" select it and command prompt will open.
Method 2:Search is very helpful. In Windows 7, open the Start Menu and type command or cmd. Then, click or tap the Command Prompt
Method 3ne of the quickest ways to launch the Command Prompt is to use the Run window (press Win+R on your keyboard and type cmd and press enter to open it).
i guess three methods are enough for windows users
4) AFter command prompt opens enter below comamnds to proceed further
5)This command will pack sparse system_1.img....files to system.raw
Note default is "system"
Code:
packsparseimg
you can use these commands to pack sparse cache and userdata persist,vendor,cust,odm partitions
Code:
Usage of packsparseimg:
-o string
output dir path (default "./")
-t string
image to unsparse: system / cache / userdata / persist / vendor / cust / odm (default "system")
-x string
xml file to load (default "./rawprogram_unsparse.xml")
6) After joining of sparse system.img's finishes you will get system.raw file
7) Use below commands to unpack system.raw to system folder
Code:
imgextractor.exe system.raw
8) Now you will get unpacked system folder
Hell Yeah! you have successfully unpack those system_1,2,3,4....imgs
now you can make your own stock deodexed rom
Downloads for windows:-
Imgextractor.exe
Password:innfinite4evr
[MOD EDIT: URL REMOVED]
Changelog:-
in update v1.1
now supports system / cache / userdata / persist / vendor / cust / odm /oem partitions from QFIL firmwares
Credits:
kidd for initially making packsparseimg binary
@and_pDA for imgextractor,exe(Based on sources ext4_unpacker)
@Innfinite4evr for testing this method and write this guide​
Great work bro :good: Nice job and thanks for this
great work man. thanks
can you share code?
There is another way to unpacj that instead of using wine.
Code:
mount -o loop -t ext4 system.img [path]
Replace:
[Path] with path to the output directory you want (ex: ~/sys-img)
ext4: This might be different, check it by yourself, but most device now using ext4
Thanks for the info, btw
Please can somebody tell me how to revert the process? To create again sparse images and flash via qfil? Thanks in advance!
cofface said:
can you share code?
Click to expand...
Click to collapse
only prebuilts
cofface said:
can you share code?
Click to expand...
Click to collapse
only prebuilts
I get this error on Ubuntu:
bash: ./packsparseimg: cannot execute binary file: Formato eseguibile non valido
What is the procedure to do the reverse?
How to repack as parts
sir i was trying to repack system folder to system_1.img system_2.img etc.
is there any way for that?
i need to repack and flash to my phone
Doesn't seem to work for Oreo a/b system
@Innfinite4evr Hi there, can you add vendor, cust and odm support ?
AL_IRAQI said:
@Innfinite4evrHi there, can you add vendor, cust and odm support ?
Click to expand...
Click to collapse
Yes there is.
Im thinking to update this stuff
AL_IRAQI said:
@Innfinite4evrHi there, can you add vendor, cust and odm support ?
Click to expand...
Click to collapse
Ive updated the tool, maybe you can try for odm partition.
Innfinite4evr said:
Ive updated the tool, maybe you can try for odm partition.
Click to expand...
Click to collapse
I've try to buy, with all my2 credit card (master card and american express)
I was addebited 1€ in my mastercard, but it always give me error and I can't download the program.
I do not want the refund, I'd like to have the tool!
Samuele Bonzio
I give you my phone number by PM if that need!
Thank you!
Thread closed. PM me when you have download links that don't require payment to be added to the OP.

CONVERSION CWM/TWRP backup-files to .IMG files (for Bootloader>FlashBoot Flash) ?

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

Mount system.img from Factory Images

I have downloaded the latest factory image from the google pixel 4a ota page.
Factory Images for Nexus and Pixel Devices | Google Play services | Google for Developers
developers.google.com
When I try to mount system.img for binary extraction, I get the following error.
mount: ../sunfish-rq3a.210805.001.a1/system: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.
The image seems not to be an ext4 images, but it's not packed as I can see selinux marks in it.
Which tool do I have to use, to make a raw image or extract the files from it. Or how to get the offset for mounting it?
Maybe this helps...
Code:
$ file system.img
system.img: Android sparse image, version: 1.0, Total of 202187 4096-byte output blocks in 21 input chunks.
It's not a normal filesystem image. The whole super partition has virtual partitions. There might be a way to extract/mount this still...
This might do it. I have done this before, though it wasn't for the system.img in the pixel zip...
How to mount Android 10 vendor image file
I used to extract Android vendor image via following steps: Convert sparse image to raw image: simg2img vendor.img v.img Mount the raw image for copying files: sudo mount v.img somefolder However...
superuser.com
Convert sparse image to raw image: simg2img vendor.img v.img
Mount the raw image for copying files: sudo mount v.img somefolder
a1291762 said:
This might do it. I have done this before, though it wasn't for the system.img in the pixel zip...
How to mount Android 10 vendor image file
I used to extract Android vendor image via following steps: Convert sparse image to raw image: simg2img vendor.img v.img Mount the raw image for copying files: sudo mount v.img somefolder However...
superuser.com
Convert sparse image to raw image: simg2img vendor.img v.img
Mount the raw image for copying files: sudo mount v.img somefolder
Click to expand...
Click to collapse
Thanks a lot. I tried it before, but it failed. But I forgot the loop option.
# mount -t ext4 -o ro,loop v.img somefolder
a1291762 said:
This might do it. I have done this before, though it wasn't for the system.img in the pixel zip...
How to mount Android 10 vendor image file
I used to extract Android vendor image via following steps: Convert sparse image to raw image: simg2img vendor.img v.img Mount the raw image for copying files: sudo mount v.img somefolder However...
superuser.com
Convert sparse image to raw image: simg2img vendor.img v.img
Mount the raw image for copying files: sudo mount v.img somefolder
Click to expand...
Click to collapse
You did this on Windows????
Benjamin B C H said:
You did this on Windows????
Click to expand...
Click to collapse
No, that's Linux commands. Windows has WSL that gives you a Linux shell that might be able to run such commands? I have not used it though because I have a Linux server handy.
a1291762 said:
No, that's Linux commands. Windows has WSL that gives you a Linux shell that might be able to run such commands? I have not used it though because I have a Linux server handy.
Click to expand...
Click to collapse
Ohh...ok .... Thank you so much for your quick response
i am getting this error
Sudo mount -o loop system.img /mnt/system
Errore
Mount: /mnt/system: wrong fa type, bad option, bad superblock on / dev/loop1
Help me
Canna77 said:
i am getting this error
Sudo mount -o loop system.img /mnt/system
Errore
Mount: /mnt/system: wrong fa type, bad option, bad superblock on / dev/loop1
Help me
Click to expand...
Click to collapse
Did you convert the sparse image into a regular image before mounting it?
yes fixed in win10
Mod translation:
i'm trying to get a wifi module to work on a rom, following this guide
5) Now run Ext4 Unpacker which you previously extracted from somewhere, you will see it has a Windows Explorer style interface, easy to use. Now using the button on the top right of the box navigate to the .img file you just extracted earlier and open it. You will see a tree folder structure which are the folders contained in the Android system folder. go inside Vendor then inside modules, select the module you need (in my case the 8192cu.ko file) then right click and select Extract, then decide where to save it.
6) having done this, copy the file onto a USB stick, start the mini pc and connect the stick containing the file to it, then from the file manager transfer the driver file to the mini pc memory
7) you need the terminal emulator, if you don't have it already installed do a search on pc with google
"terminal emulator apk" download it, copy it and install it in your mini pc.
8) start the terminal emulator and go to the folder where you previously copied the driver file, suppose you copied it to /mnt/sdcard, you will have to type cd /mnt/sdcard followed by enter.
9) from the terminal emulator type su followed by enter to become superuser (administrator)
10 type insmod followed by the name of the driver file (in my case insmod 8192cu.ko) and voilà the game is done!
but the insmod command gives me error "exec format failed"
any help?
Hello
You are talking about the new encryption EROFS I updated my huawei p10 EMUI 9.1 to latest version i unlocked the bootloader trying to flash Chinese firmware on it then it bricked no sign of power but my pc recognise it in Fastboot I downloaded a file from xda named p10 revive which includ the flashing firmware. but the partitions are not flashing even if I flash it individually please can some one help and show me how to RW the partition from RO please
Hello after update to latest version of EMUI 9.1 I tried to change my firmware to from VTR_L29 to VTR_AL00 using chimera the phone bricked and never power on again i tried flashing it but no sign of power. My pc recognise it in Fastboot and testpoint is working can some one please help me

Question [SOLVED] How to extract files from super.img?

I am using global ROM in TB-J706F but I wanted to extract the original wallpaper from chinese ROM, so I downloaded the one available in lolinet.
Then I did (I am using Linux):
Extract files
Merge super_* to a single file with
Bash:
cat super_1.img super_2.img super_3.img super_4.img > super.img
Extract system_a.img with
Bash:
lpunpack -p system_a super.img ./super
Now I don't know how to mount system_a.img, this is what I tried:
Bash:
> simg2img super/system_a.img super/system_a.ext4.img
Invalid sparse file format at header magic
Failed to read sparse file
Bash:
> sudo mount -t ext4 -o loop super/system_a.img ./system
mount: ./system: wrong fs type, bad option, bad superblock on /dev/loop2, missing codepage or helper program, or other error.
Bash:
> file super/system_a.img
super/system_a.img: data
What am I missing?
P.S.
Anyway if someone has the wallpaper and can upload it somewhere would be great.
MrCrayon said:
I am using global ROM in TB-J706F but I wanted to extract the original wallpaper from chinese ROM, so I downloaded the one available in lolinet.
Then I did (I am using Linux):
Extract files
Merge super_* to a single file with
Bash:
cat super_1.img super_2.img super_3.img super_4.img > super.img
Extract system_a.img with
Bash:
lpunpack -p system_a super.img ./super
Now I don't know how to mount system_a.img, this is what I tried:
Bash:
> simg2img super/system_a.img super/system_a.ext4.img
Invalid sparse file format at header magic
Failed to read sparse file
Bash:
> sudo mount -t ext4 -o loop super/system_a.img ./system
mount: ./system: wrong fs type, bad option, bad superblock on /dev/loop2, missing codepage or helper program, or other error.
Bash:
> file super/system_a.img
super/system_a.img: data
What am I missing?
P.S.
Anyway if someone has the wallpaper and can upload it somewhere would be great.
Click to expand...
Click to collapse
Have you read the link below?
Editing system.img inside super.img and flashing our modifications
I'm trying to modify my system.img (/system/build.prop) to include support for multi users. After struggling a lot, I've succeeded following your guide (that's an awesome work btw) to unpack, mount, modify, umount and repack super.img. Then...
forum.xda-developers.com
mardon85 said:
Have you read the link below?
Editing system.img inside super.img and flashing our modifications
I'm trying to modify my system.img (/system/build.prop) to include support for multi users. After struggling a lot, I've succeeded following your guide (that's an awesome work btw) to unpack, mount, modify, umount and repack super.img. Then...
forum.xda-developers.com
Click to expand...
Click to collapse
Yes, I got some of the commands from there, as far as I understand what they do there is aimed to mount system rw so I shouldn't need it, I tried to mount read only and it gives the same error.
Also I cannot use resize2fs or e2fsck because it's not recognized as an image, I get:
Bad magic number in super-block
I think system_a.img needs an additional step but it's not even compressed, so I'm stuck.
Ok, I solved it.
It was actually very easy, starting from the ROM:
Extract files
Mount super_2.img for system with:
Bash:
sudo mount -t ext4 -o ro,loop super_2.img ./system
The trick is that it needs to be mounted read only with ro.
Nicely done. Did you find the wallpaper?
Yes, it was in system/media/wallpaper.

Categories

Resources