Sparse image creation for Spreadtrum devices. - Android Q&A, Help & Troubleshooting

Can anyone help me out with the correct Syntax and binary required to create a sparse image from a raw image for a Spreadtrum device.
I'm trying to create an ODIN flashable cache.img , but no matter what Syntax I use the image fails in ODIN.
I have tried: ext2simg -v cache.raw.img cache_new.img
Also mounting as a loop device: make_ext4fs -s -l 32M cache_new.img cache_mnt
The image gets created just fine, but is just fails in ODIN. I don't kinow if its a missing header or what?

Related

[Q] Using ext4_utils tool

I posted my questions in another thread but got no response.
http://forum.xda-developers.com/showthread.php?t=1933541
I am trying to use the ext4_utils tool to unpack the factoryfs.img in order to modify the system files (add su). No luck so far.
I am now back to square one, testing the unpacking (./simg2img) and repacking (./mkuserimg.sh) tools. All I did was to unpack factoryfs.img, mount it in a temp folder, and repacking the mounted image (with no modification) into a new image. Then I repack this into a tar with md5 checksum (apparently ODIN uses checksum to verify the file to be flashed).
First thing I notice is that, the repacked image files is about 8 MB smaller than the original image (remember all I did was unpack, mount and repack using ext4_utils tool, no modification). When I tried to flash the repacked factoryfs.img (packed into TAR) using ODIN, checksum passed and it proceeded to flashing, but flashing failed.
Anyone have any experience with using ext4_utils to unpack factoryfs.img in order to add su / superuser to the system folder in order to make a rooted Samsung ROM? I feel like I have gone as far as a noob modder can go, and I really appreciate help from the veterans.
NOTE: I know I can use Android Kitchen to root and make a custom ROM, but the modified ROM in ZIP format can only be flashed by CWM. There is no CWM in my Galaxy Player (70 Plus Korean version only). I have a copy of Samsung stock TAR firmware, and I am trying to make a rooted ROM in TAR format which can be flashed by ODIN. I tried Heimdall and it seems that my player is not compatible (device detected but gets "usblib error" when I try to flash).
The repacking command is:
./mkuserimg.sh -s ./tempdir new.img ext4 ./temp XXXmb
I adjusted the "XXXmb" to match the size of the unpacked (eg. output,img) file, and the resulting size of the repacked .img file is now similar to the original factoryfs.img file.
Unfortunately, flashing this still failed (either repacked as a TAR file by itself, or replacing the original factoryfs.img and repacking the TAR firmware).
slim_thumb said:
The repacking command is:
./mkuserimg.sh -s ./tempdir new.img ext4 ./temp XXXmb
I adjusted the "XXXmb" to match the size of the unpacked (eg. output,img) file, and the resulting size of the repacked .img file is now similar to the original factoryfs.img file.
Unfortunately, flashing this still failed (either repacked as a TAR file by itself, or replacing the original factoryfs.img and repacking the TAR firmware).
Click to expand...
Click to collapse
Instead of making the *.tar by this command: tar cvf yourfilename.tar yourdirectoryname ; enter into the directory where all the *.img files reside. then use: tar cvf yourfilename.tar system.img factoryfs.img zImage etc etc. Make sure that the *.tar being created; unpacking it will directly provide those files; not a directory where in that directory all those files reside. This solved my problem. I hope it will solve your problem also.

I want to flashable system.img

I have Zenfone 5 phone, and i want to flashable system.img for the fastboot.
I tried dump system.img with help of this topic: http://forum.xda-developers.com/showthread.php?t=2450045
I used this code for the know what devblock is system for the zenfone:
Code:
adb shell
ls -al /dev/block/platform/intel/by-label/
And the mmcblk0p9 showed as system. Than I dumped system image with this command:
Code:
adb shell
su
dd if=/dev/block/mmcblk0p9 of=/sdcard/system.img
After dump of system.img, I tried flash it via fastboot with this command:
Code:
fastboot flash system system.img
But the flashing process is aborted with this error:
Code:
invalid sparse file format at header magi [I]-> This error appeared in Windows CMD, others in the below, appeared in the fastboot screen[/I]
e:unknowing chunk type
failed: bad file number
In summary; I dumped system.img and flashed it via fastboot and, it wasn't flashed, and give error.
I tried to convert system.img to system.raw via Ubuntu with simg2img file, I took this error:
Code:
invalid sparse file format at header magi
How to solve this "invalid sparse file format error"? Please help me? I'm making a rom, but this error blocked me

What are different ways to make system level changes in android?

Requirements :
Need to change some system files
Install one application as system app
I know that above to requirements need rooted device, but device is not of well-known company so there is no support available from CWM, TWRP or any other.
Yet I've some how managed to get some tools and files to install android 5.1 from device manufacturer as below,
Intel's Platform Flash Tool
Also all necessary files such as recovery.img(stalk-read only permission), system.img etc.
Now what I've think of solution so far is to unpack and repack system.img and replace new system.img with existing one and install with Intel's Platform Flash Tool, XDA reference-1.
Unpack :
mkdir sys
./simg2img system.img sys.raw
sudo mount -t ext4 -o loop sys.raw sys/
Repack :
sudo ./make_ext4fs -s -l 512M -a system new.img sys/
sudo umount sys
rm -fr sys
also calculated size = "Block count" * "Block size", XDA reference-2
and after creating sucessully system.img and also installation is also complete with Intel's Platform Flash Tool, bur is not able to boot and stuck at loading screen.
Solutions that I can think of,
Is there something that I'm missing in above method of unpack/repack method of system.img?
I've Intel's Platform Flash Tool, so is there any way to put my changes during installation of android OS?
I've also recovery.img, is it possible to modify this and create custom recovery.img and give read and write permission to system files?
Are there any ohter solutions which meets my requirements?
Any help will be highly appreciated.

Advice : Porting Indian ROM to Chinese ROM on Samsung Galaxy A8 8000 Model (China)

hi
I purchased a Samsung Galaxy A8 A8000 from China. I did not like its ROM since it lacked Google Apps and other stuff. So i decided to port system apps (apps+priv-app) from an indian rom. I am totall new to ROM stuff and to linux as well but i decided to go with virtual box and learn few things along the way.
For this,
first i extracted indian rom, it contained following
boot.img, cache.img, hidden.img, modem.bin, recovery.img, sboot.bin and system.img
then i extracted chinese rom, it contained different files as below
aboot.mbn, boot.img, cache.img.ext4, hyp.mbn, modem.bin, NON-HLOS.bin, recovery.img, rpm.mbn, sbl1.mbn, sec.dat, system.img.ext4 and tz.mbn
Since i donot want to mess with partitions and modem and other stuff so i decided to port only apps from indian rom and built an odin flashable tar file
For this i navigated various forum, i even dont exactly remember all but i am thankful to all who wrote useful stuff that helped me decide what to do, well most important of these were
http://forum.xda-developers.com/showthread.php?t=1974014
http://forum.xda-developers.com/showthread.php?t=1941239
http://rwilco12.com/forum/showthread.php?tid=92
first of all i converted indian rom system.img to system.raw using following command in linux virtualbox ubuntu 15.04
simg2img indsystem.img indsystem.raw
then i mounted this raw image using this command
mkdir indsystem
mount -o loop indsystem.raw indsystem/
then i converted chinese rom system.img to system.raw using same command as above
simg2img chcsystem.img chcsystem.raw
then i mounted this chinese raw image using this command
mkdir chcsystem
mount -o loop chcsystem.raw chcsystem/
then i created a system_new.img.ext4 file of 3.1GB size with this command
dd if=/dev/zero of=system_new.img.ext4 bs=4k count=775000
then i formated new image with ext4
mkfs.ext4 system_new.img.ext4
then probably i override the file system check and then mounted new ext4 image
tune2fs -c0 -i0 system_new.img.ext4
mkdir system_new
mount -o loop system_new.img.ext4 system_new
here i had a problem, i could not copy files from both indian and raw mounted images to my new ext4 image since i did not have permission to copy to the destination folder. then i made use of superuser access
gksu nautilus /path/to/image/folder
then i had full access and copied chinese rom to my new ext4 image.
cp -v -r -p chcsystem/* system_new/
then i deleted app, priv-app, font, framework, media, etc/permissions/allfiles-starting-with-android.-and-com.-and-allshare_library.xml from ext4 image.
then i manually copied these folders and permission files from indian system raw image file to my new ext4 image file
next i copy /system/lib/libandroid_runtime.so from chinese rom to the system/lib/ directory of indian rom and then deleted lib folder from chinese rom and replaced it with indian rom
then i sync files with "sync" command
then unmounted all partitions.
I then replaced system.img.ext4 file in my original rom with one that i have just made.
Now i need to compile these files back into flashable tar files with md5sum check with
tar -H ustar -c image_1 image_2 > your_odin_package.tar
md5sum -t your_odin_package.tar >> your_odin_package.tar
mv your_odin_package.tar your_odin_package.tar.md5
1. but before i do so I need some advance developer to please help me out and give some confidence as to the approach that i have used. is that correct.
2. Secondly, if someone can tell me tar ball flashing order for my rom since i heard it is important while compiling odin flashable tar file.
aboot.mbn, boot.img, cache.img.ext4, hyp.mbn, modem.bin, NON-HLOS.bin, recovery.img, rpm.mbn, sbl1.mbn, sec.dat, system.img.ext4 and tz.mbn
3. Also Is it possible that i convert system.img.ext4 into flashable odin tar file with above commands and flash only system image with Odin without messing with anyother settings.
Thank you
No one would like to help me out here.
Hi. I plan to do the same for my SM-A7000. did you get your to work?
waqasjeral said:
hi
I purchased a Samsung Galaxy A8 A8000 from China. I did not like its ROM since it lacked Google Apps and other stuff. So i decided to port system apps (apps+priv-app) from an indian rom. I am totall new to ROM stuff and to linux as well but i decided to go with virtual box and learn few things along the way.
For this,
first i extracted indian rom, it contained following
boot.img, cache.img, hidden.img, modem.bin, recovery.img, sboot.bin and system.img
then i extracted chinese rom, it contained different files as below
aboot.mbn, boot.img, cache.img.ext4, hyp.mbn, modem.bin, NON-HLOS.bin, recovery.img, rpm.mbn, sbl1.mbn, sec.dat, system.img.ext4 and tz.mbn
Since i donot want to mess with partitions and modem and other stuff so i decided to port only apps from indian rom and built an odin flashable tar file
For this i navigated various forum, i even dont exactly remember all but i am thankful to all who wrote useful stuff that helped me decide what to do, well most important of these were
http://forum.xda-developers.com/showthread.php?t=1974014
http://forum.xda-developers.com/showthread.php?t=1941239
http://rwilco12.com/forum/showthread.php?tid=92
first of all i converted indian rom system.img to system.raw using following command in linux virtualbox ubuntu 15.04
simg2img indsystem.img indsystem.raw
then i mounted this raw image using this command
mkdir indsystem
mount -o loop indsystem.raw indsystem/
then i converted chinese rom system.img to system.raw using same command as above
simg2img chcsystem.img chcsystem.raw
then i mounted this chinese raw image using this command
mkdir chcsystem
mount -o loop chcsystem.raw chcsystem/
then i created a system_new.img.ext4 file of 3.1GB size with this command
dd if=/dev/zero of=system_new.img.ext4 bs=4k count=775000
then i formated new image with ext4
mkfs.ext4 system_new.img.ext4
then probably i override the file system check and then mounted new ext4 image
tune2fs -c0 -i0 system_new.img.ext4
mkdir system_new
mount -o loop system_new.img.ext4 system_new
here i had a problem, i could not copy files from both indian and raw mounted images to my new ext4 image since i did not have permission to copy to the destination folder. then i made use of superuser access
gksu nautilus /path/to/image/folder
then i had full access and copied chinese rom to my new ext4 image.
cp -v -r -p chcsystem/* system_new/
then i deleted app, priv-app, font, framework, media, etc/permissions/allfiles-starting-with-android.-and-com.-and-allshare_library.xml from ext4 image.
then i manually copied these folders and permission files from indian system raw image file to my new ext4 image file
next i copy /system/lib/libandroid_runtime.so from chinese rom to the system/lib/ directory of indian rom and then deleted lib folder from chinese rom and replaced it with indian rom
then i sync files with "sync" command
then unmounted all partitions.
I then replaced system.img.ext4 file in my original rom with one that i have just made.
Now i need to compile these files back into flashable tar files with md5sum check with
tar -H ustar -c image_1 image_2 > your_odin_package.tar
md5sum -t your_odin_package.tar >> your_odin_package.tar
mv your_odin_package.tar your_odin_package.tar.md5
1. but before i do so I need some advance developer to please help me out and give some confidence as to the approach that i have used. is that correct.
2. Secondly, if someone can tell me tar ball flashing order for my rom since i heard it is important while compiling odin flashable tar file.
aboot.mbn, boot.img, cache.img.ext4, hyp.mbn, modem.bin, NON-HLOS.bin, recovery.img, rpm.mbn, sbl1.mbn, sec.dat, system.img.ext4 and tz.mbn
3. Also Is it possible that i convert system.img.ext4 into flashable odin tar file with above commands and flash only system image with Odin without messing with anyother settings.
Thank you
Click to expand...
Click to collapse
Hi waqasjeral. Have you already ported the Indian rom to the a8000?

What Format Is a TWRP img Installation File?

I have TWRP installation file in img format ready to be loaded with
Code:
fastboot boot twrp-unofficial.img
.
I don't have the source and want to have a look at what is packaged with it.
Is it possible to mount this img file on linux or extract the contents somehow?
Code:
file twrp-unofficial.img
twrp-unofficial.img: Android bootimg, kernel, ramdisk, page size: 2048, cmdline (console=null androidboot.console=ttyHSL0 androidboot.hardware=q)
I tried with simg2img but failed
Code:
simg2img twrp-unofficial.img twrp.raw
Invalid sparse file format at header magi
Failed to read sparse file
Furius ISO mount creates a mount point but it is an empty directory.

Categories

Resources